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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 if (new_length < old_length) { | 1357 if (new_length < old_length) { |
1358 // Find last non-deletable element in range of elements to be | 1358 // Find last non-deletable element in range of elements to be |
1359 // deleted and adjust range accordingly. | 1359 // deleted and adjust range accordingly. |
1360 for (int i = 0; i < capacity; i++) { | 1360 for (int i = 0; i < capacity; i++) { |
1361 DisallowHeapAllocation no_gc; | 1361 DisallowHeapAllocation no_gc; |
1362 Object* key = dict->KeyAt(i); | 1362 Object* key = dict->KeyAt(i); |
1363 if (key->IsNumber()) { | 1363 if (key->IsNumber()) { |
1364 uint32_t number = static_cast<uint32_t>(key->Number()); | 1364 uint32_t number = static_cast<uint32_t>(key->Number()); |
1365 if (new_length <= number && number < old_length) { | 1365 if (new_length <= number && number < old_length) { |
1366 PropertyDetails details = dict->DetailsAt(i); | 1366 PropertyDetails details = dict->DetailsAt(i); |
1367 if (details.IsDontDelete()) new_length = number + 1; | 1367 if (!details.IsConfigurable()) new_length = number + 1; |
1368 } | 1368 } |
1369 } | 1369 } |
1370 } | 1370 } |
1371 if (new_length != length) { | 1371 if (new_length != length) { |
1372 length_object = isolate->factory()->NewNumberFromUint(new_length); | 1372 length_object = isolate->factory()->NewNumberFromUint(new_length); |
1373 } | 1373 } |
1374 } | 1374 } |
1375 | 1375 |
1376 if (new_length == 0) { | 1376 if (new_length == 0) { |
1377 // Flush the backing store. | 1377 // Flush the backing store. |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 UNREACHABLE(); | 1897 UNREACHABLE(); |
1898 break; | 1898 break; |
1899 } | 1899 } |
1900 | 1900 |
1901 array->set_elements(*elms); | 1901 array->set_elements(*elms); |
1902 array->set_length(Smi::FromInt(number_of_elements)); | 1902 array->set_length(Smi::FromInt(number_of_elements)); |
1903 return array; | 1903 return array; |
1904 } | 1904 } |
1905 | 1905 |
1906 } } // namespace v8::internal | 1906 } } // namespace v8::internal |
OLD | NEW |