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

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

Issue 1908093002: [turbofan] Optimize tagged conversion based on type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 years, 8 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 | « src/compiler/simplified-operator.cc ('k') | src/compiler/typer.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/simplified-operator-reducer.h" 5 #include "src/compiler/simplified-operator-reducer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator.h" 8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue()); 43 if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue());
44 if (m.IsChangeBitToBool()) return Replace(m.InputAt(0)); 44 if (m.IsChangeBitToBool()) return Replace(m.InputAt(0));
45 break; 45 break;
46 } 46 }
47 case IrOpcode::kChangeFloat64ToTagged: { 47 case IrOpcode::kChangeFloat64ToTagged: {
48 Float64Matcher m(node->InputAt(0)); 48 Float64Matcher m(node->InputAt(0));
49 if (m.HasValue()) return ReplaceNumber(m.Value()); 49 if (m.HasValue()) return ReplaceNumber(m.Value());
50 if (m.IsChangeTaggedToFloat64()) return Replace(m.node()->InputAt(0)); 50 if (m.IsChangeTaggedToFloat64()) return Replace(m.node()->InputAt(0));
51 break; 51 break;
52 } 52 }
53 case IrOpcode::kChangeInt31ToTagged:
53 case IrOpcode::kChangeInt32ToTagged: { 54 case IrOpcode::kChangeInt32ToTagged: {
54 Int32Matcher m(node->InputAt(0)); 55 Int32Matcher m(node->InputAt(0));
55 if (m.HasValue()) return ReplaceNumber(m.Value()); 56 if (m.HasValue()) return ReplaceNumber(m.Value());
56 break; 57 break;
57 } 58 }
58 case IrOpcode::kChangeTaggedToFloat64: { 59 case IrOpcode::kChangeTaggedToFloat64: {
59 NumberMatcher m(node->InputAt(0)); 60 NumberMatcher m(node->InputAt(0));
60 if (m.HasValue()) return ReplaceFloat64(m.Value()); 61 if (m.HasValue()) return ReplaceFloat64(m.Value());
61 if (m.IsChangeFloat64ToTagged()) return Replace(m.node()->InputAt(0)); 62 if (m.IsChangeFloat64ToTagged()) return Replace(m.node()->InputAt(0));
62 if (m.IsChangeInt32ToTagged()) { 63 if (m.IsChangeInt31ToTagged() || m.IsChangeInt32ToTagged()) {
63 return Change(node, machine()->ChangeInt32ToFloat64(), m.InputAt(0)); 64 return Change(node, machine()->ChangeInt32ToFloat64(), m.InputAt(0));
64 } 65 }
65 if (m.IsChangeUint32ToTagged()) { 66 if (m.IsChangeUint32ToTagged()) {
66 return Change(node, machine()->ChangeUint32ToFloat64(), m.InputAt(0)); 67 return Change(node, machine()->ChangeUint32ToFloat64(), m.InputAt(0));
67 } 68 }
68 break; 69 break;
69 } 70 }
70 case IrOpcode::kChangeTaggedToInt32: { 71 case IrOpcode::kChangeTaggedToInt32: {
71 NumberMatcher m(node->InputAt(0)); 72 NumberMatcher m(node->InputAt(0));
72 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); 73 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value()));
73 if (m.IsChangeFloat64ToTagged()) { 74 if (m.IsChangeFloat64ToTagged()) {
74 return Change(node, machine()->ChangeFloat64ToInt32(), m.InputAt(0)); 75 return Change(node, machine()->ChangeFloat64ToInt32(), m.InputAt(0));
75 } 76 }
76 if (m.IsChangeInt32ToTagged()) return Replace(m.InputAt(0)); 77 if (m.IsChangeInt31ToTagged() || m.IsChangeInt32ToTagged()) {
78 return Replace(m.InputAt(0));
79 }
77 break; 80 break;
78 } 81 }
79 case IrOpcode::kChangeTaggedToUint32: { 82 case IrOpcode::kChangeTaggedToUint32: {
80 NumberMatcher m(node->InputAt(0)); 83 NumberMatcher m(node->InputAt(0));
81 if (m.HasValue()) return ReplaceUint32(DoubleToUint32(m.Value())); 84 if (m.HasValue()) return ReplaceUint32(DoubleToUint32(m.Value()));
82 if (m.IsChangeFloat64ToTagged()) { 85 if (m.IsChangeFloat64ToTagged()) {
83 return Change(node, machine()->ChangeFloat64ToUint32(), m.InputAt(0)); 86 return Change(node, machine()->ChangeFloat64ToUint32(), m.InputAt(0));
84 } 87 }
85 if (m.IsChangeUint32ToTagged()) return Replace(m.InputAt(0)); 88 if (m.IsChangeUint32ToTagged()) return Replace(m.InputAt(0));
86 break; 89 break;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); } 162 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); }
160 163
161 164
162 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 165 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
163 return jsgraph()->machine(); 166 return jsgraph()->machine();
164 } 167 }
165 168
166 } // namespace compiler 169 } // namespace compiler
167 } // namespace internal 170 } // namespace internal
168 } // namespace v8 171 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698