v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
builtins-abstract-module-source.cc
Go to the documentation of this file.
1// Copyright 2024 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
7
8namespace v8 {
9namespace internal {
10
11// https://tc39.es/proposal-source-phase-imports/#sec-get-%abstractmodulesource%.prototype.@@tostringtag
12BUILTIN(AbstractModuleSourceToStringTag) {
13 HandleScope scope(isolate);
14 // 1. Let O be the this value.
16
17 // 2. If O is not an Object, return undefined.
18 if (!IsJSReceiver(*receiver)) {
19 return *isolate->factory()->undefined_value();
20 }
21 // 3. Let sourceNameResult be Completion(HostGetModuleSourceName(O)).
22 // 4. If sourceNameResult is an abrupt completion, return undefined.
23 // 5. Let name be ! sourceNameResult.
24 // 6. Assert: name is a String.
25 // 7. Return name.
26
27#if V8_ENABLE_WEBASSEMBLY
28 // https://webassembly.github.io/esm-integration/js-api/index.html#hostgetmodulesourcename
29 // Whenever a WebAssembly Module object is provided with a [[Module]] internal
30 // slot, the string "WebAssembly.Module" is always returned.
31 if (IsWasmModuleObject(*receiver)) {
32 return *isolate->factory()->WebAssemblyModule_string();
33 }
34#endif
35 // TODO(42204365): Implement host hook.
36 return *isolate->factory()->undefined_value();
37}
38
39} // namespace internal
40} // namespace v8
#define BUILTIN(name)
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
TNode< Object > receiver