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