blob: a72180ca45f4dcee0485209cff3162e5d73a8cb5 [file] [log] [blame]
Andrei Popescu402d9372010-02-26 13:31:12 +00001// Copyright 2010 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Andrei Popescu402d9372010-02-26 13:31:12 +00004
Steve Block6ded16b2010-05-10 14:33:55 +01005#ifndef V8_VM_STATE_H_
6#define V8_VM_STATE_H_
Andrei Popescu402d9372010-02-26 13:31:12 +00007
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/allocation.h"
9#include "src/isolate.h"
Ben Murdochf87a2032010-10-22 12:50:53 +010010
Andrei Popescu402d9372010-02-26 13:31:12 +000011namespace v8 {
12namespace internal {
13
Ben Murdochb8a8cc12014-11-26 15:28:44 +000014template <StateTag Tag>
Steve Block6ded16b2010-05-10 14:33:55 +010015class VMState BASE_EMBEDDED {
Andrei Popescu402d9372010-02-26 13:31:12 +000016 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +000017 explicit inline VMState(Isolate* isolate);
Steve Block6ded16b2010-05-10 14:33:55 +010018 inline ~VMState();
Andrei Popescu402d9372010-02-26 13:31:12 +000019
Steve Block6ded16b2010-05-10 14:33:55 +010020 private:
Steve Block44f0eee2011-05-26 01:26:41 +010021 Isolate* isolate_;
Ben Murdochb0fe1622011-05-05 13:52:32 +010022 StateTag previous_tag_;
Andrei Popescu402d9372010-02-26 13:31:12 +000023};
24
Ben Murdochb0fe1622011-05-05 13:52:32 +010025
26class ExternalCallbackScope BASE_EMBEDDED {
Ben Murdochb0fe1622011-05-05 13:52:32 +010027 public:
Steve Block44f0eee2011-05-26 01:26:41 +010028 inline ExternalCallbackScope(Isolate* isolate, Address callback);
Ben Murdochb0fe1622011-05-05 13:52:32 +010029 inline ~ExternalCallbackScope();
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 Address callback() { return callback_; }
31 Address* callback_address() { return &callback_; }
32 ExternalCallbackScope* previous() { return previous_scope_; }
33 inline Address scope_address();
34
Ben Murdochb0fe1622011-05-05 13:52:32 +010035 private:
Steve Block44f0eee2011-05-26 01:26:41 +010036 Isolate* isolate_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000037 Address callback_;
38 ExternalCallbackScope* previous_scope_;
39#ifdef USE_SIMULATOR
40 Address scope_address_;
41#endif
Ben Murdochb0fe1622011-05-05 13:52:32 +010042};
43
Andrei Popescu402d9372010-02-26 13:31:12 +000044} } // namespace v8::internal
45
Steve Block6ded16b2010-05-10 14:33:55 +010046
47#endif // V8_VM_STATE_H_