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

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

Issue 1491223002: [turbofan] Desugar JSUnaryNot(x) to Select(x, false, true). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo in arm64. Created 5 years 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 | « src/code-stubs-hydrogen.cc ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | 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 9be3349bf085a1f0a76485b2ba956c5486451a5f..4dc3acdfa1339c1252bd73a1ecc080e5784ae1bd 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -3011,8 +3011,9 @@ void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) {
void AstGraphBuilder::VisitNot(UnaryOperation* expr) {
VisitForValue(expr->expression());
Node* operand = environment()->Pop();
- // TODO(mstarzinger): Possible optimization when we are in effect context.
- Node* value = NewNode(javascript()->UnaryNot(), operand);
+ Node* input = BuildToBoolean(operand);
+ Node* value = NewNode(common()->Select(kMachAnyTagged), input,
+ jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
ast_context()->ProduceValue(value);
}
@@ -3960,7 +3961,6 @@ Node* AstGraphBuilder::TryFastToBoolean(Node* input) {
case IrOpcode::kJSLessThanOrEqual:
case IrOpcode::kJSGreaterThan:
case IrOpcode::kJSGreaterThanOrEqual:
- case IrOpcode::kJSUnaryNot:
case IrOpcode::kJSToBoolean:
case IrOpcode::kJSDeleteProperty:
case IrOpcode::kJSHasProperty:
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698