Index: src/builtins/arm/builtins-arm.cc |
diff --git a/src/builtins/arm/builtins-arm.cc b/src/builtins/arm/builtins-arm.cc |
index 5765f64484ec92129e3984513a3893cd4f157578..23575b69705491f18a8592e6a6598acd38a2cfc3 100644 |
--- a/src/builtins/arm/builtins-arm.cc |
+++ b/src/builtins/arm/builtins-arm.cc |
@@ -1162,8 +1162,16 @@ void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
__ Jump(lr); |
} |
-static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
- Register limit, Register scratch) { |
+static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
+ Register num_args, Register index, |
+ Register scratch) { |
rmcilroy
2016/09/07 10:57:39
Could you just pass an extra scratch register and
mythria
2016/09/07 13:11:15
Done.
|
+ Register limit = num_args; |
+ |
+ // Find the address of the last argument. |
+ __ mov(limit, Operand(limit, LSL, kPointerSizeLog2)); |
+ __ sub(limit, index, limit); |
+ |
+ // TODO(mythria): Add a stack check before pushing arguments. |
Label loop_header, loop_check; |
__ b(al, &loop_check); |
__ bind(&loop_header); |
@@ -1186,14 +1194,10 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
// -- r1 : the target to call (can be any Object). |
// ----------------------------------- |
- // Find the address of the last argument. |
__ add(r3, r0, Operand(1)); // Add one for receiver. |
- __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
- __ sub(r3, r2, r3); |
- // TODO(mythria): Add a stack check before pushing arguments. |
- // Push the arguments. |
- Generate_InterpreterPushArgs(masm, r2, r3, r4); |
+ // Push the arguments. r2, r3, r4 will be modified. |
+ Generate_InterpreterPushArgs(masm, r3, r2, r4); |
// Call the target. |
if (function_type == CallableType::kJSFunction) { |
@@ -1219,17 +1223,17 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
// -- r4 : address of the first argument |
// ----------------------------------- |
- // Find the address of the last argument. |
- __ mov(r5, Operand(r0, LSL, kPointerSizeLog2)); |
- __ sub(r5, r4, r5); |
- |
// Push a slot for the receiver to be constructed. |
__ mov(ip, Operand::Zero()); |
__ push(ip); |
+ // InterpreterPushArgs modified num_args, so copy argument count to a |
+ // different register. |
+ __ mov(r5, r0); |
+ |
// TODO(mythria): Add a stack check before pushing arguments. |
- // Push the arguments. |
- Generate_InterpreterPushArgs(masm, r4, r5, r6); |
+ // Push the arguments. r5, r4, r6 will be modified. |
+ Generate_InterpreterPushArgs(masm, r5, r4, r6); |
__ AssertUndefinedOrAllocationSite(r2, r5); |
if (construct_type == CallableType::kJSFunction) { |
@@ -1249,6 +1253,29 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
} |
} |
+// static |
+void Builtins::Generate_InterpreterPushArgsAndConstructArray( |
+ MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- r0 : argument count (not including receiver) |
+ // -- r1 : target to call verified to be Array function |
+ // -- r2 : allocation site feedback if available, undefined otherwise. |
+ // -- r3 : address of the first argument |
+ // ----------------------------------- |
+ |
+ __ add(r4, r0, Operand(1)); // Add one for receiver. |
+ |
+ // TODO(mythria): Add a stack check before pushing arguments. |
+ // Push the arguments. r4, r3, r5 will be modified. |
+ Generate_InterpreterPushArgs(masm, r4, r3, r5); |
+ |
+ // Array constructor expects constructor in r3. It is same as r1 here. |
+ __ mov(r3, r1); |
+ |
+ ArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+} |
+ |
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
// Set the return address to the correct point in the interpreter entry |
// trampoline. |