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

Side by Side Diff: src/debug/debug.cc

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/contexts.cc ('k') | src/debug/liveedit.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/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 if (has_break_points && !check_result->IsUndefined()) return false; 725 if (has_break_points && !check_result->IsUndefined()) return false;
726 } 726 }
727 return has_break_points_at_all; 727 return has_break_points_at_all;
728 } 728 }
729 729
730 730
731 MaybeHandle<Object> Debug::CallFunction(const char* name, int argc, 731 MaybeHandle<Object> Debug::CallFunction(const char* name, int argc,
732 Handle<Object> args[]) { 732 Handle<Object> args[]) {
733 PostponeInterruptsScope no_interrupts(isolate_); 733 PostponeInterruptsScope no_interrupts(isolate_);
734 AssertDebugContext(); 734 AssertDebugContext();
735 Handle<Object> holder = isolate_->natives_utils_object(); 735 Handle<JSReceiver> holder =
736 Handle<JSReceiver>::cast(isolate_->natives_utils_object());
736 Handle<JSFunction> fun = Handle<JSFunction>::cast( 737 Handle<JSFunction> fun = Handle<JSFunction>::cast(
737 Object::GetProperty(isolate_, holder, name).ToHandleChecked()); 738 JSReceiver::GetProperty(isolate_, holder, name).ToHandleChecked());
738 Handle<Object> undefined = isolate_->factory()->undefined_value(); 739 Handle<Object> undefined = isolate_->factory()->undefined_value();
739 return Execution::TryCall(isolate_, fun, undefined, argc, args); 740 return Execution::TryCall(isolate_, fun, undefined, argc, args);
740 } 741 }
741 742
742 743
743 // Check whether a single break point object is triggered. 744 // Check whether a single break point object is triggered.
744 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { 745 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
745 Factory* factory = isolate_->factory(); 746 Factory* factory = isolate_->factory();
746 HandleScope scope(isolate_); 747 HandleScope scope(isolate_);
747 748
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 2092
2092 // If auto continue don't make the event cause a break, but process messages 2093 // If auto continue don't make the event cause a break, but process messages
2093 // in the queue if any. For script collected events don't even process 2094 // in the queue if any. For script collected events don't even process
2094 // messages in the queue as the execution state might not be what is expected 2095 // messages in the queue as the execution state might not be what is expected
2095 // by the client. 2096 // by the client.
2096 if (auto_continue && !has_commands()) return; 2097 if (auto_continue && !has_commands()) return;
2097 2098
2098 // DebugCommandProcessor goes here. 2099 // DebugCommandProcessor goes here.
2099 bool running = auto_continue; 2100 bool running = auto_continue;
2100 2101
2101 Handle<Object> cmd_processor_ctor = Object::GetProperty( 2102 Handle<Object> cmd_processor_ctor =
2102 isolate_, exec_state, "debugCommandProcessor").ToHandleChecked(); 2103 JSReceiver::GetProperty(isolate_, exec_state, "debugCommandProcessor")
2104 .ToHandleChecked();
2103 Handle<Object> ctor_args[] = { isolate_->factory()->ToBoolean(running) }; 2105 Handle<Object> ctor_args[] = { isolate_->factory()->ToBoolean(running) };
2104 Handle<Object> cmd_processor = Execution::Call( 2106 Handle<JSReceiver> cmd_processor = Handle<JSReceiver>::cast(
2105 isolate_, cmd_processor_ctor, exec_state, 1, ctor_args).ToHandleChecked(); 2107 Execution::Call(isolate_, cmd_processor_ctor, exec_state, 1, ctor_args)
2108 .ToHandleChecked());
2106 Handle<JSFunction> process_debug_request = Handle<JSFunction>::cast( 2109 Handle<JSFunction> process_debug_request = Handle<JSFunction>::cast(
2107 Object::GetProperty( 2110 JSReceiver::GetProperty(isolate_, cmd_processor, "processDebugRequest")
2108 isolate_, cmd_processor, "processDebugRequest").ToHandleChecked()); 2111 .ToHandleChecked());
2109 Handle<Object> is_running = Object::GetProperty( 2112 Handle<Object> is_running =
2110 isolate_, cmd_processor, "isRunning").ToHandleChecked(); 2113 JSReceiver::GetProperty(isolate_, cmd_processor, "isRunning")
2114 .ToHandleChecked();
2111 2115
2112 // Process requests from the debugger. 2116 // Process requests from the debugger.
2113 do { 2117 do {
2114 // Wait for new command in the queue. 2118 // Wait for new command in the queue.
2115 command_received_.Wait(); 2119 command_received_.Wait();
2116 2120
2117 // Get the command from the queue. 2121 // Get the command from the queue.
2118 CommandMessage command = command_queue_.Get(); 2122 CommandMessage command = command_queue_.Get();
2119 isolate_->logger()->DebugTag( 2123 isolate_->logger()->DebugTag(
2120 "Got request from command queue, in interactive loop."); 2124 "Got request from command queue, in interactive loop.");
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 return v8::Utils::ToLocal(event_data_); 2497 return v8::Utils::ToLocal(event_data_);
2494 } 2498 }
2495 2499
2496 2500
2497 v8::Local<v8::String> MessageImpl::GetJSON() const { 2501 v8::Local<v8::String> MessageImpl::GetJSON() const {
2498 Isolate* isolate = event_data_->GetIsolate(); 2502 Isolate* isolate = event_data_->GetIsolate();
2499 v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); 2503 v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate));
2500 2504
2501 if (IsEvent()) { 2505 if (IsEvent()) {
2502 // Call toJSONProtocol on the debug event object. 2506 // Call toJSONProtocol on the debug event object.
2503 Handle<Object> fun = Object::GetProperty( 2507 Handle<Object> fun =
2504 isolate, event_data_, "toJSONProtocol").ToHandleChecked(); 2508 JSReceiver::GetProperty(isolate, event_data_, "toJSONProtocol")
2509 .ToHandleChecked();
2505 if (!fun->IsJSFunction()) { 2510 if (!fun->IsJSFunction()) {
2506 return v8::Local<v8::String>(); 2511 return v8::Local<v8::String>();
2507 } 2512 }
2508 2513
2509 MaybeHandle<Object> maybe_json = 2514 MaybeHandle<Object> maybe_json =
2510 Execution::TryCall(isolate, fun, event_data_, 0, NULL); 2515 Execution::TryCall(isolate, fun, event_data_, 0, NULL);
2511 Handle<Object> json; 2516 Handle<Object> json;
2512 if (!maybe_json.ToHandle(&json) || !json->IsString()) { 2517 if (!maybe_json.ToHandle(&json) || !json->IsString()) {
2513 return v8::Local<v8::String>(); 2518 return v8::Local<v8::String>();
2514 } 2519 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 } 2673 }
2669 2674
2670 2675
2671 void LockingCommandMessageQueue::Clear() { 2676 void LockingCommandMessageQueue::Clear() {
2672 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2677 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2673 queue_.Clear(); 2678 queue_.Clear();
2674 } 2679 }
2675 2680
2676 } // namespace internal 2681 } // namespace internal
2677 } // namespace v8 2682 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/debug/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698