Reviewers: Igor Sheludko,
Message:
ptal
Description:
Delete from non-array end by trimming the backing store
Please review this at https://codereview.chromium.org/1218663009/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -0 lines):
M src/elements.cc
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index
89b292a09338e6ad510ca7e59d95ec731751c8e1..c118dc08fa4578ac18601cc108c15e25651e881a
100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -1046,6 +1046,13 @@ class FastElementsAccessor
DCHECK(obj->HasFastSmiOrObjectElements() ||
obj->HasFastDoubleElements() ||
obj->HasFastArgumentsElements());
+ if (!obj->IsJSArray() &&
+ entry == static_cast<uint32_t>(store->length()) - 1) {
+
obj->GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*store,
+ 1);
+ return;
+ }
+
Handle<BackingStore> backing_store = Handle<BackingStore>::cast(store);
backing_store->set_the_hole(entry);
@@ -1065,6 +1072,17 @@ class FastElementsAccessor
}
if ((entry > 0 && backing_store->is_the_hole(entry - 1)) ||
(entry + 1 < length && backing_store->is_the_hole(entry + 1))) {
+ if (!obj->IsJSArray()) {
+ uint32_t i;
+ for (i = entry + 1; i < length; i++) {
+ if (!backing_store->is_the_hole(i)) break;
+ }
+ if (i == length) {
+ obj->GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(
+ *backing_store, length - entry);
+ return;
+ }
+ }
int num_used = 0;
for (int i = 0; i < backing_store->length(); ++i) {
if (!backing_store->is_the_hole(i)) ++num_used;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.