| 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::Enter(isolate_, &timer_, | |
| 68 &RuntimeCallStats::ExternalCallback); | |
| 69 } | |
| 70 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), | 66 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), |
| 71 "V8.ExternalCallback"); | 67 "V8.ExternalCallback"); |
| 72 } | 68 } |
| 73 | 69 |
| 74 ExternalCallbackScope::~ExternalCallbackScope() { | 70 ExternalCallbackScope::~ExternalCallbackScope() { |
| 75 if (FLAG_runtime_call_stats) { | |
| 76 RuntimeCallStats::Leave(isolate_, &timer_); | |
| 77 } | |
| 78 isolate_->set_external_callback_scope(previous_scope_); | 71 isolate_->set_external_callback_scope(previous_scope_); |
| 79 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), | 72 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), |
| 80 "V8.ExternalCallback"); | 73 "V8.ExternalCallback"); |
| 81 } | 74 } |
| 82 | 75 |
| 83 Address ExternalCallbackScope::scope_address() { | 76 Address ExternalCallbackScope::scope_address() { |
| 84 #ifdef USE_SIMULATOR | 77 #ifdef USE_SIMULATOR |
| 85 return scope_address_; | 78 return scope_address_; |
| 86 #else | 79 #else |
| 87 return reinterpret_cast<Address>(this); | 80 return reinterpret_cast<Address>(this); |
| 88 #endif | 81 #endif |
| 89 } | 82 } |
| 90 | 83 |
| 91 | 84 |
| 92 } // namespace internal | 85 } // namespace internal |
| 93 } // namespace v8 | 86 } // namespace v8 |
| 94 | 87 |
| 95 #endif // V8_VM_STATE_INL_H_ | 88 #endif // V8_VM_STATE_INL_H_ |
| OLD | NEW |