Commit 7cbf0a4d authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Add inspection of whether frame is a construct frame to optimized frames

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
parent 44c4d0e3
...@@ -1821,6 +1821,13 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) { ...@@ -1821,6 +1821,13 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) { bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
HandleScope scope(isolate_); 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. // Get the executing function in which the debug break occurred.
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared()); Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
......
...@@ -10059,8 +10059,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { ...@@ -10059,8 +10059,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
int position = int position =
it.frame()->LookupCode()->SourcePosition(it.frame()->pc()); it.frame()->LookupCode()->SourcePosition(it.frame()->pc());
// Check for constructor frame. // Check for constructor frame. Inlined frames cannot be construct calls.
bool constructor = it.frame()->IsConstructor(); 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. // Get scope info and read from it for local variable information.
Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); Handle<JSFunction> function(JSFunction::cast(it.frame()->function()));
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
// Get the Debug object exposed from the debug context global object. // Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
listenerComplete = false; var listenerComplete = false;
exception = false; var exception = false;
var testingConstructCall = false;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
...@@ -70,6 +72,9 @@ function listener(event, exec_state, event_data, data) { ...@@ -70,6 +72,9 @@ function listener(event, exec_state, event_data, data) {
default: assertUnreachable(); default: assertUnreachable();
} }
// Check for construct call.
assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
// When function f is optimized (2 means YES, see runtime.cc) we // When function f is optimized (2 means YES, see runtime.cc) we
// expect an optimized frame for f with g1, g2 and g3 inlined. // expect an optimized frame for f with g1, g2 and g3 inlined.
if (%GetOptimizationStatus(f) == 2) { if (%GetOptimizationStatus(f) == 2) {
...@@ -142,7 +147,10 @@ function f(x, y) { ...@@ -142,7 +147,10 @@ function f(x, y) {
g1(a, b); g1(a, b);
}; };
// Test calling f normally and as a constructor.
f(11.11, 12.12); f(11.11, 12.12);
testingConstructCall = true;
new f(11.11, 12.12);
// Make sure that the debug event listener vas invoked. // Make sure that the debug event listener vas invoked.
assertFalse(exception, "exception in listener " + exception) assertFalse(exception, "exception in listener " + exception)
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
// Get the Debug object exposed from the debug context global object. // Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
listenerComplete = false; var listenerComplete = false;
exception = false; var exception = false;
var testingConstructCall = false;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
...@@ -66,6 +68,9 @@ function listener(event, exec_state, event_data, data) { ...@@ -66,6 +68,9 @@ function listener(event, exec_state, event_data, data) {
default: assertUnreachable(); default: assertUnreachable();
} }
// Check for construct call.
assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
// When function f is optimized (2 means YES, see runtime.cc) we // When function f is optimized (2 means YES, see runtime.cc) we
// expect an optimized frame for f with g1, g2 and g3 inlined. // expect an optimized frame for f with g1, g2 and g3 inlined.
if (%GetOptimizationStatus(f) == 2) { if (%GetOptimizationStatus(f) == 2) {
...@@ -127,7 +132,10 @@ function f(x, y) { ...@@ -127,7 +132,10 @@ function f(x, y) {
g1(a, b); g1(a, b);
}; };
// Test calling f normally and as a constructor.
f(11, 12); f(11, 12);
testingConstructCall = true;
new f(11, 12);
// Make sure that the debug event listener vas invoked. // Make sure that the debug event listener vas invoked.
assertFalse(exception, "exception in listener " + exception) assertFalse(exception, "exception in listener " + exception)
......
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