Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index c6ba51770331417db3b30847214692805a4708ea..9d04f0e2bc8cc4ded55e42a6153d4c8f5d9cbfcd 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3287,14 +3287,22 @@ void LCodeGen::DoLoadExternalArrayPointer( |
void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
Register arguments = ToRegister(instr->arguments()); |
- Register length = ToRegister(instr->length()); |
- Register index = ToRegister(instr->index()); |
Register result = ToRegister(instr->result()); |
- // There are two words between the frame pointer and the last argument. |
- // Subtracting from length accounts for one of them add one more. |
- __ sub(length, length, index); |
- __ add(length, length, Operand(1)); |
- __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); |
+ if (instr->length()->IsConstantOperand() && |
+ instr->index()->IsConstantOperand()) { |
+ int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
+ int const_length = ToInteger32(LConstantOperand::cast(instr->length())); |
+ int index = (const_length - const_index) + 1; |
+ __ ldr(result, MemOperand(arguments, index * kPointerSize)); |
+ } else { |
+ Register length = ToRegister(instr->length()); |
+ Register index = ToRegister(instr->index()); |
+ // There are two words between the frame pointer and the last argument. |
+ // Subtracting from length accounts for one of them add one more. |
+ __ sub(length, length, index); |
+ __ add(length, length, Operand(1)); |
+ __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); |
+ } |
} |