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 11918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11929 | 11929 |
11930 return Execution::Call( | 11930 return Execution::Call( |
11931 isolate, Handle<JSFunction>(isolate->observers_end_perform_splice()), | 11931 isolate, Handle<JSFunction>(isolate->observers_end_perform_splice()), |
11932 isolate->factory()->undefined_value(), arraysize(args), args); | 11932 isolate->factory()->undefined_value(), arraysize(args), args); |
11933 } | 11933 } |
11934 | 11934 |
11935 | 11935 |
11936 MaybeHandle<Object> JSArray::SetElementsLength( | 11936 MaybeHandle<Object> JSArray::SetElementsLength( |
11937 Handle<JSArray> array, | 11937 Handle<JSArray> array, |
11938 Handle<Object> new_length_handle) { | 11938 Handle<Object> new_length_handle) { |
11939 if (array->HasFastElements()) { | 11939 if (array->HasFastElements() && |
11940 // If the new array won't fit in a some non-trivial fraction of the max old | 11940 SetElementsLengthWouldNormalize(array->GetHeap(), new_length_handle)) { |
11941 // space size, then force it to go dictionary mode. | 11941 NormalizeElements(array); |
11942 int max_fast_array_size = static_cast<int>( | |
11943 (array->GetHeap()->MaxOldGenerationSize() / kDoubleSize) / 4); | |
11944 if (new_length_handle->IsNumber() && | |
11945 NumberToInt32(*new_length_handle) >= max_fast_array_size) { | |
11946 NormalizeElements(array); | |
11947 } | |
11948 } | 11942 } |
11949 | 11943 |
11950 // We should never end in here with a pixel or external array. | 11944 // We should never end in here with a pixel or external array. |
11951 DCHECK(array->AllowsSetElementsLength()); | 11945 DCHECK(array->AllowsSetElementsLength()); |
11952 if (!array->map()->is_observed()) { | 11946 if (!array->map()->is_observed()) { |
11953 return array->GetElementsAccessor()->SetLength(array, new_length_handle); | 11947 return array->GetElementsAccessor()->SetLength(array, new_length_handle); |
11954 } | 11948 } |
11955 | 11949 |
11956 Isolate* isolate = array->GetIsolate(); | 11950 Isolate* isolate = array->GetIsolate(); |
11957 List<uint32_t> indices; | 11951 List<uint32_t> indices; |
(...skipping 5093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17051 CompilationInfo* info) { | 17045 CompilationInfo* info) { |
17052 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17046 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17053 handle(cell->dependent_code(), info->isolate()), | 17047 handle(cell->dependent_code(), info->isolate()), |
17054 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17048 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17055 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17049 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17056 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17050 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17057 cell, info->zone()); | 17051 cell, info->zone()); |
17058 } | 17052 } |
17059 | 17053 |
17060 } } // namespace v8::internal | 17054 } } // namespace v8::internal |
OLD | NEW |