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 "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 return jsgraph()->Int32Constant(iv); | 213 return jsgraph()->Int32Constant(iv); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type, | 217 Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type, |
218 bool use_unsigned) { | 218 bool use_unsigned) { |
219 // Eagerly fold representation changes for constants. | 219 // Eagerly fold representation changes for constants. |
220 switch (node->opcode()) { | 220 switch (node->opcode()) { |
221 case IrOpcode::kInt32Constant: | 221 case IrOpcode::kInt32Constant: |
222 return node; // No change necessary. | 222 return node; // No change necessary. |
223 case IrOpcode::kNumberConstant: | |
224 case IrOpcode::kFloat32Constant: | 223 case IrOpcode::kFloat32Constant: |
225 return MakeInt32Constant(OpParameter<float>(node)); | 224 return MakeInt32Constant(OpParameter<float>(node)); |
| 225 case IrOpcode::kNumberConstant: |
226 case IrOpcode::kFloat64Constant: | 226 case IrOpcode::kFloat64Constant: |
227 return MakeInt32Constant(OpParameter<double>(node)); | 227 return MakeInt32Constant(OpParameter<double>(node)); |
228 default: | 228 default: |
229 break; | 229 break; |
230 } | 230 } |
231 // Select the correct X -> Word32 operator. | 231 // Select the correct X -> Word32 operator. |
232 const Operator* op = NULL; | 232 const Operator* op = NULL; |
233 if (output_type & kRepFloat64) { | 233 if (output_type & kRepFloat64) { |
234 if (output_type & kTypeUint32 || use_unsigned) { | 234 if (output_type & kTypeUint32 || use_unsigned) { |
235 op = machine()->ChangeFloat64ToUint32(); | 235 op = machine()->ChangeFloat64ToUint32(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 Isolate* isolate() { return isolate_; } | 423 Isolate* isolate() { return isolate_; } |
424 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 424 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
425 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 425 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
426 }; | 426 }; |
427 | 427 |
428 } // namespace compiler | 428 } // namespace compiler |
429 } // namespace internal | 429 } // namespace internal |
430 } // namespace v8 | 430 } // namespace v8 |
431 | 431 |
432 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 432 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |