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

Side by Side Diff: src/compiler/common-operator-reducer.cc

Issue 2080703006: [turbofan] Some strength reduction on Smi/HeapObject checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/pipeline.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/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
11 #include "src/compiler/machine-operator.h" 11 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/node.h" 12 #include "src/compiler/node.h"
13 #include "src/compiler/node-matchers.h" 13 #include "src/compiler/node-matchers.h"
14 #include "src/compiler/node-properties.h" 14 #include "src/compiler/node-properties.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 namespace compiler { 18 namespace compiler {
19 19
20 namespace { 20 namespace {
21 21
22 enum class Decision { kUnknown, kTrue, kFalse };
23
24 Decision DecideCondition(Node* const cond) { 22 Decision DecideCondition(Node* const cond) {
25 switch (cond->opcode()) { 23 switch (cond->opcode()) {
26 case IrOpcode::kInt32Constant: { 24 case IrOpcode::kInt32Constant: {
27 Int32Matcher mcond(cond); 25 Int32Matcher mcond(cond);
28 return mcond.Value() ? Decision::kTrue : Decision::kFalse; 26 return mcond.Value() ? Decision::kTrue : Decision::kFalse;
29 } 27 }
30 case IrOpcode::kHeapConstant: { 28 case IrOpcode::kHeapConstant: {
31 HeapObjectMatcher mcond(cond); 29 HeapObjectMatcher mcond(cond);
32 return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse; 30 return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse;
33 } 31 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 node->ReplaceInput(0, a); 403 node->ReplaceInput(0, a);
406 node->ReplaceInput(1, b); 404 node->ReplaceInput(1, b);
407 node->TrimInputCount(2); 405 node->TrimInputCount(2);
408 NodeProperties::ChangeOp(node, op); 406 NodeProperties::ChangeOp(node, op);
409 return Changed(node); 407 return Changed(node);
410 } 408 }
411 409
412 } // namespace compiler 410 } // namespace compiler
413 } // namespace internal 411 } // namespace internal
414 } // namespace v8 412 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698