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_X87_MACRO_ASSEMBLER_X87_H_ | 5 #ifndef V8_X87_MACRO_ASSEMBLER_X87_H_ |
6 #define V8_X87_MACRO_ASSEMBLER_X87_H_ | 6 #define V8_X87_MACRO_ASSEMBLER_X87_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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 780 |
781 // --------------------------------------------------------------------------- | 781 // --------------------------------------------------------------------------- |
782 // Utilities | 782 // Utilities |
783 | 783 |
784 void Ret(); | 784 void Ret(); |
785 | 785 |
786 // Return and drop arguments from stack, where the number of arguments | 786 // Return and drop arguments from stack, where the number of arguments |
787 // may be bigger than 2^16 - 1. Requires a scratch register. | 787 // may be bigger than 2^16 - 1. Requires a scratch register. |
788 void Ret(int bytes_dropped, Register scratch); | 788 void Ret(int bytes_dropped, Register scratch); |
789 | 789 |
| 790 // Emit code that loads |parameter_index|'th parameter from the stack to |
| 791 // the register according to the CallInterfaceDescriptor definition. |
| 792 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed |
| 793 // below the caller's sp (on x87 it's at least return address). |
| 794 template <class Descriptor> |
| 795 void LoadParameterFromStack( |
| 796 Register reg, typename Descriptor::ParameterIndices parameter_index, |
| 797 int sp_to_ra_offset_in_words = 1) { |
| 798 DCHECK(Descriptor::kPassLastArgsOnStack); |
| 799 DCHECK_LT(parameter_index, Descriptor::kParameterCount); |
| 800 DCHECK_LE(Descriptor::kParameterCount - Descriptor::kStackArgumentsCount, |
| 801 parameter_index); |
| 802 int offset = (Descriptor::kParameterCount - parameter_index - 1 + |
| 803 sp_to_ra_offset_in_words) * |
| 804 kPointerSize; |
| 805 mov(reg, Operand(esp, offset)); |
| 806 } |
| 807 |
790 // Emit code to discard a non-negative number of pointer-sized elements | 808 // Emit code to discard a non-negative number of pointer-sized elements |
791 // from the stack, clobbering only the esp register. | 809 // from the stack, clobbering only the esp register. |
792 void Drop(int element_count); | 810 void Drop(int element_count); |
793 | 811 |
794 void Call(Label* target) { call(target); } | 812 void Call(Label* target) { call(target); } |
795 void Call(Handle<Code> target, RelocInfo::Mode rmode) { call(target, rmode); } | 813 void Call(Handle<Code> target, RelocInfo::Mode rmode) { call(target, rmode); } |
796 void Jump(Handle<Code> target, RelocInfo::Mode rmode) { jmp(target, rmode); } | 814 void Jump(Handle<Code> target, RelocInfo::Mode rmode) { jmp(target, rmode); } |
797 void Push(Register src) { push(src); } | 815 void Push(Register src) { push(src); } |
798 void Push(const Operand& src) { push(src); } | 816 void Push(const Operand& src) { push(src); } |
799 void Push(Immediate value) { push(value); } | 817 void Push(Immediate value) { push(value); } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 inline Operand NativeContextOperand() { | 1056 inline Operand NativeContextOperand() { |
1039 return ContextOperand(esi, Context::NATIVE_CONTEXT_INDEX); | 1057 return ContextOperand(esi, Context::NATIVE_CONTEXT_INDEX); |
1040 } | 1058 } |
1041 | 1059 |
1042 #define ACCESS_MASM(masm) masm-> | 1060 #define ACCESS_MASM(masm) masm-> |
1043 | 1061 |
1044 } // namespace internal | 1062 } // namespace internal |
1045 } // namespace v8 | 1063 } // namespace v8 |
1046 | 1064 |
1047 #endif // V8_X87_MACRO_ASSEMBLER_X87_H_ | 1065 #endif // V8_X87_MACRO_ASSEMBLER_X87_H_ |
OLD | NEW |