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

Side by Side Diff: src/api.cc

Issue 2727393003: [debugger,api] deprecate everything in v8-debug.h (Closed)
Patch Set: Created 3 years, 9 months 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 8940 matching lines...) Expand 10 before | Expand all | Expand 10 after
8951 } else { 8951 } else {
8952 i::Handle<i::Object> i_data = i_isolate->factory()->undefined_value(); 8952 i::Handle<i::Object> i_data = i_isolate->factory()->undefined_value();
8953 if (!data.IsEmpty()) i_data = Utils::OpenHandle(*data); 8953 if (!data.IsEmpty()) i_data = Utils::OpenHandle(*data);
8954 i::NativeDebugDelegate* delegate = 8954 i::NativeDebugDelegate* delegate =
8955 new i::NativeDebugDelegate(i_isolate, that, i_data); 8955 new i::NativeDebugDelegate(i_isolate, that, i_data);
8956 i_isolate->debug()->SetDebugDelegate(delegate, true); 8956 i_isolate->debug()->SetDebugDelegate(delegate, true);
8957 } 8957 }
8958 return true; 8958 return true;
8959 } 8959 }
8960 8960
8961 void Debug::DebugBreak(Isolate* isolate) { 8961 void Debug::DebugBreak(Isolate* isolate) { debug::DebugBreak(isolate); }
8962 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); 8962
8963 void Debug::CancelDebugBreak(Isolate* isolate) {
8964 debug::CancelDebugBreak(isolate);
8963 } 8965 }
8964 8966
8965 8967
8966 void Debug::CancelDebugBreak(Isolate* isolate) {
8967 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8968 internal_isolate->stack_guard()->ClearDebugBreak();
8969 }
8970
8971
8972 bool Debug::CheckDebugBreak(Isolate* isolate) { 8968 bool Debug::CheckDebugBreak(Isolate* isolate) {
8973 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8969 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8974 return internal_isolate->stack_guard()->CheckDebugBreak(); 8970 return internal_isolate->stack_guard()->CheckDebugBreak();
8975 } 8971 }
8976 8972
8977 void Debug::SetMessageHandler(Isolate* isolate, 8973 void Debug::SetMessageHandler(Isolate* isolate,
8978 v8::Debug::MessageHandler handler) {} 8974 v8::Debug::MessageHandler handler) {}
8979 8975
8980 void Debug::SendCommand(Isolate* isolate, const uint16_t* command, int length, 8976 void Debug::SendCommand(Isolate* isolate, const uint16_t* command, int length,
8981 ClientData* client_data) {} 8977 ClientData* client_data) {}
8982 8978
8983 MaybeLocal<Value> Debug::Call(Local<Context> context, 8979 MaybeLocal<Value> Debug::Call(Local<Context> context,
8984 v8::Local<v8::Function> fun, 8980 v8::Local<v8::Function> fun,
8985 v8::Local<v8::Value> data) { 8981 v8::Local<v8::Value> data) {
8986 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); 8982 return debug::Call(context, fun, data);
8987 i::Handle<i::Object> data_obj;
8988 if (data.IsEmpty()) {
8989 data_obj = isolate->factory()->undefined_value();
8990 } else {
8991 data_obj = Utils::OpenHandle(*data);
8992 }
8993 Local<Value> result;
8994 has_pending_exception =
8995 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj),
8996 &result);
8997 RETURN_ON_FAILED_EXECUTION(Value);
8998 RETURN_ESCAPED(result);
8999 } 8983 }
9000 8984
9001
9002 void Debug::ProcessDebugMessages(Isolate* isolate) {} 8985 void Debug::ProcessDebugMessages(Isolate* isolate) {}
9003 8986
9004 Local<Context> Debug::GetDebugContext(Isolate* isolate) { 8987 Local<Context> Debug::GetDebugContext(Isolate* isolate) {
9005 return debug::GetDebugContext(isolate); 8988 return debug::GetDebugContext(isolate);
9006 } 8989 }
9007 8990
9008
9009 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { 8991 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) {
9010 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8992 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
9011 ENTER_V8(i_isolate); 8993 ENTER_V8(i_isolate);
9012 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); 8994 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>();
9013 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); 8995 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext();
9014 if (calling.is_null()) return MaybeLocal<Context>(); 8996 if (calling.is_null()) return MaybeLocal<Context>();
9015 return Utils::ToLocal(i::Handle<i::Context>::cast(calling)); 8997 return Utils::ToLocal(i::Handle<i::Context>::cast(calling));
9016 } 8998 }
9017 8999
9018 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 9000 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
9019 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 9001 debug::SetLiveEditEnabled(isolate, enable);
9020 internal_isolate->debug()->set_live_edit_enabled(enable);
9021 } 9002 }
9022 9003
9023 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { 9004 bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) {
9024 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 9005 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
9025 return internal_isolate->is_tail_call_elimination_enabled(); 9006 return internal_isolate->is_tail_call_elimination_enabled();
9026 } 9007 }
9027 9008
9028 void Debug::SetTailCallEliminationEnabled(Isolate* isolate, bool enabled) { 9009 void Debug::SetTailCallEliminationEnabled(Isolate* isolate, bool enabled) {
9029 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 9010 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
9030 internal_isolate->SetTailCallEliminationEnabled(enabled); 9011 internal_isolate->SetTailCallEliminationEnabled(enabled);
9031 } 9012 }
9032 9013
9033 MaybeLocal<Array> Debug::GetInternalProperties(Isolate* v8_isolate, 9014 MaybeLocal<Array> Debug::GetInternalProperties(Isolate* v8_isolate,
9034 Local<Value> value) { 9015 Local<Value> value) {
9035 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 9016 return debug::GetInternalProperties(v8_isolate, value);
9036 ENTER_V8(isolate);
9037 i::Handle<i::Object> val = Utils::OpenHandle(*value);
9038 i::Handle<i::JSArray> result;
9039 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result))
9040 return MaybeLocal<Array>();
9041 return Utils::ToLocal(result);
9042 } 9017 }
9043 9018
9044 Local<Context> debug::GetDebugContext(Isolate* isolate) { 9019 Local<Context> debug::GetDebugContext(Isolate* isolate) {
9045 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 9020 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
9046 ENTER_V8(i_isolate); 9021 ENTER_V8(i_isolate);
9047 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); 9022 return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
9048 } 9023 }
9049 9024
9050 MaybeLocal<Value> debug::Call(Local<Context> context, 9025 MaybeLocal<Value> debug::Call(Local<Context> context,
9051 v8::Local<v8::Function> fun, 9026 v8::Local<v8::Function> fun,
9052 v8::Local<v8::Value> data) { 9027 v8::Local<v8::Value> data) {
9053 return Debug::Call(context, fun, data); 9028 PREPARE_FOR_EXECUTION(context, Debug, Call, Value);
9029 i::Handle<i::Object> data_obj;
9030 if (data.IsEmpty()) {
9031 data_obj = isolate->factory()->undefined_value();
9032 } else {
9033 data_obj = Utils::OpenHandle(*data);
9034 }
9035 Local<Value> result;
9036 has_pending_exception = !ToLocal<Value>(
9037 isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), &result);
9038 RETURN_ON_FAILED_EXECUTION(Value);
9039 RETURN_ESCAPED(result);
9054 } 9040 }
9055 9041
9056 void debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 9042 void debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
9057 Debug::SetLiveEditEnabled(isolate, enable); 9043 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
9044 internal_isolate->debug()->set_live_edit_enabled(enable);
9058 } 9045 }
9059 9046
9060 void debug::DebugBreak(Isolate* isolate) { Debug::DebugBreak(isolate); } 9047 void debug::DebugBreak(Isolate* isolate) {
9048 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
9049 }
9061 9050
9062 void debug::CancelDebugBreak(Isolate* isolate) { 9051 void debug::CancelDebugBreak(Isolate* isolate) {
9063 Debug::CancelDebugBreak(isolate); 9052 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
9053 internal_isolate->stack_guard()->ClearDebugBreak();
9064 } 9054 }
9065 9055
9066 MaybeLocal<Array> debug::GetInternalProperties(Isolate* isolate, 9056 MaybeLocal<Array> debug::GetInternalProperties(Isolate* v8_isolate,
9067 Local<Value> value) { 9057 Local<Value> value) {
9068 return Debug::GetInternalProperties(isolate, value); 9058 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9059 ENTER_V8(isolate);
9060 i::Handle<i::Object> val = Utils::OpenHandle(*value);
9061 i::Handle<i::JSArray> result;
9062 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result))
9063 return MaybeLocal<Array>();
9064 return Utils::ToLocal(result);
9069 } 9065 }
9070 9066
9071 void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) { 9067 void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) {
9072 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 9068 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
9073 internal_isolate->debug()->ChangeBreakOnException( 9069 internal_isolate->debug()->ChangeBreakOnException(
9074 i::BreakException, type == BreakOnAnyException); 9070 i::BreakException, type == BreakOnAnyException);
9075 internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException, 9071 internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException,
9076 type != NoBreakOnException); 9072 type != NoBreakOnException);
9077 } 9073 }
9078 9074
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
10247 Address callback_address = 10243 Address callback_address =
10248 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10244 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10249 VMState<EXTERNAL> state(isolate); 10245 VMState<EXTERNAL> state(isolate);
10250 ExternalCallbackScope call_scope(isolate, callback_address); 10246 ExternalCallbackScope call_scope(isolate, callback_address);
10251 callback(info); 10247 callback(info);
10252 } 10248 }
10253 10249
10254 10250
10255 } // namespace internal 10251 } // namespace internal
10256 } // namespace v8 10252 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698