Revision: 5139
Author: [email protected]
Date: Tue Jul 27 07:23:04 2010
Log: Backport http://code.google.com/p/v8/source/detail?r=5131 to 2.2.
Review URL: http://codereview.chromium.org/3074004
http://code.google.com/p/v8/source/detail?r=5139
Modified:
/branches/2.2/src/runtime.cc
/branches/2.2/src/version.cc
/branches/2.2/test/mjsunit/debug-setbreakpoint.js
=======================================
--- /branches/2.2/src/runtime.cc Tue Jul 13 13:58:03 2010
+++ /branches/2.2/src/runtime.cc Tue Jul 27 07:23:04 2010
@@ -9344,6 +9344,13 @@
}
Debug::SetBreakPoint(shared, break_point_object_arg, &position);
position += shared->start_position();
+
+ // The result position may become beyond script source end.
+ // This is expected when the function is toplevel. This may become
+ // a problem later when actual position gets converted into
line/column.
+ if (shared->is_toplevel() && position == shared->end_position()) {
+ position = shared->end_position() - 1;
+ }
return Smi::FromInt(position);
}
return Heap::undefined_value();
=======================================
--- /branches/2.2/src/version.cc Fri Jul 23 05:48:36 2010
+++ /branches/2.2/src/version.cc Tue Jul 27 07:23:04 2010
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 2
#define MINOR_VERSION 2
#define BUILD_NUMBER 24
-#define PATCH_LEVEL 4
+#define PATCH_LEVEL 5
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
=======================================
--- /branches/2.2/test/mjsunit/debug-setbreakpoint.js Wed Jun 30 02:09:34
2010
+++ /branches/2.2/test/mjsunit/debug-setbreakpoint.js Tue Jul 27 07:23:04
2010
@@ -192,3 +192,26 @@
sourceUrlFunc();
assertTrue(breakListenerCalled, "Break listener not called on breakpoint
set by sourceURL");
+
+
+// Breakpoint in a script with no statements test case. If breakpoint is
set
+// to the script body, its actual position is taken from the nearest
statement
+// below or like in this case is reset to the very end of the script.
+// Unless some precautions made, this position becomes out-of-range and
+// we get an exception.
+
+// Gets a script of 'i1' function and sets the breakpoint at line #4 which
+// should be empty.
+function SetBreakpointInI1Script() {
+ var i_script = Debug.findScript(i1);
+ assertTrue(!!i_script, "invalid script for i1");
+ Debug.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
+ i_script.id, 4);
+}
+
+// Creates the eval script and tries to set the breakpoint.
+// The tricky part is that the script function must be strongly reachable
at the
+// moment. Since there's no way of simply getting the pointer to the
function,
+// we run this code while the script function is being activated on stack.
+eval('SetBreakpointInI1Script()\nfunction i1(){}\n\n\n\nfunction
i2(){}\n');
+
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev