Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 081774f21a614d5ea61234735c7789098aa7da2c..6ad2cc1fbacb24f809a806ac1b5f221bbfdcadcd 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -12097,14 +12097,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { |
} |
+static bool IsPositionAlignmentValueCorrect(BreakPositionAlignment 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_alighned_code, Int32, args[1]); |
+ |
+ BreakPositionAlignment alignment = |
+ static_cast<BreakPositionAlignment>(statement_alighned_code); |
+ if (!IsPositionAlignmentValueCorrect(alignment)) { |
+ return isolate->ThrowIllegalOperation(); |
+ } |
+ |
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( |
@@ -12137,14 +12151,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_alighned_code, Int32, args[2]); |
+ Handle<Object> break_point_object_arg = args.at<Object>(3); |
+ |
+ BreakPositionAlignment alignment = |
+ static_cast<BreakPositionAlignment>(statement_alighned_code); |
+ if (!IsPositionAlignmentValueCorrect(alignment)) { |
+ return isolate->ThrowIllegalOperation(); |
+ } |
// Get the script from the script wrapper. |
RUNTIME_ASSERT(wrapper->value()->IsScript()); |
@@ -12152,7 +12174,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(); |
} |