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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 // int32 -> float64 -> float32 | 151 // int32 -> float64 -> float32 |
152 node = jsgraph()->graph()->NewNode(op, node); | 152 node = jsgraph()->graph()->NewNode(op, node); |
153 op = machine()->TruncateFloat64ToFloat32(); | 153 op = machine()->TruncateFloat64ToFloat32(); |
154 } else if (output_type & kRepTagged) { | 154 } else if (output_type & kRepTagged) { |
155 op = simplified() | 155 op = simplified() |
156 ->ChangeTaggedToFloat64(); // tagged -> float64 -> float32 | 156 ->ChangeTaggedToFloat64(); // tagged -> float64 -> float32 |
157 node = jsgraph()->graph()->NewNode(op, node); | 157 node = jsgraph()->graph()->NewNode(op, node); |
158 op = machine()->TruncateFloat64ToFloat32(); | 158 op = machine()->TruncateFloat64ToFloat32(); |
159 } else if (output_type & kRepFloat64) { | 159 } else if (output_type & kRepFloat64) { |
160 op = machine()->ChangeFloat32ToFloat64(); | 160 op = machine()->TruncateFloat64ToFloat32(); |
161 } else { | 161 } else { |
162 return TypeError(node, output_type, kRepFloat32); | 162 return TypeError(node, output_type, kRepFloat32); |
163 } | 163 } |
164 return jsgraph()->graph()->NewNode(op, node); | 164 return jsgraph()->graph()->NewNode(op, node); |
165 } | 165 } |
166 | 166 |
167 Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type) { | 167 Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type) { |
168 // Eagerly fold representation changes for constants. | 168 // Eagerly fold representation changes for constants. |
169 switch (node->opcode()) { | 169 switch (node->opcode()) { |
170 case IrOpcode::kNumberConstant: | 170 case IrOpcode::kNumberConstant: |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 Isolate* isolate() { return isolate_; } | 425 Isolate* isolate() { return isolate_; } |
426 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 426 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
427 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 427 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
428 }; | 428 }; |
429 | 429 |
430 } // namespace compiler | 430 } // namespace compiler |
431 } // namespace internal | 431 } // namespace internal |
432 } // namespace v8 | 432 } // namespace v8 |
433 | 433 |
434 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 434 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |