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 24 matching lines...) Expand all Loading... |
35 #ifdef ENABLE_VMSTATE_TRACKING | 35 #ifdef ENABLE_VMSTATE_TRACKING |
36 public: | 36 public: |
37 inline VMState(StateTag state); | 37 inline VMState(StateTag state); |
38 inline ~VMState(); | 38 inline ~VMState(); |
39 | 39 |
40 StateTag state() { return state_; } | 40 StateTag state() { return state_; } |
41 void set_external_callback(Address external_callback) { | 41 void set_external_callback(Address external_callback) { |
42 external_callback_ = external_callback; | 42 external_callback_ = external_callback; |
43 } | 43 } |
44 | 44 |
| 45 // Used for debug asserts. |
| 46 static bool is_outermost_external() { |
| 47 return current_state_ == NULL; |
| 48 } |
| 49 |
45 static StateTag current_state() { | 50 static StateTag current_state() { |
46 return current_state_ ? current_state_->state() : EXTERNAL; | 51 return current_state_ ? current_state_->state() : EXTERNAL; |
47 } | 52 } |
48 | 53 |
49 static Address external_callback() { | 54 static Address external_callback() { |
50 return current_state_ ? current_state_->external_callback_ : NULL; | 55 return current_state_ ? current_state_->external_callback_ : NULL; |
51 } | 56 } |
52 | 57 |
53 private: | 58 private: |
54 bool disabled_; | 59 bool disabled_; |
55 StateTag state_; | 60 StateTag state_; |
56 VMState* previous_; | 61 VMState* previous_; |
57 Address external_callback_; | 62 Address external_callback_; |
58 | 63 |
59 // A stack of VM states. | 64 // A stack of VM states. |
60 static VMState* current_state_; | 65 static VMState* current_state_; |
61 #else | 66 #else |
62 public: | 67 public: |
63 explicit VMState(StateTag state) {} | 68 explicit VMState(StateTag state) {} |
64 #endif | 69 #endif |
65 }; | 70 }; |
66 | 71 |
67 } } // namespace v8::internal | 72 } } // namespace v8::internal |
68 | 73 |
69 | 74 |
70 #endif // V8_VM_STATE_H_ | 75 #endif // V8_VM_STATE_H_ |
OLD | NEW |