v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
builtins-async-module.cc
Go to the documentation of this file.
1
// Copyright 2019 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/module-inl.h
"
7
#include "
src/objects/objects-inl.h
"
8
9
namespace
v8
{
10
namespace
internal
{
11
12
BUILTIN
(CallAsyncModuleFulfilled) {
13
HandleScope
handle_scope(isolate);
14
Handle<SourceTextModule>
module(
15
Cast<SourceTextModule>
(isolate->context()->get(
16
SourceTextModule::ExecuteAsyncModuleContextSlots::kModule
)),
17
isolate);
18
if
(
SourceTextModule::AsyncModuleExecutionFulfilled
(isolate, module)
19
.IsNothing()) {
20
// The evaluation of async module can not throwing a JavaScript observable
21
// exception.
22
DCHECK_IMPLIES
(
v8_flags
.strict_termination_checks,
23
isolate->is_execution_terminating());
24
return
ReadOnlyRoots
(isolate).exception();
25
}
26
return
ReadOnlyRoots
(isolate).undefined_value();
27
}
28
29
BUILTIN
(CallAsyncModuleRejected) {
30
HandleScope
handle_scope(isolate);
31
DirectHandle<SourceTextModule>
module(
32
Cast<SourceTextModule>
(isolate->context()->get(
33
SourceTextModule::ExecuteAsyncModuleContextSlots::kModule
)),
34
isolate);
35
36
// Arguments should be an exception object, with receiver.
37
DCHECK_EQ
(
args
.length(), 2);
38
DirectHandle<Object>
exception(
args
.at(1));
39
SourceTextModule::AsyncModuleExecutionRejected
(isolate, module, exception);
40
return
ReadOnlyRoots
(isolate).undefined_value();
41
}
42
43
}
// namespace internal
44
}
// 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
v8::internal::Handle
Definition
handles.h:149
v8::internal::ReadOnlyRoots
Definition
roots.h:709
v8::internal::SourceTextModule::kModule
@ kModule
Definition
source-text-module.h:85
v8::internal::SourceTextModule::AsyncModuleExecutionRejected
static void AsyncModuleExecutionRejected(Isolate *isolate, DirectHandle< SourceTextModule > module, DirectHandle< Object > exception)
Definition
source-text-module.cc:997
v8::internal::SourceTextModule::AsyncModuleExecutionFulfilled
static Maybe< bool > AsyncModuleExecutionFulfilled(Isolate *isolate, Handle< SourceTextModule > module)
Definition
source-text-module.cc:886
args
base::Vector< const DirectHandle< Object > > args
Definition
execution.cc:74
module-inl.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::v8_flags
V8_EXPORT_PRIVATE FlagValues v8_flags
v8::internal::Cast
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition
casting.h:150
v8
Definition
api-arguments-inl.h:19
objects-inl.h
DCHECK_IMPLIES
#define DCHECK_IMPLIES(v1, v2)
Definition
logging.h:493
DCHECK_EQ
#define DCHECK_EQ(v1, v2)
Definition
logging.h:485
src
builtins
builtins-async-module.cc
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0