Also avoid that calling Debug::IsBreakAtReturn causes a full doptimization when there are no break points set. The full deoptimization is caused by Debug::IsBreakAtReturn calling Debug::EnsureDebugInfo which will assume that a break point is now set.
R=svenpanne@chromium.org
BUG=v8:1140
TEST=test/mjsunit/debug-evaluate-locals-optimized.js,test/mjsunit/debug-
evaluate-locals-optimized-doubles.js
Review URL: http://codereview.chromium.org//7307035
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8573
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
HandleScope scope(isolate_);
+ // If there are no break points this cannot be break at return, as
+ // the debugger statement and stack guard bebug break cannot be at
+ // return.
+ if (!has_break_points_) {
+ return false;
+ }
+
// Get the executing function in which the debug break occurred.
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
int position =
it.frame()->LookupCode()->SourcePosition(it.frame()->pc());
- // Check for constructor frame.
- bool constructor = it.frame()->IsConstructor();
+ // Check for constructor frame. Inlined frames cannot be construct calls.
+ bool inlined_frame =
+ it.frame()->is_optimized() && deoptimized_frame_index != 0;
+ bool constructor = !inlined_frame && it.frame()->IsConstructor();
// Get scope info and read from it for local variable information.
Handle<JSFunction> function(JSFunction::cast(it.frame()->function()));
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
-listenerComplete = false;
-exception = false;
+var listenerComplete = false;
+var exception = false;
+
+var testingConstructCall = false;
function listener(event, exec_state, event_data, data) {
default: assertUnreachable();
}
+ // Check for construct call.
+ assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
+
// When function f is optimized (2 means YES, see runtime.cc) we
// expect an optimized frame for f with g1, g2 and g3 inlined.
if (%GetOptimizationStatus(f) == 2) {
g1(a, b);
};
+// Test calling f normally and as a constructor.
f(11.11, 12.12);
+testingConstructCall = true;
+new f(11.11, 12.12);
// Make sure that the debug event listener vas invoked.
assertFalse(exception, "exception in listener " + exception)
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
-listenerComplete = false;
-exception = false;
+var listenerComplete = false;
+var exception = false;
+
+var testingConstructCall = false;
function listener(event, exec_state, event_data, data) {
default: assertUnreachable();
}
+ // Check for construct call.
+ assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
+
// When function f is optimized (2 means YES, see runtime.cc) we
// expect an optimized frame for f with g1, g2 and g3 inlined.
if (%GetOptimizationStatus(f) == 2) {
g1(a, b);
};
+// Test calling f normally and as a constructor.
f(11, 12);
+testingConstructCall = true;
+new f(11, 12);
// Make sure that the debug event listener vas invoked.
assertFalse(exception, "exception in listener " + exception)