Index: src/arm/lithium-codegen-arm.cc |
=================================================================== |
--- src/arm/lithium-codegen-arm.cc (revision 6178) |
+++ src/arm/lithium-codegen-arm.cc (working copy) |
@@ -1588,7 +1588,18 @@ |
void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
- Abort("DoAccessArgumentsAt unimplemented."); |
+ Register arguments = ToRegister(instr->arguments()); |
+ Register length = ToRegister(instr->length()); |
+ Operand index = ToOperand(instr->index()); |
+ Register result = ToRegister(instr->result()); |
+ |
+ __ sub(length, length, index); |
+ DeoptimizeIf(hi, instr->environment()); |
+ |
+ // There are two words between the frame pointer and the last argument. |
+ // Subtracting from length accounts for one of them add one more. |
+ __ add(length, length, Operand(1)); |
+ __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); |
} |
@@ -1607,12 +1618,41 @@ |
void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
- Abort("DoArgumentsElements unimplemented."); |
+ Register scratch = scratch0(); |
+ Register result = ToRegister(instr->result()); |
+ |
+ // Check if the calling frame is an arguments adaptor frame. |
+ Label done, adapted; |
+ __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ __ ldr(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); |
+ __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
+ |
+ // Result is the frame pointer for the frame if not adapted and for the real |
+ // frame below the adaptor frame if adapted. |
+ __ mov(result, fp, LeaveCC, ne); |
+ __ mov(result, scratch, LeaveCC, eq); |
} |
void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { |
- Abort("DoArgumentsLength unimplemented."); |
+ Operand elem = ToOperand(instr->input()); |
+ Register result = ToRegister(instr->result()); |
+ |
+ Label done; |
+ |
+ // If no arguments adaptor frame the number of arguments is fixed. |
+ __ cmp(fp, elem); |
+ __ mov(result, Operand(scope()->num_parameters())); |
+ __ b(eq, &done); |
+ |
+ // Arguments adaptor frame present. Get argument length from there. |
+ __ ldr(result, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ __ ldr(result, |
+ MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ __ SmiUntag(result); |
+ |
+ // Argument length is in result register. |
+ __ bind(&done); |
} |