Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: src/api.cc

Issue 2537313005: [debug] Revert debug API removal (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 UNIMPLEMENTED(); 8737 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8738 ENTER_V8(i_isolate);
8739 i_isolate->debug()->SetMessageHandler(handler);
8738 } 8740 }
8739 8741
8740 8742
8741 void Debug::SendCommand(Isolate* isolate, 8743 void Debug::SendCommand(Isolate* isolate,
8742 const uint16_t* command, 8744 const uint16_t* command,
8743 int length, 8745 int length,
8744 ClientData* client_data) { 8746 ClientData* client_data) {
8745 UNIMPLEMENTED(); 8747 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8748 internal_isolate->debug()->EnqueueCommandMessage(
8749 i::Vector<const uint16_t>(command, length), client_data);
8746 } 8750 }
8747 8751
8748 8752
8749 MaybeLocal<Value> Debug::Call(Local<Context> context, 8753 MaybeLocal<Value> Debug::Call(Local<Context> context,
8750 v8::Local<v8::Function> fun, 8754 v8::Local<v8::Function> fun,
8751 v8::Local<v8::Value> data) { 8755 v8::Local<v8::Value> data) {
8752 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); 8756 PREPARE_FOR_EXECUTION(context, Debug, Call, Value);
8753 i::Handle<i::Object> data_obj; 8757 i::Handle<i::Object> data_obj;
8754 if (data.IsEmpty()) { 8758 if (data.IsEmpty()) {
8755 data_obj = isolate->factory()->undefined_value(); 8759 data_obj = isolate->factory()->undefined_value();
8756 } else { 8760 } else {
8757 data_obj = Utils::OpenHandle(*data); 8761 data_obj = Utils::OpenHandle(*data);
8758 } 8762 }
8759 Local<Value> result; 8763 Local<Value> result;
8760 has_pending_exception = 8764 has_pending_exception =
8761 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), 8765 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj),
8762 &result); 8766 &result);
8763 RETURN_ON_FAILED_EXECUTION(Value); 8767 RETURN_ON_FAILED_EXECUTION(Value);
8764 RETURN_ESCAPED(result); 8768 RETURN_ESCAPED(result);
8765 } 8769 }
8766 8770
8767 8771
8768 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, 8772 MaybeLocal<Value> Debug::GetMirror(Local<Context> context,
8769 v8::Local<v8::Value> obj) { 8773 v8::Local<v8::Value> obj) {
8770 UNIMPLEMENTED(); 8774 PREPARE_FOR_EXECUTION(context, Debug, GetMirror, Value);
8771 return MaybeLocal<Value>(); 8775 i::Debug* isolate_debug = isolate->debug();
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);
8772 } 8790 }
8773 8791
8774 void Debug::ProcessDebugMessages(Isolate* isolate) { UNIMPLEMENTED(); } 8792 void Debug::ProcessDebugMessages(Isolate* isolate) {
8793 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true);
8794 }
8795
8775 8796
8776 Local<Context> Debug::GetDebugContext(Isolate* isolate) { 8797 Local<Context> Debug::GetDebugContext(Isolate* isolate) {
8777 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8798 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8778 ENTER_V8(i_isolate); 8799 ENTER_V8(i_isolate);
8779 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); 8800 return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
8780 } 8801 }
8781 8802
8782 8803
8783 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { 8804 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) {
8784 UNIMPLEMENTED(); 8805 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8785 return MaybeLocal<Context>(); 8806 ENTER_V8(i_isolate);
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));
8786 } 8811 }
8787 8812
8788 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 8813 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
8789 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8814 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8790 internal_isolate->debug()->set_live_edit_enabled(enable); 8815 internal_isolate->debug()->set_live_edit_enabled(enable);
8791 } 8816 }
8792 8817
8793 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { 8818 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) {
8794 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8819 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8795 return internal_isolate->is_tail_call_elimination_enabled(); 8820 return internal_isolate->is_tail_call_elimination_enabled();
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
9839 Address callback_address = 9864 Address callback_address =
9840 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9865 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9841 VMState<EXTERNAL> state(isolate); 9866 VMState<EXTERNAL> state(isolate);
9842 ExternalCallbackScope call_scope(isolate, callback_address); 9867 ExternalCallbackScope call_scope(isolate, callback_address);
9843 callback(info); 9868 callback(info);
9844 } 9869 }
9845 9870
9846 9871
9847 } // namespace internal 9872 } // namespace internal
9848 } // namespace v8 9873 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698