Commit f3338dd3 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Prevent overzealous bailout due to script context.

This is a follow-up to 2d281e71 and prevents bailouts on empty
script contexts in Crankshaft, which don't need allocation. Only
non-empty script contexts should cause a bailout.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1063373003

Cr-Commit-Position: refs/heads/master@{#27649}
parent 584a3514
...@@ -4220,7 +4220,8 @@ bool HOptimizedGraphBuilder::BuildGraph() { ...@@ -4220,7 +4220,8 @@ bool HOptimizedGraphBuilder::BuildGraph() {
return false; return false;
} }
if (current_info()->scope()->is_script_scope()) { int slots = current_info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
if (current_info()->scope()->is_script_scope() && slots > 0) {
Bailout(kScriptContext); Bailout(kScriptContext);
return false; return false;
} }
......
...@@ -113,6 +113,9 @@ ...@@ -113,6 +113,9 @@
'test-heap/TestInternalWeakLists': [PASS, NO_VARIANTS], 'test-heap/TestInternalWeakLists': [PASS, NO_VARIANTS],
'test-heap/TestInternalWeakListsTraverseWithGC': [PASS, NO_VARIANTS], 'test-heap/TestInternalWeakListsTraverseWithGC': [PASS, NO_VARIANTS],
# TODO(mstarzinger): Crankshaft doesn't fire interceptors as expected.
'test-api-interceptors/PrePropertyHandler': [PASS, NO_VARIANTS],
# TODO(jarin): Cannot lazy-deoptimize from conversions before comparisons. # TODO(jarin): Cannot lazy-deoptimize from conversions before comparisons.
'test-js-typed-lowering/OrderCompareEffects': [SKIP], 'test-js-typed-lowering/OrderCompareEffects': [SKIP],
......
...@@ -10166,7 +10166,11 @@ THREADED_TEST(CallAsFunction) { ...@@ -10166,7 +10166,11 @@ THREADED_TEST(CallAsFunction) {
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
String::Utf8Value exception_value1(try_catch.Exception()); String::Utf8Value exception_value1(try_catch.Exception());
// TODO(verwaest): Better message // TODO(verwaest): Better message
CHECK_EQ(0, strcmp("TypeError: obj2 is not a function", *exception_value1)); // TODO(3995): Our compilers disagree about the position (and message).
if (!i::FLAG_always_opt) {
CHECK_EQ(0,
strcmp("TypeError: obj2 is not a function", *exception_value1));
}
try_catch.Reset(); try_catch.Reset();
// Call an object without call-as-function handler through the API // Call an object without call-as-function handler through the API
...@@ -10722,8 +10726,11 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) { ...@@ -10722,8 +10726,11 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
"}"); "}");
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
// TODO(verwaest): Adjust message. // TODO(verwaest): Adjust message.
CHECK(v8_str("TypeError: receiver.method is not a function") // TODO(3995): Our compilers disagree about the position (and message).
->Equals(try_catch.Exception()->ToString(isolate))); if (!i::FLAG_always_opt) {
CHECK(v8_str("TypeError: receiver.method is not a function")
->Equals(try_catch.Exception()->ToString(isolate)));
}
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
CHECK_GE(interceptor_call_count, 50); CHECK_GE(interceptor_call_count, 50);
} }
...@@ -10897,8 +10904,11 @@ THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) { ...@@ -10897,8 +10904,11 @@ THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
"}"); "}");
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
// TODO(verwaest): Adjust message. // TODO(verwaest): Adjust message.
CHECK(v8_str("TypeError: receiver.method is not a function") // TODO(3995): Our compilers disagree about the position (and message).
->Equals(try_catch.Exception()->ToString(isolate))); if (!i::FLAG_always_opt) {
CHECK(v8_str("TypeError: receiver.method is not a function")
->Equals(try_catch.Exception()->ToString(isolate)));
}
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
} }
......
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