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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
| 7 #include "src/debug/debug.h" |
| 8 |
7 #include "src/api.h" | 9 #include "src/api.h" |
8 #include "src/arguments.h" | 10 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 12 #include "src/code-stubs.h" |
11 #include "src/codegen.h" | 13 #include "src/codegen.h" |
12 #include "src/compilation-cache.h" | 14 #include "src/compilation-cache.h" |
13 #include "src/compiler.h" | 15 #include "src/compiler.h" |
14 #include "src/debug.h" | |
15 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" |
16 #include "src/execution.h" | 17 #include "src/execution.h" |
17 #include "src/full-codegen/full-codegen.h" | 18 #include "src/full-codegen/full-codegen.h" |
18 #include "src/global-handles.h" | 19 #include "src/global-handles.h" |
19 #include "src/list.h" | 20 #include "src/list.h" |
20 #include "src/log.h" | 21 #include "src/log.h" |
21 #include "src/messages.h" | 22 #include "src/messages.h" |
22 #include "src/snapshot/natives.h" | 23 #include "src/snapshot/natives.h" |
23 | 24 |
24 #include "include/v8-debug.h" | 25 #include "include/v8-debug.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 STATIC_CHAR_VECTOR("builtins")); | 519 STATIC_CHAR_VECTOR("builtins")); |
519 Handle<GlobalObject> global = | 520 Handle<GlobalObject> global = |
520 Handle<GlobalObject>(context->global_object(), isolate_); | 521 Handle<GlobalObject>(context->global_object(), isolate_); |
521 Handle<JSBuiltinsObject> builtin = | 522 Handle<JSBuiltinsObject> builtin = |
522 Handle<JSBuiltinsObject>(global->builtins(), isolate_); | 523 Handle<JSBuiltinsObject>(global->builtins(), isolate_); |
523 RETURN_ON_EXCEPTION_VALUE( | 524 RETURN_ON_EXCEPTION_VALUE( |
524 isolate_, Object::SetProperty(global, key, builtin, SLOPPY), false); | 525 isolate_, Object::SetProperty(global, key, builtin, SLOPPY), false); |
525 | 526 |
526 // Compile the JavaScript for the debugger in the debugger context. | 527 // Compile the JavaScript for the debugger in the debugger context. |
527 bool caught_exception = | 528 bool caught_exception = |
528 !CompileDebuggerScript(isolate_, Natives::GetIndex("mirror")) || | 529 !CompileDebuggerScript(isolate_, Natives::GetIndex("mirrors")) || |
529 !CompileDebuggerScript(isolate_, Natives::GetIndex("debug")); | 530 !CompileDebuggerScript(isolate_, Natives::GetIndex("debug")); |
530 | 531 |
531 if (FLAG_enable_liveedit) { | 532 if (FLAG_enable_liveedit) { |
532 caught_exception = caught_exception || | 533 caught_exception = caught_exception || |
533 !CompileDebuggerScript(isolate_, Natives::GetIndex("liveedit")); | 534 !CompileDebuggerScript(isolate_, Natives::GetIndex("liveedit")); |
534 } | 535 } |
535 // Check for caught exceptions. | 536 // Check for caught exceptions. |
536 if (caught_exception) return false; | 537 if (caught_exception) return false; |
537 | 538 |
538 debug_context_ = Handle<Context>::cast( | 539 debug_context_ = Handle<Context>::cast( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 712 |
712 | 713 |
713 // Check whether a single break point object is triggered. | 714 // Check whether a single break point object is triggered. |
714 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 715 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
715 Factory* factory = isolate_->factory(); | 716 Factory* factory = isolate_->factory(); |
716 HandleScope scope(isolate_); | 717 HandleScope scope(isolate_); |
717 | 718 |
718 // Ignore check if break point object is not a JSObject. | 719 // Ignore check if break point object is not a JSObject. |
719 if (!break_point_object->IsJSObject()) return true; | 720 if (!break_point_object->IsJSObject()) return true; |
720 | 721 |
721 // Get the function IsBreakPointTriggered (defined in debug-debugger.js). | 722 // Get the function IsBreakPointTriggered (defined in debug.js). |
722 Handle<String> is_break_point_triggered_string = | 723 Handle<String> is_break_point_triggered_string = |
723 factory->InternalizeOneByteString( | 724 factory->InternalizeOneByteString( |
724 STATIC_CHAR_VECTOR("IsBreakPointTriggered")); | 725 STATIC_CHAR_VECTOR("IsBreakPointTriggered")); |
725 Handle<GlobalObject> debug_global(debug_context()->global_object()); | 726 Handle<GlobalObject> debug_global(debug_context()->global_object()); |
726 Handle<JSFunction> check_break_point = | 727 Handle<JSFunction> check_break_point = |
727 Handle<JSFunction>::cast(Object::GetProperty( | 728 Handle<JSFunction>::cast(Object::GetProperty( |
728 debug_global, is_break_point_triggered_string).ToHandleChecked()); | 729 debug_global, is_break_point_triggered_string).ToHandleChecked()); |
729 | 730 |
730 // Get the break id as an object. | 731 // Get the break id as an object. |
731 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 732 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 return; | 2053 return; |
2053 } | 2054 } |
2054 | 2055 |
2055 HandleScope scope(isolate_); | 2056 HandleScope scope(isolate_); |
2056 DebugScope debug_scope(this); | 2057 DebugScope debug_scope(this); |
2057 if (debug_scope.failed()) return; | 2058 if (debug_scope.failed()) return; |
2058 | 2059 |
2059 // If debugging there might be script break points registered for this | 2060 // If debugging there might be script break points registered for this |
2060 // script. Make sure that these break points are set. | 2061 // script. Make sure that these break points are set. |
2061 | 2062 |
2062 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2063 // Get the function UpdateScriptBreakPoints (defined in debug.js). |
2063 Handle<String> update_script_break_points_string = | 2064 Handle<String> update_script_break_points_string = |
2064 isolate_->factory()->InternalizeOneByteString( | 2065 isolate_->factory()->InternalizeOneByteString( |
2065 STATIC_CHAR_VECTOR("UpdateScriptBreakPoints")); | 2066 STATIC_CHAR_VECTOR("UpdateScriptBreakPoints")); |
2066 Handle<GlobalObject> debug_global(debug_context()->global_object()); | 2067 Handle<GlobalObject> debug_global(debug_context()->global_object()); |
2067 Handle<Object> update_script_break_points = | 2068 Handle<Object> update_script_break_points = |
2068 Object::GetProperty( | 2069 Object::GetProperty( |
2069 debug_global, update_script_break_points_string).ToHandleChecked(); | 2070 debug_global, update_script_break_points_string).ToHandleChecked(); |
2070 if (!update_script_break_points->IsJSFunction()) { | 2071 if (!update_script_break_points->IsJSFunction()) { |
2071 return; | 2072 return; |
2072 } | 2073 } |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 } | 2803 } |
2803 | 2804 |
2804 | 2805 |
2805 void LockingCommandMessageQueue::Clear() { | 2806 void LockingCommandMessageQueue::Clear() { |
2806 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2807 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2807 queue_.Clear(); | 2808 queue_.Clear(); |
2808 } | 2809 } |
2809 | 2810 |
2810 } // namespace internal | 2811 } // namespace internal |
2811 } // namespace v8 | 2812 } // namespace v8 |
OLD | NEW |