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/elements.h" | 5 #include "src/elements.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/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 | 1429 |
1430 static void DeleteAtEnd(Handle<JSObject> obj, | 1430 static void DeleteAtEnd(Handle<JSObject> obj, |
1431 Handle<BackingStore> backing_store, uint32_t entry) { | 1431 Handle<BackingStore> backing_store, uint32_t entry) { |
1432 uint32_t length = static_cast<uint32_t>(backing_store->length()); | 1432 uint32_t length = static_cast<uint32_t>(backing_store->length()); |
1433 Heap* heap = obj->GetHeap(); | 1433 Heap* heap = obj->GetHeap(); |
1434 for (; entry > 0; entry--) { | 1434 for (; entry > 0; entry--) { |
1435 if (!backing_store->is_the_hole(entry - 1)) break; | 1435 if (!backing_store->is_the_hole(entry - 1)) break; |
1436 } | 1436 } |
1437 if (entry == 0) { | 1437 if (entry == 0) { |
1438 FixedArray* empty = heap->empty_fixed_array(); | 1438 FixedArray* empty = heap->empty_fixed_array(); |
1439 if (Subclass::kind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS) { | 1439 // Dynamically ask for the elements kind here since we manually redirect |
| 1440 // the operations for argument backing stores. |
| 1441 if (obj->GetElementsKind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS) { |
1440 FixedArray::cast(obj->elements())->set(1, empty); | 1442 FixedArray::cast(obj->elements())->set(1, empty); |
1441 } else { | 1443 } else { |
1442 obj->set_elements(empty); | 1444 obj->set_elements(empty); |
1443 } | 1445 } |
1444 return; | 1446 return; |
1445 } | 1447 } |
1446 | 1448 |
1447 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*backing_store, | 1449 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*backing_store, |
1448 length - entry); | 1450 length - entry); |
1449 } | 1451 } |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 static uint32_t GetEntryForIndexImpl(JSObject* holder, | 2338 static uint32_t GetEntryForIndexImpl(JSObject* holder, |
2337 FixedArrayBase* parameters, | 2339 FixedArrayBase* parameters, |
2338 uint32_t index, PropertyFilter filter) { | 2340 uint32_t index, PropertyFilter filter) { |
2339 FixedArray* parameter_map = FixedArray::cast(parameters); | 2341 FixedArray* parameter_map = FixedArray::cast(parameters); |
2340 Object* probe = GetParameterMapArg(parameter_map, index); | 2342 Object* probe = GetParameterMapArg(parameter_map, index); |
2341 if (!probe->IsTheHole()) return index; | 2343 if (!probe->IsTheHole()) return index; |
2342 | 2344 |
2343 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); | 2345 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
2344 uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl(holder, arguments, | 2346 uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl(holder, arguments, |
2345 index, filter); | 2347 index, filter); |
2346 if (entry == kMaxUInt32) return entry; | 2348 if (entry == kMaxUInt32) return kMaxUInt32; |
2347 return (parameter_map->length() - 2) + entry; | 2349 return (parameter_map->length() - 2) + entry; |
2348 } | 2350 } |
2349 | 2351 |
2350 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { | 2352 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { |
2351 FixedArray* parameter_map = FixedArray::cast(holder->elements()); | 2353 FixedArray* parameter_map = FixedArray::cast(holder->elements()); |
2352 uint32_t length = parameter_map->length() - 2; | 2354 uint32_t length = parameter_map->length() - 2; |
2353 if (entry < length) { | 2355 if (entry < length) { |
2354 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); | 2356 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); |
2355 } | 2357 } |
2356 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); | 2358 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3039 insertion_index += len; | 3041 insertion_index += len; |
3040 } | 3042 } |
3041 | 3043 |
3042 DCHECK_EQ(insertion_index, result_len); | 3044 DCHECK_EQ(insertion_index, result_len); |
3043 return result_array; | 3045 return result_array; |
3044 } | 3046 } |
3045 | 3047 |
3046 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 3048 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
3047 } // namespace internal | 3049 } // namespace internal |
3048 } // namespace v8 | 3050 } // namespace v8 |
OLD | NEW |