Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index a84d15015c4e3aa01ea5f7cb2cf780b42ad80249..6bcebd8a2e149361b2d8aac4221989ae46287db4 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -195,14 +195,6 @@ inline bool ClampedToInteger(Object* object, int* out) { |
} |
-void MoveDoubleElements(FixedDoubleArray* dst, int dst_index, |
- FixedDoubleArray* src, int src_index, int len) { |
- if (len == 0) return; |
- MemMove(dst->data_start() + dst_index, src->data_start() + src_index, |
- len * kDoubleSize); |
-} |
- |
- |
inline bool GetSloppyArgumentsLength(Isolate* isolate, Handle<JSObject> object, |
int* out) { |
Map* arguments_map = |
@@ -432,30 +424,7 @@ BUILTIN(ArrayShift) { |
return CallJsIntrinsic(isolate, isolate->array_shift(), args); |
} |
- // Get first element |
- Handle<Object> first; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, first, |
- Object::GetElement(isolate, array, 0)); |
- |
- if (heap->CanMoveObjectStart(*elms_obj)) { |
- array->set_elements(heap->LeftTrimFixedArray(*elms_obj, 1)); |
- } else { |
- // Shift the elements. |
- if (elms_obj->IsFixedArray()) { |
- Handle<FixedArray> elms = Handle<FixedArray>::cast(elms_obj); |
- DisallowHeapAllocation no_gc; |
- heap->MoveElements(*elms, 0, 1, len - 1); |
- elms->set(len - 1, heap->the_hole_value()); |
- } else { |
- Handle<FixedDoubleArray> elms = Handle<FixedDoubleArray>::cast(elms_obj); |
- MoveDoubleElements(*elms, 0, *elms, 1, len - 1); |
- elms->set_the_hole(len - 1); |
- } |
- } |
- |
- // Set the length. |
- array->set_length(Smi::FromInt(len - 1)); |
- |
+ Handle<Object> first = array->GetElementsAccessor()->Shift(array, elms_obj); |
return *first; |
} |