Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: src/elements.cc

Issue 1325483002: Adding ElementsAccessor::Pop (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-08-27_array_builtin_slice
Patch Set: fixing holey pop Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/messages.h" 10 #include "src/messages.h"
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 632 }
633 633
634 static Handle<JSArray> SpliceImpl(Handle<JSArray> receiver, 634 static Handle<JSArray> SpliceImpl(Handle<JSArray> receiver,
635 Handle<FixedArrayBase> backing_store, 635 Handle<FixedArrayBase> backing_store,
636 uint32_t start, uint32_t delete_count, 636 uint32_t start, uint32_t delete_count,
637 Arguments args, uint32_t add_count) { 637 Arguments args, uint32_t add_count) {
638 UNREACHABLE(); 638 UNREACHABLE();
639 return Handle<JSArray>(); 639 return Handle<JSArray>();
640 } 640 }
641 641
642 virtual Handle<Object> Pop(Handle<JSArray> receiver,
643 Handle<FixedArrayBase> backing_store) final {
644 return ElementsAccessorSubclass::PopImpl(receiver, backing_store);
645 }
646
647 static Handle<Object> PopImpl(Handle<JSArray> receiver,
Igor Sheludko 2015/08/31 14:08:03 I think FastElementsAccessor is a better place for
Camillo Bruni 2015/08/31 14:41:35 moved PopImpl down to FastElementsAccessor
648 Handle<FixedArrayBase> backing_store) {
649 uint32_t new_length =
650 static_cast<uint32_t>(Smi::cast(receiver->length())->value()) - 1;
651 Handle<Object> result =
652 ElementsAccessorSubclass::GetImpl(backing_store, new_length);
653 ElementsAccessorSubclass::SetLengthImpl(receiver, new_length,
654 backing_store);
655 return result;
656 }
642 657
643 virtual void SetLength(Handle<JSArray> array, uint32_t length) final { 658 virtual void SetLength(Handle<JSArray> array, uint32_t length) final {
644 ElementsAccessorSubclass::SetLengthImpl(array, length, 659 ElementsAccessorSubclass::SetLengthImpl(array, length,
645 handle(array->elements())); 660 handle(array->elements()));
646 } 661 }
647 662
648 static void SetLengthImpl(Handle<JSArray> array, uint32_t length, 663 static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
649 Handle<FixedArrayBase> backing_store); 664 Handle<FixedArrayBase> backing_store);
650 665
651 static Handle<FixedArrayBase> ConvertElementsWithCapacity( 666 static Handle<FixedArrayBase> ConvertElementsWithCapacity(
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 #define ACCESSOR_DELETE(Class, Kind, Store) delete elements_accessors_[Kind]; 2211 #define ACCESSOR_DELETE(Class, Kind, Store) delete elements_accessors_[Kind];
2197 ELEMENTS_LIST(ACCESSOR_DELETE) 2212 ELEMENTS_LIST(ACCESSOR_DELETE)
2198 #undef ACCESSOR_DELETE 2213 #undef ACCESSOR_DELETE
2199 elements_accessors_ = NULL; 2214 elements_accessors_ = NULL;
2200 } 2215 }
2201 2216
2202 2217
2203 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 2218 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
2204 } // namespace internal 2219 } // namespace internal
2205 } // namespace v8 2220 } // namespace v8
OLDNEW
« src/builtins.cc ('K') | « src/elements.h ('k') | src/elements-kind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698