OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/crankshaft/hydrogen-instructions.h" | 5 #include "src/crankshaft/hydrogen-instructions.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/safe_math.h" | 8 #include "src/base/safe_math.h" |
9 #include "src/crankshaft/hydrogen-infer-representation.h" | 9 #include "src/crankshaft/hydrogen-infer-representation.h" |
10 #include "src/double.h" | 10 #include "src/double.h" |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 case HValue::kBlockEntry: | 776 case HValue::kBlockEntry: |
777 case HValue::kBoundsCheckBaseIndexInformation: | 777 case HValue::kBoundsCheckBaseIndexInformation: |
778 case HValue::kCallFunction: | 778 case HValue::kCallFunction: |
779 case HValue::kCallNewArray: | 779 case HValue::kCallNewArray: |
780 case HValue::kCallStub: | 780 case HValue::kCallStub: |
781 case HValue::kCapturedObject: | 781 case HValue::kCapturedObject: |
782 case HValue::kClassOfTestAndBranch: | 782 case HValue::kClassOfTestAndBranch: |
783 case HValue::kCompareGeneric: | 783 case HValue::kCompareGeneric: |
784 case HValue::kCompareHoleAndBranch: | 784 case HValue::kCompareHoleAndBranch: |
785 case HValue::kCompareMap: | 785 case HValue::kCompareMap: |
786 case HValue::kCompareMinusZeroAndBranch: | |
787 case HValue::kCompareNumericAndBranch: | 786 case HValue::kCompareNumericAndBranch: |
788 case HValue::kCompareObjectEqAndBranch: | 787 case HValue::kCompareObjectEqAndBranch: |
789 case HValue::kConstant: | 788 case HValue::kConstant: |
790 case HValue::kConstructDouble: | 789 case HValue::kConstructDouble: |
791 case HValue::kContext: | 790 case HValue::kContext: |
792 case HValue::kDebugBreak: | 791 case HValue::kDebugBreak: |
793 case HValue::kDeclareGlobals: | 792 case HValue::kDeclareGlobals: |
794 case HValue::kDoubleBits: | 793 case HValue::kDoubleBits: |
795 case HValue::kDummyUse: | 794 case HValue::kDummyUse: |
796 case HValue::kEnterInlined: | 795 case HValue::kEnterInlined: |
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 token() == Token::LTE || | 3318 token() == Token::LTE || |
3320 token() == Token::GTE) | 3319 token() == Token::GTE) |
3321 ? FirstSuccessor() : SecondSuccessor(); | 3320 ? FirstSuccessor() : SecondSuccessor(); |
3322 return true; | 3321 return true; |
3323 } | 3322 } |
3324 *block = NULL; | 3323 *block = NULL; |
3325 return false; | 3324 return false; |
3326 } | 3325 } |
3327 | 3326 |
3328 | 3327 |
3329 bool HCompareMinusZeroAndBranch::KnownSuccessorBlock(HBasicBlock** block) { | |
3330 if (FLAG_fold_constants && value()->IsConstant()) { | |
3331 HConstant* constant = HConstant::cast(value()); | |
3332 if (constant->HasDoubleValue()) { | |
3333 *block = IsMinusZero(constant->DoubleValue()) | |
3334 ? FirstSuccessor() : SecondSuccessor(); | |
3335 return true; | |
3336 } | |
3337 } | |
3338 if (value()->representation().IsSmiOrInteger32()) { | |
3339 // A Smi or Integer32 cannot contain minus zero. | |
3340 *block = SecondSuccessor(); | |
3341 return true; | |
3342 } | |
3343 *block = NULL; | |
3344 return false; | |
3345 } | |
3346 | |
3347 | |
3348 void HCompareMinusZeroAndBranch::InferRepresentation( | |
3349 HInferRepresentationPhase* h_infer) { | |
3350 ChangeRepresentation(value()->representation()); | |
3351 } | |
3352 | |
3353 | |
3354 std::ostream& HGoto::PrintDataTo(std::ostream& os) const { // NOLINT | 3328 std::ostream& HGoto::PrintDataTo(std::ostream& os) const { // NOLINT |
3355 return os << *SuccessorAt(0); | 3329 return os << *SuccessorAt(0); |
3356 } | 3330 } |
3357 | 3331 |
3358 | 3332 |
3359 void HCompareNumericAndBranch::InferRepresentation( | 3333 void HCompareNumericAndBranch::InferRepresentation( |
3360 HInferRepresentationPhase* h_infer) { | 3334 HInferRepresentationPhase* h_infer) { |
3361 Representation left_rep = left()->representation(); | 3335 Representation left_rep = left()->representation(); |
3362 Representation right_rep = right()->representation(); | 3336 Representation right_rep = right()->representation(); |
3363 Representation observed_left = observed_input_representation(0); | 3337 Representation observed_left = observed_input_representation(0); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4692 case HObjectAccess::kExternalMemory: | 4666 case HObjectAccess::kExternalMemory: |
4693 os << "[external-memory]"; | 4667 os << "[external-memory]"; |
4694 break; | 4668 break; |
4695 } | 4669 } |
4696 | 4670 |
4697 return os << "@" << access.offset(); | 4671 return os << "@" << access.offset(); |
4698 } | 4672 } |
4699 | 4673 |
4700 } // namespace internal | 4674 } // namespace internal |
4701 } // namespace v8 | 4675 } // namespace v8 |
OLD | NEW |