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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 963713002: [turbofan] Avoid generating dead BooleanNot nodes in typed lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/js-typed-lowering.h" 7 #include "src/compiler/js-typed-lowering.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 510
511 Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { 511 Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) {
512 Node* input = node->InputAt(0); 512 Node* input = node->InputAt(0);
513 Type* input_type = NodeProperties::GetBounds(input).upper; 513 Type* input_type = NodeProperties::GetBounds(input).upper;
514 if (input_type->Is(Type::Boolean())) { 514 if (input_type->Is(Type::Boolean())) {
515 // JSUnaryNot(x:boolean,context) => BooleanNot(x) 515 // JSUnaryNot(x:boolean,context) => BooleanNot(x)
516 node->set_op(simplified()->BooleanNot()); 516 node->set_op(simplified()->BooleanNot());
517 node->TrimInputCount(1); 517 node->TrimInputCount(1);
518 return Changed(node); 518 return Changed(node);
519 } else if (input_type->Is(Type::OrderedNumber())) {
520 // JSUnaryNot(x:number,context) => NumberEqual(x,#0)
521 node->set_op(simplified()->NumberEqual());
522 node->ReplaceInput(1, jsgraph()->ZeroConstant());
523 DCHECK_EQ(2, node->InputCount());
524 return Changed(node);
519 } 525 }
520 // JSUnaryNot(x,context) => BooleanNot(AnyToBoolean(x)) 526 // JSUnaryNot(x,context) => BooleanNot(AnyToBoolean(x))
521 node->set_op(simplified()->BooleanNot()); 527 node->set_op(simplified()->BooleanNot());
522 node->ReplaceInput(0, graph()->NewNode(simplified()->AnyToBoolean(), input)); 528 node->ReplaceInput(0, graph()->NewNode(simplified()->AnyToBoolean(), input));
523 node->TrimInputCount(1); 529 node->TrimInputCount(1);
524 return Changed(node); 530 return Changed(node);
525 } 531 }
526 532
527 533
528 Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { 534 Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 } 1030 }
1025 1031
1026 1032
1027 MachineOperatorBuilder* JSTypedLowering::machine() const { 1033 MachineOperatorBuilder* JSTypedLowering::machine() const {
1028 return jsgraph()->machine(); 1034 return jsgraph()->machine();
1029 } 1035 }
1030 1036
1031 } // namespace compiler 1037 } // namespace compiler
1032 } // namespace internal 1038 } // namespace internal
1033 } // namespace v8 1039 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698