Revision: 23561
Author: [email protected]
Date: Mon Sep 1 12:17:43 2014 UTC
Log: Fix typed lowering of JSUnaryNot to work with graph reducer.
[email protected]
TEST=cctest/test-js-typed-lowering/UnaryNot[Effects]
Review URL: https://codereview.chromium.org/523633002
https://code.google.com/p/v8/source/detail?r=23561
Modified:
/branches/bleeding_edge/src/compiler/js-generic-lowering.cc
/branches/bleeding_edge/src/compiler/js-typed-lowering.cc
/branches/bleeding_edge/test/cctest/compiler/test-js-typed-lowering.cc
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Mon Sep 1
09:31:14 2014 UTC
+++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Mon Sep 1
12:17:43 2014 UTC
@@ -280,7 +280,6 @@
UNIMPLEMENTED(); \
return node; \
}
-REPLACE_UNIMPLEMENTED(JSToString)
REPLACE_UNIMPLEMENTED(JSToName)
REPLACE_UNIMPLEMENTED(JSYield)
REPLACE_UNIMPLEMENTED(JSDebugger)
@@ -400,6 +399,12 @@
ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
return node;
}
+
+
+Node* JSGenericLowering::LowerJSToString(Node* node) {
+ ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1);
+ return node;
+}
Node* JSGenericLowering::LowerJSToObject(Node* node) {
=======================================
--- /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Thu Aug 28
14:35:11 2014 UTC
+++ /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Mon Sep 1
12:17:43 2014 UTC
@@ -587,19 +587,19 @@
Reduction result = ReduceJSToBooleanInput(node->InputAt(0));
Node* value;
if (result.Changed()) {
- // !x => BooleanNot(x)
+ // JSUnaryNot(x) => BooleanNot(x)
value =
graph()->NewNode(simplified()->BooleanNot(),
result.replacement());
NodeProperties::ReplaceWithValue(node, value);
return Changed(value);
} else {
- // !x => BooleanNot(JSToBoolean(x))
+ // JSUnaryNot(x) => BooleanNot(JSToBoolean(x))
value = graph()->NewNode(simplified()->BooleanNot(), node);
node->set_op(javascript()->ToBoolean());
NodeProperties::ReplaceWithValue(node, value, node);
// Note: ReplaceUses() smashes all uses, so smash it back here.
value->ReplaceInput(0, node);
- return ReplaceWith(value);
+ return Changed(node);
}
}
case IrOpcode::kJSToBoolean:
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-js-typed-lowering.cc
Tue Aug 26 09:19:24 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-js-typed-lowering.cc
Mon Sep 1 12:17:43 2014 UTC
@@ -755,9 +755,18 @@
Operator* opnot = R.javascript.UnaryNot();
for (size_t i = 0; i < arraysize(kJSTypes); i++) {
- Node* r = R.ReduceUnop(opnot, kJSTypes[i]);
+ Node* orig = R.Unop(opnot, R.Parameter(kJSTypes[i]));
+ Node* use = R.graph.NewNode(R.common.Return(), orig);
+ Node* r = R.reduce(orig);
// TODO(titzer): test will break if/when js-typed-lowering constant
folds.
- CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
+ CHECK_EQ(IrOpcode::kBooleanNot, use->InputAt(0)->opcode());
+
+ if (r == orig && orig->opcode() == IrOpcode::kJSToBoolean) {
+ // The original node was turned into a ToBoolean.
+ CHECK_EQ(IrOpcode::kJSToBoolean, r->opcode());
+ } else {
+ CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
+ }
}
}
@@ -1184,16 +1193,16 @@
Node* value_use = R.graph.NewNode(R.common.Return(), orig);
Node* r = R.reduce(orig);
// TODO(titzer): test will break if/when js-typed-lowering constant
folds.
- CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
-
- CHECK_EQ(r, value_use->InputAt(0));
+ CHECK_EQ(IrOpcode::kBooleanNot, value_use->InputAt(0)->opcode());
- if (r->InputAt(0) == orig && orig->opcode() == IrOpcode::kJSToBoolean)
{
+ if (r == orig && orig->opcode() == IrOpcode::kJSToBoolean) {
// The original node was turned into a ToBoolean, which has an
effect.
+ CHECK_EQ(IrOpcode::kJSToBoolean, r->opcode());
R.CheckEffectInput(R.start(), orig);
R.CheckEffectInput(orig, effect_use);
} else {
// effect should have been removed from this node.
+ CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
R.CheckEffectInput(R.start(), effect_use);
}
}
--
--
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/d/optout.