OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 8124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8135 switch (kind) { | 8135 switch (kind) { |
8136 case FAST_ELEMENTS: { | 8136 case FAST_ELEMENTS: { |
8137 uint32_t length = IsJSArray() ? | 8137 uint32_t length = IsJSArray() ? |
8138 static_cast<uint32_t> | 8138 static_cast<uint32_t> |
8139 (Smi::cast(JSArray::cast(this)->length())->value()) : | 8139 (Smi::cast(JSArray::cast(this)->length())->value()) : |
8140 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 8140 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
8141 if ((index < length) && | 8141 if ((index < length) && |
8142 !FixedArray::cast(elements())->get(index)->IsTheHole()) return true; | 8142 !FixedArray::cast(elements())->get(index)->IsTheHole()) return true; |
8143 break; | 8143 break; |
8144 } | 8144 } |
8145 case FAST_DOUBLE_ELEMENTS: { | |
8146 uint32_t length = IsJSArray() ? | |
8147 static_cast<uint32_t> | |
8148 (Smi::cast(JSArray::cast(this)->length())->value()) : | |
8149 static_cast<uint32_t>(FixedDoubleArray::cast(elements())->length()); | |
8150 if ((index < length) && | |
8151 !FixedDoubleArray::cast(elements())->is_the_hole(index)) return true; | |
8152 break; | |
8153 } | |
8145 case EXTERNAL_PIXEL_ELEMENTS: { | 8154 case EXTERNAL_PIXEL_ELEMENTS: { |
8146 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); | 8155 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
8147 if (index < static_cast<uint32_t>(pixels->length())) { | 8156 if (index < static_cast<uint32_t>(pixels->length())) { |
8148 return true; | 8157 return true; |
8149 } | 8158 } |
8150 break; | 8159 break; |
8151 } | 8160 } |
8152 case EXTERNAL_BYTE_ELEMENTS: | 8161 case EXTERNAL_BYTE_ELEMENTS: |
8153 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 8162 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
8154 case EXTERNAL_SHORT_ELEMENTS: | 8163 case EXTERNAL_SHORT_ELEMENTS: |
8155 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 8164 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
8156 case EXTERNAL_INT_ELEMENTS: | 8165 case EXTERNAL_INT_ELEMENTS: |
8157 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 8166 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
8158 case EXTERNAL_FLOAT_ELEMENTS: | 8167 case EXTERNAL_FLOAT_ELEMENTS: |
8159 case EXTERNAL_DOUBLE_ELEMENTS: { | 8168 case EXTERNAL_DOUBLE_ELEMENTS: { |
8160 ExternalArray* array = ExternalArray::cast(elements()); | 8169 ExternalArray* array = ExternalArray::cast(elements()); |
8161 if (index < static_cast<uint32_t>(array->length())) { | 8170 if (index < static_cast<uint32_t>(array->length())) { |
8162 return true; | 8171 return true; |
8163 } | 8172 } |
8164 break; | 8173 break; |
8165 } | 8174 } |
8166 case FAST_DOUBLE_ELEMENTS: | |
8167 UNREACHABLE(); | |
8168 break; | |
8169 case DICTIONARY_ELEMENTS: { | 8175 case DICTIONARY_ELEMENTS: { |
8170 if (element_dictionary()->FindEntry(index) | 8176 if (element_dictionary()->FindEntry(index) |
8171 != NumberDictionary::kNotFound) { | 8177 != NumberDictionary::kNotFound) { |
8172 return true; | 8178 return true; |
8173 } | 8179 } |
8174 break; | 8180 break; |
8175 } | 8181 } |
8176 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 8182 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
8177 FixedArray* parameter_map = FixedArray::cast(elements()); | 8183 FixedArray* parameter_map = FixedArray::cast(elements()); |
8178 uint32_t length = parameter_map->length(); | 8184 uint32_t length = parameter_map->length(); |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9625 int length = ExternalArray::cast(elements())->length(); | 9631 int length = ExternalArray::cast(elements())->length(); |
9626 while (counter < length) { | 9632 while (counter < length) { |
9627 if (storage != NULL) { | 9633 if (storage != NULL) { |
9628 storage->set(counter, Smi::FromInt(counter)); | 9634 storage->set(counter, Smi::FromInt(counter)); |
9629 } | 9635 } |
9630 counter++; | 9636 counter++; |
9631 } | 9637 } |
9632 ASSERT(!storage || storage->length() >= counter); | 9638 ASSERT(!storage || storage->length() >= counter); |
9633 break; | 9639 break; |
9634 } | 9640 } |
9635 case FAST_DOUBLE_ELEMENTS: | 9641 case FAST_DOUBLE_ELEMENTS: { |
Mads Ager (chromium)
2011/07/20 10:10:29
Move this to right after FAST_ELEMENTS so the simi
| |
9636 UNREACHABLE(); | 9642 int length = IsJSArray() ? |
9643 Smi::cast(JSArray::cast(this)->length())->value() : | |
9644 FixedDoubleArray::cast(elements())->length(); | |
9645 for (int i = 0; i < length; i++) { | |
9646 if (!FixedDoubleArray::cast(elements())->is_the_hole(i)) { | |
9647 if (storage != NULL) { | |
9648 storage->set(counter, Smi::FromInt(i)); | |
9649 } | |
9650 counter++; | |
9651 } | |
9652 } | |
9653 ASSERT(!storage || storage->length() >= counter); | |
9637 break; | 9654 break; |
9655 } | |
9638 case DICTIONARY_ELEMENTS: { | 9656 case DICTIONARY_ELEMENTS: { |
9639 if (storage != NULL) { | 9657 if (storage != NULL) { |
9640 element_dictionary()->CopyKeysTo(storage, | 9658 element_dictionary()->CopyKeysTo(storage, |
9641 filter, | 9659 filter, |
9642 NumberDictionary::SORTED); | 9660 NumberDictionary::SORTED); |
9643 } | 9661 } |
9644 counter += element_dictionary()->NumberOfElementsFilterAttributes(filter); | 9662 counter += element_dictionary()->NumberOfElementsFilterAttributes(filter); |
9645 break; | 9663 break; |
9646 } | 9664 } |
9647 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 9665 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11818 if (break_point_objects()->IsUndefined()) return 0; | 11836 if (break_point_objects()->IsUndefined()) return 0; |
11819 // Single beak point. | 11837 // Single beak point. |
11820 if (!break_point_objects()->IsFixedArray()) return 1; | 11838 if (!break_point_objects()->IsFixedArray()) return 1; |
11821 // Multiple break points. | 11839 // Multiple break points. |
11822 return FixedArray::cast(break_point_objects())->length(); | 11840 return FixedArray::cast(break_point_objects())->length(); |
11823 } | 11841 } |
11824 #endif | 11842 #endif |
11825 | 11843 |
11826 | 11844 |
11827 } } // namespace v8::internal | 11845 } } // namespace v8::internal |
OLD | NEW |