OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 | 791 |
792 // --------------------------------------------------------------------------- | 792 // --------------------------------------------------------------------------- |
793 // Utilities | 793 // Utilities |
794 | 794 |
795 void Ret(); | 795 void Ret(); |
796 | 796 |
797 // Return and drop arguments from stack, where the number of arguments | 797 // Return and drop arguments from stack, where the number of arguments |
798 // may be bigger than 2^16 - 1. Requires a scratch register. | 798 // may be bigger than 2^16 - 1. Requires a scratch register. |
799 void Ret(int bytes_dropped, Register scratch); | 799 void Ret(int bytes_dropped, Register scratch); |
800 | 800 |
| 801 // Emit code that loads |parameter_index|'th parameter from the stack to |
| 802 // the register according to the CallInterfaceDescriptor definition. |
| 803 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed |
| 804 // below the caller's sp (on ia32 it's at least return address). |
| 805 template <class Descriptor> |
| 806 void LoadParameterFromStack( |
| 807 Register reg, typename Descriptor::ParameterIndices parameter_index, |
| 808 int sp_to_ra_offset_in_words = 1) { |
| 809 DCHECK(Descriptor::kPassLastArgsOnStack); |
| 810 DCHECK_LT(parameter_index, Descriptor::kParameterCount); |
| 811 DCHECK_LE(Descriptor::kParameterCount - Descriptor::kStackArgumentsCount, |
| 812 parameter_index); |
| 813 int offset = (Descriptor::kParameterCount - parameter_index - 1 + |
| 814 sp_to_ra_offset_in_words) * |
| 815 kPointerSize; |
| 816 mov(reg, Operand(esp, offset)); |
| 817 } |
| 818 |
801 // Emit code to discard a non-negative number of pointer-sized elements | 819 // Emit code to discard a non-negative number of pointer-sized elements |
802 // from the stack, clobbering only the esp register. | 820 // from the stack, clobbering only the esp register. |
803 void Drop(int element_count); | 821 void Drop(int element_count); |
804 | 822 |
805 void Call(Label* target) { call(target); } | 823 void Call(Label* target) { call(target); } |
806 void Call(Handle<Code> target, RelocInfo::Mode rmode) { call(target, rmode); } | 824 void Call(Handle<Code> target, RelocInfo::Mode rmode) { call(target, rmode); } |
807 void Jump(Handle<Code> target, RelocInfo::Mode rmode) { jmp(target, rmode); } | 825 void Jump(Handle<Code> target, RelocInfo::Mode rmode) { jmp(target, rmode); } |
808 void Push(Register src) { push(src); } | 826 void Push(Register src) { push(src); } |
809 void Push(const Operand& src) { push(src); } | 827 void Push(const Operand& src) { push(src); } |
810 void Push(Immediate value) { push(value); } | 828 void Push(Immediate value) { push(value); } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 inline Operand NativeContextOperand() { | 1077 inline Operand NativeContextOperand() { |
1060 return ContextOperand(esi, Context::NATIVE_CONTEXT_INDEX); | 1078 return ContextOperand(esi, Context::NATIVE_CONTEXT_INDEX); |
1061 } | 1079 } |
1062 | 1080 |
1063 #define ACCESS_MASM(masm) masm-> | 1081 #define ACCESS_MASM(masm) masm-> |
1064 | 1082 |
1065 } // namespace internal | 1083 } // namespace internal |
1066 } // namespace v8 | 1084 } // namespace v8 |
1067 | 1085 |
1068 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1086 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |