• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 #ifndef V8_EXECUTION_EMBEDDER_STATE_H_
6 #define V8_EXECUTION_EMBEDDER_STATE_H_
7 
8 #include "include/v8-local-handle.h"
9 #include "src/execution/isolate.h"
10 
11 namespace v8 {
12 
13 enum class EmbedderStateTag : uint8_t;
14 
15 namespace internal {
16 class V8_EXPORT_PRIVATE EmbedderState {
17  public:
18   EmbedderState(v8::Isolate* isolate, Local<v8::Context> context,
19                 EmbedderStateTag tag);
20 
21   ~EmbedderState();
22 
GetState()23   EmbedderStateTag GetState() const { return tag_; }
24 
native_context_address()25   Address native_context_address() const { return native_context_address_; }
26 
27   void OnMoveEvent(Address from, Address to);
28 
29  private:
30   Isolate* isolate_;
31   EmbedderStateTag tag_;
32   Address native_context_address_ = kNullAddress;
33   EmbedderState* previous_embedder_state_;
34 };
35 }  // namespace internal
36 
37 }  // namespace v8
38 
39 #endif  // V8_EXECUTION_EMBEDDER_STATE_H_
40