LGTM. On Tue, Jul 27, 2010 at 4:46 PM, <[email protected]> wrote: > Reviewers: antonm, > > Description: > Backport http://code.google.com/p/v8/source/detail?r=5131 to 2.2. > > Please review this at http://codereview.chromium.org/3074004/show > > SVN Base: http://v8.googlecode.com/svn/branches/2.2/ > > Affected files: > M src/runtime.cc > M src/version.cc > M test/mjsunit/debug-setbreakpoint.js > > > Index: src/runtime.cc > =================================================================== > --- src/runtime.cc (revision 5138) > +++ src/runtime.cc (working copy) > @@ -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(); > Index: src/version.cc > =================================================================== > --- src/version.cc (revision 5138) > +++ src/version.cc (working copy) > @@ -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 > Index: test/mjsunit/debug-setbreakpoint.js > =================================================================== > --- test/mjsunit/debug-setbreakpoint.js (revision 5138) > +++ test/mjsunit/debug-setbreakpoint.js (working copy) > @@ -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
