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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 VMState<Tag>::~VMState() { | 54 VMState<Tag>::~VMState() { |
55 if (previous_tag_ != EXTERNAL && Tag == EXTERNAL) { | 55 if (previous_tag_ != EXTERNAL && Tag == EXTERNAL) { |
56 if (FLAG_log_timer_events) { | 56 if (FLAG_log_timer_events) { |
57 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name())); | 57 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name())); |
58 } | 58 } |
59 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.External"); | 59 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.External"); |
60 } | 60 } |
61 isolate_->set_current_vm_state(previous_tag_); | 61 isolate_->set_current_vm_state(previous_tag_); |
62 } | 62 } |
63 | 63 |
64 | |
65 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) | 64 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) |
66 : isolate_(isolate), | 65 : isolate_(isolate), |
67 callback_(callback), | 66 callback_(callback), |
68 previous_scope_(isolate->external_callback_scope()) { | 67 previous_scope_(isolate->external_callback_scope()), |
| 68 timer_(&isolate->counters()->runtime_call_stats()->ExternalCallback, |
| 69 isolate->counters()->runtime_call_stats()->current_timer()) { |
69 #ifdef USE_SIMULATOR | 70 #ifdef USE_SIMULATOR |
70 scope_address_ = Simulator::current(isolate)->get_sp(); | 71 scope_address_ = Simulator::current(isolate)->get_sp(); |
71 #endif | 72 #endif |
72 isolate_->set_external_callback_scope(this); | 73 isolate_->set_external_callback_scope(this); |
| 74 if (FLAG_runtime_call_stats) { |
| 75 isolate_->counters()->runtime_call_stats()->Enter(&timer_); |
| 76 } |
73 } | 77 } |
74 | 78 |
75 ExternalCallbackScope::~ExternalCallbackScope() { | 79 ExternalCallbackScope::~ExternalCallbackScope() { |
| 80 if (FLAG_runtime_call_stats) { |
| 81 isolate_->counters()->runtime_call_stats()->Leave(&timer_); |
| 82 } |
76 isolate_->set_external_callback_scope(previous_scope_); | 83 isolate_->set_external_callback_scope(previous_scope_); |
77 } | 84 } |
78 | 85 |
79 Address ExternalCallbackScope::scope_address() { | 86 Address ExternalCallbackScope::scope_address() { |
80 #ifdef USE_SIMULATOR | 87 #ifdef USE_SIMULATOR |
81 return scope_address_; | 88 return scope_address_; |
82 #else | 89 #else |
83 return reinterpret_cast<Address>(this); | 90 return reinterpret_cast<Address>(this); |
84 #endif | 91 #endif |
85 } | 92 } |
86 | 93 |
87 | 94 |
88 } // namespace internal | 95 } // namespace internal |
89 } // namespace v8 | 96 } // namespace v8 |
90 | 97 |
91 #endif // V8_VM_STATE_INL_H_ | 98 #endif // V8_VM_STATE_INL_H_ |
OLD | NEW |