v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
vm-state.h
Go to the documentation of this file.
1// Copyright 2010 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_VM_STATE_H_
6#define V8_EXECUTION_VM_STATE_H_
7
11#include "v8-internal.h"
12
13namespace v8 {
14namespace internal {
15
16// Logging and profiling. A StateTag represents a possible state of the VM. The
17// logger maintains a stack of these. Creating a VMState object enters a state
18// by pushing on the stack, and destroying a VMState object leaves a state by
19// popping the current state from the stack.
20template <StateTag Tag>
21class VMState {
22 public:
23 explicit inline VMState(Isolate* isolate);
24 inline ~VMState();
25
26 Isolate* isolate() { return isolate_; }
27
28 private:
31
33};
34
36 public:
38 Isolate* isolate, Address callback,
40 const void* callback_info = nullptr);
42 Address callback() { return callback_; }
44 if (callback_ == kNullAddress) return nullptr;
45#if USES_FUNCTION_DESCRIPTORS
46 return FUNCTION_ENTRYPOINT_ADDRESS(callback_);
47#else
48 return const_cast<Address*>(&callback_);
49#endif
50 }
51 ExternalCallbackScope* previous() { return previous_scope_; }
52 inline Address JSStackComparableAddress();
53
54 v8::ExceptionContext exception_context() const { return exception_context_; }
55 const void* callback_info() { return callback_info_; }
56
57 private:
58 Address const callback_;
59 // v8::FunctionCallbackInfo* or v8::PropertyCallbackInfo* or nullptr.
60 const void* const callback_info_;
65#if USE_SIMULATOR || V8_USE_ADDRESS_SANITIZER || V8_USE_SAFE_STACK
66 Address js_stack_comparable_address_;
67#endif
68};
69
70} // namespace internal
71} // namespace v8
72
73#endif // V8_EXECUTION_VM_STATE_H_
ExternalCallbackScope *const previous_scope_
Definition vm-state.h:61
v8::ExceptionContext exception_context() const
Definition vm-state.h:54
ExternalCallbackScope * previous()
Definition vm-state.h:51
PauseNestedTimedHistogramScope const pause_timed_histogram_scope_
Definition vm-state.h:64
const void *const callback_info_
Definition vm-state.h:60
v8::ExceptionContext exception_context_
Definition vm-state.h:63
VMState< EXTERNAL > const vm_state_
Definition vm-state.h:62
Isolate *const isolate_
Definition vm-state.h:29
StateTag const previous_tag_
Definition vm-state.h:30
VMState(Isolate *isolate)
friend ExternalCallbackScope
Definition vm-state.h:32
Isolate * isolate()
Definition vm-state.h:26
TNode< Object > callback
ExceptionContext
StateTag
Definition v8-unwinder.h:36
const AsyncStreamingDecoder::MoreFunctionsCanBeSerializedCallback callback_
#define V8_NODISCARD
Definition v8config.h:693