Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1811693002: [crankshaft] Fix inlining to always connect both branches of test context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-v8-4839.js » ('j') | test/mjsunit/regress/regress-v8-4839.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index b869f27184c4f3a9d002d888349bfb23beb1d564..e85c22961c7cfde5f96a2ed337fe140b69a4f924 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -4924,9 +4924,8 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
// will always evaluate to true, in a value context the return value needs
// to be a JSObject.
if (context->IsTest()) {
- TestContext* test = TestContext::cast(context);
CHECK_ALIVE(VisitForEffect(stmt->expression()));
- Goto(test->if_true(), state);
+ context->ReturnValue(graph()->GetConstantTrue());
} else if (context->IsEffect()) {
CHECK_ALIVE(VisitForEffect(stmt->expression()));
Goto(function_return(), state);
@@ -8564,7 +8563,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
// return value will always evaluate to true, in a value context the
// return value is the newly allocated receiver.
if (call_context()->IsTest()) {
- Goto(inlined_test_context()->if_true(), state);
+ inlined_test_context()->ReturnValue(graph()->GetConstantTrue());
} else if (call_context()->IsEffect()) {
Goto(function_return(), state);
} else {
@@ -8587,7 +8586,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
// Falling off the end of a normal inlined function. This basically means
// returning undefined.
if (call_context()->IsTest()) {
- Goto(inlined_test_context()->if_false(), state);
+ inlined_test_context()->ReturnValue(graph()->GetConstantFalse());
} else if (call_context()->IsEffect()) {
Goto(function_return(), state);
} else {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-v8-4839.js » ('j') | test/mjsunit/regress/regress-v8-4839.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698