| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 11420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11431 | 11431 |
| 11432 bool threw; | 11432 bool threw; |
| 11433 Execution::Call(isolate, | 11433 Execution::Call(isolate, |
| 11434 Handle<JSFunction>(isolate->observers_end_perform_splice()), | 11434 Handle<JSFunction>(isolate->observers_end_perform_splice()), |
| 11435 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, | 11435 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, |
| 11436 &threw); | 11436 &threw); |
| 11437 ASSERT(!threw); | 11437 ASSERT(!threw); |
| 11438 } | 11438 } |
| 11439 | 11439 |
| 11440 | 11440 |
| 11441 Handle<Object> JSArray::SetElementsLength(Handle<JSArray> array, | 11441 MaybeHandle<Object> JSArray::SetElementsLength( |
| 11442 Handle<Object> new_length_handle) { | 11442 Handle<JSArray> array, |
| 11443 Handle<Object> new_length_handle) { |
| 11443 // We should never end in here with a pixel or external array. | 11444 // We should never end in here with a pixel or external array. |
| 11444 ASSERT(array->AllowsSetElementsLength()); | 11445 ASSERT(array->AllowsSetElementsLength()); |
| 11445 if (!array->map()->is_observed()) { | 11446 if (!array->map()->is_observed()) { |
| 11446 return array->GetElementsAccessor()->SetLength(array, new_length_handle); | 11447 return array->GetElementsAccessor()->SetLength(array, new_length_handle); |
| 11447 } | 11448 } |
| 11448 | 11449 |
| 11449 Isolate* isolate = array->GetIsolate(); | 11450 Isolate* isolate = array->GetIsolate(); |
| 11450 List<uint32_t> indices; | 11451 List<uint32_t> indices; |
| 11451 List<Handle<Object> > old_values; | 11452 List<Handle<Object> > old_values; |
| 11452 Handle<Object> old_length_handle(array->length(), isolate); | 11453 Handle<Object> old_length_handle(array->length(), isolate); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 11470 Handle<FixedArray> keys = isolate->factory()->NewFixedArray(num_elements); | 11471 Handle<FixedArray> keys = isolate->factory()->NewFixedArray(num_elements); |
| 11471 array->GetLocalElementKeys(*keys, kNoAttrFilter); | 11472 array->GetLocalElementKeys(*keys, kNoAttrFilter); |
| 11472 while (num_elements-- > 0) { | 11473 while (num_elements-- > 0) { |
| 11473 uint32_t index = NumberToUint32(keys->get(num_elements)); | 11474 uint32_t index = NumberToUint32(keys->get(num_elements)); |
| 11474 if (index < new_length) break; | 11475 if (index < new_length) break; |
| 11475 if (!GetOldValue(isolate, array, index, &old_values, &indices)) break; | 11476 if (!GetOldValue(isolate, array, index, &old_values, &indices)) break; |
| 11476 } | 11477 } |
| 11477 } | 11478 } |
| 11478 } | 11479 } |
| 11479 | 11480 |
| 11480 Handle<Object> hresult = | 11481 Handle<Object> hresult; |
| 11481 array->GetElementsAccessor()->SetLength(array, new_length_handle); | 11482 ASSIGN_RETURN_ON_EXCEPTION( |
| 11482 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, hresult, hresult); | 11483 isolate, hresult, |
| 11484 array->GetElementsAccessor()->SetLength(array, new_length_handle), |
| 11485 Object); |
| 11483 | 11486 |
| 11484 CHECK(array->length()->ToArrayIndex(&new_length)); | 11487 CHECK(array->length()->ToArrayIndex(&new_length)); |
| 11485 if (old_length == new_length) return hresult; | 11488 if (old_length == new_length) return hresult; |
| 11486 | 11489 |
| 11487 BeginPerformSplice(array); | 11490 BeginPerformSplice(array); |
| 11488 | 11491 |
| 11489 for (int i = 0; i < indices.length(); ++i) { | 11492 for (int i = 0; i < indices.length(); ++i) { |
| 11490 // For deletions where the property was an accessor, old_values[i] | 11493 // For deletions where the property was an accessor, old_values[i] |
| 11491 // will be the hole, which instructs EnqueueChangeRecord to elide | 11494 // will be the hole, which instructs EnqueueChangeRecord to elide |
| 11492 // the "oldValue" property. | 11495 // the "oldValue" property. |
| (...skipping 5173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16666 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16669 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16667 static const char* error_messages_[] = { | 16670 static const char* error_messages_[] = { |
| 16668 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16671 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16669 }; | 16672 }; |
| 16670 #undef ERROR_MESSAGES_TEXTS | 16673 #undef ERROR_MESSAGES_TEXTS |
| 16671 return error_messages_[reason]; | 16674 return error_messages_[reason]; |
| 16672 } | 16675 } |
| 16673 | 16676 |
| 16674 | 16677 |
| 16675 } } // namespace v8::internal | 16678 } } // namespace v8::internal |
| OLD | NEW |