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 8716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8727 | 8727 |
8728 | 8728 |
8729 bool Debug::CheckDebugBreak(Isolate* isolate) { | 8729 bool Debug::CheckDebugBreak(Isolate* isolate) { |
8730 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8730 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8731 return internal_isolate->stack_guard()->CheckDebugBreak(); | 8731 return internal_isolate->stack_guard()->CheckDebugBreak(); |
8732 } | 8732 } |
8733 | 8733 |
8734 | 8734 |
8735 void Debug::SetMessageHandler(Isolate* isolate, | 8735 void Debug::SetMessageHandler(Isolate* isolate, |
8736 v8::Debug::MessageHandler handler) { | 8736 v8::Debug::MessageHandler handler) { |
8737 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8737 UNIMPLEMENTED(); |
8738 ENTER_V8(i_isolate); | |
8739 i_isolate->debug()->SetMessageHandler(handler); | |
8740 } | 8738 } |
8741 | 8739 |
8742 | 8740 |
8743 void Debug::SendCommand(Isolate* isolate, | 8741 void Debug::SendCommand(Isolate* isolate, |
8744 const uint16_t* command, | 8742 const uint16_t* command, |
8745 int length, | 8743 int length, |
8746 ClientData* client_data) { | 8744 ClientData* client_data) { |
8747 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8745 UNIMPLEMENTED(); |
8748 internal_isolate->debug()->EnqueueCommandMessage( | |
8749 i::Vector<const uint16_t>(command, length), client_data); | |
8750 } | 8746 } |
8751 | 8747 |
8752 | 8748 |
8753 MaybeLocal<Value> Debug::Call(Local<Context> context, | 8749 MaybeLocal<Value> Debug::Call(Local<Context> context, |
8754 v8::Local<v8::Function> fun, | 8750 v8::Local<v8::Function> fun, |
8755 v8::Local<v8::Value> data) { | 8751 v8::Local<v8::Value> data) { |
8756 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); | 8752 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); |
8757 i::Handle<i::Object> data_obj; | 8753 i::Handle<i::Object> data_obj; |
8758 if (data.IsEmpty()) { | 8754 if (data.IsEmpty()) { |
8759 data_obj = isolate->factory()->undefined_value(); | 8755 data_obj = isolate->factory()->undefined_value(); |
8760 } else { | 8756 } else { |
8761 data_obj = Utils::OpenHandle(*data); | 8757 data_obj = Utils::OpenHandle(*data); |
8762 } | 8758 } |
8763 Local<Value> result; | 8759 Local<Value> result; |
8764 has_pending_exception = | 8760 has_pending_exception = |
8765 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), | 8761 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), |
8766 &result); | 8762 &result); |
8767 RETURN_ON_FAILED_EXECUTION(Value); | 8763 RETURN_ON_FAILED_EXECUTION(Value); |
8768 RETURN_ESCAPED(result); | 8764 RETURN_ESCAPED(result); |
8769 } | 8765 } |
8770 | 8766 |
8771 | 8767 |
8772 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, | 8768 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, |
8773 v8::Local<v8::Value> obj) { | 8769 v8::Local<v8::Value> obj) { |
8774 PREPARE_FOR_EXECUTION(context, Debug, GetMirror, Value); | 8770 UNIMPLEMENTED(); |
8775 i::Debug* isolate_debug = isolate->debug(); | 8771 return MaybeLocal<Value>(); |
8776 has_pending_exception = !isolate_debug->Load(); | |
8777 RETURN_ON_FAILED_EXECUTION(Value); | |
8778 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); | |
8779 auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror"); | |
8780 auto fun_obj = i::JSReceiver::GetProperty(debug, name).ToHandleChecked(); | |
8781 auto v8_fun = Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(fun_obj)); | |
8782 const int kArgc = 1; | |
8783 v8::Local<v8::Value> argv[kArgc] = {obj}; | |
8784 Local<Value> result; | |
8785 has_pending_exception = | |
8786 !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv) | |
8787 .ToLocal(&result); | |
8788 RETURN_ON_FAILED_EXECUTION(Value); | |
8789 RETURN_ESCAPED(result); | |
8790 } | 8772 } |
8791 | 8773 |
8792 void Debug::ProcessDebugMessages(Isolate* isolate) { | 8774 void Debug::ProcessDebugMessages(Isolate* isolate) { UNIMPLEMENTED(); } |
8793 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true); | |
8794 } | |
8795 | |
8796 | 8775 |
8797 Local<Context> Debug::GetDebugContext(Isolate* isolate) { | 8776 Local<Context> Debug::GetDebugContext(Isolate* isolate) { |
8798 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8777 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8799 ENTER_V8(i_isolate); | 8778 ENTER_V8(i_isolate); |
8800 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); | 8779 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); |
8801 } | 8780 } |
8802 | 8781 |
8803 | 8782 |
8804 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { | 8783 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { |
8805 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8784 UNIMPLEMENTED(); |
8806 ENTER_V8(i_isolate); | 8785 return MaybeLocal<Context>(); |
8807 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); | |
8808 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); | |
8809 if (calling.is_null()) return MaybeLocal<Context>(); | |
8810 return Utils::ToLocal(i::Handle<i::Context>::cast(calling)); | |
8811 } | 8786 } |
8812 | 8787 |
8813 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { | 8788 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { |
8814 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8789 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8815 internal_isolate->debug()->set_live_edit_enabled(enable); | 8790 internal_isolate->debug()->set_live_edit_enabled(enable); |
8816 } | 8791 } |
8817 | 8792 |
8818 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { | 8793 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { |
8819 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8794 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8820 return internal_isolate->is_tail_call_elimination_enabled(); | 8795 return internal_isolate->is_tail_call_elimination_enabled(); |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9864 Address callback_address = | 9839 Address callback_address = |
9865 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9840 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9866 VMState<EXTERNAL> state(isolate); | 9841 VMState<EXTERNAL> state(isolate); |
9867 ExternalCallbackScope call_scope(isolate, callback_address); | 9842 ExternalCallbackScope call_scope(isolate, callback_address); |
9868 callback(info); | 9843 callback(info); |
9869 } | 9844 } |
9870 | 9845 |
9871 | 9846 |
9872 } // namespace internal | 9847 } // namespace internal |
9873 } // namespace v8 | 9848 } // namespace v8 |
OLD | NEW |