| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); } | 300 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); } |
| 301 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); } | 301 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); } |
| 302 | 302 |
| 303 // Infer representation for phi-like nodes. | 303 // Infer representation for phi-like nodes. |
| 304 MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) { | 304 MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) { |
| 305 // Phis adapt to the output representation their uses demand. | 305 // Phis adapt to the output representation their uses demand. |
| 306 Type* upper = NodeProperties::GetBounds(node).upper; | 306 Type* upper = NodeProperties::GetBounds(node).upper; |
| 307 if ((use & kRepMask) == kRepTagged) { | 307 if ((use & kRepMask) == kRepTagged) { |
| 308 // only tagged uses. | 308 // only tagged uses. |
| 309 return kRepTagged; | 309 return kRepTagged; |
| 310 } else if (IsSafeIntAdditiveOperand(node)) { | 310 } else if (upper->Is(Type::Integral32())) { |
| 311 // Integer within [-2^52, 2^52] range. | 311 // Integer within [-2^31, 2^32[ range. |
| 312 if ((use & kRepMask) == kRepFloat64) { | 312 if ((use & kRepMask) == kRepFloat64) { |
| 313 // only float64 uses. | 313 // only float64 uses. |
| 314 return kRepFloat64; | 314 return kRepFloat64; |
| 315 } else if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) { | 315 } else if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) { |
| 316 // multiple uses, but we are within 32 bits range => pick kRepWord32. | 316 // multiple uses, but we are within 32 bits range => pick kRepWord32. |
| 317 return kRepWord32; | 317 return kRepWord32; |
| 318 } else if ((use & kRepMask) == kRepWord32 || | 318 } else if ((use & kRepMask) == kRepWord32 || |
| 319 (use & kTypeMask) == kTypeInt32 || | 319 (use & kTypeMask) == kTypeInt32 || |
| 320 (use & kTypeMask) == kTypeUint32) { | 320 (use & kTypeMask) == kTypeUint32) { |
| 321 // The type is a safe integer, but we only use 32 bits. | 321 // We only use 32 bits or we use the result consistently. |
| 322 return kRepWord32; | 322 return kRepWord32; |
| 323 } else { | 323 } else { |
| 324 return kRepFloat64; | 324 return kRepFloat64; |
| 325 } | 325 } |
| 326 } else if (IsSafeBitOperand(node)) { | 326 } else if (IsSafeBitOperand(node)) { |
| 327 // multiple uses => pick kRepBit. | 327 // multiple uses => pick kRepBit. |
| 328 return kRepBit; | 328 return kRepBit; |
| 329 } else if (upper->Is(Type::Number())) { | 329 } else if (upper->Is(Type::Number())) { |
| 330 // multiple uses => pick kRepFloat64. | 330 // multiple uses => pick kRepFloat64. |
| 331 return kRepFloat64; | 331 return kRepFloat64; |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 | 1508 |
| 1509 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1509 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1510 node->set_op(machine()->IntLessThanOrEqual()); | 1510 node->set_op(machine()->IntLessThanOrEqual()); |
| 1511 node->ReplaceInput(0, StringComparison(node, true)); | 1511 node->ReplaceInput(0, StringComparison(node, true)); |
| 1512 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1512 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1513 } | 1513 } |
| 1514 | 1514 |
| 1515 } // namespace compiler | 1515 } // namespace compiler |
| 1516 } // namespace internal | 1516 } // namespace internal |
| 1517 } // namespace v8 | 1517 } // namespace v8 |
| OLD | NEW |