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_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 5 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/mips64/assembler-mips64.h" | 10 #include "src/mips64/assembler-mips64.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Register reg4 = no_reg, | 109 Register reg4 = no_reg, |
110 Register reg5 = no_reg, | 110 Register reg5 = no_reg, |
111 Register reg6 = no_reg, | 111 Register reg6 = no_reg, |
112 Register reg7 = no_reg, | 112 Register reg7 = no_reg, |
113 Register reg8 = no_reg); | 113 Register reg8 = no_reg); |
114 | 114 |
115 | 115 |
116 // ----------------------------------------------------------------------------- | 116 // ----------------------------------------------------------------------------- |
117 // Static helper functions. | 117 // Static helper functions. |
118 | 118 |
| 119 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 120 #define SmiWordOffset(offset) (offset + kPointerSize / 2) |
| 121 #else |
| 122 #define SmiWordOffset(offset) offset |
| 123 #endif |
| 124 |
| 125 |
119 inline MemOperand ContextOperand(Register context, int index) { | 126 inline MemOperand ContextOperand(Register context, int index) { |
120 return MemOperand(context, Context::SlotOffset(index)); | 127 return MemOperand(context, Context::SlotOffset(index)); |
121 } | 128 } |
122 | 129 |
123 | 130 |
124 inline MemOperand GlobalObjectOperand() { | 131 inline MemOperand GlobalObjectOperand() { |
125 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); | 132 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); |
126 } | 133 } |
127 | 134 |
128 | 135 |
129 // Generate a MemOperand for loading a field from an object. | 136 // Generate a MemOperand for loading a field from an object. |
130 inline MemOperand FieldMemOperand(Register object, int offset) { | 137 inline MemOperand FieldMemOperand(Register object, int offset) { |
131 return MemOperand(object, offset - kHeapObjectTag); | 138 return MemOperand(object, offset - kHeapObjectTag); |
132 } | 139 } |
133 | 140 |
134 | 141 |
135 inline MemOperand UntagSmiMemOperand(Register rm, int offset) { | 142 inline MemOperand UntagSmiMemOperand(Register rm, int offset) { |
136 // Assumes that Smis are shifted by 32 bits and little endianness. | 143 // Assumes that Smis are shifted by 32 bits. |
137 STATIC_ASSERT(kSmiShift == 32); | 144 STATIC_ASSERT(kSmiShift == 32); |
138 return MemOperand(rm, offset + (kSmiShift / kBitsPerByte)); | 145 return MemOperand(rm, SmiWordOffset(offset)); |
139 } | 146 } |
140 | 147 |
141 | 148 |
142 inline MemOperand UntagSmiFieldMemOperand(Register rm, int offset) { | 149 inline MemOperand UntagSmiFieldMemOperand(Register rm, int offset) { |
143 return UntagSmiMemOperand(rm, offset - kHeapObjectTag); | 150 return UntagSmiMemOperand(rm, offset - kHeapObjectTag); |
144 } | 151 } |
145 | 152 |
146 | 153 |
147 // Generate a MemOperand for storing arguments 5..N on the stack | 154 // Generate a MemOperand for storing arguments 5..N on the stack |
148 // when calling CallCFunction(). | 155 // when calling CallCFunction(). |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // --------------------------------------------------------------------------- | 682 // --------------------------------------------------------------------------- |
676 // Pseudo-instructions. | 683 // Pseudo-instructions. |
677 | 684 |
678 void mov(Register rd, Register rt) { or_(rd, rt, zero_reg); } | 685 void mov(Register rd, Register rt) { or_(rd, rt, zero_reg); } |
679 | 686 |
680 void Ulw(Register rd, const MemOperand& rs); | 687 void Ulw(Register rd, const MemOperand& rs); |
681 void Usw(Register rd, const MemOperand& rs); | 688 void Usw(Register rd, const MemOperand& rs); |
682 void Uld(Register rd, const MemOperand& rs, Register scratch = at); | 689 void Uld(Register rd, const MemOperand& rs, Register scratch = at); |
683 void Usd(Register rd, const MemOperand& rs, Register scratch = at); | 690 void Usd(Register rd, const MemOperand& rs, Register scratch = at); |
684 | 691 |
| 692 void LoadWordPair(Register rd, const MemOperand& rs, Register scratch = at); |
| 693 void StoreWordPair(Register rd, const MemOperand& rs, Register scratch = at); |
| 694 |
685 // Load int32 in the rd register. | 695 // Load int32 in the rd register. |
686 void li(Register rd, Operand j, LiFlags mode = OPTIMIZE_SIZE); | 696 void li(Register rd, Operand j, LiFlags mode = OPTIMIZE_SIZE); |
687 inline void li(Register rd, int64_t j, LiFlags mode = OPTIMIZE_SIZE) { | 697 inline void li(Register rd, int64_t j, LiFlags mode = OPTIMIZE_SIZE) { |
688 li(rd, Operand(j), mode); | 698 li(rd, Operand(j), mode); |
689 } | 699 } |
690 void li(Register dst, Handle<Object> value, LiFlags mode = OPTIMIZE_SIZE); | 700 void li(Register dst, Handle<Object> value, LiFlags mode = OPTIMIZE_SIZE); |
691 | 701 |
692 // Push multiple registers on the stack. | 702 // Push multiple registers on the stack. |
693 // Registers are saved in numerical order, with higher numbered registers | 703 // Registers are saved in numerical order, with higher numbered registers |
694 // saved in higher memory addresses. | 704 // saved in higher memory addresses. |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1837 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1828 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1838 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1829 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1839 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1830 #else | 1840 #else |
1831 #define ACCESS_MASM(masm) masm-> | 1841 #define ACCESS_MASM(masm) masm-> |
1832 #endif | 1842 #endif |
1833 | 1843 |
1834 } } // namespace v8::internal | 1844 } } // namespace v8::internal |
1835 | 1845 |
1836 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1846 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |