v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
embedder-state.cc
Go to the documentation of this file.
1// Copyright 2021 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
6
7#include "src/api/api-inl.h"
8#include "src/base/logging.h"
9
10namespace v8 {
11
12namespace internal {
13
16 : isolate_(reinterpret_cast<i::Isolate*>(isolate)),
17 tag_(tag),
18 previous_embedder_state_(isolate_->current_embedder_state()) {
19 if (!context.IsEmpty()) {
20 native_context_address_ =
21 v8::Utils::OpenDirectHandle(*context)->native_context().address();
22 }
23
24 DCHECK_NE(this, isolate_->current_embedder_state());
25 isolate_->set_current_embedder_state(this);
26}
27
29 DCHECK_EQ(this, isolate_->current_embedder_state());
30 isolate_->set_current_embedder_state(previous_embedder_state_);
31}
32
34 EmbedderState* state = this;
35 do {
36 if (state->native_context_address_ == from) {
38 }
39 state = state->previous_embedder_state_;
40 } while (state != nullptr);
41}
42
43} // namespace internal
44
45} // namespace v8
Isolate * isolate_
EmbedderState(v8::Isolate *isolate, Local< v8::Context > context, EmbedderStateTag tag)
void OnMoveEvent(Address from, Address to)
EmbedderState * previous_embedder_state_
Point to
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK_EQ(v1, v2)
Definition logging.h:485