v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
execution.h
Go to the documentation of this file.
1// Copyright 2014 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#ifndef V8_EXECUTION_EXECUTION_H_
6#define V8_EXECUTION_EXECUTION_H_
7
8#include "src/base/vector.h"
10
11namespace v8 {
12namespace internal {
13
14class MicrotaskQueue;
15
16class Execution final : public AllStatic {
17 public:
18 // Whether to report pending messages, or keep them pending on the isolate.
21
22 // Call a function (that is not a script), the caller supplies a receiver and
23 // an array of arguments.
24 // When the function called is not in strict mode, receiver is
25 // converted to an object.
27 Isolate* isolate, DirectHandle<Object> callable,
30 // Run a script. For JSFunctions that are not scripts, use Execution::Call.
31 // Depending on the script, the host_defined_options might not be used but the
32 // caller has to provide it at all times.
34 Isolate* isolate, DirectHandle<JSFunction> callable,
36
38 Isolate* isolate, DirectHandle<JSFunction> builtin,
41
42 // Construct object from function, the caller supplies an array of
43 // arguments.
45 Isolate* isolate, DirectHandle<Object> constructor,
48 Isolate* isolate, DirectHandle<Object> constructor,
51
52 // Call a function, just like Call(), but handle don't report exceptions
53 // externally.
54 // The return value is either the result of calling the function (if no
55 // exception occurred), or an empty handle.
56 // If message_handling is MessageHandling::kReport, exceptions (except for
57 // termination exceptions) will be stored in exception_out (if not a
58 // nullptr).
60 Isolate* isolate, DirectHandle<Object> callable,
65 // Same as Execute::TryCall but for scripts which need an explicit
66 // host-defined options object. See Execution:CallScript
68 Isolate* isolate, DirectHandle<JSFunction> script_function,
70 DirectHandle<FixedArray> host_defined_options);
71
72 // Convenience method for performing RunMicrotasks
75
76#if V8_ENABLE_WEBASSEMBLY
77 // Call a Wasm function identified by {wasm_call_target} through the
78 // provided {wrapper_code}, which must match the function's signature.
79 // Upon return, either isolate->has_exception() is true, or
80 // the function's return values are in {packed_args}.
81 V8_EXPORT_PRIVATE static void CallWasm(Isolate* isolate,
82 DirectHandle<Code> wrapper_code,
83 WasmCodePointer wasm_call_target,
84 DirectHandle<Object> object_ref,
85 Address packed_args);
86#endif // V8_ENABLE_WEBASSEMBLY
87};
88
89} // namespace internal
90} // namespace v8
91
92#endif // V8_EXECUTION_EXECUTION_H_
static V8_EXPORT_PRIVATE MaybeDirectHandle< Object > TryCallScript(Isolate *isolate, DirectHandle< JSFunction > script_function, DirectHandle< Object > receiver, DirectHandle< FixedArray > host_defined_options)
Definition execution.cc:573
static V8_EXPORT_PRIVATE MaybeDirectHandle< Object > TryCall(Isolate *isolate, DirectHandle< Object > callable, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args, MessageHandling message_handling, MaybeDirectHandle< Object > *exception_out)
Definition execution.cc:587
static MaybeDirectHandle< Object > TryRunMicrotasks(Isolate *isolate, MicrotaskQueue *microtask_queue)
Definition execution.cc:602
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > CallScript(Isolate *isolate, DirectHandle< JSFunction > callable, DirectHandle< Object > receiver, DirectHandle< Object > host_defined_options)
Definition execution.cc:535
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > Call(Isolate *isolate, DirectHandle< Object > callable, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args)
Definition execution.cc:523
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > CallBuiltin(Isolate *isolate, DirectHandle< JSFunction > builtin, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args)
Definition execution.cc:545
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > New(Isolate *isolate, DirectHandle< Object > constructor, base::Vector< const DirectHandle< Object > > args)
Definition execution.cc:556
MicrotaskQueue * microtask_queue
Definition execution.cc:77
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
DirectHandle< Object > new_target
Definition execution.cc:75
MaybeDirectHandle< Object > * exception_out
Definition execution.cc:80
Execution::MessageHandling message_handling
Definition execution.cc:79
TNode< Object > receiver
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671