Index: src/arm64/builtins-arm64.cc |
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc |
index 18de7f8a0955d0e964233e80c3a71a61a031af71..903f3321f153e65a4fc8c2c4d8a9792bb97b4486 100644 |
--- a/src/arm64/builtins-arm64.cc |
+++ b/src/arm64/builtins-arm64.cc |
@@ -1312,54 +1312,73 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
- // -- r0 : argc |
- // -- sp[0] : argArray |
- // -- sp[8] : thisArg |
- // -- sp[16] : receiver |
+ // -- x0 : argc |
+ // -- jssp[0] : argArray (if argc == 2) |
+ // -- jssp[8] : thisArg (if argc >= 1) |
+ // -- jssp[16] : receiver |
// ----------------------------------- |
ASM_LOCATION("Builtins::Generate_FunctionApply"); |
+ Register argc = x0; |
+ Register arg_array = x0; |
+ Register receiver = x1; |
+ Register this_arg = x2; |
+ Register undefined = x3; |
+ Register null = x4; |
+ |
+ __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); |
+ __ LoadRoot(null, Heap::kNullValueRootIndex); |
+ |
// 1. Load receiver into x1, argArray into x0 (if present), remove all |
// arguments from the stack (including the receiver), and push thisArg (if |
// present) instead. |
{ |
- Label done; |
- __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
- __ Mov(x3, x2); |
- __ Peek(x1, Operand(x0, LSL, kPointerSizeLog2)); // receiver |
- __ Subs(x4, x0, 1); |
- __ B(lt, &done); |
- __ Peek(x2, Operand(x4, LSL, kPointerSizeLog2)); // thisArg |
- __ Subs(x4, x4, 1); |
- __ B(lt, &done); |
- __ Peek(x3, Operand(x4, LSL, kPointerSizeLog2)); // argArray |
- __ Bind(&done); |
- __ Drop(x0); |
- __ Poke(x2, 0); |
- __ Mov(x0, x3); |
+ // Claim (2 - argc) dummy arguments from the stack, to put the stack in a |
+ // consistent state for a simple pop operation. |
+ Register neg_argc = x10; |
+ __ Negs(neg_argc, argc); // Negate; set the Z flag if argc == 0. |
+ __ Add(x11, neg_argc, 2); |
+ __ Claim(x11); |
+ |
+ // ----------- S t a t e ------------- |
+ // -- x0 : argc |
+ // -- jssp[0] : argArray (dummy value if argc <= 1) |
+ // -- jssp[8] : thisArg (dummy value if argc == 0) |
+ // -- jssp[16] : receiver |
+ // ----------------------------------- |
+ __ Pop(arg_array, this_arg); |
+ __ CmovX(this_arg, undefined, eq); // undefined if argc == 0. |
+ __ Cmp(neg_argc, -1); |
+ __ CmovX(arg_array, undefined, ge); // undefined if argc <= 1. |
+ |
+ __ Peek(receiver, 0); |
+ __ Poke(this_arg, 0); |
} |
// ----------- S t a t e ------------- |
- // -- x0 : argArray |
- // -- x1 : receiver |
- // -- sp[0] : thisArg |
+ // -- x0 : argArray |
+ // -- x1 : receiver |
+ // -- x3 : undefined root value |
+ // -- jssp[0] : thisArg |
// ----------------------------------- |
// 2. Make sure the receiver is actually callable. |
Label receiver_not_callable; |
- __ JumpIfSmi(x1, &receiver_not_callable); |
- __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); |
- __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
- __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &receiver_not_callable); |
+ __ JumpIfSmi(receiver, &receiver_not_callable); |
+ __ Ldr(x10, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
+ __ Ldrb(w10, FieldMemOperand(x10, Map::kBitFieldOffset)); |
+ __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable, |
+ &receiver_not_callable); |
// 3. Tail call with no arguments if argArray is null or undefined. |
Label no_arguments; |
- __ JumpIfRoot(x0, Heap::kNullValueRootIndex, &no_arguments); |
- __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, &no_arguments); |
+ __ Cmp(arg_array, null); |
+ __ Ccmp(arg_array, undefined, ZFlag, ne); |
+ __ B(eq, &no_arguments); |
// 4a. Apply the receiver to the given argArray (passing undefined for |
- // new.target). |
- __ LoadRoot(x3, Heap::kUndefinedValueRootIndex); |
+ // new.target in x3). |
+ DCHECK(undefined.Is(x3)); |
__ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
// 4b. The argArray is either null or undefined, so we tail call without any |
@@ -1367,13 +1386,14 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
__ Bind(&no_arguments); |
{ |
__ Mov(x0, 0); |
+ DCHECK(receiver.Is(x1)); |
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
} |
// 4c. The receiver is not callable, throw an appropriate TypeError. |
__ Bind(&receiver_not_callable); |
{ |
- __ Poke(x1, 0); |
+ __ Poke(receiver, 0); |
__ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); |
} |
} |
@@ -1381,59 +1401,70 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
void Builtins::Generate_ReflectApply(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
- // -- x0 : argc |
- // -- sp[0] : argumentsList |
- // -- sp[8] : thisArgument |
- // -- sp[16] : target |
- // -- sp[24] : receiver |
+ // -- x0 : argc |
+ // -- jssp[0] : argumentsList (if argc == 3) |
+ // -- jssp[8] : thisArgument (if argc >= 2) |
+ // -- jssp[16] : target (if argc >= 1) |
+ // -- jssp[24] : receiver |
// ----------------------------------- |
ASM_LOCATION("Builtins::Generate_ReflectApply"); |
+ Register argc = x0; |
+ Register arguments_list = x0; |
+ Register target = x1; |
+ Register this_argument = x2; |
+ Register undefined = x3; |
+ |
+ __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); |
+ |
// 1. Load target into x1 (if present), argumentsList into x0 (if present), |
// remove all arguments from the stack (including the receiver), and push |
// thisArgument (if present) instead. |
{ |
- Label done; |
- __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); |
- __ Mov(x2, x1); |
- __ Mov(x3, x1); |
- __ Subs(x4, x0, 1); |
- __ B(lt, &done); |
- __ Peek(x1, Operand(x4, LSL, kPointerSizeLog2)); // target |
- __ Subs(x4, x4, 1); |
- __ B(lt, &done); |
- __ Peek(x2, Operand(x4, LSL, kPointerSizeLog2)); // thisArgument |
- __ Subs(x4, x4, 1); |
- __ B(lt, &done); |
- __ Peek(x3, Operand(x4, LSL, kPointerSizeLog2)); // argumentsList |
- __ Bind(&done); |
- __ Drop(x0); |
- __ Poke(x2, 0); |
- __ Mov(x0, x3); |
+ // Claim (3 - argc) dummy arguments from the stack, to put the stack in a |
+ // consistent state for a simple pop operation. |
+ Register neg_argc = x10; |
+ __ Negs(neg_argc, argc); // Negate; set the Z flag if argc == 0. |
+ __ Add(x11, neg_argc, 3); |
+ __ Claim(x11); |
+ |
+ // ----------- S t a t e ------------- |
+ // -- x0 : argc |
+ // -- jssp[0] : argumentsList (dummy value if argc <= 2) |
+ // -- jssp[8] : thisArgument (dummy value if argc <= 1) |
+ // -- jssp[16] : target (dummy value if argc == 0) |
+ // -- jssp[24] : receiver |
+ // ----------------------------------- |
+ __ Pop(arguments_list, this_argument, target); |
+ __ CmovX(target, undefined, eq); // undefined if argc == 0. |
+ __ Cmp(neg_argc, -2); |
+ __ CmovX(this_argument, undefined, gt); // undefined if argc <= 1. |
+ __ CmovX(arguments_list, undefined, ge); // undefined if argc <= 2. |
+ __ Poke(this_argument, 0); // Overwrite receiver. |
} |
// ----------- S t a t e ------------- |
- // -- x0 : argumentsList |
- // -- x1 : target |
- // -- sp[0] : thisArgument |
+ // -- x0 : argumentsList |
+ // -- x1 : target |
+ // -- jssp[0] : thisArgument |
// ----------------------------------- |
// 2. Make sure the target is actually callable. |
Label target_not_callable; |
- __ JumpIfSmi(x1, &target_not_callable); |
- __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); |
- __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
- __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &target_not_callable); |
+ __ JumpIfSmi(target, &target_not_callable); |
+ __ Ldr(x10, FieldMemOperand(target, HeapObject::kMapOffset)); |
+ __ Ldr(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); |
+ __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable, &target_not_callable); |
// 3a. Apply the target to the given argumentsList (passing undefined for |
- // new.target). |
- __ LoadRoot(x3, Heap::kUndefinedValueRootIndex); |
+ // new.target in x3). |
+ DCHECK(undefined.Is(x3)); |
__ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
// 3b. The target is not callable, throw an appropriate TypeError. |
__ Bind(&target_not_callable); |
{ |
- __ Poke(x1, 0); |
+ __ Poke(target, 0); |
__ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); |
} |
} |
@@ -1441,59 +1472,70 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { |
void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
- // -- x0 : argc |
- // -- sp[0] : new.target (optional) |
- // -- sp[8] : argumentsList |
- // -- sp[16] : target |
- // -- sp[24] : receiver |
+ // -- x0 : argc |
+ // -- jssp[0] : new.target (optional) |
+ // -- jssp[8] : argumentsList |
+ // -- jssp[16] : target |
+ // -- jssp[24] : receiver |
// ----------------------------------- |
ASM_LOCATION("Builtins::Generate_ReflectConstruct"); |
+ Register argc = x0; |
+ Register arguments_list = x0; |
+ Register target = x1; |
+ Register new_target = x3; |
+ Register undefined = x4; |
+ |
+ __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); |
+ |
// 1. Load target into x1 (if present), argumentsList into x0 (if present), |
// new.target into x3 (if present, otherwise use target), remove all |
// arguments from the stack (including the receiver), and push thisArgument |
// (if present) instead. |
{ |
- Label done; |
- __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); |
- __ Mov(x2, x1); |
- __ Poke(x2, Operand(x0, LSL, kPointerSizeLog2)); // receiver |
- __ Subs(x4, x0, 1); |
- __ B(lt, &done); |
- __ Peek(x1, Operand(x4, LSL, kPointerSizeLog2)); // target |
- __ Mov(x3, x1); // new.target defaults to target |
- __ Subs(x4, x4, 1); |
- __ B(lt, &done); |
- __ Peek(x2, Operand(x4, LSL, kPointerSizeLog2)); // argumentsList |
- __ Subs(x4, x4, 1); |
- __ B(lt, &done); |
- __ Peek(x3, Operand(x4, LSL, kPointerSizeLog2)); // new.target |
- __ Bind(&done); |
- __ Drop(x0); |
- __ Mov(x0, x2); |
+ // Claim (3 - argc) dummy arguments from the stack, to put the stack in a |
+ // consistent state for a simple pop operation. |
+ Register neg_argc = x10; |
+ __ Negs(neg_argc, argc); // Negate; set the Z flag if argc == 0. |
+ __ Add(x11, neg_argc, 3); |
+ __ Claim(x11); |
+ |
+ // ----------- S t a t e ------------- |
+ // -- x0 : argc |
+ // -- jssp[0] : new.target (dummy value if argc <= 2) |
+ // -- jssp[8] : argumentsList (dummy value if argc <= 1) |
+ // -- jssp[16] : target (dummy value if argc == 0) |
+ // -- jssp[24] : receiver |
+ // ----------------------------------- |
+ __ Pop(new_target, arguments_list, target); |
+ __ CmovX(target, undefined, eq); // undefined if argc == 0. |
+ __ Cmp(neg_argc, -2); |
+ __ CmovX(arguments_list, undefined, gt); // undefined if argc <= 1. |
+ __ CmovX(new_target, target, ge); // target if argc <= 2. |
+ __ Poke(undefined, 0); // Overwrite receiver. |
} |
// ----------- S t a t e ------------- |
- // -- x0 : argumentsList |
- // -- x3 : new.target |
- // -- x1 : target |
- // -- sp[0] : receiver (undefined) |
+ // -- x0 : argumentsList |
+ // -- x1 : target |
+ // -- x3 : new.target |
+ // -- jssp[0] : receiver (undefined) |
// ----------------------------------- |
// 2. Make sure the target is actually a constructor. |
Label target_not_constructor; |
- __ JumpIfSmi(x1, &target_not_constructor); |
- __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); |
- __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
- __ TestAndBranchIfAllClear(x4, 1 << Map::kIsConstructor, |
+ __ JumpIfSmi(target, &target_not_constructor); |
+ __ Ldr(x10, FieldMemOperand(target, HeapObject::kMapOffset)); |
+ __ Ldrb(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); |
+ __ TestAndBranchIfAllClear(x10, 1 << Map::kIsConstructor, |
&target_not_constructor); |
- // 3. Make sure the target is actually a constructor. |
+ // 3. Make sure the new.target is actually a constructor. |
Label new_target_not_constructor; |
- __ JumpIfSmi(x3, &new_target_not_constructor); |
- __ Ldr(x4, FieldMemOperand(x3, HeapObject::kMapOffset)); |
- __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
- __ TestAndBranchIfAllClear(x4, 1 << Map::kIsConstructor, |
+ __ JumpIfSmi(new_target, &new_target_not_constructor); |
+ __ Ldr(x10, FieldMemOperand(new_target, HeapObject::kMapOffset)); |
+ __ Ldrb(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); |
+ __ TestAndBranchIfAllClear(x10, 1 << Map::kIsConstructor, |
&new_target_not_constructor); |
// 4a. Construct the target with the given new.target and argumentsList. |
@@ -1502,14 +1544,14 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
// 4b. The target is not a constructor, throw an appropriate TypeError. |
__ Bind(&target_not_constructor); |
{ |
- __ Poke(x1, 0); |
+ __ Poke(target, 0); |
__ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); |
} |
// 4c. The new.target is not a constructor, throw an appropriate TypeError. |
__ Bind(&new_target_not_constructor); |
{ |
- __ Poke(x3, 0); |
+ __ Poke(new_target, 0); |
__ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); |
} |
} |
@@ -1565,72 +1607,81 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { |
// static |
void Builtins::Generate_Apply(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
- // -- x0 : argumentsList |
- // -- x1 : target |
- // -- x3 : new.target (checked to be constructor or undefined) |
- // -- sp[0] : thisArgument |
+ // -- x0 : argumentsList |
+ // -- x1 : target |
+ // -- x3 : new.target (checked to be constructor or undefined) |
+ // -- jssp[0] : thisArgument |
// ----------------------------------- |
+ Register arguments_list = x0; |
+ Register target = x1; |
+ Register new_target = x3; |
+ |
+ Register args = x0; |
+ Register len = x2; |
+ |
// Create the list of arguments from the array-like argumentsList. |
{ |
Label create_arguments, create_array, create_runtime, done_create; |
- __ JumpIfSmi(x0, &create_runtime); |
+ __ JumpIfSmi(arguments_list, &create_runtime); |
- // Load the map of argumentsList into x2. |
- __ Ldr(x2, FieldMemOperand(x0, HeapObject::kMapOffset)); |
+ // Load native context. |
+ Register native_context = x4; |
+ __ Ldr(native_context, NativeContextMemOperand()); |
- // Load native context into x4. |
- __ Ldr(x4, NativeContextMemOperand()); |
+ // Load the map of argumentsList. |
+ Register arguments_list_map = x2; |
+ __ Ldr(arguments_list_map, |
+ FieldMemOperand(arguments_list, HeapObject::kMapOffset)); |
// Check if argumentsList is an (unmodified) arguments object. |
- __ Ldr(x5, ContextMemOperand(x4, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
- __ Cmp(x5, x2); |
- __ B(eq, &create_arguments); |
- __ Ldr(x5, ContextMemOperand(x4, Context::STRICT_ARGUMENTS_MAP_INDEX)); |
- __ Cmp(x5, x2); |
+ __ Ldr(x10, ContextMemOperand(native_context, |
+ Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
+ __ Ldr(x11, ContextMemOperand(native_context, |
+ Context::STRICT_ARGUMENTS_MAP_INDEX)); |
+ __ Cmp(arguments_list_map, x10); |
+ __ Ccmp(arguments_list_map, x11, ZFlag, ne); |
__ B(eq, &create_arguments); |
// Check if argumentsList is a fast JSArray. |
- __ CompareInstanceType(x2, x4, JS_ARRAY_TYPE); |
+ __ CompareInstanceType(arguments_list_map, native_context, JS_ARRAY_TYPE); |
__ B(eq, &create_array); |
// Ask the runtime to create the list (actually a FixedArray). |
__ Bind(&create_runtime); |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
- __ Push(x1, x3, x0); |
+ __ Push(target, new_target, arguments_list); |
__ CallRuntime(Runtime::kCreateListFromArrayLike, 1); |
- __ Pop(x3, x1); |
- __ Ldrsw(x2, UntagSmiFieldMemOperand(x0, FixedArray::kLengthOffset)); |
+ __ Pop(new_target, target); |
+ __ Ldrsw(len, UntagSmiFieldMemOperand(arguments_list, |
+ FixedArray::kLengthOffset)); |
} |
__ B(&done_create); |
// Try to create the list from an arguments object. |
__ Bind(&create_arguments); |
- __ Ldr(x2, |
- FieldMemOperand(x0, JSObject::kHeaderSize + |
- Heap::kArgumentsLengthIndex * kPointerSize)); |
- __ Ldr(x4, FieldMemOperand(x0, JSObject::kElementsOffset)); |
- __ Ldr(x5, FieldMemOperand(x4, FixedArray::kLengthOffset)); |
- __ Cmp(x2, x4); |
- __ B(ne, &create_runtime); |
- __ SmiUntag(x2); |
- __ Mov(x0, x4); |
+ __ Ldrsw(len, UntagSmiFieldMemOperand( |
+ arguments_list, |
+ JSObject::kHeaderSize + |
+ Heap::kArgumentsLengthIndex * kPointerSize)); |
+ __ Ldr(x10, FieldMemOperand(arguments_list, JSObject::kElementsOffset)); |
+ __ Ldrsw(x11, UntagSmiFieldMemOperand(x10, FixedArray::kLengthOffset)); |
+ __ CompareAndBranch(len, x11, ne, &create_runtime); |
+ __ Mov(args, x10); |
__ B(&done_create); |
// Try to create the list from a JSArray object. |
__ Bind(&create_array); |
- __ Ldr(x2, FieldMemOperand(x2, Map::kBitField2Offset)); |
- __ DecodeField<Map::ElementsKindBits>(x2); |
+ __ Ldr(x10, FieldMemOperand(arguments_list_map, Map::kBitField2Offset)); |
+ __ DecodeField<Map::ElementsKindBits>(x10); |
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
- STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
STATIC_ASSERT(FAST_ELEMENTS == 2); |
- __ Cmp(x2, FAST_ELEMENTS); |
- __ B(hi, &create_runtime); |
- __ Cmp(x2, FAST_HOLEY_SMI_ELEMENTS); |
- __ B(eq, &create_runtime); |
- __ Ldrsw(x2, UntagSmiFieldMemOperand(x0, JSArray::kLengthOffset)); |
- __ Ldr(x0, FieldMemOperand(x0, JSArray::kElementsOffset)); |
+ // Branch for anything that's not FAST_{SMI_}ELEMENTS. |
+ __ TestAndBranchIfAnySet(x10, ~FAST_ELEMENTS, &create_runtime); |
+ __ Ldrsw(len, |
+ UntagSmiFieldMemOperand(arguments_list, JSArray::kLengthOffset)); |
+ __ Ldr(args, FieldMemOperand(arguments_list, JSArray::kElementsOffset)); |
__ Bind(&done_create); |
} |
@@ -1643,41 +1694,53 @@ void Builtins::Generate_Apply(MacroAssembler* masm) { |
__ LoadRoot(x10, Heap::kRealStackLimitRootIndex); |
// Make x10 the space we have left. The stack might already be overflowed |
// here which will cause x10 to become negative. |
- __ Sub(x10, jssp, x10); |
+ __ Sub(x10, masm->StackPointer(), x10); |
// Check if the arguments will overflow the stack. |
- __ Cmp(x10, Operand(x2, LSL, kPointerSizeLog2)); |
+ __ Cmp(x10, Operand(len, LSL, kPointerSizeLog2)); |
__ B(gt, &done); // Signed comparison. |
__ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); |
__ Bind(&done); |
} |
// ----------- S t a t e ------------- |
- // -- x1 : target |
- // -- x0 : args (a FixedArray built from argumentsList) |
- // -- x2 : len (number of elements to push from args) |
- // -- x3 : new.target (checked to be constructor or undefined) |
- // -- sp[0] : thisArgument |
+ // -- x0 : args (a FixedArray built from argumentsList) |
+ // -- x1 : target |
+ // -- x2 : len (number of elements to push from args) |
+ // -- x3 : new.target (checked to be constructor or undefined) |
+ // -- jssp[0] : thisArgument |
// ----------------------------------- |
// Push arguments onto the stack (thisArgument is already on the stack). |
{ |
- __ Mov(x4, 0); |
Label done, loop; |
+ Register src = x4; |
+ |
+ __ Add(src, args, FixedArray::kHeaderSize - kHeapObjectTag); |
+ __ Mov(x0, len); // The 'len' argument for Call() or Construct(). |
+ __ Cbz(len, &done); |
+ __ Claim(len); |
__ Bind(&loop); |
- __ Cmp(x4, x2); |
- __ B(eq, &done); |
- __ Add(x10, x0, Operand(x4, LSL, kPointerSizeLog2)); |
- __ Ldr(x10, FieldMemOperand(x10, FixedArray::kHeaderSize)); |
- __ Push(x10); |
- __ Add(x4, x4, 1); |
- __ B(&loop); |
+ __ Subs(len, len, 1); |
+ __ Ldr(x10, MemOperand(src, kPointerSize, PostIndex)); |
+ __ Poke(x10, Operand(len, LSL, kPointerSizeLog2)); |
+ __ B(ne, &loop); |
__ Bind(&done); |
- __ Mov(x0, x4); |
} |
+ // ----------- S t a t e ------------- |
+ // -- x0 : argument count (len) |
+ // -- x1 : target |
+ // -- x3 : new.target (checked to be constructor or undefined) |
+ // -- jssp[0] : args[len-1] |
+ // -- jssp[8] : args[len-2] |
+ // ... : ... |
+ // -- jssp[8*(len-2)] : args[1] |
+ // -- jssp[8*(len-1)] : args[0] |
+ // ----------------------------------- |
+ |
// Dispatch to Call or Construct depending on whether new.target is undefined. |
{ |
- __ CompareRoot(x3, Heap::kUndefinedValueRootIndex); |
+ __ CompareRoot(new_target, Heap::kUndefinedValueRootIndex); |
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); |
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
} |