Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 84a16754e1d8c453dd5930addcefbb15a43df9c2..497a69456035dfd29d694c85ed46f36615f5c6a9 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -15,6 +15,7 @@ |
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
#include "src/compiler.h" |
#include "src/debug/debug-evaluate.h" |
+#include "src/debug/debug-frames.h" |
#include "src/debug/liveedit.h" |
#include "src/deoptimizer.h" |
#include "src/execution.h" |
@@ -627,14 +628,32 @@ 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()->length()) return true; |
+ Handle<String> condition(break_point->condition()); |
+ Handle<Object> result; |
+ // Since we call CheckBreakpoint only for deoptimized frame on top of stack, |
+ // we can use 0 as index of inlined frame. |
+ if (!DebugEvaluate::Local(isolate_, break_frame_id(), |
+ /* inlined_jsframe_index */ 0, condition, false) |
+ .ToHandle(&result)) { |
+ if (isolate_->has_pending_exception()) { |
+ isolate_->clear_pending_exception(); |
+ } |
+ return false; |
+ } |
+ return result->IsTrue(isolate_); |
+ } |
+ // TODO(yangguo): remove code below with mirrors API. |
// Ignore check if break point object is not a JSObject. |
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 }; |