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 #include "src/compiler/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 void VisitFloat64Cmp(Node* node) { VisitBinop(node, kMachFloat64, kRepBit); } | 312 void VisitFloat64Cmp(Node* node) { VisitBinop(node, kMachFloat64, kRepBit); } |
313 void VisitInt32Cmp(Node* node) { VisitBinop(node, kMachInt32, kRepBit); } | 313 void VisitInt32Cmp(Node* node) { VisitBinop(node, kMachInt32, kRepBit); } |
314 void VisitUint32Cmp(Node* node) { VisitBinop(node, kMachUint32, kRepBit); } | 314 void VisitUint32Cmp(Node* node) { VisitBinop(node, kMachUint32, kRepBit); } |
315 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); } | 315 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); } |
316 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); } | 316 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); } |
317 | 317 |
318 // Infer representation for phi-like nodes. | 318 // Infer representation for phi-like nodes. |
319 MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) { | 319 MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) { |
320 // Phis adapt to the output representation their uses demand. | 320 // Phis adapt to the output representation their uses demand. |
321 Type* upper = NodeProperties::GetBounds(node).upper; | 321 Type* upper = NodeProperties::GetBounds(node).upper; |
322 if ((use & kRepMask) == kRepTagged) { | 322 if ((use & kRepMask) == kRepFloat32) { |
| 323 // only float32 uses. |
| 324 return kRepFloat32; |
| 325 } else if ((use & kRepMask) == kRepFloat64) { |
| 326 // only float64 uses. |
| 327 return kRepFloat64; |
| 328 } else if ((use & kRepMask) == kRepTagged) { |
323 // only tagged uses. | 329 // only tagged uses. |
324 return kRepTagged; | 330 return kRepTagged; |
325 } else if (upper->Is(Type::Integral32())) { | 331 } else if (upper->Is(Type::Integral32())) { |
326 // Integer within [-2^31, 2^32[ range. | 332 // Integer within [-2^31, 2^32[ range. |
327 if ((use & kRepMask) == kRepFloat64) { | 333 if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) { |
328 // only float64 uses. | |
329 return kRepFloat64; | |
330 } else if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) { | |
331 // multiple uses, but we are within 32 bits range => pick kRepWord32. | 334 // multiple uses, but we are within 32 bits range => pick kRepWord32. |
332 return kRepWord32; | 335 return kRepWord32; |
333 } else if (((use & kRepMask) == kRepWord32 && | 336 } else if (((use & kRepMask) == kRepWord32 && |
334 !CanObserveNonWord32(use)) || | 337 !CanObserveNonWord32(use)) || |
335 (use & kTypeMask) == kTypeInt32 || | 338 (use & kTypeMask) == kTypeInt32 || |
336 (use & kTypeMask) == kTypeUint32) { | 339 (use & kTypeMask) == kTypeUint32) { |
337 // We only use 32 bits or we use the result consistently. | 340 // We only use 32 bits or we use the result consistently. |
338 return kRepWord32; | 341 return kRepWord32; |
339 } else { | 342 } else { |
340 return kRepFloat64; | 343 return kRepFloat64; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 ProcessInput(node, 0, 0); | 503 ProcessInput(node, 0, 0); |
501 SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper)); | 504 SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper)); |
502 return; | 505 return; |
503 } | 506 } |
504 case IrOpcode::kAlways: | 507 case IrOpcode::kAlways: |
505 return VisitLeaf(node, kRepBit); | 508 return VisitLeaf(node, kRepBit); |
506 case IrOpcode::kInt32Constant: | 509 case IrOpcode::kInt32Constant: |
507 return VisitLeaf(node, kRepWord32); | 510 return VisitLeaf(node, kRepWord32); |
508 case IrOpcode::kInt64Constant: | 511 case IrOpcode::kInt64Constant: |
509 return VisitLeaf(node, kRepWord64); | 512 return VisitLeaf(node, kRepWord64); |
| 513 case IrOpcode::kFloat32Constant: |
| 514 return VisitLeaf(node, kRepFloat32); |
510 case IrOpcode::kFloat64Constant: | 515 case IrOpcode::kFloat64Constant: |
511 return VisitLeaf(node, kRepFloat64); | 516 return VisitLeaf(node, kRepFloat64); |
512 case IrOpcode::kExternalConstant: | 517 case IrOpcode::kExternalConstant: |
513 return VisitLeaf(node, kMachPtr); | 518 return VisitLeaf(node, kMachPtr); |
514 case IrOpcode::kNumberConstant: | 519 case IrOpcode::kNumberConstant: |
515 return VisitLeaf(node, kRepTagged); | 520 return VisitLeaf(node, kRepTagged); |
516 case IrOpcode::kHeapConstant: | 521 case IrOpcode::kHeapConstant: |
517 return VisitLeaf(node, kRepTagged); | 522 return VisitLeaf(node, kRepTagged); |
518 | 523 |
519 case IrOpcode::kBranch: | 524 case IrOpcode::kBranch: |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 | 1589 |
1585 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1590 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1586 node->set_op(machine()->IntLessThanOrEqual()); | 1591 node->set_op(machine()->IntLessThanOrEqual()); |
1587 node->ReplaceInput(0, StringComparison(node, true)); | 1592 node->ReplaceInput(0, StringComparison(node, true)); |
1588 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1593 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1589 } | 1594 } |
1590 | 1595 |
1591 } // namespace compiler | 1596 } // namespace compiler |
1592 } // namespace internal | 1597 } // namespace internal |
1593 } // namespace v8 | 1598 } // namespace v8 |
OLD | NEW |