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 7709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7720 if (!obj->IsJSObject()) return Local<StackTrace>(); | 7720 if (!obj->IsJSObject()) return Local<StackTrace>(); |
7721 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); | 7721 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); |
7722 i::Isolate* isolate = js_obj->GetIsolate(); | 7722 i::Isolate* isolate = js_obj->GetIsolate(); |
7723 ENTER_V8(isolate); | 7723 ENTER_V8(isolate); |
7724 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); | 7724 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); |
7725 } | 7725 } |
7726 | 7726 |
7727 | 7727 |
7728 // --- D e b u g S u p p o r t --- | 7728 // --- D e b u g S u p p o r t --- |
7729 | 7729 |
7730 bool Debug::SetDebugEventListener(Isolate* isolate, EventCallback that, | |
7731 Local<Value> data) { | |
7732 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
7733 ENTER_V8(i_isolate); | |
7734 i::HandleScope scope(i_isolate); | |
7735 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value(); | |
7736 if (that != NULL) { | |
7737 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that)); | |
7738 } | |
7739 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true)); | |
7740 return true; | |
7741 } | |
7742 | |
7743 | |
7730 bool Debug::SetDebugEventListener(EventCallback that, Local<Value> data) { | 7744 bool Debug::SetDebugEventListener(EventCallback that, Local<Value> data) { |
7731 i::Isolate* isolate = i::Isolate::Current(); | 7745 return SetDebugEventListener( |
7732 ENTER_V8(isolate); | 7746 reinterpret_cast<Isolate*>(i::Isolate::Current()), that, data); |
vogelheim
2015/12/02 11:38:48
Meh... reinterpret_cast-ing i::Isolate to Isolate
| |
7733 i::HandleScope scope(isolate); | |
7734 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); | |
7735 if (that != NULL) { | |
7736 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); | |
7737 } | |
7738 isolate->debug()->SetEventListener(foreign, | |
7739 Utils::OpenHandle(*data, true)); | |
7740 return true; | |
7741 } | 7747 } |
7742 | 7748 |
7743 | 7749 |
7744 void Debug::DebugBreak(Isolate* isolate) { | 7750 void Debug::DebugBreak(Isolate* isolate) { |
7745 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); | 7751 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); |
7746 } | 7752 } |
7747 | 7753 |
7748 | 7754 |
7749 void Debug::CancelDebugBreak(Isolate* isolate) { | 7755 void Debug::CancelDebugBreak(Isolate* isolate) { |
7750 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7756 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7751 internal_isolate->stack_guard()->ClearDebugBreak(); | 7757 internal_isolate->stack_guard()->ClearDebugBreak(); |
7752 } | 7758 } |
7753 | 7759 |
7754 | 7760 |
7755 bool Debug::CheckDebugBreak(Isolate* isolate) { | 7761 bool Debug::CheckDebugBreak(Isolate* isolate) { |
7756 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7762 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7757 return internal_isolate->stack_guard()->CheckDebugBreak(); | 7763 return internal_isolate->stack_guard()->CheckDebugBreak(); |
7758 } | 7764 } |
7759 | 7765 |
7760 | 7766 |
7767 void Debug::SetMessageHandler(Isolate* isolate, | |
7768 v8::Debug::MessageHandler handler) { | |
7769 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
7770 ENTER_V8(i_isolate); | |
7771 i_isolate->debug()->SetMessageHandler(handler); | |
7772 } | |
7773 | |
7774 | |
7761 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { | 7775 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { |
7762 i::Isolate* isolate = i::Isolate::Current(); | 7776 SetMessageHandler(reinterpret_cast<Isolate*>(i::Isolate::Current()), handler); |
7763 ENTER_V8(isolate); | |
7764 isolate->debug()->SetMessageHandler(handler); | |
7765 } | 7777 } |
7766 | 7778 |
7767 | 7779 |
7768 void Debug::SendCommand(Isolate* isolate, | 7780 void Debug::SendCommand(Isolate* isolate, |
7769 const uint16_t* command, | 7781 const uint16_t* command, |
7770 int length, | 7782 int length, |
7771 ClientData* client_data) { | 7783 ClientData* client_data) { |
7772 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7784 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7773 internal_isolate->debug()->EnqueueCommandMessage( | 7785 internal_isolate->debug()->EnqueueCommandMessage( |
7774 i::Vector<const uint16_t>(command, length), client_data); | 7786 i::Vector<const uint16_t>(command, length), client_data); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7820 RETURN_ON_FAILED_EXECUTION(Value); | 7832 RETURN_ON_FAILED_EXECUTION(Value); |
7821 RETURN_ESCAPED(result); | 7833 RETURN_ESCAPED(result); |
7822 } | 7834 } |
7823 | 7835 |
7824 | 7836 |
7825 Local<Value> Debug::GetMirror(v8::Local<v8::Value> obj) { | 7837 Local<Value> Debug::GetMirror(v8::Local<v8::Value> obj) { |
7826 RETURN_TO_LOCAL_UNCHECKED(GetMirror(Local<Context>(), obj), Value); | 7838 RETURN_TO_LOCAL_UNCHECKED(GetMirror(Local<Context>(), obj), Value); |
7827 } | 7839 } |
7828 | 7840 |
7829 | 7841 |
7842 void Debug::ProcessDebugMessages(Isolate* isolate) { | |
7843 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true); | |
7844 } | |
7845 | |
7846 | |
7830 void Debug::ProcessDebugMessages() { | 7847 void Debug::ProcessDebugMessages() { |
7831 i::Isolate::Current()->debug()->ProcessDebugMessages(true); | 7848 ProcessDebugMessages(reinterpret_cast<Isolate*>(i::Isolate::Current())); |
7849 } | |
7850 | |
7851 | |
7852 Local<Context> Debug::GetDebugContext(Isolate* isolate) { | |
7853 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
7854 ENTER_V8(i_isolate); | |
7855 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); | |
7832 } | 7856 } |
7833 | 7857 |
7834 | 7858 |
7835 Local<Context> Debug::GetDebugContext() { | 7859 Local<Context> Debug::GetDebugContext() { |
7836 i::Isolate* isolate = i::Isolate::Current(); | 7860 return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current())); |
7837 ENTER_V8(isolate); | |
7838 return Utils::ToLocal(isolate->debug()->GetDebugContext()); | |
7839 } | 7861 } |
7840 | 7862 |
7841 | 7863 |
7842 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { | 7864 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { |
7843 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7865 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7844 internal_isolate->debug()->set_live_edit_enabled(enable); | 7866 internal_isolate->debug()->set_live_edit_enabled(enable); |
7845 } | 7867 } |
7846 | 7868 |
7847 | 7869 |
7848 MaybeLocal<Array> Debug::GetInternalProperties(Isolate* v8_isolate, | 7870 MaybeLocal<Array> Debug::GetInternalProperties(Isolate* v8_isolate, |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8496 Address callback_address = | 8518 Address callback_address = |
8497 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8519 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8498 VMState<EXTERNAL> state(isolate); | 8520 VMState<EXTERNAL> state(isolate); |
8499 ExternalCallbackScope call_scope(isolate, callback_address); | 8521 ExternalCallbackScope call_scope(isolate, callback_address); |
8500 callback(info); | 8522 callback(info); |
8501 } | 8523 } |
8502 | 8524 |
8503 | 8525 |
8504 } // namespace internal | 8526 } // namespace internal |
8505 } // namespace v8 | 8527 } // namespace v8 |
OLD | NEW |