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

Side by Side Diff: src/api.cc

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

Powered by Google App Engine
This is Rietveld 408576698