| 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/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 case IrOpcode::kFloat64Constant: | 144 case IrOpcode::kFloat64Constant: |
| 145 return node; // No change necessary. | 145 return node; // No change necessary. |
| 146 default: | 146 default: |
| 147 break; | 147 break; |
| 148 } | 148 } |
| 149 // Select the correct X -> Float64 operator. | 149 // Select the correct X -> Float64 operator. |
| 150 Operator* op; | 150 Operator* op; |
| 151 if (output_type & rWord32) { | 151 if (output_type & rWord32) { |
| 152 if (output_type & tUint32) { | 152 if (output_type & tUint32) { |
| 153 op = machine()->ConvertUint32ToFloat64(); | 153 op = machine()->ChangeUint32ToFloat64(); |
| 154 } else if (output_type & tInt32) { | 154 } else if (output_type & tInt32) { |
| 155 op = machine()->ConvertInt32ToFloat64(); | 155 op = machine()->ChangeInt32ToFloat64(); |
| 156 } else { | 156 } else { |
| 157 return TypeError(node, output_type, rFloat64); | 157 return TypeError(node, output_type, rFloat64); |
| 158 } | 158 } |
| 159 } else if (output_type & rTagged) { | 159 } else if (output_type & rTagged) { |
| 160 op = simplified()->ChangeTaggedToFloat64(); | 160 op = simplified()->ChangeTaggedToFloat64(); |
| 161 } else { | 161 } else { |
| 162 return TypeError(node, output_type, rFloat64); | 162 return TypeError(node, output_type, rFloat64); |
| 163 } | 163 } |
| 164 return jsgraph()->graph()->NewNode(op, node); | 164 return jsgraph()->graph()->NewNode(op, node); |
| 165 } | 165 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 181 } else { | 181 } else { |
| 182 return TypeError(node, output_type, rWord32); | 182 return TypeError(node, output_type, rWord32); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 default: | 185 default: |
| 186 break; | 186 break; |
| 187 } | 187 } |
| 188 // Select the correct X -> Word32 operator. | 188 // Select the correct X -> Word32 operator. |
| 189 Operator* op = NULL; | 189 Operator* op = NULL; |
| 190 if (output_type & rFloat64) { | 190 if (output_type & rFloat64) { |
| 191 // TODO(turbofan): could have cheaper float64 conversions that don't do | |
| 192 // the full JavaScript truncation here. | |
| 193 if (output_type & tUint32) { | 191 if (output_type & tUint32) { |
| 194 op = machine()->ConvertFloat64ToUint32(); | 192 op = machine()->ChangeFloat64ToUint32(); |
| 195 } else if (output_type & tInt32) { | 193 } else if (output_type & tInt32) { |
| 196 op = machine()->ConvertFloat64ToInt32(); | 194 op = machine()->ChangeFloat64ToInt32(); |
| 197 } else { | 195 } else { |
| 198 return TypeError(node, output_type, rWord32); | 196 return TypeError(node, output_type, rWord32); |
| 199 } | 197 } |
| 200 } else if (output_type & rTagged) { | 198 } else if (output_type & rTagged) { |
| 201 if (output_type & tUint32) { | 199 if (output_type & tUint32) { |
| 202 op = simplified()->ChangeTaggedToUint32(); | 200 op = simplified()->ChangeTaggedToUint32(); |
| 203 } else if (output_type & tInt32) { | 201 } else if (output_type & tInt32) { |
| 204 op = simplified()->ChangeTaggedToInt32(); | 202 op = simplified()->ChangeTaggedToInt32(); |
| 205 } else { | 203 } else { |
| 206 return TypeError(node, output_type, rWord32); | 204 return TypeError(node, output_type, rWord32); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 JSGraph* jsgraph() { return jsgraph_; } | 372 JSGraph* jsgraph() { return jsgraph_; } |
| 375 Isolate* isolate() { return isolate_; } | 373 Isolate* isolate() { return isolate_; } |
| 376 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 374 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
| 377 MachineOperatorBuilder* machine() { return machine_; } | 375 MachineOperatorBuilder* machine() { return machine_; } |
| 378 }; | 376 }; |
| 379 } | 377 } |
| 380 } | 378 } |
| 381 } // namespace v8::internal::compiler | 379 } // namespace v8::internal::compiler |
| 382 | 380 |
| 383 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 381 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
| OLD | NEW |