OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 8106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8117 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8117 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8118 ENTER_V8(i_isolate); | 8118 ENTER_V8(i_isolate); |
8119 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); | 8119 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); |
8120 } | 8120 } |
8121 | 8121 |
8122 | 8122 |
8123 Local<Context> Debug::GetDebugContext() { | 8123 Local<Context> Debug::GetDebugContext() { |
8124 return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current())); | 8124 return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current())); |
8125 } | 8125 } |
8126 | 8126 |
| 8127 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { |
| 8128 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 8129 ENTER_V8(i_isolate); |
| 8130 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); |
| 8131 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); |
| 8132 if (calling.is_null()) return MaybeLocal<Context>(); |
| 8133 return Utils::ToLocal(i::Handle<i::Context>::cast(calling)); |
| 8134 } |
8127 | 8135 |
8128 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { | 8136 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { |
8129 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8137 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8130 internal_isolate->debug()->set_live_edit_enabled(enable); | 8138 internal_isolate->debug()->set_live_edit_enabled(enable); |
8131 } | 8139 } |
8132 | 8140 |
8133 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { | 8141 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { |
8134 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8142 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8135 return internal_isolate->is_tail_call_elimination_enabled(); | 8143 return internal_isolate->is_tail_call_elimination_enabled(); |
8136 } | 8144 } |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8817 Address callback_address = | 8825 Address callback_address = |
8818 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8826 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8819 VMState<EXTERNAL> state(isolate); | 8827 VMState<EXTERNAL> state(isolate); |
8820 ExternalCallbackScope call_scope(isolate, callback_address); | 8828 ExternalCallbackScope call_scope(isolate, callback_address); |
8821 callback(info); | 8829 callback(info); |
8822 } | 8830 } |
8823 | 8831 |
8824 | 8832 |
8825 } // namespace internal | 8833 } // namespace internal |
8826 } // namespace v8 | 8834 } // namespace v8 |
OLD | NEW |