OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 value()->PrintNameTo(stream); | 1478 value()->PrintNameTo(stream); |
1479 } | 1479 } |
1480 | 1480 |
1481 | 1481 |
1482 void HChange::PrintDataTo(StringStream* stream) { | 1482 void HChange::PrintDataTo(StringStream* stream) { |
1483 HUnaryOperation::PrintDataTo(stream); | 1483 HUnaryOperation::PrintDataTo(stream); |
1484 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); | 1484 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); |
1485 | 1485 |
1486 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); | 1486 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); |
1487 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 1487 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
1488 if (CheckFlag(kDeoptimizeOnUndefined)) stream->Add(" deopt-on-undefined"); | 1488 if (CheckFlag(kAllowUndefinedAsNaN)) stream->Add(" allow-undefined-as-nan"); |
1489 } | 1489 } |
1490 | 1490 |
1491 | 1491 |
1492 HValue* HUnaryMathOperation::Canonicalize() { | 1492 HValue* HUnaryMathOperation::Canonicalize() { |
1493 if (op() == kMathFloor) { | 1493 if (op() == kMathFloor) { |
1494 // If the input is integer32 then we replace the floor instruction | 1494 // If the input is integer32 then we replace the floor instruction |
1495 // with its input. This happens before the representation changes are | 1495 // with its input. This happens before the representation changes are |
1496 // introduced. | 1496 // introduced. |
1497 if (value()->representation().IsInteger32()) return value(); | 1497 if (value()->representation().IsInteger32()) return value(); |
1498 | 1498 |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 // calling ToPrimitive() on their arguments. The standard Crankshaft | 2483 // calling ToPrimitive() on their arguments. The standard Crankshaft |
2484 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs | 2484 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs |
2485 // are doubles caused 'undefined' to be converted to NaN. That's compatible | 2485 // are doubles caused 'undefined' to be converted to NaN. That's compatible |
2486 // out-of-the box with ordered relational comparisons (<, >, <=, | 2486 // out-of-the box with ordered relational comparisons (<, >, <=, |
2487 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), | 2487 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), |
2488 // it is not consistent with the spec. For example, it would cause undefined | 2488 // it is not consistent with the spec. For example, it would cause undefined |
2489 // == undefined (should be true) to be evaluated as NaN == NaN | 2489 // == undefined (should be true) to be evaluated as NaN == NaN |
2490 // (false). Therefore, any comparisons other than ordered relational | 2490 // (false). Therefore, any comparisons other than ordered relational |
2491 // comparisons must cause a deopt when one of their arguments is undefined. | 2491 // comparisons must cause a deopt when one of their arguments is undefined. |
2492 // See also v8:1434 | 2492 // See also v8:1434 |
2493 if (!Token::IsOrderedRelationalCompareOp(token_)) { | 2493 if (Token::IsOrderedRelationalCompareOp(token_)) { |
2494 SetFlag(kDeoptimizeOnUndefined); | 2494 SetFlag(kAllowUndefinedAsNaN); |
2495 } | 2495 } |
2496 } | 2496 } |
2497 ChangeRepresentation(rep); | 2497 ChangeRepresentation(rep); |
2498 } | 2498 } |
2499 | 2499 |
2500 | 2500 |
2501 void HParameter::PrintDataTo(StringStream* stream) { | 2501 void HParameter::PrintDataTo(StringStream* stream) { |
2502 stream->Add("%u", index()); | 2502 stream->Add("%u", index()); |
2503 } | 2503 } |
2504 | 2504 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 } | 2747 } |
2748 | 2748 |
2749 | 2749 |
2750 bool HLoadKeyed::AllUsesCanTreatHoleAsNaN() const { | 2750 bool HLoadKeyed::AllUsesCanTreatHoleAsNaN() const { |
2751 if (!IsFastDoubleElementsKind(elements_kind())) { | 2751 if (!IsFastDoubleElementsKind(elements_kind())) { |
2752 return false; | 2752 return false; |
2753 } | 2753 } |
2754 | 2754 |
2755 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | 2755 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
2756 HValue* use = it.value(); | 2756 HValue* use = it.value(); |
2757 if (use->CheckFlag(HValue::kDeoptimizeOnUndefined)) { | 2757 if (!use->CheckFlag(HValue::kAllowUndefinedAsNaN)) { |
2758 return false; | 2758 return false; |
2759 } | 2759 } |
2760 } | 2760 } |
2761 | 2761 |
2762 return true; | 2762 return true; |
2763 } | 2763 } |
2764 | 2764 |
2765 | 2765 |
2766 bool HLoadKeyed::RequiresHoleCheck() const { | 2766 bool HLoadKeyed::RequiresHoleCheck() const { |
2767 if (IsFastPackedElementsKind(elements_kind())) { | 2767 if (IsFastPackedElementsKind(elements_kind())) { |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3742 } | 3742 } |
3743 } | 3743 } |
3744 | 3744 |
3745 | 3745 |
3746 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { | 3746 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
3747 // set the appropriate GVN flags for a given load or store instruction | 3747 // set the appropriate GVN flags for a given load or store instruction |
3748 if (is_store) { | 3748 if (is_store) { |
3749 // track dominating allocations in order to eliminate write barriers | 3749 // track dominating allocations in order to eliminate write barriers |
3750 instr->SetGVNFlag(kDependsOnNewSpacePromotion); | 3750 instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
3751 instr->SetFlag(HValue::kTrackSideEffectDominators); | 3751 instr->SetFlag(HValue::kTrackSideEffectDominators); |
3752 instr->SetFlag(HValue::kDeoptimizeOnUndefined); | |
3753 } else { | 3752 } else { |
3754 // try to GVN loads, but don't hoist above map changes | 3753 // try to GVN loads, but don't hoist above map changes |
3755 instr->SetFlag(HValue::kUseGVN); | 3754 instr->SetFlag(HValue::kUseGVN); |
3756 instr->SetGVNFlag(kDependsOnMaps); | 3755 instr->SetGVNFlag(kDependsOnMaps); |
3757 } | 3756 } |
3758 | 3757 |
3759 switch (portion()) { | 3758 switch (portion()) { |
3760 case kArrayLengths: | 3759 case kArrayLengths: |
3761 instr->SetGVNFlag(is_store | 3760 instr->SetGVNFlag(is_store |
3762 ? kChangesArrayLengths : kDependsOnArrayLengths); | 3761 ? kChangesArrayLengths : kDependsOnArrayLengths); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 case kBackingStore: | 3805 case kBackingStore: |
3807 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3806 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3808 stream->Add("[backing-store]"); | 3807 stream->Add("[backing-store]"); |
3809 break; | 3808 break; |
3810 } | 3809 } |
3811 | 3810 |
3812 stream->Add("@%d", offset()); | 3811 stream->Add("@%d", offset()); |
3813 } | 3812 } |
3814 | 3813 |
3815 } } // namespace v8::internal | 3814 } } // namespace v8::internal |
OLD | NEW |