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

Side by Side Diff: src/api.cc

Issue 2162503002: [debugger] remove deprecated api functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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') | no next file » | 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 8201 matching lines...) Expand 10 before | Expand all | Expand 10 after
8212 i::HandleScope scope(i_isolate); 8212 i::HandleScope scope(i_isolate);
8213 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value(); 8213 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value();
8214 if (that != NULL) { 8214 if (that != NULL) {
8215 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that)); 8215 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that));
8216 } 8216 }
8217 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true)); 8217 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true));
8218 return true; 8218 return true;
8219 } 8219 }
8220 8220
8221 8221
8222 bool Debug::SetDebugEventListener(EventCallback that, Local<Value> data) {
8223 return SetDebugEventListener(
8224 reinterpret_cast<Isolate*>(i::Isolate::Current()), that, data);
8225 }
8226
8227
8228 void Debug::DebugBreak(Isolate* isolate) { 8222 void Debug::DebugBreak(Isolate* isolate) {
8229 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); 8223 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
8230 } 8224 }
8231 8225
8232 8226
8233 void Debug::CancelDebugBreak(Isolate* isolate) { 8227 void Debug::CancelDebugBreak(Isolate* isolate) {
8234 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8228 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8235 internal_isolate->stack_guard()->ClearDebugBreak(); 8229 internal_isolate->stack_guard()->ClearDebugBreak();
8236 } 8230 }
8237 8231
8238 8232
8239 bool Debug::CheckDebugBreak(Isolate* isolate) { 8233 bool Debug::CheckDebugBreak(Isolate* isolate) {
8240 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8234 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8241 return internal_isolate->stack_guard()->CheckDebugBreak(); 8235 return internal_isolate->stack_guard()->CheckDebugBreak();
8242 } 8236 }
8243 8237
8244 8238
8245 void Debug::SetMessageHandler(Isolate* isolate, 8239 void Debug::SetMessageHandler(Isolate* isolate,
8246 v8::Debug::MessageHandler handler) { 8240 v8::Debug::MessageHandler handler) {
8247 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8241 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8248 ENTER_V8(i_isolate); 8242 ENTER_V8(i_isolate);
8249 i_isolate->debug()->SetMessageHandler(handler); 8243 i_isolate->debug()->SetMessageHandler(handler);
8250 } 8244 }
8251 8245
8252 8246
8253 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) {
8254 SetMessageHandler(reinterpret_cast<Isolate*>(i::Isolate::Current()), handler);
8255 }
8256
8257
8258 void Debug::SendCommand(Isolate* isolate, 8247 void Debug::SendCommand(Isolate* isolate,
8259 const uint16_t* command, 8248 const uint16_t* command,
8260 int length, 8249 int length,
8261 ClientData* client_data) { 8250 ClientData* client_data) {
8262 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8251 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8263 internal_isolate->debug()->EnqueueCommandMessage( 8252 internal_isolate->debug()->EnqueueCommandMessage(
8264 i::Vector<const uint16_t>(command, length), client_data); 8253 i::Vector<const uint16_t>(command, length), client_data);
8265 } 8254 }
8266 8255
8267 8256
8268 MaybeLocal<Value> Debug::Call(Local<Context> context, 8257 MaybeLocal<Value> Debug::Call(Local<Context> context,
8269 v8::Local<v8::Function> fun, 8258 v8::Local<v8::Function> fun,
8270 v8::Local<v8::Value> data) { 8259 v8::Local<v8::Value> data) {
8271 PREPARE_FOR_EXECUTION(context, Debug, Call, Value); 8260 PREPARE_FOR_EXECUTION(context, Debug, Call, Value);
8272 i::Handle<i::Object> data_obj; 8261 i::Handle<i::Object> data_obj;
8273 if (data.IsEmpty()) { 8262 if (data.IsEmpty()) {
8274 data_obj = isolate->factory()->undefined_value(); 8263 data_obj = isolate->factory()->undefined_value();
8275 } else { 8264 } else {
8276 data_obj = Utils::OpenHandle(*data); 8265 data_obj = Utils::OpenHandle(*data);
8277 } 8266 }
8278 Local<Value> result; 8267 Local<Value> result;
8279 has_pending_exception = 8268 has_pending_exception =
8280 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), 8269 !ToLocal<Value>(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj),
8281 &result); 8270 &result);
8282 RETURN_ON_FAILED_EXECUTION(Value); 8271 RETURN_ON_FAILED_EXECUTION(Value);
8283 RETURN_ESCAPED(result); 8272 RETURN_ESCAPED(result);
8284 } 8273 }
8285 8274
8286 8275
8287 Local<Value> Debug::Call(v8::Local<v8::Function> fun,
8288 v8::Local<v8::Value> data) {
8289 auto context = ContextFromHeapObject(Utils::OpenHandle(*fun));
8290 RETURN_TO_LOCAL_UNCHECKED(Call(context, fun, data), Value);
8291 }
8292
8293
8294 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, 8276 MaybeLocal<Value> Debug::GetMirror(Local<Context> context,
8295 v8::Local<v8::Value> obj) { 8277 v8::Local<v8::Value> obj) {
8296 PREPARE_FOR_EXECUTION(context, Debug, GetMirror, Value); 8278 PREPARE_FOR_EXECUTION(context, Debug, GetMirror, Value);
8297 i::Debug* isolate_debug = isolate->debug(); 8279 i::Debug* isolate_debug = isolate->debug();
8298 has_pending_exception = !isolate_debug->Load(); 8280 has_pending_exception = !isolate_debug->Load();
8299 RETURN_ON_FAILED_EXECUTION(Value); 8281 RETURN_ON_FAILED_EXECUTION(Value);
8300 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); 8282 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
8301 auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror"); 8283 auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror");
8302 auto fun_obj = i::JSReceiver::GetProperty(debug, name).ToHandleChecked(); 8284 auto fun_obj = i::JSReceiver::GetProperty(debug, name).ToHandleChecked();
8303 auto v8_fun = Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(fun_obj)); 8285 auto v8_fun = Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(fun_obj));
8304 const int kArgc = 1; 8286 const int kArgc = 1;
8305 v8::Local<v8::Value> argv[kArgc] = {obj}; 8287 v8::Local<v8::Value> argv[kArgc] = {obj};
8306 Local<Value> result; 8288 Local<Value> result;
8307 has_pending_exception = 8289 has_pending_exception =
8308 !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv) 8290 !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv)
8309 .ToLocal(&result); 8291 .ToLocal(&result);
8310 RETURN_ON_FAILED_EXECUTION(Value); 8292 RETURN_ON_FAILED_EXECUTION(Value);
8311 RETURN_ESCAPED(result); 8293 RETURN_ESCAPED(result);
8312 } 8294 }
8313 8295
8314 8296
8315 Local<Value> Debug::GetMirror(v8::Local<v8::Value> obj) {
8316 RETURN_TO_LOCAL_UNCHECKED(GetMirror(Local<Context>(), obj), Value);
8317 }
8318
8319
8320 void Debug::ProcessDebugMessages(Isolate* isolate) { 8297 void Debug::ProcessDebugMessages(Isolate* isolate) {
8321 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true); 8298 reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true);
8322 } 8299 }
8323 8300
8324 8301
8325 void Debug::ProcessDebugMessages() {
8326 ProcessDebugMessages(reinterpret_cast<Isolate*>(i::Isolate::Current()));
8327 }
8328
8329
8330 Local<Context> Debug::GetDebugContext(Isolate* isolate) { 8302 Local<Context> Debug::GetDebugContext(Isolate* isolate) {
8331 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8303 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8332 ENTER_V8(i_isolate); 8304 ENTER_V8(i_isolate);
8333 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); 8305 return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
8334 } 8306 }
8335 8307
8336 8308
8337 Local<Context> Debug::GetDebugContext() {
8338 return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current()));
8339 }
8340
8341 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) { 8309 MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) {
8342 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8310 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8343 ENTER_V8(i_isolate); 8311 ENTER_V8(i_isolate);
8344 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>(); 8312 if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>();
8345 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext(); 8313 i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext();
8346 if (calling.is_null()) return MaybeLocal<Context>(); 8314 if (calling.is_null()) return MaybeLocal<Context>();
8347 return Utils::ToLocal(i::Handle<i::Context>::cast(calling)); 8315 return Utils::ToLocal(i::Handle<i::Context>::cast(calling));
8348 } 8316 }
8349 8317
8350 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 8318 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
9044 Address callback_address = 9012 Address callback_address =
9045 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9013 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9046 VMState<EXTERNAL> state(isolate); 9014 VMState<EXTERNAL> state(isolate);
9047 ExternalCallbackScope call_scope(isolate, callback_address); 9015 ExternalCallbackScope call_scope(isolate, callback_address);
9048 callback(info); 9016 callback(info);
9049 } 9017 }
9050 9018
9051 9019
9052 } // namespace internal 9020 } // namespace internal
9053 } // namespace v8 9021 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698