Reviewers: Michael Starzinger,
Message:
PTAL.
Description:
Always visit branches during HGraph building
even if constant values indicate that they are unreachable.
BUG=chromium:280333
Please review this at https://codereview.chromium.org/23623009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen.cc
A + test/mjsunit/regress/regress-crbug-280333.js
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
237e8071463fe5d3f405f9d4b4f60ce43ec804fc..3132e1acda0d650e084d12bcbfb98c94feaae753
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2769,16 +2769,6 @@ void TestContext::BuildBranch(HValue* value) {
if (value != NULL && value->CheckFlag(HValue::kIsArguments)) {
builder->Bailout(kArgumentsObjectValueInATestContext);
}
- if (value->IsConstant()) {
- HConstant* constant_value = HConstant::cast(value);
- if (constant_value->BooleanValue()) {
- builder->current_block()->Goto(if_true(), builder->function_state());
- } else {
- builder->current_block()->Goto(if_false(),
builder->function_state());
- }
- builder->set_current_block(NULL);
- return;
- }
HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
ToBooleanStub::Types expected(condition()->to_boolean_types());
Index: test/mjsunit/regress/regress-crbug-280333.js
diff --git a/test/mjsunit/regress/regress-2843.js
b/test/mjsunit/regress/regress-crbug-280333.js
similarity index 88%
copy from test/mjsunit/regress/regress-2843.js
copy to test/mjsunit/regress/regress-crbug-280333.js
index
5b28c2d7948ee5b71f2cc072aea326057f8156db..ca3fdc774606bfa56669b8a3b289af9845176ff3
100644
--- a/test/mjsunit/regress/regress-2843.js
+++ b/test/mjsunit/regress/regress-crbug-280333.js
@@ -27,19 +27,21 @@
// Flags: --allow-natives-syntax
-function bailout() { throw "bailout"; }
+function funky() { return false; }
var global;
function foo(x, fun) {
var a = x + 1;
var b = x + 2; // Need another Simulate to fold the first one into.
global = true; // Need a side effect to deopt to.
- fun();
- return a;
+ if (fun()) {
+ return a;
+ }
+ return 0;
}
-assertThrows("foo(1, bailout)");
-assertThrows("foo(1, bailout)");
+assertEquals(0, foo(1, funky));
+assertEquals(0, foo(1, funky));
%OptimizeFunctionOnNextCall(foo);
-assertThrows("foo(1, bailout)");
-assertEquals(2, foo(1, function() {}));
+assertEquals(0, foo(1, funky));
+assertEquals(2, foo(1, function() { return true; }));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.