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_VM_STATE_H_
6 #define V8_VM_STATE_H_
7 
8 #include "src/allocation.h"
9 #include "src/isolate.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 template <StateTag Tag>
15 class VMState BASE_EMBEDDED {
16  public:
17   explicit inline VMState(Isolate* isolate);
18   inline ~VMState();
19 
20  private:
21   Isolate* isolate_;
22   StateTag previous_tag_;
23 };
24 
25 
26 class ExternalCallbackScope BASE_EMBEDDED {
27  public:
28   inline ExternalCallbackScope(Isolate* isolate, Address callback);
29   inline ~ExternalCallbackScope();
callback()30   Address callback() { return callback_; }
callback_address()31   Address* callback_address() { return &callback_; }
previous()32   ExternalCallbackScope* previous() { return previous_scope_; }
33   inline Address scope_address();
34 
35  private:
36   Isolate* isolate_;
37   Address callback_;
38   ExternalCallbackScope* previous_scope_;
39 #ifdef USE_SIMULATOR
40   Address scope_address_;
41 #endif
42 };
43 
44 } }  // namespace v8::internal
45 
46 
47 #endif  // V8_VM_STATE_H_
48