OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 11916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11927 : JSReceiver::GetDataProperty(&it); | 11927 : JSReceiver::GetDataProperty(&it); |
11928 old_values->Add(value); | 11928 old_values->Add(value); |
11929 indices->Add(index); | 11929 indices->Add(index); |
11930 return true; | 11930 return true; |
11931 } | 11931 } |
11932 | 11932 |
11933 | 11933 |
11934 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { | 11934 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { |
11935 // We should never end in here with a pixel or external array. | 11935 // We should never end in here with a pixel or external array. |
11936 DCHECK(array->AllowsSetLength()); | 11936 DCHECK(array->AllowsSetLength()); |
| 11937 if (JSArray::SetLengthWouldNormalize(array->GetHeap(), new_length)) { |
| 11938 JSObject::NormalizeElements(array); |
| 11939 } |
11937 array->GetElementsAccessor()->SetLength(array, new_length); | 11940 array->GetElementsAccessor()->SetLength(array, new_length); |
11938 } | 11941 } |
11939 | 11942 |
11940 | 11943 |
11941 MaybeHandle<Object> JSArray::ObservableSetLength(Handle<JSArray> array, | 11944 MaybeHandle<Object> JSArray::ObservableSetLength(Handle<JSArray> array, |
11942 uint32_t new_length) { | 11945 uint32_t new_length) { |
11943 if (!array->map()->is_observed()) { | 11946 if (!array->map()->is_observed()) { |
11944 SetLength(array, new_length); | 11947 SetLength(array, new_length); |
11945 return array; | 11948 return array; |
11946 } | 11949 } |
(...skipping 4707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16654 Handle<Object> new_value) { | 16657 Handle<Object> new_value) { |
16655 if (cell->value() != *new_value) { | 16658 if (cell->value() != *new_value) { |
16656 cell->set_value(*new_value); | 16659 cell->set_value(*new_value); |
16657 Isolate* isolate = cell->GetIsolate(); | 16660 Isolate* isolate = cell->GetIsolate(); |
16658 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16661 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16659 isolate, DependentCode::kPropertyCellChangedGroup); | 16662 isolate, DependentCode::kPropertyCellChangedGroup); |
16660 } | 16663 } |
16661 } | 16664 } |
16662 } // namespace internal | 16665 } // namespace internal |
16663 } // namespace v8 | 16666 } // namespace v8 |
OLD | NEW |