Save actual break point location to script break point object.

Review URL: http://codereview.chromium.org/2864003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4879 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2043956c
......@@ -295,7 +295,6 @@ ScriptBreakPoint.prototype.update_positions = function(line, column) {
}
ScriptBreakPoint.prototype.hit_count = function() {
return this.hit_count_;
};
......@@ -389,7 +388,10 @@ ScriptBreakPoint.prototype.set = function (script) {
// Create a break point object and set the break point.
break_point = MakeBreakPoint(pos, this.line(), this.column(), this);
break_point.setIgnoreCount(this.ignoreCount());
%SetScriptBreakPoint(script, pos, break_point);
pos = %SetScriptBreakPoint(script, pos, break_point);
if (!IS_UNDEFINED(pos)) {
this.actual_location = script.locationFromPosition(pos);
}
return break_point;
};
......
......@@ -1028,8 +1028,8 @@ Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
int source_position,
Handle<Object> break_point_object) {
Handle<Object> break_point_object,
int* source_position) {
HandleScope scope;
if (!EnsureDebugInfo(shared)) {
......@@ -1043,9 +1043,11 @@ void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
// Find the break point and change it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
it.FindBreakLocationFromPosition(source_position);
it.FindBreakLocationFromPosition(*source_position);
it.SetBreakPoint(break_point_object);
*source_position = it.position();
// At least one active break point now.
ASSERT(debug_info->GetBreakPointCount() > 0);
}
......
......@@ -230,8 +230,8 @@ class Debug {
static Object* Break(Arguments args);
static void SetBreakPoint(Handle<SharedFunctionInfo> shared,
int source_position,
Handle<Object> break_point_object);
Handle<Object> break_point_object,
int* source_position);
static void ClearBreakPoint(Handle<Object> break_point_object);
static void ClearAllBreakPoints();
static void FloodWithOneShot(Handle<SharedFunctionInfo> shared);
......
......@@ -9061,7 +9061,7 @@ static Object* Runtime_SetFunctionBreakPoint(Arguments args) {
Handle<Object> break_point_object_arg = args.at<Object>(2);
// Set break point.
Debug::SetBreakPoint(shared, source_position, break_point_object_arg);
Debug::SetBreakPoint(shared, break_point_object_arg, &source_position);
return Heap::undefined_value();
}
......@@ -9159,8 +9159,9 @@ Object* Runtime::FindSharedFunctionInfoInScript(Handle<Script> script,
}
// Change the state of a break point in a script. NOTE: Regarding performance
// see the NOTE for GetScriptFromScriptData.
// Changes the state of a break point in a script and returns source position
// where break point was set. NOTE: Regarding performance see the NOTE for
// 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
......@@ -9188,7 +9189,9 @@ static Object* Runtime_SetScriptBreakPoint(Arguments args) {
} else {
position = source_position - shared->start_position();
}
Debug::SetBreakPoint(shared, position, break_point_object_arg);
Debug::SetBreakPoint(shared, break_point_object_arg, &position);
position += shared->start_position();
return Smi::FromInt(position);
}
return Heap::undefined_value();
}
......
......@@ -192,8 +192,9 @@ static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) {
static int break_point = 0;
Handle<v8::internal::SharedFunctionInfo> shared(fun->shared());
Debug::SetBreakPoint(
shared, position,
Handle<Object>(v8::internal::Smi::FromInt(++break_point)));
shared,
Handle<Object>(v8::internal::Smi::FromInt(++break_point)),
&position);
return break_point;
}
......
......@@ -134,6 +134,7 @@ function f() {
};
function g() {
// Comment.
f();
};
......@@ -184,3 +185,8 @@ Debug.setListener(breakListener);
sourceUrlFunc();
assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by sourceURL");
// Set a break point on a line with the comment, and check that actual position
// is the next line after the comment.
var number = Debug.setScriptBreakPointById(g_script_id, g_line + 1);
assertEquals(g_line + 2, Debug.findBreakPoint(number).actual_location.line);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment