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
8
9namespace v8 {
10namespace internal {
11
12BUILTIN(CallAsyncModuleFulfilled) {
13 HandleScope handle_scope(isolate);
15 Cast<SourceTextModule>(isolate->context()->get(
17 isolate);
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
29BUILTIN(CallAsyncModuleRejected) {
30 HandleScope handle_scope(isolate);
32 Cast<SourceTextModule>(isolate->context()->get(
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
#define BUILTIN(name)
static void AsyncModuleExecutionRejected(Isolate *isolate, DirectHandle< SourceTextModule > module, DirectHandle< Object > exception)
static Maybe< bool > AsyncModuleExecutionFulfilled(Isolate *isolate, Handle< SourceTextModule > module)
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
V8_EXPORT_PRIVATE FlagValues v8_flags
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define DCHECK_EQ(v1, v2)
Definition logging.h:485