Index: src/x64/codegen-x64.cc |
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc |
index a823bf2e6d0ce6e7a919b271cda30a1a04accca5..ab1c5adb9d212abb3a65fff854771605cf021a0b 100644 |
--- a/src/x64/codegen-x64.cc |
+++ b/src/x64/codegen-x64.cc |
@@ -744,6 +744,28 @@ void Code::PatchPlatformCodeAge(byte* sequence, |
} |
+Operand StackArgumentsAccessor::GetArgumentOperand(int index) { |
+ ASSERT(index >= 0); |
+ ASSERT(base_reg_.is(rsp) || base_reg_.is(rbp)); |
+ int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; |
+ int displacement_to_last_argument = base_reg_.is(rsp) ? |
+ kPCOnStackSize : kFPOnStackSize + kPCOnStackSize; |
+ displacement_to_last_argument += extra_displacement_to_last_argument_; |
+ if (argument_count_reg_.is(no_reg)) { |
+ // argument[0] is at base_reg_ + displacement_to_last_argument + |
+ // (argument_count_immediate_ + receiver - 1) * kPointerSize. |
+ ASSERT(argument_count_immediate_ + receiver > 0); |
+ return Operand(base_reg_, displacement_to_last_argument + |
+ (argument_count_immediate_ + receiver - 1 - index) * kPointerSize); |
+ } else { |
+ // argument[0] is at base_reg_ + displacement_to_last_argument + |
+ // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
+ return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
+ displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
+ } |
+} |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_TARGET_ARCH_X64 |