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

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

Issue 2612763002: [turbofan] Add constant-folding for CheckedFloat64ToInt32. (Closed)
Patch Set: Created 3 years, 11 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/simplified-operator-reducer-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/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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); 122 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value()));
123 if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged() || 123 if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged() ||
124 m.IsChangeUint32ToTagged()) { 124 m.IsChangeUint32ToTagged()) {
125 return Replace(m.InputAt(0)); 125 return Replace(m.InputAt(0));
126 } 126 }
127 if (m.IsChangeFloat64ToTagged() || m.IsChangeFloat64ToTaggedPointer()) { 127 if (m.IsChangeFloat64ToTagged() || m.IsChangeFloat64ToTaggedPointer()) {
128 return Change(node, machine()->TruncateFloat64ToWord32(), m.InputAt(0)); 128 return Change(node, machine()->TruncateFloat64ToWord32(), m.InputAt(0));
129 } 129 }
130 break; 130 break;
131 } 131 }
132 case IrOpcode::kCheckedFloat64ToInt32: {
133 Float64Matcher m(node->InputAt(0));
134 if (m.HasValue() && IsInt32Double(m.Value())) {
135 Node* value = jsgraph()->Int32Constant(static_cast<int32_t>(m.Value()));
136 ReplaceWithValue(node, value);
137 return Replace(value);
138 }
139 break;
140 }
132 case IrOpcode::kCheckedTaggedToInt32: 141 case IrOpcode::kCheckedTaggedToInt32:
133 case IrOpcode::kCheckedTaggedSignedToInt32: { 142 case IrOpcode::kCheckedTaggedSignedToInt32: {
134 NodeMatcher m(node->InputAt(0)); 143 NodeMatcher m(node->InputAt(0));
135 if (m.IsConvertTaggedHoleToUndefined()) { 144 if (m.IsConvertTaggedHoleToUndefined()) {
136 node->ReplaceInput(0, m.InputAt(0)); 145 node->ReplaceInput(0, m.InputAt(0));
137 return Changed(node); 146 return Changed(node);
138 } 147 }
139 break; 148 break;
140 } 149 }
141 case IrOpcode::kCheckIf: { 150 case IrOpcode::kCheckIf: {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return jsgraph()->isolate(); 262 return jsgraph()->isolate();
254 } 263 }
255 264
256 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 265 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
257 return jsgraph()->machine(); 266 return jsgraph()->machine();
258 } 267 }
259 268
260 } // namespace compiler 269 } // namespace compiler
261 } // namespace internal 270 } // namespace internal
262 } // namespace v8 271 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/simplified-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698