Commit dcdabdc8 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[elements] Improve Array.prototype.splice speed

By using memmove for SMI elements we get a roughly 3x speedup over the slower
iterative copying with write barriers.

Bug: chromium:835558
Change-Id: I73da07a1648a3495ff78212ffa1ed949d205a7d2
Reviewed-on: https://chromium-review.googlesource.com/1028236Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52792}
parent a3142476
......@@ -2298,6 +2298,9 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
if (IsDoubleElementsKind(KindTraits::Kind)) {
MemMove(dst_elms->data_start() + dst_index,
dst_elms->data_start() + src_index, len * kDoubleSize);
} else if (IsSmiElementsKind(KindTraits::Kind)) {
MemMove(dst_elms->data_start() + dst_index,
dst_elms->data_start() + src_index, len * kPointerSize);
} else {
DisallowHeapAllocation no_gc;
heap->MoveElements(FixedArray::cast(*dst_elms), dst_index, src_index,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment