Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 57281a3319199b8edc7e2b7cd59fc035ddaeeb04..ca56040e06697894ded261332c259220d999cf0d 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -12103,14 +12103,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { |
} |
+static bool IsPositionAlignmentCodeCorrect(int alignment) { |
+ return alignment == STATEMENT_ALIGNED || alignment == BREAK_POSITION_ALIGNED; |
+} |
+ |
+ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) { |
HandleScope scope(isolate); |
- ASSERT(args.length() == 1); |
+ ASSERT(args.length() == 2); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
+ CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[1]); |
+ |
+ if (!IsPositionAlignmentCodeCorrect(statement_aligned_code)) { |
+ return isolate->ThrowIllegalOperation(); |
+ } |
+ BreakPositionAlignment alignment = |
+ static_cast<BreakPositionAlignment>(statement_aligned_code); |
+ |
Handle<SharedFunctionInfo> shared(fun->shared()); |
// Find the number of break points |
- Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared); |
+ Handle<Object> break_locations = |
+ Debug::GetSourceBreakLocations(shared, alignment); |
if (break_locations->IsUndefined()) return isolate->heap()->undefined_value(); |
// Return array as JS array |
return *isolate->factory()->NewJSArrayWithElements( |
@@ -12143,14 +12157,22 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFunctionBreakPoint) { |
// GetScriptFromScriptData. |
// args[0]: script to set break point in |
// args[1]: number: break source position (within the script source) |
-// args[2]: number: break point object |
+// args[2]: number, breakpoint position alignment |
+// args[3]: number: break point object |
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { |
HandleScope scope(isolate); |
- ASSERT(args.length() == 3); |
+ ASSERT(args.length() == 4); |
CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); |
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
RUNTIME_ASSERT(source_position >= 0); |
- Handle<Object> break_point_object_arg = args.at<Object>(2); |
+ CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[2]); |
+ Handle<Object> break_point_object_arg = args.at<Object>(3); |
+ |
+ if (!IsPositionAlignmentCodeCorrect(statement_aligned_code)) { |
+ return isolate->ThrowIllegalOperation(); |
+ } |
+ BreakPositionAlignment alignment = |
+ static_cast<BreakPositionAlignment>(statement_aligned_code); |
// Get the script from the script wrapper. |
RUNTIME_ASSERT(wrapper->value()->IsScript()); |
@@ -12158,7 +12180,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { |
// Set break point. |
if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, |
- &source_position)) { |
+ &source_position, |
+ alignment)) { |
return isolate->heap()->undefined_value(); |
} |