OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ | 5 #ifndef V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ |
6 #define V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ | 6 #define V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
9 #include "src/mips64/assembler-mips64.h" | 9 #include "src/mips64/assembler-mips64.h" |
10 #include "src/regexp/regexp-macro-assembler.h" | 10 #include "src/regexp/regexp-macro-assembler.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Called from RegExp if the stack-guard is triggered. | 90 // Called from RegExp if the stack-guard is triggered. |
91 // If the code object is relocated, the return address is fixed before | 91 // If the code object is relocated, the return address is fixed before |
92 // returning. | 92 // returning. |
93 static int64_t CheckStackGuardState(Address* return_address, Code* re_code, | 93 static int64_t CheckStackGuardState(Address* return_address, Code* re_code, |
94 Address re_frame); | 94 Address re_frame); |
95 | 95 |
96 void print_regexp_frame_constants(); | 96 void print_regexp_frame_constants(); |
97 | 97 |
98 private: | 98 private: |
99 #if defined(MIPS_ABI_N64) | |
100 // Offsets from frame_pointer() of function parameters and stored registers. | 99 // Offsets from frame_pointer() of function parameters and stored registers. |
101 static const int kFramePointer = 0; | 100 static const int kFramePointer = 0; |
102 | 101 |
103 // Above the frame pointer - Stored registers and stack passed parameters. | 102 // Above the frame pointer - Stored registers and stack passed parameters. |
104 // Registers s0 to s7, fp, and ra. | 103 // Registers s0 to s7, fp, and ra. |
105 static const int kStoredRegisters = kFramePointer; | 104 static const int kStoredRegisters = kFramePointer; |
106 // Return address (stored from link register, read into pc on return). | 105 // Return address (stored from link register, read into pc on return). |
107 | 106 |
108 // TODO(plind): This 9 - is 8 s-regs (s0..s7) plus fp. | 107 // TODO(plind): This 9 - is 8 s-regs (s0..s7) plus fp. |
109 | 108 |
110 static const int kReturnAddress = kStoredRegisters + 9 * kPointerSize; | 109 static const int kReturnAddress = kStoredRegisters + 9 * kPointerSize; |
111 static const int kSecondaryReturnAddress = kReturnAddress + kPointerSize; | 110 static const int kSecondaryReturnAddress = kReturnAddress + kPointerSize; |
112 // Stack frame header. | 111 // Stack frame header. |
113 static const int kStackFrameHeader = kSecondaryReturnAddress; | 112 static const int kStackFrameHeader = kSecondaryReturnAddress; |
114 // Stack parameters placed by caller. | 113 // Stack parameters placed by caller. |
115 static const int kIsolate = kStackFrameHeader + kPointerSize; | 114 static const int kIsolate = kStackFrameHeader + kPointerSize; |
116 | 115 |
117 // Below the frame pointer. | 116 // Below the frame pointer. |
118 // Register parameters stored by setup code. | 117 // Register parameters stored by setup code. |
119 static const int kDirectCall = kFramePointer - kPointerSize; | 118 static const int kDirectCall = kFramePointer - kPointerSize; |
120 static const int kStackHighEnd = kDirectCall - kPointerSize; | 119 static const int kStackHighEnd = kDirectCall - kPointerSize; |
121 static const int kNumOutputRegisters = kStackHighEnd - kPointerSize; | 120 static const int kNumOutputRegisters = kStackHighEnd - kPointerSize; |
122 static const int kRegisterOutput = kNumOutputRegisters - kPointerSize; | 121 static const int kRegisterOutput = kNumOutputRegisters - kPointerSize; |
123 static const int kInputEnd = kRegisterOutput - kPointerSize; | 122 static const int kInputEnd = kRegisterOutput - kPointerSize; |
124 static const int kInputStart = kInputEnd - kPointerSize; | 123 static const int kInputStart = kInputEnd - kPointerSize; |
125 static const int kStartIndex = kInputStart - kPointerSize; | 124 static const int kStartIndex = kInputStart - kPointerSize; |
126 static const int kInputString = kStartIndex - kPointerSize; | 125 static const int kInputString = kStartIndex - kPointerSize; |
127 // When adding local variables remember to push space for them in | 126 // When adding local variables remember to push space for them in |
128 // the frame in GetCode. | 127 // the frame in GetCode. |
129 static const int kSuccessfulCaptures = kInputString - kPointerSize; | 128 static const int kSuccessfulCaptures = kInputString - kPointerSize; |
130 static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize; | 129 static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize; |
131 // First register address. Following registers are below it on the stack. | 130 // First register address. Following registers are below it on the stack. |
132 static const int kRegisterZero = kStringStartMinusOne - kPointerSize; | 131 static const int kRegisterZero = kStringStartMinusOne - kPointerSize; |
133 | 132 |
134 #elif defined(MIPS_ABI_O32) | |
135 // Offsets from frame_pointer() of function parameters and stored registers. | |
136 static const int kFramePointer = 0; | |
137 | |
138 // Above the frame pointer - Stored registers and stack passed parameters. | |
139 // Registers s0 to s7, fp, and ra. | |
140 static const int kStoredRegisters = kFramePointer; | |
141 // Return address (stored from link register, read into pc on return). | |
142 static const int kReturnAddress = kStoredRegisters + 9 * kPointerSize; | |
143 static const int kSecondaryReturnAddress = kReturnAddress + kPointerSize; | |
144 // Stack frame header. | |
145 static const int kStackFrameHeader = kReturnAddress + kPointerSize; | |
146 // Stack parameters placed by caller. | |
147 static const int kRegisterOutput = | |
148 kStackFrameHeader + 4 * kPointerSize + kPointerSize; | |
149 static const int kNumOutputRegisters = kRegisterOutput + kPointerSize; | |
150 static const int kStackHighEnd = kNumOutputRegisters + kPointerSize; | |
151 static const int kDirectCall = kStackHighEnd + kPointerSize; | |
152 static const int kIsolate = kDirectCall + kPointerSize; | |
153 | |
154 // Below the frame pointer. | |
155 // Register parameters stored by setup code. | |
156 static const int kInputEnd = kFramePointer - kPointerSize; | |
157 static const int kInputStart = kInputEnd - kPointerSize; | |
158 static const int kStartIndex = kInputStart - kPointerSize; | |
159 static const int kInputString = kStartIndex - kPointerSize; | |
160 // When adding local variables remember to push space for them in | |
161 // the frame in GetCode. | |
162 static const int kSuccessfulCaptures = kInputString - kPointerSize; | |
163 static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize; | |
164 // First register address. Following registers are below it on the stack. | |
165 static const int kRegisterZero = kStringStartMinusOne - kPointerSize; | |
166 | |
167 #else | |
168 # error "undefined MIPS ABI" | |
169 #endif | |
170 | |
171 // Initial size of code buffer. | 133 // Initial size of code buffer. |
172 static const size_t kRegExpCodeSize = 1024; | 134 static const size_t kRegExpCodeSize = 1024; |
173 | 135 |
174 // Load a number of characters at the given offset from the | 136 // Load a number of characters at the given offset from the |
175 // current position, into the current-character register. | 137 // current position, into the current-character register. |
176 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); | 138 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); |
177 | 139 |
178 // Check whether preemption has been requested. | 140 // Check whether preemption has been requested. |
179 void CheckPreemption(); | 141 void CheckPreemption(); |
180 | 142 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 Label internal_failure_label_; | 223 Label internal_failure_label_; |
262 }; | 224 }; |
263 | 225 |
264 #endif // V8_INTERPRETED_REGEXP | 226 #endif // V8_INTERPRETED_REGEXP |
265 | 227 |
266 | 228 |
267 } // namespace internal | 229 } // namespace internal |
268 } // namespace v8 | 230 } // namespace v8 |
269 | 231 |
270 #endif // V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ | 232 #endif // V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |