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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 Handle<Object> undefined = isolate_->factory()->undefined_value(); | 620 Handle<Object> undefined = isolate_->factory()->undefined_value(); |
621 MaybeHandle<Object> maybe_exception; | 621 MaybeHandle<Object> maybe_exception; |
622 return Execution::TryCall(isolate_, fun, undefined, argc, args, | 622 return Execution::TryCall(isolate_, fun, undefined, argc, args, |
623 Execution::MessageHandling::kReport, | 623 Execution::MessageHandling::kReport, |
624 &maybe_exception); | 624 &maybe_exception); |
625 } | 625 } |
626 | 626 |
627 | 627 |
628 // Check whether a single break point object is triggered. | 628 // Check whether a single break point object is triggered. |
629 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { | 629 bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
630 Factory* factory = isolate_->factory(); | 630 if (break_point_object->IsBreakPoint()) { |
631 HandleScope scope(isolate_); | 631 Handle<BreakPoint> break_point = |
632 Handle<BreakPoint>::cast(break_point_object); | |
633 if (!break_point->condition()->IsString()) return true; | |
634 Handle<String> condition(String::cast(break_point->condition())); | |
635 Handle<Object> result; | |
636 if (!DebugEvaluate::Local(isolate_, break_frame_id(), | |
637 /* inlined_jsframe_index */ 0, condition, false) | |
Yang
2017/02/15 13:21:10
0 is wrong. If you have the situation where f call
kozy
2017/02/15 16:21:33
I thought that when we call CheckBreakpoint on top
Yang
2017/02/15 16:32:23
Ah yes you are right! Can you add a comment about
kozy
2017/02/15 16:42:33
Added.
| |
638 .ToHandle(&result)) { | |
639 if (isolate_->has_pending_exception()) { | |
640 isolate_->clear_pending_exception(); | |
641 } | |
642 return false; | |
643 } | |
644 return result->IsTrue(isolate_); | |
645 } | |
632 | 646 |
633 // Ignore check if break point object is not a JSObject. | 647 // Ignore check if break point object is not a JSObject. |
Yang
2017/02/15 13:21:10
Can you add a TODO to remove the code below becaus
kozy
2017/02/15 16:21:33
Done.
| |
634 if (!break_point_object->IsJSObject()) return true; | 648 if (!break_point_object->IsJSObject()) return true; |
635 | 649 |
636 // Get the break id as an object. | 650 // Get the break id as an object. |
637 Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); | 651 Handle<Object> break_id = |
652 isolate_->factory()->NewNumberFromInt(Debug::break_id()); | |
638 | 653 |
639 // Call IsBreakPointTriggered. | 654 // Call IsBreakPointTriggered. |
640 Handle<Object> argv[] = { break_id, break_point_object }; | 655 Handle<Object> argv[] = { break_id, break_point_object }; |
641 Handle<Object> result; | 656 Handle<Object> result; |
642 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) | 657 if (!CallFunction("IsBreakPointTriggered", arraysize(argv), argv) |
643 .ToHandle(&result)) { | 658 .ToHandle(&result)) { |
644 return false; | 659 return false; |
645 } | 660 } |
646 | 661 |
647 // Return whether the break point is triggered. | 662 // 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( | 2428 isolate_->Throw(*isolate_->factory()->NewEvalError( |
2414 MessageTemplate::kNoSideEffectDebugEvaluate)); | 2429 MessageTemplate::kNoSideEffectDebugEvaluate)); |
2415 } | 2430 } |
2416 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); | 2431 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); |
2417 isolate_->debug()->UpdateHookOnFunctionCall(); | 2432 isolate_->debug()->UpdateHookOnFunctionCall(); |
2418 isolate_->debug()->side_effect_check_failed_ = false; | 2433 isolate_->debug()->side_effect_check_failed_ = false; |
2419 } | 2434 } |
2420 | 2435 |
2421 } // namespace internal | 2436 } // namespace internal |
2422 } // namespace v8 | 2437 } // namespace v8 |
OLD | NEW |