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 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2583 stream->Add(" check_hole"); | 2583 stream->Add(" check_hole"); |
2584 } | 2584 } |
2585 } | 2585 } |
2586 | 2586 |
2587 | 2587 |
2588 bool HLoadKeyed::UsesMustHandleHole() const { | 2588 bool HLoadKeyed::UsesMustHandleHole() const { |
2589 if (IsFastPackedElementsKind(elements_kind())) { | 2589 if (IsFastPackedElementsKind(elements_kind())) { |
2590 return false; | 2590 return false; |
2591 } | 2591 } |
2592 | 2592 |
2593 if (IsExternalArrayElementsKind(elements_kind())) { | |
2594 return false; | |
2595 } | |
2596 | |
2593 if (hole_mode() == ALLOW_RETURN_HOLE) return true; | 2597 if (hole_mode() == ALLOW_RETURN_HOLE) return true; |
2594 | 2598 |
2595 if (IsFastDoubleElementsKind(elements_kind())) { | 2599 if (IsFastDoubleElementsKind(elements_kind())) { |
2596 return false; | 2600 return false; |
2597 } | 2601 } |
2598 | 2602 |
2599 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | 2603 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
2600 HValue* use = it.value(); | 2604 HValue* use = it.value(); |
2601 if (!use->IsChange()) { | 2605 if (!use->IsChange()) { |
2602 return false; | 2606 return false; |
2603 } | 2607 } |
2604 } | 2608 } |
2605 | 2609 |
2606 return true; | 2610 return true; |
2607 } | 2611 } |
2608 | 2612 |
2609 | 2613 |
2610 bool HLoadKeyed::RequiresHoleCheck() const { | 2614 bool HLoadKeyed::RequiresHoleCheck() const { |
2611 if (IsFastPackedElementsKind(elements_kind())) { | 2615 if (IsFastPackedElementsKind(elements_kind())) { |
2612 return false; | 2616 return false; |
2613 } | 2617 } |
2614 | 2618 |
2619 if (IsExternalArrayElementsKind(elements_kind())) { | |
2620 return false; | |
2621 } | |
2622 | |
2615 return !UsesMustHandleHole(); | 2623 return !UsesMustHandleHole(); |
2616 } | 2624 } |
2617 | 2625 |
2618 | 2626 |
2619 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { | 2627 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
2620 object()->PrintNameTo(stream); | 2628 object()->PrintNameTo(stream); |
2621 stream->Add("["); | 2629 stream->Add("["); |
2622 key()->PrintNameTo(stream); | 2630 key()->PrintNameTo(stream); |
2623 stream->Add("]"); | 2631 stream->Add("]"); |
2624 } | 2632 } |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3030 return left(); | 3038 return left(); |
3031 } | 3039 } |
3032 return NULL; | 3040 return NULL; |
3033 } | 3041 } |
3034 | 3042 |
3035 | 3043 |
3036 bool HStoreKeyed::NeedsCanonicalization() { | 3044 bool HStoreKeyed::NeedsCanonicalization() { |
3037 // If value is an integer or smi or comes from the result of a keyed load or | 3045 // If value is an integer or smi or comes from the result of a keyed load or |
3038 // constant then it is either be a non-hole value or in the case of a constant | 3046 // constant then it is either be a non-hole value or in the case of a constant |
3039 // the hole is only being stored explicitly: no need for canonicalization. | 3047 // the hole is only being stored explicitly: no need for canonicalization. |
3040 if (value()->IsLoadKeyed() || value()->IsConstant()) { | 3048 // |
3049 // The exception to that is keyed loads from external float or double arrays: | |
3050 // these can load arbitrary representation of NaN. | |
3051 | |
3052 if (value()->IsConstant()) { | |
3041 return false; | 3053 return false; |
3042 } | 3054 } |
3043 | 3055 |
3056 if (value()->IsLoadKeyed()) { | |
3057 ElementsKind load_elements_kind = | |
3058 HLoadKeyed::cast(value())->elements_kind(); | |
3059 | |
3060 return load_elements_kind == EXTERNAL_FLOAT_ELEMENTS | |
danno
2013/03/28 12:30:40
Maybe add a predicate to elements-kind.h: IsExtern
| |
3061 || load_elements_kind == EXTERNAL_DOUBLE_ELEMENTS; | |
3062 } | |
3063 | |
3044 if (value()->IsChange()) { | 3064 if (value()->IsChange()) { |
3045 if (HChange::cast(value())->from().IsInteger32()) { | 3065 if (HChange::cast(value())->from().IsInteger32()) { |
3046 return false; | 3066 return false; |
3047 } | 3067 } |
3048 if (HChange::cast(value())->value()->type().IsSmi()) { | 3068 if (HChange::cast(value())->value()->type().IsSmi()) { |
3049 return false; | 3069 return false; |
3050 } | 3070 } |
3051 } | 3071 } |
3052 return true; | 3072 return true; |
3053 } | 3073 } |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3519 | 3539 |
3520 | 3540 |
3521 void HCheckFunction::Verify() { | 3541 void HCheckFunction::Verify() { |
3522 HInstruction::Verify(); | 3542 HInstruction::Verify(); |
3523 ASSERT(HasNoUses()); | 3543 ASSERT(HasNoUses()); |
3524 } | 3544 } |
3525 | 3545 |
3526 #endif | 3546 #endif |
3527 | 3547 |
3528 } } // namespace v8::internal | 3548 } } // namespace v8::internal |
OLD | NEW |