| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #define V8_VM_STATE_H_ | 29 #define V8_VM_STATE_H_ |
| 30 | 30 |
| 31 #include "isolate.h" | 31 #include "isolate.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 class VMState BASE_EMBEDDED { | 36 class VMState BASE_EMBEDDED { |
| 37 #ifdef ENABLE_VMSTATE_TRACKING | 37 #ifdef ENABLE_VMSTATE_TRACKING |
| 38 public: | 38 public: |
| 39 inline VMState(StateTag state); | 39 inline VMState(Isolate* isolate, StateTag state); |
| 40 inline ~VMState(); | 40 inline ~VMState(); |
| 41 | 41 |
| 42 StateTag state() { return state_; } | 42 StateTag state() { return state_; } |
| 43 void set_external_callback(Address external_callback) { | 43 void set_external_callback(Address external_callback) { |
| 44 external_callback_ = external_callback; | 44 external_callback_ = external_callback; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Used for debug asserts. | 47 // Used for debug asserts. |
| 48 static bool is_outermost_external() { | 48 static bool is_outermost_external() { |
| 49 return Isolate::Current()->current_vm_state() == 0; | 49 return Isolate::Current()->current_vm_state() == 0; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static StateTag current_state() { | 52 static StateTag current_state() { |
| 53 VMState* state = Isolate::Current()->current_vm_state(); | 53 VMState* state = Isolate::Current()->current_vm_state(); |
| 54 return state ? state->state() : EXTERNAL; | 54 return state ? state->state() : EXTERNAL; |
| 55 } | 55 } |
| 56 | 56 |
| 57 static Address external_callback() { | 57 static Address external_callback() { |
| 58 VMState* state = Isolate::Current()->current_vm_state(); | 58 VMState* state = Isolate::Current()->current_vm_state(); |
| 59 return state ? state->external_callback_ : NULL; | 59 return state ? state->external_callback_ : NULL; |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 Isolate* isolate_; |
| 63 bool disabled_; | 64 bool disabled_; |
| 64 StateTag state_; | 65 StateTag state_; |
| 65 VMState* previous_; | 66 VMState* previous_; |
| 66 Address external_callback_; | 67 Address external_callback_; |
| 67 Isolate* isolate_; | |
| 68 | 68 |
| 69 #else | 69 #else |
| 70 public: | 70 public: |
| 71 explicit VMState(StateTag state) {} | 71 VMState(Isolate* isolate, StateTag state) {} |
| 72 #endif | 72 #endif |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } } // namespace v8::internal | 75 } } // namespace v8::internal |
| 76 | 76 |
| 77 | 77 |
| 78 #endif // V8_VM_STATE_H_ | 78 #endif // V8_VM_STATE_H_ |
| OLD | NEW |