| Index: src/arm64/code-stubs-arm64.cc
|
| diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
|
| index 9bd2dcaee855c173a8faeda215203f22058db8f4..a42f5cd34da87677a2f8fd4d59c417c82fbb4ee5 100644
|
| --- a/src/arm64/code-stubs-arm64.cc
|
| +++ b/src/arm64/code-stubs-arm64.cc
|
| @@ -4405,215 +4405,6 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| -void ArrayPushStub::Generate(MacroAssembler* masm) {
|
| - Register receiver = x0;
|
| -
|
| - int argc = arguments_count();
|
| -
|
| - if (argc == 0) {
|
| - // Nothing to do, just return the length.
|
| - __ Ldr(x0, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ Drop(argc + 1);
|
| - __ Ret();
|
| - return;
|
| - }
|
| -
|
| - Isolate* isolate = masm->isolate();
|
| -
|
| - if (argc != 1) {
|
| - __ TailCallExternalReference(
|
| - ExternalReference(Builtins::c_ArrayPush, isolate), argc + 1, 1);
|
| - return;
|
| - }
|
| -
|
| - Label call_builtin, attempt_to_grow_elements, with_write_barrier;
|
| -
|
| - Register elements_length = x8;
|
| - Register length = x7;
|
| - Register elements = x6;
|
| - Register end_elements = x5;
|
| - Register value = x4;
|
| - // Get the elements array of the object.
|
| - __ Ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
|
| -
|
| - if (IsFastSmiOrObjectElementsKind(elements_kind())) {
|
| - // Check that the elements are in fast mode and writable.
|
| - __ CheckMap(elements,
|
| - x10,
|
| - Heap::kFixedArrayMapRootIndex,
|
| - &call_builtin,
|
| - DONT_DO_SMI_CHECK);
|
| - }
|
| -
|
| - // Get the array's length and calculate new length.
|
| - __ Ldr(length, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - STATIC_ASSERT(kSmiTag == 0);
|
| - __ Add(length, length, Smi::FromInt(argc));
|
| -
|
| - // Check if we could survive without allocation.
|
| - __ Ldr(elements_length,
|
| - FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| - __ Cmp(length, elements_length);
|
| -
|
| - const int kEndElementsOffset =
|
| - FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize;
|
| -
|
| - if (IsFastSmiOrObjectElementsKind(elements_kind())) {
|
| - __ B(gt, &attempt_to_grow_elements);
|
| -
|
| - // Check if value is a smi.
|
| - __ Peek(value, (argc - 1) * kPointerSize);
|
| - __ JumpIfNotSmi(value, &with_write_barrier);
|
| -
|
| - // Store the value.
|
| - // We may need a register containing the address end_elements below,
|
| - // so write back the value in end_elements.
|
| - __ Add(end_elements, elements,
|
| - Operand::UntagSmiAndScale(length, kPointerSizeLog2));
|
| - __ Str(value, MemOperand(end_elements, kEndElementsOffset, PreIndex));
|
| - } else {
|
| - __ B(gt, &call_builtin);
|
| -
|
| - __ Peek(value, (argc - 1) * kPointerSize);
|
| - __ StoreNumberToDoubleElements(value, length, elements, x10, d0, d1,
|
| - &call_builtin, argc * kDoubleSize);
|
| - }
|
| -
|
| - // Save new length.
|
| - __ Str(length, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - // Return length.
|
| - __ Drop(argc + 1);
|
| - __ Mov(x0, length);
|
| - __ Ret();
|
| -
|
| - if (IsFastDoubleElementsKind(elements_kind())) {
|
| - __ Bind(&call_builtin);
|
| - __ TailCallExternalReference(
|
| - ExternalReference(Builtins::c_ArrayPush, isolate), argc + 1, 1);
|
| - return;
|
| - }
|
| -
|
| - __ Bind(&with_write_barrier);
|
| -
|
| - if (IsFastSmiElementsKind(elements_kind())) {
|
| - if (FLAG_trace_elements_transitions) {
|
| - __ B(&call_builtin);
|
| - }
|
| -
|
| - __ Ldr(x10, FieldMemOperand(value, HeapObject::kMapOffset));
|
| - __ JumpIfHeapNumber(x10, &call_builtin);
|
| -
|
| - ElementsKind target_kind = IsHoleyElementsKind(elements_kind())
|
| - ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS;
|
| - __ Ldr(x10, GlobalObjectMemOperand());
|
| - __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kNativeContextOffset));
|
| - __ Ldr(x10, ContextMemOperand(x10, Context::JS_ARRAY_MAPS_INDEX));
|
| - const int header_size = FixedArrayBase::kHeaderSize;
|
| - // Verify that the object can be transitioned in place.
|
| - const int origin_offset = header_size + elements_kind() * kPointerSize;
|
| - __ ldr(x11, FieldMemOperand(receiver, origin_offset));
|
| - __ ldr(x12, FieldMemOperand(x10, HeapObject::kMapOffset));
|
| - __ cmp(x11, x12);
|
| - __ B(ne, &call_builtin);
|
| -
|
| - const int target_offset = header_size + target_kind * kPointerSize;
|
| - __ Ldr(x10, FieldMemOperand(x10, target_offset));
|
| - __ Mov(x11, receiver);
|
| - ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
|
| - masm, DONT_TRACK_ALLOCATION_SITE, NULL);
|
| - }
|
| -
|
| - // Save new length.
|
| - __ Str(length, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - // Store the value.
|
| - // We may need a register containing the address end_elements below,
|
| - // so write back the value in end_elements.
|
| - __ Add(end_elements, elements,
|
| - Operand::UntagSmiAndScale(length, kPointerSizeLog2));
|
| - __ Str(value, MemOperand(end_elements, kEndElementsOffset, PreIndex));
|
| -
|
| - __ RecordWrite(elements,
|
| - end_elements,
|
| - value,
|
| - kLRHasNotBeenSaved,
|
| - kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| - OMIT_SMI_CHECK);
|
| - __ Drop(argc + 1);
|
| - __ Mov(x0, length);
|
| - __ Ret();
|
| -
|
| - __ Bind(&attempt_to_grow_elements);
|
| -
|
| - if (!FLAG_inline_new) {
|
| - __ B(&call_builtin);
|
| - }
|
| -
|
| - Register argument = x2;
|
| - __ Peek(argument, (argc - 1) * kPointerSize);
|
| - // Growing elements that are SMI-only requires special handling in case
|
| - // the new element is non-Smi. For now, delegate to the builtin.
|
| - if (IsFastSmiElementsKind(elements_kind())) {
|
| - __ JumpIfNotSmi(argument, &call_builtin);
|
| - }
|
| -
|
| - // We could be lucky and the elements array could be at the top of new-space.
|
| - // In this case we can just grow it in place by moving the allocation pointer
|
| - // up.
|
| - ExternalReference new_space_allocation_top =
|
| - ExternalReference::new_space_allocation_top_address(isolate);
|
| - ExternalReference new_space_allocation_limit =
|
| - ExternalReference::new_space_allocation_limit_address(isolate);
|
| -
|
| - const int kAllocationDelta = 4;
|
| - ASSERT(kAllocationDelta >= argc);
|
| - Register allocation_top_addr = x5;
|
| - Register allocation_top = x9;
|
| - // Load top and check if it is the end of elements.
|
| - __ Add(end_elements, elements,
|
| - Operand::UntagSmiAndScale(length, kPointerSizeLog2));
|
| - __ Add(end_elements, end_elements, kEndElementsOffset);
|
| - __ Mov(allocation_top_addr, new_space_allocation_top);
|
| - __ Ldr(allocation_top, MemOperand(allocation_top_addr));
|
| - __ Cmp(end_elements, allocation_top);
|
| - __ B(ne, &call_builtin);
|
| -
|
| - __ Mov(x10, new_space_allocation_limit);
|
| - __ Ldr(x10, MemOperand(x10));
|
| - __ Add(allocation_top, allocation_top, kAllocationDelta * kPointerSize);
|
| - __ Cmp(allocation_top, x10);
|
| - __ B(hi, &call_builtin);
|
| -
|
| - // We fit and could grow elements.
|
| - // Update new_space_allocation_top.
|
| - __ Str(allocation_top, MemOperand(allocation_top_addr));
|
| - // Push the argument.
|
| - __ Str(argument, MemOperand(end_elements));
|
| - // Fill the rest with holes.
|
| - __ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
|
| - ASSERT(kAllocationDelta == 4);
|
| - __ Stp(x10, x10, MemOperand(end_elements, 1 * kPointerSize));
|
| - __ Stp(x10, x10, MemOperand(end_elements, 3 * kPointerSize));
|
| -
|
| - // Update elements' and array's sizes.
|
| - __ Str(length, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ Add(elements_length, elements_length, Smi::FromInt(kAllocationDelta));
|
| - __ Str(elements_length,
|
| - FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| -
|
| - // Elements are in new space, so write barrier is not required.
|
| - __ Drop(argc + 1);
|
| - __ Mov(x0, length);
|
| - __ Ret();
|
| -
|
| - __ Bind(&call_builtin);
|
| - __ TailCallExternalReference(
|
| - ExternalReference(Builtins::c_ArrayPush, isolate), argc + 1, 1);
|
| -}
|
| -
|
| -
|
| void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- x1 : left
|
|
|