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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1188503003: [turbofan] The AstGraphBuilder does not need to care about types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698