| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index cf7bbc99a52a8e830c5b3b5d78fd6e8635649402..75c25774059e2da470d9fd9d7b3ad1b0abc142f8 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -3572,26 +3572,32 @@ Node* AstGraphBuilder::BuildStoreExternal(ExternalReference reference,
|
|
|
|
|
| Node* AstGraphBuilder::BuildToBoolean(Node* input) {
|
| - // TODO(titzer): This should be in a JSOperatorReducer.
|
| + // TODO(bmeurer, mstarzinger): Refactor this into a separate optimization
|
| + // method.
|
| switch (input->opcode()) {
|
| - case IrOpcode::kInt32Constant:
|
| - return jsgraph_->BooleanConstant(!Int32Matcher(input).Is(0));
|
| - case IrOpcode::kFloat64Constant:
|
| - return jsgraph_->BooleanConstant(!Float64Matcher(input).Is(0));
|
| case IrOpcode::kNumberConstant:
|
| return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0));
|
| case IrOpcode::kHeapConstant: {
|
| Handle<Object> object = HeapObjectMatcher<Object>(input).Value().handle();
|
| return jsgraph_->BooleanConstant(object->BooleanValue());
|
| }
|
| + case IrOpcode::kJSEqual:
|
| + case IrOpcode::kJSNotEqual:
|
| + case IrOpcode::kJSStrictEqual:
|
| + case IrOpcode::kJSStrictNotEqual:
|
| + case IrOpcode::kJSLessThan:
|
| + case IrOpcode::kJSLessThanOrEqual:
|
| + case IrOpcode::kJSGreaterThan:
|
| + case IrOpcode::kJSGreaterThanOrEqual:
|
| + case IrOpcode::kJSUnaryNot:
|
| + case IrOpcode::kJSToBoolean:
|
| + case IrOpcode::kJSDeleteProperty:
|
| + case IrOpcode::kJSHasProperty:
|
| + case IrOpcode::kJSInstanceOf:
|
| + return input;
|
| default:
|
| break;
|
| }
|
| - if (NodeProperties::IsTyped(input)) {
|
| - Type* upper = NodeProperties::GetBounds(input).upper;
|
| - if (upper->Is(Type::Boolean())) return input;
|
| - }
|
| -
|
| return NewNode(javascript()->ToBoolean(), input);
|
| }
|
|
|
|
|