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

Side by Side Diff: src/compiler/representation-change.h

Issue 1225993002: [turbofan] Add TruncationMode for TruncateFloat64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/raw-machine-assembler.h ('k') | src/compiler/simplified-lowering.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 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ 5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_
7 7
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case IrOpcode::kNumberConstant: 225 case IrOpcode::kNumberConstant:
226 case IrOpcode::kFloat64Constant: 226 case IrOpcode::kFloat64Constant:
227 return jsgraph()->Int32Constant( 227 return jsgraph()->Int32Constant(
228 DoubleToInt32(OpParameter<double>(node))); 228 DoubleToInt32(OpParameter<double>(node)));
229 default: 229 default:
230 break; 230 break;
231 } 231 }
232 // Select the correct X -> Word32 truncation operator. 232 // Select the correct X -> Word32 truncation operator.
233 const Operator* op = NULL; 233 const Operator* op = NULL;
234 if (output_type & kRepFloat64) { 234 if (output_type & kRepFloat64) {
235 op = machine()->TruncateFloat64ToInt32(); 235 op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
236 } else if (output_type & kRepFloat32) { 236 } else if (output_type & kRepFloat32) {
237 node = InsertChangeFloat32ToFloat64(node); 237 node = InsertChangeFloat32ToFloat64(node);
238 op = machine()->TruncateFloat64ToInt32(); 238 op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
239 } else if (output_type & kRepTagged) { 239 } else if (output_type & kRepTagged) {
240 node = InsertChangeTaggedToFloat64(node); 240 node = InsertChangeTaggedToFloat64(node);
241 op = machine()->TruncateFloat64ToInt32(); 241 op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
242 } else { 242 } else {
243 return TypeError(node, output_type, kRepWord32); 243 return TypeError(node, output_type, kRepWord32);
244 } 244 }
245 return jsgraph()->graph()->NewNode(op, node); 245 return jsgraph()->graph()->NewNode(op, node);
246 } 246 }
247 247
248 Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type, 248 Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type,
249 bool use_unsigned) { 249 bool use_unsigned) {
250 // Eagerly fold representation changes for constants. 250 // Eagerly fold representation changes for constants.
251 switch (node->opcode()) { 251 switch (node->opcode()) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 Factory* factory() const { return isolate()->factory(); } 453 Factory* factory() const { return isolate()->factory(); }
454 SimplifiedOperatorBuilder* simplified() { return simplified_; } 454 SimplifiedOperatorBuilder* simplified() { return simplified_; }
455 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } 455 MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
456 }; 456 };
457 457
458 } // namespace compiler 458 } // namespace compiler
459 } // namespace internal 459 } // namespace internal
460 } // namespace v8 460 } // namespace v8
461 461
462 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ 462 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698