OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/representation-change.h" | 5 #include "src/compiler/representation-change.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 // Both are words less than or equal to 32-bits. | 135 // Both are words less than or equal to 32-bits. |
136 // Since loads of integers from memory implicitly sign or zero extend the | 136 // Since loads of integers from memory implicitly sign or zero extend the |
137 // value to the full machine word size and stores implicitly truncate, | 137 // value to the full machine word size and stores implicitly truncate, |
138 // no representation change is necessary. | 138 // no representation change is necessary. |
139 return node; | 139 return node; |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 switch (use_info.representation()) { | 143 switch (use_info.representation()) { |
144 case MachineRepresentation::kTaggedSigned: | 144 case MachineRepresentation::kTaggedSigned: |
145 DCHECK(use_info.type_check() == TypeCheckKind::kNone); | |
146 return GetTaggedSignedRepresentationFor(node, output_rep, output_type); | |
145 case MachineRepresentation::kTaggedPointer: | 147 case MachineRepresentation::kTaggedPointer: |
148 DCHECK(use_info.type_check() == TypeCheckKind::kNone); | |
149 return GetTaggedPointerRepresentationFor(node, output_rep, output_type); | |
146 case MachineRepresentation::kTagged: | 150 case MachineRepresentation::kTagged: |
147 DCHECK(use_info.type_check() == TypeCheckKind::kNone); | 151 DCHECK(use_info.type_check() == TypeCheckKind::kNone); |
148 return GetTaggedRepresentationFor(node, output_rep, output_type); | 152 return GetTaggedRepresentationFor(node, output_rep, output_type); |
149 case MachineRepresentation::kFloat32: | 153 case MachineRepresentation::kFloat32: |
150 DCHECK(use_info.type_check() == TypeCheckKind::kNone); | 154 DCHECK(use_info.type_check() == TypeCheckKind::kNone); |
151 return GetFloat32RepresentationFor(node, output_rep, output_type, | 155 return GetFloat32RepresentationFor(node, output_rep, output_type, |
152 use_info.truncation()); | 156 use_info.truncation()); |
153 case MachineRepresentation::kFloat64: | 157 case MachineRepresentation::kFloat64: |
154 return GetFloat64RepresentationFor(node, output_rep, output_type, | 158 return GetFloat64RepresentationFor(node, output_rep, output_type, |
155 use_node, use_info); | 159 use_node, use_info); |
(...skipping 11 matching lines...) Expand all Loading... | |
167 case MachineRepresentation::kSimd128: // Fall through. | 171 case MachineRepresentation::kSimd128: // Fall through. |
168 // TODO(bbudge) Handle conversions between tagged and untagged. | 172 // TODO(bbudge) Handle conversions between tagged and untagged. |
169 break; | 173 break; |
170 case MachineRepresentation::kNone: | 174 case MachineRepresentation::kNone: |
171 return node; | 175 return node; |
172 } | 176 } |
173 UNREACHABLE(); | 177 UNREACHABLE(); |
174 return nullptr; | 178 return nullptr; |
175 } | 179 } |
176 | 180 |
181 Node* RepresentationChanger::GetTaggedSignedRepresentationFor( | |
182 Node* node, MachineRepresentation output_rep, Type* output_type) { | |
183 // Eagerly fold representation changes for constants. | |
184 switch (node->opcode()) { | |
185 case IrOpcode::kNumberConstant: { | |
186 int32_t value = OpParameter<int32_t>(node); | |
187 if (Smi::IsValid(value)) { | |
188 return jsgraph()->Constant(value); | |
189 } | |
190 return TypeError(node, output_rep, output_type, | |
191 MachineRepresentation::kTaggedSigned); | |
192 } | |
193 case IrOpcode::kHeapConstant: | |
194 return TypeError(node, output_rep, output_type, | |
195 MachineRepresentation::kTaggedSigned); | |
196 break; | |
Jarin
2016/08/22 14:23:22
No need for break.
mvstanton
2016/08/24 16:06:28
Done.
| |
197 case IrOpcode::kInt32Constant: | |
198 if (output_type->Is(Type::SignedSmall())) { | |
199 // do it. | |
Jarin
2016/08/22 14:23:22
Remove comment.
mvstanton
2016/08/24 16:06:28
Done.
| |
200 int32_t value = OpParameter<int32_t>(node); | |
201 return jsgraph()->Constant(value); | |
202 } | |
203 if (machine()->Is64() && output_type->Is(Type::Signed32())) { | |
Jarin
2016/08/22 14:23:22
Do you ever get here? If this is a 64-bit platform
mvstanton
2016/08/24 16:06:28
Done.
| |
204 int32_t value = OpParameter<int32_t>(node); | |
205 return jsgraph()->Constant(value); | |
206 } else if (output_type->Is(Type::Unsigned32())) { | |
207 uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node)); | |
208 if (Smi::IsValid(value)) { | |
209 return jsgraph()->Constant(static_cast<double>(value)); | |
210 } else { | |
211 return TypeError(node, output_rep, output_type, | |
212 MachineRepresentation::kTaggedSigned); | |
213 } | |
214 } else { | |
215 return TypeError(node, output_rep, output_type, | |
216 MachineRepresentation::kTaggedSigned); | |
217 } | |
218 case IrOpcode::kFloat64Constant: | |
219 case IrOpcode::kFloat32Constant: | |
220 return TypeError(node, output_rep, output_type, | |
221 MachineRepresentation::kTaggedSigned); | |
222 default: | |
223 break; | |
224 } | |
225 // Select the correct X -> Tagged operator. | |
226 const Operator* op; | |
227 if (output_rep == MachineRepresentation::kNone) { | |
228 // We should only asisgn this representation if the type is empty. | |
229 CHECK(!output_type->IsInhabited()); | |
230 // consider producing a smi 0 here instead of all the impossible to whatever | |
231 // boilerplate. | |
232 op = machine()->ImpossibleToTaggedSigned(); | |
233 } else if (output_rep == MachineRepresentation::kBit) { | |
Jarin
2016/08/22 14:23:22
This case is not necessary (since the final else g
mvstanton
2016/08/24 16:06:28
Done.
| |
234 return TypeError(node, output_rep, output_type, | |
235 MachineRepresentation::kTaggedSigned); | |
236 } else if (IsWord(output_rep)) { | |
237 if (output_type->Is(Type::Signed31())) { | |
238 op = simplified()->ChangeInt31ToTaggedSigned(); | |
239 } else if (machine()->Is64() && output_type->Is(Type::Signed32())) { | |
240 // TODO(mvstanton): Can I count on this to produce a machine | |
241 // representation of | |
242 // TaggedSigned? I think so because we are on a 64bit platform. | |
Jarin
2016/08/22 14:23:22
Yes, on 64-but platform this produces a Smi.
mvstanton
2016/08/24 16:06:28
Thanks, removed TODO.
| |
243 op = simplified()->ChangeInt32ToTagged(); | |
244 } else { | |
245 return TypeError(node, output_rep, output_type, | |
246 MachineRepresentation::kTaggedSigned); | |
247 } | |
248 } else { | |
249 return TypeError(node, output_rep, output_type, | |
250 MachineRepresentation::kTaggedSigned); | |
251 } | |
252 return jsgraph()->graph()->NewNode(op, node); | |
253 } | |
254 | |
255 Node* RepresentationChanger::GetTaggedPointerRepresentationFor( | |
256 Node* node, MachineRepresentation output_rep, Type* output_type) { | |
257 // Eagerly fold representation changes for constants. | |
258 switch (node->opcode()) { | |
259 case IrOpcode::kNumberConstant: | |
260 case IrOpcode::kHeapConstant: | |
261 return node; // No change necessary. | |
Jarin
2016/08/22 14:23:22
Actually, NumberConstant would be wrong because it
mvstanton
2016/08/24 16:06:28
Done.
| |
262 case IrOpcode::kInt32Constant: | |
263 if (output_type->Is(Type::Boolean())) { | |
264 return OpParameter<int32_t>(node) == 0 ? jsgraph()->FalseConstant() | |
265 : jsgraph()->TrueConstant(); | |
266 } else { | |
267 return TypeError(node, output_rep, output_type, | |
268 MachineRepresentation::kTaggedPointer); | |
269 } | |
270 case IrOpcode::kFloat64Constant: | |
271 return jsgraph()->Constant(OpParameter<double>(node)); | |
272 case IrOpcode::kFloat32Constant: | |
273 return jsgraph()->Constant(OpParameter<float>(node)); | |
274 default: | |
275 break; | |
276 } | |
277 if (output_rep == MachineRepresentation::kTagged) { | |
278 // It's a no-op as long as the output_type is not in smi range. | |
279 // True, we could convert the smi to a heap number, but let's be | |
280 // conservative. | |
281 if (output_type->Is(Type::SignedSmall())) { | |
Jarin
2016/08/22 14:23:22
Here you have to ask if it can be a Smi:
if (outp
mvstanton
2016/08/24 16:06:28
Done.
| |
282 return TypeError(node, output_rep, output_type, | |
283 MachineRepresentation::kTaggedPointer); | |
284 } | |
285 return node; | |
286 } | |
287 // Select the correct X -> Tagged operator. | |
288 const Operator* op; | |
289 if (output_rep == MachineRepresentation::kNone) { | |
290 // We should only asisgn this representation if the type is empty. | |
291 CHECK(!output_type->IsInhabited()); | |
292 op = machine()->ImpossibleToTaggedPointer(); | |
293 } else if (output_rep == MachineRepresentation::kBit) { | |
294 if (output_type->Is(Type::Boolean())) { | |
295 op = simplified()->ChangeBitToTagged(); | |
296 } else { | |
297 return TypeError(node, output_rep, output_type, | |
298 MachineRepresentation::kTaggedPointer); | |
299 } | |
300 } else if (IsWord(output_rep)) { | |
301 // These are all about optimizing to smi types, and we want a pointer. | |
302 // Let's be very conservative at first here and declare this to be a | |
303 // type error. | |
304 return TypeError(node, output_rep, output_type, | |
305 MachineRepresentation::kTaggedPointer); | |
306 } else { | |
307 // TODO(mvstanton): Consider introducing a ChangeFloat64ToTaggedPointer | |
308 // operator, but for now all kFloat to kTaggedPointer conversions seem | |
309 // suspicious. Really, if we want a TaggedPointer representation we | |
310 // should have come from a TaggedPointer type. | |
311 return TypeError(node, output_rep, output_type, | |
312 MachineRepresentation::kTaggedPointer); | |
313 } | |
314 return jsgraph()->graph()->NewNode(op, node); | |
315 } | |
316 | |
177 Node* RepresentationChanger::GetTaggedRepresentationFor( | 317 Node* RepresentationChanger::GetTaggedRepresentationFor( |
178 Node* node, MachineRepresentation output_rep, Type* output_type) { | 318 Node* node, MachineRepresentation output_rep, Type* output_type) { |
179 // Eagerly fold representation changes for constants. | 319 // Eagerly fold representation changes for constants. |
180 switch (node->opcode()) { | 320 switch (node->opcode()) { |
181 case IrOpcode::kNumberConstant: | 321 case IrOpcode::kNumberConstant: |
182 case IrOpcode::kHeapConstant: | 322 case IrOpcode::kHeapConstant: |
183 return node; // No change necessary. | 323 return node; // No change necessary. |
184 case IrOpcode::kInt32Constant: | 324 case IrOpcode::kInt32Constant: |
185 if (output_type->Is(Type::Signed32())) { | 325 if (output_type->Is(Type::Signed32())) { |
186 int32_t value = OpParameter<int32_t>(node); | 326 int32_t value = OpParameter<int32_t>(node); |
187 return jsgraph()->Constant(value); | 327 return jsgraph()->Constant(value); |
188 } else if (output_type->Is(Type::Unsigned32())) { | 328 } else if (output_type->Is(Type::Unsigned32())) { |
189 uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node)); | 329 uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node)); |
190 return jsgraph()->Constant(static_cast<double>(value)); | 330 return jsgraph()->Constant(static_cast<double>(value)); |
191 } else if (output_type->Is(Type::Boolean())) { | 331 } else if (output_type->Is(Type::Boolean())) { |
192 return OpParameter<int32_t>(node) == 0 ? jsgraph()->FalseConstant() | 332 return OpParameter<int32_t>(node) == 0 ? jsgraph()->FalseConstant() |
193 : jsgraph()->TrueConstant(); | 333 : jsgraph()->TrueConstant(); |
194 } else { | 334 } else { |
195 return TypeError(node, output_rep, output_type, | 335 return TypeError(node, output_rep, output_type, |
196 MachineRepresentation::kTagged); | 336 MachineRepresentation::kTagged); |
197 } | 337 } |
198 case IrOpcode::kFloat64Constant: | 338 case IrOpcode::kFloat64Constant: |
199 return jsgraph()->Constant(OpParameter<double>(node)); | 339 return jsgraph()->Constant(OpParameter<double>(node)); |
200 case IrOpcode::kFloat32Constant: | 340 case IrOpcode::kFloat32Constant: |
201 return jsgraph()->Constant(OpParameter<float>(node)); | 341 return jsgraph()->Constant(OpParameter<float>(node)); |
202 default: | 342 default: |
203 break; | 343 break; |
204 } | 344 } |
345 if (output_rep == MachineRepresentation::kTaggedSigned || | |
346 output_rep == MachineRepresentation::kTaggedPointer) { | |
347 // this is a no-op. | |
348 return node; | |
349 } | |
205 // Select the correct X -> Tagged operator. | 350 // Select the correct X -> Tagged operator. |
206 const Operator* op; | 351 const Operator* op; |
207 if (output_rep == MachineRepresentation::kNone) { | 352 if (output_rep == MachineRepresentation::kNone) { |
208 // We should only asisgn this representation if the type is empty. | 353 // We should only asisgn this representation if the type is empty. |
209 CHECK(!output_type->IsInhabited()); | 354 CHECK(!output_type->IsInhabited()); |
210 op = machine()->ImpossibleToTagged(); | 355 op = machine()->ImpossibleToTagged(); |
211 } else if (output_rep == MachineRepresentation::kBit) { | 356 } else if (output_rep == MachineRepresentation::kBit) { |
212 if (output_type->Is(Type::Boolean())) { | 357 if (output_type->Is(Type::Boolean())) { |
213 op = simplified()->ChangeBitToTagged(); | 358 op = simplified()->ChangeBitToTagged(); |
214 } else { | 359 } else { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 } else if (output_type->Is(Type::Unsigned32()) || | 441 } else if (output_type->Is(Type::Unsigned32()) || |
297 truncation.IsUsedAsWord32()) { | 442 truncation.IsUsedAsWord32()) { |
298 // Either the output is uint32 or the uses only care about the | 443 // Either the output is uint32 or the uses only care about the |
299 // low 32 bits (so we can pick uint32 safely). | 444 // low 32 bits (so we can pick uint32 safely). |
300 | 445 |
301 // uint32 -> float64 -> float32 | 446 // uint32 -> float64 -> float32 |
302 op = machine()->ChangeUint32ToFloat64(); | 447 op = machine()->ChangeUint32ToFloat64(); |
303 node = jsgraph()->graph()->NewNode(op, node); | 448 node = jsgraph()->graph()->NewNode(op, node); |
304 op = machine()->TruncateFloat64ToFloat32(); | 449 op = machine()->TruncateFloat64ToFloat32(); |
305 } | 450 } |
306 } else if (output_rep == MachineRepresentation::kTagged) { | 451 } else if (output_rep == MachineRepresentation::kTagged || |
452 output_rep == MachineRepresentation::kTaggedPointer) { | |
307 if (output_type->Is(Type::NumberOrOddball())) { | 453 if (output_type->Is(Type::NumberOrOddball())) { |
308 // tagged -> float64 -> float32 | 454 // tagged -> float64 -> float32 |
309 if (output_type->Is(Type::Number())) { | 455 if (output_type->Is(Type::Number())) { |
310 op = simplified()->ChangeTaggedToFloat64(); | 456 op = simplified()->ChangeTaggedToFloat64(); |
311 } else { | 457 } else { |
312 op = simplified()->TruncateTaggedToFloat64(); | 458 op = simplified()->TruncateTaggedToFloat64(); |
313 } | 459 } |
314 node = jsgraph()->graph()->NewNode(op, node); | 460 node = jsgraph()->graph()->NewNode(op, node); |
315 op = machine()->TruncateFloat64ToFloat32(); | 461 op = machine()->TruncateFloat64ToFloat32(); |
316 } | 462 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 if (output_type->Is(Type::Signed32())) { | 506 if (output_type->Is(Type::Signed32())) { |
361 op = machine()->ChangeInt32ToFloat64(); | 507 op = machine()->ChangeInt32ToFloat64(); |
362 } else if (output_type->Is(Type::Unsigned32()) || | 508 } else if (output_type->Is(Type::Unsigned32()) || |
363 use_info.truncation().IsUsedAsWord32()) { | 509 use_info.truncation().IsUsedAsWord32()) { |
364 // Either the output is uint32 or the uses only care about the | 510 // Either the output is uint32 or the uses only care about the |
365 // low 32 bits (so we can pick uint32 safely). | 511 // low 32 bits (so we can pick uint32 safely). |
366 op = machine()->ChangeUint32ToFloat64(); | 512 op = machine()->ChangeUint32ToFloat64(); |
367 } | 513 } |
368 } else if (output_rep == MachineRepresentation::kBit) { | 514 } else if (output_rep == MachineRepresentation::kBit) { |
369 op = machine()->ChangeUint32ToFloat64(); | 515 op = machine()->ChangeUint32ToFloat64(); |
370 } else if (output_rep == MachineRepresentation::kTagged) { | 516 } else if (output_rep == MachineRepresentation::kTagged || |
517 output_rep == MachineRepresentation::kTaggedSigned || | |
518 output_rep == MachineRepresentation::kTaggedPointer) { | |
371 if (output_type->Is(Type::Undefined())) { | 519 if (output_type->Is(Type::Undefined())) { |
372 return jsgraph()->Float64Constant( | 520 return jsgraph()->Float64Constant( |
373 std::numeric_limits<double>::quiet_NaN()); | 521 std::numeric_limits<double>::quiet_NaN()); |
374 } else if (output_type->Is(Type::TaggedSigned())) { | 522 } else if (output_type->Is(Type::TaggedSigned())) { |
375 node = InsertChangeTaggedSignedToInt32(node); | 523 node = InsertChangeTaggedSignedToInt32(node); |
376 op = machine()->ChangeInt32ToFloat64(); | 524 op = machine()->ChangeInt32ToFloat64(); |
377 } else if (output_type->Is(Type::Number())) { | 525 } else if (output_type->Is(Type::Number())) { |
378 op = simplified()->ChangeTaggedToFloat64(); | 526 op = simplified()->ChangeTaggedToFloat64(); |
379 } else if (output_type->Is(Type::NumberOrOddball())) { | 527 } else if (output_type->Is(Type::NumberOrOddball())) { |
380 // TODO(jarin) Here we should check that truncation is Number. | 528 // TODO(jarin) Here we should check that truncation is Number. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 op = machine()->ChangeFloat64ToInt32(); | 611 op = machine()->ChangeFloat64ToInt32(); |
464 } else if (use_info.truncation().IsUsedAsWord32()) { | 612 } else if (use_info.truncation().IsUsedAsWord32()) { |
465 op = machine()->TruncateFloat64ToWord32(); | 613 op = machine()->TruncateFloat64ToWord32(); |
466 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall || | 614 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall || |
467 use_info.type_check() == TypeCheckKind::kSigned32) { | 615 use_info.type_check() == TypeCheckKind::kSigned32) { |
468 op = simplified()->CheckedFloat64ToInt32( | 616 op = simplified()->CheckedFloat64ToInt32( |
469 output_type->Maybe(Type::MinusZero()) | 617 output_type->Maybe(Type::MinusZero()) |
470 ? CheckForMinusZeroMode::kCheckForMinusZero | 618 ? CheckForMinusZeroMode::kCheckForMinusZero |
471 : CheckForMinusZeroMode::kDontCheckForMinusZero); | 619 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
472 } | 620 } |
473 } else if (output_rep == MachineRepresentation::kTagged) { | 621 } else if (output_rep == MachineRepresentation::kTaggedSigned) { |
474 if (output_type->Is(Type::TaggedSigned())) { | 622 if (output_type->Is(Type::TaggedSigned())) { |
Jarin
2016/08/22 14:23:22
You should not need this case. Maybe you want to a
mvstanton
2016/08/24 16:06:28
Done.
| |
475 op = simplified()->ChangeTaggedSignedToInt32(); | 623 op = simplified()->ChangeTaggedSignedToInt32(); |
476 } else if (output_type->Is(Type::Unsigned32())) { | 624 } else if (output_type->Is(Type::Unsigned32())) { |
625 op = simplified()->ChangeTaggedToUint32(); | |
626 } else if (output_type->Is(Type::Signed32())) { | |
627 op = simplified()->ChangeTaggedToInt32(); | |
Jarin
2016/08/22 14:23:22
This should be ChangeTaggedSignedToInt32, no?
mvstanton
2016/08/24 16:06:28
Done.
| |
628 } else if (use_info.truncation().IsUsedAsWord32()) { | |
629 if (use_info.type_check() != TypeCheckKind::kNone) { | |
630 op = simplified()->CheckedTruncateTaggedToWord32(); | |
631 } else { | |
632 op = simplified()->TruncateTaggedToWord32(); | |
633 } | |
634 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall) { | |
635 op = simplified()->CheckedTaggedSignedToInt32(); | |
636 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { | |
637 op = simplified()->CheckedTaggedToInt32( | |
638 output_type->Maybe(Type::MinusZero()) | |
639 ? CheckForMinusZeroMode::kCheckForMinusZero | |
640 : CheckForMinusZeroMode::kDontCheckForMinusZero); | |
641 } | |
642 } else if (output_rep == MachineRepresentation::kTagged || | |
643 output_rep == MachineRepresentation::kTaggedPointer) { | |
644 if (output_type->Is(Type::TaggedSigned())) { | |
Jarin
2016/08/22 14:23:22
This case should go away. Maybe a TODO here?
| |
645 op = simplified()->ChangeTaggedSignedToInt32(); | |
646 } else if (output_type->Is(Type::Unsigned32())) { | |
477 op = simplified()->ChangeTaggedToUint32(); | 647 op = simplified()->ChangeTaggedToUint32(); |
478 } else if (output_type->Is(Type::Signed32())) { | 648 } else if (output_type->Is(Type::Signed32())) { |
479 op = simplified()->ChangeTaggedToInt32(); | 649 op = simplified()->ChangeTaggedToInt32(); |
480 } else if (use_info.truncation().IsUsedAsWord32()) { | 650 } else if (use_info.truncation().IsUsedAsWord32()) { |
481 if (use_info.type_check() != TypeCheckKind::kNone) { | 651 if (use_info.type_check() != TypeCheckKind::kNone) { |
482 op = simplified()->CheckedTruncateTaggedToWord32(); | 652 op = simplified()->CheckedTruncateTaggedToWord32(); |
483 } else { | 653 } else { |
484 op = simplified()->TruncateTaggedToWord32(); | 654 op = simplified()->TruncateTaggedToWord32(); |
485 } | 655 } |
486 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall) { | 656 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 } | 718 } |
549 default: | 719 default: |
550 break; | 720 break; |
551 } | 721 } |
552 // Select the correct X -> Bit operator. | 722 // Select the correct X -> Bit operator. |
553 const Operator* op; | 723 const Operator* op; |
554 if (output_rep == MachineRepresentation::kNone) { | 724 if (output_rep == MachineRepresentation::kNone) { |
555 // We should only use kNone representation if the type is empty. | 725 // We should only use kNone representation if the type is empty. |
556 CHECK(!output_type->IsInhabited()); | 726 CHECK(!output_type->IsInhabited()); |
557 op = machine()->ImpossibleToBit(); | 727 op = machine()->ImpossibleToBit(); |
558 } else if (output_rep == MachineRepresentation::kTagged) { | 728 } else if (output_rep == MachineRepresentation::kTagged || |
729 output_rep == MachineRepresentation::kTaggedSigned || | |
730 output_rep == MachineRepresentation::kTaggedPointer) { | |
559 op = simplified()->ChangeTaggedToBit(); | 731 op = simplified()->ChangeTaggedToBit(); |
560 } else { | 732 } else { |
561 return TypeError(node, output_rep, output_type, | 733 return TypeError(node, output_rep, output_type, |
562 MachineRepresentation::kBit); | 734 MachineRepresentation::kBit); |
563 } | 735 } |
564 return jsgraph()->graph()->NewNode(op, node); | 736 return jsgraph()->graph()->NewNode(op, node); |
565 } | 737 } |
566 | 738 |
567 Node* RepresentationChanger::GetWord64RepresentationFor( | 739 Node* RepresentationChanger::GetWord64RepresentationFor( |
568 Node* node, MachineRepresentation output_rep, Type* output_type) { | 740 Node* node, MachineRepresentation output_rep, Type* output_type) { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 } | 993 } |
822 | 994 |
823 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 995 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
824 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 996 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
825 node); | 997 node); |
826 } | 998 } |
827 | 999 |
828 } // namespace compiler | 1000 } // namespace compiler |
829 } // namespace internal | 1001 } // namespace internal |
830 } // namespace v8 | 1002 } // namespace v8 |
OLD | NEW |