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 10005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10016 if (backing_store->IsDictionary()) { | 10016 if (backing_store->IsDictionary()) { |
10017 SeededNumberDictionary* dictionary = | 10017 SeededNumberDictionary* dictionary = |
10018 SeededNumberDictionary::cast(backing_store); | 10018 SeededNumberDictionary::cast(backing_store); |
10019 *capacity = dictionary->Capacity(); | 10019 *capacity = dictionary->Capacity(); |
10020 *used = dictionary->NumberOfElements(); | 10020 *used = dictionary->NumberOfElements(); |
10021 break; | 10021 break; |
10022 } | 10022 } |
10023 // Fall through. | 10023 // Fall through. |
10024 case FAST_SMI_ELEMENTS: | 10024 case FAST_SMI_ELEMENTS: |
10025 case FAST_ELEMENTS: | 10025 case FAST_ELEMENTS: |
10026 if (FLAG_packed_arrays && IsJSArray()) { | |
Jakob Kummerow
2012/06/12 12:50:44
This flag check isn't necessary, as we can't have
danno
2012/06/12 15:38:14
Done.
| |
10027 *capacity = backing_store_base->length(); | |
10028 *used = Smi::cast(JSArray::cast(this)->length())->value(); | |
10029 break; | |
10030 } | |
10031 // Fall through if packing is not guaranteed. | |
10026 case FAST_HOLEY_SMI_ELEMENTS: | 10032 case FAST_HOLEY_SMI_ELEMENTS: |
10027 case FAST_HOLEY_ELEMENTS: | 10033 case FAST_HOLEY_ELEMENTS: |
10028 backing_store = FixedArray::cast(backing_store_base); | 10034 backing_store = FixedArray::cast(backing_store_base); |
10029 *capacity = backing_store->length(); | 10035 *capacity = backing_store->length(); |
10030 for (int i = 0; i < *capacity; ++i) { | 10036 for (int i = 0; i < *capacity; ++i) { |
10031 if (!backing_store->get(i)->IsTheHole()) ++(*used); | 10037 if (!backing_store->get(i)->IsTheHole()) ++(*used); |
10032 } | 10038 } |
10033 break; | 10039 break; |
10034 case DICTIONARY_ELEMENTS: { | 10040 case DICTIONARY_ELEMENTS: { |
10035 SeededNumberDictionary* dictionary = | 10041 SeededNumberDictionary* dictionary = |
10036 SeededNumberDictionary::cast(FixedArray::cast(elements())); | 10042 SeededNumberDictionary::cast(FixedArray::cast(elements())); |
10037 *capacity = dictionary->Capacity(); | 10043 *capacity = dictionary->Capacity(); |
10038 *used = dictionary->NumberOfElements(); | 10044 *used = dictionary->NumberOfElements(); |
10039 break; | 10045 break; |
10040 } | 10046 } |
10041 case FAST_DOUBLE_ELEMENTS: | 10047 case FAST_DOUBLE_ELEMENTS: |
10048 if (FLAG_packed_arrays && IsJSArray()) { | |
10049 *capacity = backing_store_base->length(); | |
10050 *used = Smi::cast(JSArray::cast(this)->length())->value(); | |
10051 break; | |
10052 } | |
10053 // Fall through if packing is not guaranteed. | |
10042 case FAST_HOLEY_DOUBLE_ELEMENTS: { | 10054 case FAST_HOLEY_DOUBLE_ELEMENTS: { |
10043 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); | 10055 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); |
10044 *capacity = elms->length(); | 10056 *capacity = elms->length(); |
10045 for (int i = 0; i < *capacity; i++) { | 10057 for (int i = 0; i < *capacity; i++) { |
10046 if (!elms->is_the_hole(i)) ++(*used); | 10058 if (!elms->is_the_hole(i)) ++(*used); |
10047 } | 10059 } |
10048 break; | 10060 break; |
10049 } | 10061 } |
10050 case EXTERNAL_BYTE_ELEMENTS: | 10062 case EXTERNAL_BYTE_ELEMENTS: |
10051 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10063 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13184 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13196 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13185 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13197 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13186 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13198 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13187 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13199 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13188 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13200 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13189 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13201 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13190 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13202 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13191 } | 13203 } |
13192 | 13204 |
13193 } } // namespace v8::internal | 13205 } } // namespace v8::internal |
OLD | NEW |