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
5
#include "
src/builtins/builtins-utils-inl.h
"
6
#include "
src/objects/objects-inl.h
"
7
8
namespace
v8
{
9
namespace
internal
{
10
11
// https://tc39.es/proposal-source-phase-imports/#sec-get-%abstractmodulesource%.prototype.@@tostringtag
12
BUILTIN
(AbstractModuleSourceToStringTag) {
13
HandleScope
scope(isolate);
14
// 1. Let O be the this value.
15
DirectHandle<Object>
receiver
=
args
.receiver();
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
builtins-utils-inl.h
BUILTIN
#define BUILTIN(name)
Definition
builtins-utils.h:152
v8::internal::DirectHandle
Definition
handles.h:659
v8::internal::HandleScope
Definition
handles.h:262
args
base::Vector< const DirectHandle< Object > > args
Definition
execution.cc:74
receiver
TNode< Object > receiver
Definition
js-call-reducer.cc:1498
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
objects-inl.h
src
builtins
builtins-abstract-module-source.cc
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0