Commit f292c4f7 authored by neis@chromium.org's avatar neis@chromium.org

Take output type into account in JSTypedLowering reduction.

R=rossberg@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24287 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 171e62e5
......@@ -630,6 +630,15 @@ static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
Reduction JSTypedLowering::Reduce(Node* node) {
// Check if the output type is a singleton. In that case we already know the
// result value and can simply replace the node unless there are effects.
if (node->bounds().upper->IsConstant() &&
!IrOpcode::IsLeafOpcode(node->opcode()) &&
!OperatorProperties::HasEffectOutput(node->op())) {
return ReplaceEagerly(node, jsgraph()->Constant(
node->bounds().upper->AsConstant()->Value()));
// TODO(neis): Extend this to Range(x,x), NaN, MinusZero, ...?
}
switch (node->opcode()) {
case IrOpcode::kJSEqual:
return ReduceJSEqual(node, false);
......
......@@ -289,6 +289,18 @@ class IrOpcode {
}
}
static bool IsLeafOpcode(Value val) {
switch (val) {
#define RETURN_NAME(x) \
case k##x: \
return true;
LEAF_OP_LIST(RETURN_NAME)
#undef RETURN_NAME
default:
return false;
}
}
static bool IsCommonOpcode(Value val) {
switch (val) {
#define RETURN_NAME(x) \
......
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