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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_VM_STATE_INL_H_ | 28 #ifndef V8_VM_STATE_INL_H_ |
29 #define V8_VM_STATE_INL_H_ | 29 #define V8_VM_STATE_INL_H_ |
30 | 30 |
31 #include "vm-state.h" | 31 #include "vm-state.h" |
32 #include "runtime-profiler.h" | 32 #include "log.h" |
| 33 #include "simulator.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 // | 38 // |
38 // VMState class implementation. A simple stack of VM states held by the | 39 // VMState class implementation. A simple stack of VM states held by the |
39 // logger and partially threaded through the call stack. States are pushed by | 40 // logger and partially threaded through the call stack. States are pushed by |
40 // VMState construction and popped by destruction. | 41 // VMState construction and popped by destruction. |
41 // | 42 // |
42 inline const char* StateToString(StateTag state) { | 43 inline const char* StateToString(StateTag state) { |
(...skipping 30 matching lines...) Expand all Loading... |
73 VMState<Tag>::~VMState() { | 74 VMState<Tag>::~VMState() { |
74 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) { | 75 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) { |
75 LOG(isolate_, | 76 LOG(isolate_, |
76 TimerEvent(Logger::END, Logger::TimerEventScope::v8_external)); | 77 TimerEvent(Logger::END, Logger::TimerEventScope::v8_external)); |
77 } | 78 } |
78 isolate_->set_current_vm_state(previous_tag_); | 79 isolate_->set_current_vm_state(previous_tag_); |
79 } | 80 } |
80 | 81 |
81 | 82 |
82 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) | 83 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) |
83 : isolate_(isolate), previous_callback_(isolate->external_callback()) { | 84 : isolate_(isolate), |
84 isolate_->set_external_callback(callback); | 85 callback_(callback), |
| 86 previous_scope_(isolate->external_callback_scope()) { |
| 87 #ifdef USE_SIMULATOR |
| 88 int32_t sp = Simulator::current(isolate)->get_register(Simulator::sp); |
| 89 scope_address_ = reinterpret_cast<Address>(static_cast<intptr_t>(sp)); |
| 90 #endif |
| 91 isolate_->set_external_callback_scope(this); |
85 } | 92 } |
86 | 93 |
87 ExternalCallbackScope::~ExternalCallbackScope() { | 94 ExternalCallbackScope::~ExternalCallbackScope() { |
88 isolate_->set_external_callback(previous_callback_); | 95 isolate_->set_external_callback_scope(previous_scope_); |
| 96 } |
| 97 |
| 98 Address ExternalCallbackScope::scope_address() { |
| 99 #ifdef USE_SIMULATOR |
| 100 return scope_address_; |
| 101 #else |
| 102 return reinterpret_cast<Address>(this); |
| 103 #endif |
89 } | 104 } |
90 | 105 |
91 | 106 |
92 } } // namespace v8::internal | 107 } } // namespace v8::internal |
93 | 108 |
94 #endif // V8_VM_STATE_INL_H_ | 109 #endif // V8_VM_STATE_INL_H_ |
OLD | NEW |