mirrored from https://chromium.googlesource.com/v8/v8.git
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[source-phase-imports] Add �stractModuleSource%
Make `WebAssembly.Module` a subclass of �stractModuleSource%. At the moment, `HostGetModuleSourceNameCallback` is only applied to `WebAssembly.Module`. A runtime native method `%GetAbstractModuleSource` is added for testing. Bug: 42204365 Change-Id: I0150f3d75e1f63e3695fc6f0a0f5c29fcc59536e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/ /5690180 Reviewed-by: Shu-yu Guo <[email protected]> Commit-Queue: Chengzhong Wu (legendecas) <[email protected]> Reviewed-by: Adam Klein <[email protected]> Cr-Commit-Position: refs/heads/main@{#95568}
- Loading branch information
1 parent
b5012b8
commit 3ac0c46
Showing
19 changed files
with
399 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,40 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "src/builtins/builtins-utils-inl.h" | ||
#include "src/objects/objects-inl.h" | ||
|
||
namespace v8 { | ||
namespace internal { | ||
|
||
// https://tc39.es/proposal-source-phase-imports/#sec-get-�stractmodulesource%.prototype.@@tostringtag | ||
BUILTIN(AbstractModuleSourceToStringTag) { | ||
HandleScope scope(isolate); | ||
// 1. Let O be the this value. | ||
Handle<Object> receiver = args.receiver(); | ||
|
||
// 2. If O is not an Object, return undefined. | ||
if (!IsJSReceiver(*receiver)) { | ||
return *isolate->factory()->undefined_value(); | ||
} | ||
// 3. Let sourceNameResult be Completion(HostGetModuleSourceName(O)). | ||
// 4. If sourceNameResult is an abrupt completion, return undefined. | ||
// 5. Let name be ! sourceNameResult. | ||
// 6. Assert: name is a String. | ||
// 7. Return name. | ||
|
||
#if V8_ENABLE_WEBASSEMBLY | ||
// https://webassembly.github.io/esm-integration/js-api/index.html#hostgetmodulesourcename | ||
// Whenever a WebAssembly Module object is provided with a [[Module]] internal | ||
// slot, the string "WebAssembly.Module" is always returned. | ||
if (IsWasmModuleObject(*receiver)) { | ||
return *isolate->factory()->WebAssemblyModule_string(); | ||
} | ||
#endif | ||
// TODO(42204365): Implement host hook. | ||
return *isolate->factory()->undefined_value(); | ||
} | ||
|
||
} // namespace internal | ||
} // namespace v8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.