OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_VM_STATE_INL_H_ | 5 #ifndef V8_VM_STATE_INL_H_ |
6 #define V8_VM_STATE_INL_H_ | 6 #define V8_VM_STATE_INL_H_ |
7 | 7 |
8 #include "src/vm-state.h" | 8 #include "src/vm-state.h" |
9 #include "src/log.h" | 9 #include "src/log.h" |
10 #include "src/simulator.h" | 10 #include "src/simulator.h" |
| 11 #include "src/tracing/trace-event.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 // | 16 // |
16 // VMState class implementation. A simple stack of VM states held by the | 17 // VMState class implementation. A simple stack of VM states held by the |
17 // logger and partially threaded through the call stack. States are pushed by | 18 // logger and partially threaded through the call stack. States are pushed by |
18 // VMState construction and popped by destruction. | 19 // VMState construction and popped by destruction. |
19 // | 20 // |
20 inline const char* StateToString(StateTag state) { | 21 inline const char* StateToString(StateTag state) { |
(...skipping 11 matching lines...) Expand all Loading... |
32 default: | 33 default: |
33 UNREACHABLE(); | 34 UNREACHABLE(); |
34 return NULL; | 35 return NULL; |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 | 39 |
39 template <StateTag Tag> | 40 template <StateTag Tag> |
40 VMState<Tag>::VMState(Isolate* isolate) | 41 VMState<Tag>::VMState(Isolate* isolate) |
41 : isolate_(isolate), previous_tag_(isolate->current_vm_state()) { | 42 : isolate_(isolate), previous_tag_(isolate->current_vm_state()) { |
42 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) { | 43 if (previous_tag_ != EXTERNAL && Tag == EXTERNAL) { |
43 LOG(isolate_, TimerEvent(Logger::START, TimerEventExternal::name())); | 44 if (FLAG_log_timer_events) { |
| 45 LOG(isolate_, TimerEvent(Logger::START, TimerEventExternal::name())); |
| 46 } |
| 47 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.External"); |
44 } | 48 } |
45 isolate_->set_current_vm_state(Tag); | 49 isolate_->set_current_vm_state(Tag); |
46 } | 50 } |
47 | 51 |
48 | 52 |
49 template <StateTag Tag> | 53 template <StateTag Tag> |
50 VMState<Tag>::~VMState() { | 54 VMState<Tag>::~VMState() { |
51 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) { | 55 if (previous_tag_ != EXTERNAL && Tag == EXTERNAL) { |
52 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name())); | 56 if (FLAG_log_timer_events) { |
| 57 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name())); |
| 58 } |
| 59 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.External"); |
53 } | 60 } |
54 isolate_->set_current_vm_state(previous_tag_); | 61 isolate_->set_current_vm_state(previous_tag_); |
55 } | 62 } |
56 | 63 |
57 | 64 |
58 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) | 65 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) |
59 : isolate_(isolate), | 66 : isolate_(isolate), |
60 callback_(callback), | 67 callback_(callback), |
61 previous_scope_(isolate->external_callback_scope()) { | 68 previous_scope_(isolate->external_callback_scope()) { |
62 #ifdef USE_SIMULATOR | 69 #ifdef USE_SIMULATOR |
(...skipping 12 matching lines...) Expand all Loading... |
75 #else | 82 #else |
76 return reinterpret_cast<Address>(this); | 83 return reinterpret_cast<Address>(this); |
77 #endif | 84 #endif |
78 } | 85 } |
79 | 86 |
80 | 87 |
81 } // namespace internal | 88 } // namespace internal |
82 } // namespace v8 | 89 } // namespace v8 |
83 | 90 |
84 #endif // V8_VM_STATE_INL_H_ | 91 #endif // V8_VM_STATE_INL_H_ |
OLD | NEW |