| 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" |
| 11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
| 12 #include "src/code-stubs.h" | 12 #include "src/code-stubs.h" |
| 13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
| 14 #include "src/compilation-cache.h" | 14 #include "src/compilation-cache.h" |
| 15 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" | 15 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| 16 #include "src/compiler.h" | 16 #include "src/compiler.h" |
| 17 #include "src/debug/debug-evaluate.h" | 17 #include "src/debug/debug-evaluate.h" |
| 18 #include "src/debug/debug-frames.h" |
| 18 #include "src/debug/liveedit.h" | 19 #include "src/debug/liveedit.h" |
| 19 #include "src/deoptimizer.h" | 20 #include "src/deoptimizer.h" |
| 20 #include "src/execution.h" | 21 #include "src/execution.h" |
| 21 #include "src/frames-inl.h" | 22 #include "src/frames-inl.h" |
| 22 #include "src/full-codegen/full-codegen.h" | 23 #include "src/full-codegen/full-codegen.h" |
| 23 #include "src/global-handles.h" | 24 #include "src/global-handles.h" |
| 24 #include "src/globals.h" | 25 #include "src/globals.h" |
| 25 #include "src/interpreter/interpreter.h" | 26 #include "src/interpreter/interpreter.h" |
| 26 #include "src/isolate-inl.h" | 27 #include "src/isolate-inl.h" |
| 27 #include "src/list.h" | 28 #include "src/list.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 Handle<Object> undefined = isolate_->factory()->undefined_value(); | 621 Handle<Object> undefined = isolate_->factory()->undefined_value(); |
| 621 MaybeHandle<Object> maybe_exception; | 622 MaybeHandle<Object> maybe_exception; |
| 622 return Execution::TryCall(isolate_, fun, undefined, argc, args, | 623 return Execution::TryCall(isolate_, fun, undefined, argc, args, |
| 623 Execution::MessageHandling::kReport, | 624 Execution::MessageHandling::kReport, |
| 624 &maybe_exception); | 625 &maybe_exception); |
| 625 } | 626 } |
| 626 | 627 |
| 627 | 628 |
| 628 // Check whether a single break point object is triggered. | 629 // Check whether a single break point object is triggered. |
| 629 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 630 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
| 630 Factory* factory = isolate_->factory(); | 631 if (break_point_object->IsBreakPoint()) { |
| 631 HandleScope scope(isolate_); | 632 Handle<BreakPoint> break_point = |
| 633 Handle<BreakPoint>::cast(break_point_object); |
| 634 if (!break_point->condition()->length()) return true; |
| 635 Handle<String> condition(break_point->condition()); |
| 636 Handle<Object> result; |
| 637 // Since we call CheckBreakpoint only for deoptimized frame on top of stack, |
| 638 // we can use 0 as index of inlined frame. |
| 639 if (!DebugEvaluate::Local(isolate_, break_frame_id(), |
| 640 /* inlined_jsframe_index */ 0, condition, false) |
| 641 .ToHandle(&result)) { |
| 642 if (isolate_->has_pending_exception()) { |
| 643 isolate_->clear_pending_exception(); |
| 644 } |
| 645 return false; |
| 646 } |
| 647 return result->IsTrue(isolate_); |
| 648 } |
| 632 | 649 |
| 650 // TODO(yangguo): remove code below with mirrors API. |
| 633 // Ignore check if break point object is not a JSObject. | 651 // Ignore check if break point object is not a JSObject. |
| 634 if (!break_point_object->IsJSObject()) return true; | 652 if (!break_point_object->IsJSObject()) return true; |
| 635 | 653 |
| 636 // Get the break id as an object. | 654 // Get the break id as an object. |
| 637 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 655 Handle<Object> break_id = |
| 656 isolate_->factory()->NewNumberFromInt(Debug::break_id()); |
| 638 | 657 |
| 639 // Call IsBreakPointTriggered. | 658 // Call IsBreakPointTriggered. |
| 640 Handle<Object> argv[] = { break_id, break_point_object }; | 659 Handle<Object> argv[] = { break_id, break_point_object }; |
| 641 Handle<Object> result; | 660 Handle<Object> result; |
| 642 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) | 661 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) |
| 643 .ToHandle(&result)) { | 662 .ToHandle(&result)) { |
| 644 return false; | 663 return false; |
| 645 } | 664 } |
| 646 | 665 |
| 647 // Return whether the break point is triggered. | 666 // Return whether the break point is triggered. |
| (...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 isolate_->Throw(*isolate_->factory()->NewEvalError( | 2432 isolate_->Throw(*isolate_->factory()->NewEvalError( |
| 2414 MessageTemplate::kNoSideEffectDebugEvaluate)); | 2433 MessageTemplate::kNoSideEffectDebugEvaluate)); |
| 2415 } | 2434 } |
| 2416 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); | 2435 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); |
| 2417 isolate_->debug()->UpdateHookOnFunctionCall(); | 2436 isolate_->debug()->UpdateHookOnFunctionCall(); |
| 2418 isolate_->debug()->side_effect_check_failed_ = false; | 2437 isolate_->debug()->side_effect_check_failed_ = false; |
| 2419 } | 2438 } |
| 2420 | 2439 |
| 2421 } // namespace internal | 2440 } // namespace internal |
| 2422 } // namespace v8 | 2441 } // namespace v8 |
| OLD | NEW |