Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 84a16754e1d8c453dd5930addcefbb15a43df9c2..0b1d4f5e45c07753a1a1ad8a8b86bdabceb0b5e3 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -627,14 +627,29 @@ MaybeHandle<Object> Debug::CallFunction(const char* name, int argc, |
// Check whether a single break point object is triggered. |
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { |
- Factory* factory = isolate_->factory(); |
- HandleScope scope(isolate_); |
+ if (break_point_object->IsBreakPoint()) { |
+ Handle<BreakPoint> break_point = |
+ Handle<BreakPoint>::cast(break_point_object); |
+ if (!break_point->condition()->IsString()) return true; |
+ Handle<String> condition(String::cast(break_point->condition())); |
+ Handle<Object> result; |
+ if (!DebugEvaluate::Local(isolate_, break_frame_id(), |
+ /* 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.
|
+ .ToHandle(&result)) { |
+ if (isolate_->has_pending_exception()) { |
+ isolate_->clear_pending_exception(); |
+ } |
+ return false; |
+ } |
+ return result->IsTrue(isolate_); |
+ } |
// 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.
|
if (!break_point_object->IsJSObject()) return true; |
// Get the break id as an object. |
- Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id()); |
+ Handle<Object> break_id = |
+ isolate_->factory()->NewNumberFromInt(Debug::break_id()); |
// Call IsBreakPointTriggered. |
Handle<Object> argv[] = { break_id, break_point_object }; |