OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/arm64/assembler-arm64-inl.h" | 8 #include "src/arm64/assembler-arm64-inl.h" |
9 #include "src/arm64/frames-arm64.h" | 9 #include "src/arm64/frames-arm64.h" |
10 #include "src/arm64/macro-assembler-arm64-inl.h" | 10 #include "src/arm64/macro-assembler-arm64-inl.h" |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 // Restore the callee-saved registers and return. | 1260 // Restore the callee-saved registers and return. |
1261 DCHECK(jssp.Is(__ StackPointer())); | 1261 DCHECK(jssp.Is(__ StackPointer())); |
1262 __ Mov(csp, jssp); | 1262 __ Mov(csp, jssp); |
1263 __ SetStackPointer(csp); | 1263 __ SetStackPointer(csp); |
1264 __ PopCalleeSavedRegisters(); | 1264 __ PopCalleeSavedRegisters(); |
1265 // After this point, we must not modify jssp because it is a callee-saved | 1265 // After this point, we must not modify jssp because it is a callee-saved |
1266 // register which we have just restored. | 1266 // register which we have just restored. |
1267 __ Ret(); | 1267 __ Ret(); |
1268 } | 1268 } |
1269 | 1269 |
| 1270 void RegExpExecStub::Generate(MacroAssembler* masm) { |
| 1271 #ifdef V8_INTERPRETED_REGEXP |
| 1272 // This case is handled prior to the RegExpExecStub call. |
| 1273 __ Abort(kUnexpectedRegExpExecCall); |
| 1274 #else // V8_INTERPRETED_REGEXP |
| 1275 // Isolates: note we add an additional parameter here (isolate pointer). |
| 1276 __ EnterExitFrame(false, x10, 1); |
| 1277 DCHECK(csp.Is(__ StackPointer())); |
| 1278 |
| 1279 // We have 9 arguments to pass to the regexp code, therefore we have to pass |
| 1280 // one on the stack and the rest as registers. |
| 1281 |
| 1282 // Note that the placement of the argument on the stack isn't standard |
| 1283 // AAPCS64: |
| 1284 // csp[0]: Space for the return address placed by DirectCEntryStub. |
| 1285 // csp[8]: Argument 9, the current isolate address. |
| 1286 |
| 1287 __ Mov(x10, ExternalReference::isolate_address(isolate())); |
| 1288 __ Poke(x10, kPointerSize); |
| 1289 |
| 1290 // Argument 1 (x0): Subject string. |
| 1291 CHECK(x0.is(RegExpExecDescriptor::StringRegister())); |
| 1292 |
| 1293 // Argument 2 (x1): Previous index, already there. |
| 1294 CHECK(x1.is(RegExpExecDescriptor::LastIndexRegister())); |
| 1295 |
| 1296 // Argument 3 (x2): Input start. |
| 1297 // Argument 4 (x3): Input end. |
| 1298 CHECK(x2.is(RegExpExecDescriptor::StringStartRegister())); |
| 1299 CHECK(x3.is(RegExpExecDescriptor::StringEndRegister())); |
| 1300 |
| 1301 // Argument 5 (x4): static offsets vector buffer. |
| 1302 __ Mov(x4, ExternalReference::address_of_static_offsets_vector(isolate())); |
| 1303 |
| 1304 // Argument 6 (x5): Set the number of capture registers to zero to force |
| 1305 // global regexps to behave as non-global. This stub is not used for global |
| 1306 // regexps. |
| 1307 __ Mov(x5, 0); |
| 1308 |
| 1309 // Argument 7 (x6): Start (high end) of backtracking stack memory area. |
| 1310 ExternalReference address_of_regexp_stack_memory_address = |
| 1311 ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
| 1312 ExternalReference address_of_regexp_stack_memory_size = |
| 1313 ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
| 1314 __ Mov(x10, address_of_regexp_stack_memory_address); |
| 1315 __ Ldr(x10, MemOperand(x10)); |
| 1316 __ Mov(x11, address_of_regexp_stack_memory_size); |
| 1317 __ Ldr(x11, MemOperand(x11)); |
| 1318 __ Add(x6, x10, x11); |
| 1319 |
| 1320 // Argument 8 (x7): Indicate that this is a direct call from JavaScript. |
| 1321 __ Mov(x7, 1); |
| 1322 |
| 1323 // Locate the code entry and call it. |
| 1324 Register code_object = RegExpExecDescriptor::CodeRegister(); |
| 1325 __ Add(code_object, code_object, Code::kHeaderSize - kHeapObjectTag); |
| 1326 DirectCEntryStub stub(isolate()); |
| 1327 stub.GenerateCall(masm, code_object); |
| 1328 |
| 1329 __ LeaveExitFrame(false, x10, true); |
| 1330 |
| 1331 // Return the smi-tagged result. |
| 1332 __ SmiTag(x0); |
| 1333 __ Ret(); |
| 1334 #endif |
| 1335 } |
| 1336 |
1270 | 1337 |
1271 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, | 1338 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, |
1272 Register argc, Register function, | 1339 Register argc, Register function, |
1273 Register feedback_vector, Register index, | 1340 Register feedback_vector, Register index, |
1274 Register new_target) { | 1341 Register new_target) { |
1275 FrameScope scope(masm, StackFrame::INTERNAL); | 1342 FrameScope scope(masm, StackFrame::INTERNAL); |
1276 | 1343 |
1277 // Number-of-arguments register must be smi-tagged to call out. | 1344 // Number-of-arguments register must be smi-tagged to call out. |
1278 __ SmiTag(argc); | 1345 __ SmiTag(argc); |
1279 __ Push(argc, function, feedback_vector, index); | 1346 __ Push(argc, function, feedback_vector, index); |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 kStackUnwindSpace, NULL, spill_offset, | 3230 kStackUnwindSpace, NULL, spill_offset, |
3164 return_value_operand, NULL); | 3231 return_value_operand, NULL); |
3165 } | 3232 } |
3166 | 3233 |
3167 #undef __ | 3234 #undef __ |
3168 | 3235 |
3169 } // namespace internal | 3236 } // namespace internal |
3170 } // namespace v8 | 3237 } // namespace v8 |
3171 | 3238 |
3172 #endif // V8_TARGET_ARCH_ARM64 | 3239 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |