OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |