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/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 648 |
649 MaybeHandle<Object> Debug::CallFunction(const char* name, int argc, | 649 MaybeHandle<Object> Debug::CallFunction(const char* name, int argc, |
650 Handle<Object> args[]) { | 650 Handle<Object> args[]) { |
651 PostponeInterruptsScope no_interrupts(isolate_); | 651 PostponeInterruptsScope no_interrupts(isolate_); |
652 AssertDebugContext(); | 652 AssertDebugContext(); |
653 Handle<JSReceiver> holder = | 653 Handle<JSReceiver> holder = |
654 Handle<JSReceiver>::cast(isolate_->natives_utils_object()); | 654 Handle<JSReceiver>::cast(isolate_->natives_utils_object()); |
655 Handle<JSFunction> fun = Handle<JSFunction>::cast( | 655 Handle<JSFunction> fun = Handle<JSFunction>::cast( |
656 JSReceiver::GetProperty(isolate_, holder, name).ToHandleChecked()); | 656 JSReceiver::GetProperty(isolate_, holder, name).ToHandleChecked()); |
657 Handle<Object> undefined = isolate_->factory()->undefined_value(); | 657 Handle<Object> undefined = isolate_->factory()->undefined_value(); |
658 return Execution::TryCall(isolate_, fun, undefined, argc, args); | 658 MaybeHandle<Object> maybe_exception; |
| 659 return Execution::TryCall(isolate_, fun, undefined, argc, args, |
| 660 Execution::MessageHandling::kReport, |
| 661 &maybe_exception); |
659 } | 662 } |
660 | 663 |
661 | 664 |
662 // Check whether a single break point object is triggered. | 665 // Check whether a single break point object is triggered. |
663 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 666 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
664 Factory* factory = isolate_->factory(); | 667 Factory* factory = isolate_->factory(); |
665 HandleScope scope(isolate_); | 668 HandleScope scope(isolate_); |
666 | 669 |
667 // Ignore check if break point object is not a JSObject. | 670 // Ignore check if break point object is not a JSObject. |
668 if (!break_point_object->IsJSObject()) return true; | 671 if (!break_point_object->IsJSObject()) return true; |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 Vector<const uc16> command_text( | 2087 Vector<const uc16> command_text( |
2085 const_cast<const uc16*>(command.text().start()), | 2088 const_cast<const uc16*>(command.text().start()), |
2086 command.text().length()); | 2089 command.text().length()); |
2087 Handle<String> request_text = isolate_->factory() | 2090 Handle<String> request_text = isolate_->factory() |
2088 ->NewStringFromTwoByte(command_text) | 2091 ->NewStringFromTwoByte(command_text) |
2089 .ToHandleChecked(); | 2092 .ToHandleChecked(); |
2090 Handle<Object> request_args[] = {request_text}; | 2093 Handle<Object> request_args[] = {request_text}; |
2091 Handle<Object> answer_value; | 2094 Handle<Object> answer_value; |
2092 Handle<String> answer; | 2095 Handle<String> answer; |
2093 MaybeHandle<Object> maybe_exception; | 2096 MaybeHandle<Object> maybe_exception; |
2094 MaybeHandle<Object> maybe_result = | 2097 MaybeHandle<Object> maybe_result = Execution::TryCall( |
2095 Execution::TryCall(isolate_, process_debug_request, cmd_processor, 1, | 2098 isolate_, process_debug_request, cmd_processor, 1, request_args, |
2096 request_args, &maybe_exception); | 2099 Execution::MessageHandling::kReport, &maybe_exception); |
2097 | 2100 |
2098 if (maybe_result.ToHandle(&answer_value)) { | 2101 if (maybe_result.ToHandle(&answer_value)) { |
2099 if (answer_value->IsUndefined(isolate_)) { | 2102 if (answer_value->IsUndefined(isolate_)) { |
2100 answer = isolate_->factory()->empty_string(); | 2103 answer = isolate_->factory()->empty_string(); |
2101 } else { | 2104 } else { |
2102 answer = Handle<String>::cast(answer_value); | 2105 answer = Handle<String>::cast(answer_value); |
2103 } | 2106 } |
2104 | 2107 |
2105 // Log the JSON request/response. | 2108 // Log the JSON request/response. |
2106 if (FLAG_trace_debug_json) { | 2109 if (FLAG_trace_debug_json) { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 | 2487 |
2485 if (IsEvent()) { | 2488 if (IsEvent()) { |
2486 // Call toJSONProtocol on the debug event object. | 2489 // Call toJSONProtocol on the debug event object. |
2487 Handle<Object> fun = | 2490 Handle<Object> fun = |
2488 JSReceiver::GetProperty(isolate, event_data_, "toJSONProtocol") | 2491 JSReceiver::GetProperty(isolate, event_data_, "toJSONProtocol") |
2489 .ToHandleChecked(); | 2492 .ToHandleChecked(); |
2490 if (!fun->IsJSFunction()) { | 2493 if (!fun->IsJSFunction()) { |
2491 return v8::Local<v8::String>(); | 2494 return v8::Local<v8::String>(); |
2492 } | 2495 } |
2493 | 2496 |
2494 MaybeHandle<Object> maybe_json = | 2497 MaybeHandle<Object> maybe_exception; |
2495 Execution::TryCall(isolate, fun, event_data_, 0, NULL); | 2498 MaybeHandle<Object> maybe_json = Execution::TryCall( |
| 2499 isolate, fun, event_data_, 0, nullptr, |
| 2500 Execution::MessageHandling::kReport, &maybe_exception); |
2496 Handle<Object> json; | 2501 Handle<Object> json; |
2497 if (!maybe_json.ToHandle(&json) || !json->IsString()) { | 2502 if (!maybe_json.ToHandle(&json) || !json->IsString()) { |
2498 return v8::Local<v8::String>(); | 2503 return v8::Local<v8::String>(); |
2499 } | 2504 } |
2500 return scope.Escape(v8::Utils::ToLocal(Handle<String>::cast(json))); | 2505 return scope.Escape(v8::Utils::ToLocal(Handle<String>::cast(json))); |
2501 } else { | 2506 } else { |
2502 return v8::Utils::ToLocal(response_json_); | 2507 return v8::Utils::ToLocal(response_json_); |
2503 } | 2508 } |
2504 } | 2509 } |
2505 | 2510 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 logger_->DebugEvent("Put", message.text()); | 2653 logger_->DebugEvent("Put", message.text()); |
2649 } | 2654 } |
2650 | 2655 |
2651 void LockingCommandMessageQueue::Clear() { | 2656 void LockingCommandMessageQueue::Clear() { |
2652 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2657 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2653 queue_.Clear(); | 2658 queue_.Clear(); |
2654 } | 2659 } |
2655 | 2660 |
2656 } // namespace internal | 2661 } // namespace internal |
2657 } // namespace v8 | 2662 } // namespace v8 |
OLD | NEW |