Commit 292e007c authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Remove more assumptions from debug tests. Even though a function

is optimized, does not mean all frames on the stack are optimized.
Also, when we ask for the list of scripts we may get more or less
depending on GC timing.  Also fixed a presubmit error and made
%GetOptimizationStatus a little more honest.
Review URL: https://chromiumcodereview.appspot.com/10234007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11455 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f46906d7
......@@ -8316,10 +8316,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
if (!V8::UseCrankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (FLAG_always_opt) {
return Smi::FromInt(3); // 3 == "always".
// We may have always opt, but that is more best-effort than a real
// promise, so we still say "no" if it is not optimized.
return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always".
: Smi::FromInt(2); // 2 == "no".
}
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes".
: Smi::FromInt(2); // 2 == "no".
}
......
......@@ -56,11 +56,6 @@ function arraySum(arr) {
return arr.reduce(function (a, b) { return a + b; }, 0);
}
function isCurrentlyOptimized(fun) {
// See runtime.cc.
return (%GetOptimizationStatus(fun) & 1) != 0;
}
function listener(event, exec_state, event_data, data) {
try {
if (event == Debug.DebugEvent.Break)
......@@ -159,16 +154,6 @@ function listener(event, exec_state, event_data, data) {
}
}
// When function f is optimized we expect an optimized frame for f. We
// can't say whether or not the top 3 frames (g1, g2 and g3) are
// optimized and inlined.
var frame4 = exec_state.frame(4);
if (isCurrentlyOptimized(f)) {
assertTrue(frame4.isOptimizedFrame());
assertFalse(frame4.isInlinedFrame());
}
// Indicate that all was processed.
listenerComplete = true;
}
......
......@@ -46,11 +46,6 @@ function arraySum(arr) {
return arr.reduce(function (a, b) { return a + b; }, 0);
}
function isCurrentlyOptimized(fun) {
// See runtime.cc.
return (%GetOptimizationStatus(fun) & 1) != 0;
}
function listener(event, exec_state, event_data, data) {
try {
if (event == Debug.DebugEvent.Break)
......@@ -149,16 +144,6 @@ function listener(event, exec_state, event_data, data) {
}
}
// When function f is optimized we expect an optimized frame for f. We
// can't say whether or not the top 3 frames (g1, g2 and g3) are
// optimized and inlined.
var frame4 = exec_state.frame(4);
if (isCurrentlyOptimized(f)) {
assertTrue(frame4.isOptimizedFrame());
assertFalse(frame4.isInlinedFrame());
}
// Indicate that all was processed.
listenerComplete = true;
}
......
......@@ -78,8 +78,10 @@ function listener(event, exec_state, event_data, data) {
var response = safeEval(dcp.processDebugJSONRequest(request));
assertTrue(response.success);
// Test filtering by id.
assertEquals(2, response.body.length);
// Test filtering by id. We have to get at least one script back, but
// the exact number depends on the timing of GC.
assertTrue(response.body.length >= 1);
var script = response.body[0];
var request = '{' + base_request + ',"arguments":{"ids":[' +
script.id + ']}}';
......
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