| 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(Isolate* isolate, StateTag state); | 39 inline VMState(Isolate* isolate, StateTag tag); |
| 40 inline ~VMState(); | 40 inline ~VMState(); |
| 41 | 41 |
| 42 StateTag state() { return state_; } | |
| 43 void set_external_callback(Address external_callback) { | |
| 44 external_callback_ = external_callback; | |
| 45 } | |
| 46 | |
| 47 // Used for debug asserts. | |
| 48 static bool is_outermost_external() { | |
| 49 return Isolate::Current()->current_vm_state() == 0; | |
| 50 } | |
| 51 | |
| 52 static StateTag current_state() { | |
| 53 VMState* state = Isolate::Current()->current_vm_state(); | |
| 54 return state ? state->state() : EXTERNAL; | |
| 55 } | |
| 56 | |
| 57 static Address external_callback() { | |
| 58 VMState* state = Isolate::Current()->current_vm_state(); | |
| 59 return state ? state->external_callback_ : NULL; | |
| 60 } | |
| 61 | |
| 62 private: | 42 private: |
| 63 Isolate* isolate_; | 43 Isolate* isolate_; |
| 64 bool disabled_; | 44 StateTag previous_tag_; |
| 65 StateTag state_; | |
| 66 VMState* previous_; | |
| 67 Address external_callback_; | |
| 68 | 45 |
| 69 #else | 46 #else |
| 70 public: | 47 public: |
| 71 VMState(Isolate* isolate, StateTag state) {} | 48 VMState(Isolate* isolate, StateTag state) {} |
| 72 #endif | 49 #endif |
| 73 }; | 50 }; |
| 74 | 51 |
| 52 |
| 53 class ExternalCallbackScope BASE_EMBEDDED { |
| 54 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 55 public: |
| 56 inline ExternalCallbackScope(Isolate* isolate, Address callback); |
| 57 inline ~ExternalCallbackScope(); |
| 58 private: |
| 59 Isolate* isolate_; |
| 60 Address previous_callback_; |
| 61 #else |
| 62 public: |
| 63 ExternalCallbackScope(Isolate* isolate, Address callback) {} |
| 64 #endif |
| 65 }; |
| 66 |
| 75 } } // namespace v8::internal | 67 } } // namespace v8::internal |
| 76 | 68 |
| 77 | 69 |
| 78 #endif // V8_VM_STATE_H_ | 70 #endif // V8_VM_STATE_H_ |
| OLD | NEW |