| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 // x19 subject subject string | 2298 // x19 subject subject string |
| 2299 // x20 regexp_data RegExp data (FixedArray) | 2299 // x20 regexp_data RegExp data (FixedArray) |
| 2300 // x21 last_match_info_elements info relative to the last match | 2300 // x21 last_match_info_elements info relative to the last match |
| 2301 // (FixedArray) | 2301 // (FixedArray) |
| 2302 // x22 code_object generated regexp code | 2302 // x22 code_object generated regexp code |
| 2303 Register subject = x19; | 2303 Register subject = x19; |
| 2304 Register regexp_data = x20; | 2304 Register regexp_data = x20; |
| 2305 Register last_match_info_elements = x21; | 2305 Register last_match_info_elements = x21; |
| 2306 Register code_object = x22; | 2306 Register code_object = x22; |
| 2307 | 2307 |
| 2308 // TODO(jbramley): Is it necessary to preserve these? I don't think ARM does. | 2308 // Stack frame. |
| 2309 CPURegList used_callee_saved_registers(subject, | 2309 // jssp[00]: last_match_info (JSArray) |
| 2310 regexp_data, | 2310 // jssp[08]: previous index |
| 2311 last_match_info_elements, | 2311 // jssp[16]: subject string |
| 2312 code_object); | 2312 // jssp[24]: JSRegExp object |
| 2313 __ PushCPURegList(used_callee_saved_registers); | |
| 2314 | 2313 |
| 2315 // Stack frame. | 2314 const int kLastMatchInfoOffset = 0 * kPointerSize; |
| 2316 // jssp[0] : x19 | 2315 const int kPreviousIndexOffset = 1 * kPointerSize; |
| 2317 // jssp[8] : x20 | 2316 const int kSubjectOffset = 2 * kPointerSize; |
| 2318 // jssp[16]: x21 | 2317 const int kJSRegExpOffset = 3 * kPointerSize; |
| 2319 // jssp[24]: x22 | |
| 2320 // jssp[32]: last_match_info (JSArray) | |
| 2321 // jssp[40]: previous index | |
| 2322 // jssp[48]: subject string | |
| 2323 // jssp[56]: JSRegExp object | |
| 2324 | |
| 2325 const int kLastMatchInfoOffset = 4 * kPointerSize; | |
| 2326 const int kPreviousIndexOffset = 5 * kPointerSize; | |
| 2327 const int kSubjectOffset = 6 * kPointerSize; | |
| 2328 const int kJSRegExpOffset = 7 * kPointerSize; | |
| 2329 | 2318 |
| 2330 // Ensure that a RegExp stack is allocated. | 2319 // Ensure that a RegExp stack is allocated. |
| 2331 ExternalReference address_of_regexp_stack_memory_address = | 2320 ExternalReference address_of_regexp_stack_memory_address = |
| 2332 ExternalReference::address_of_regexp_stack_memory_address(isolate()); | 2321 ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
| 2333 ExternalReference address_of_regexp_stack_memory_size = | 2322 ExternalReference address_of_regexp_stack_memory_size = |
| 2334 ExternalReference::address_of_regexp_stack_memory_size(isolate()); | 2323 ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
| 2335 __ Mov(x10, address_of_regexp_stack_memory_size); | 2324 __ Mov(x10, address_of_regexp_stack_memory_size); |
| 2336 __ Ldr(x10, MemOperand(x10)); | 2325 __ Ldr(x10, MemOperand(x10)); |
| 2337 __ Cbz(x10, &runtime); | 2326 __ Cbz(x10, &runtime); |
| 2338 | 2327 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 STATIC_ASSERT(kSmiTag == 0); | 2674 STATIC_ASSERT(kSmiTag == 0); |
| 2686 __ Bic(x11, current_offset, kSmiShiftMask); | 2675 __ Bic(x11, current_offset, kSmiShiftMask); |
| 2687 __ Stp(x10, | 2676 __ Stp(x10, |
| 2688 x11, | 2677 x11, |
| 2689 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); | 2678 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); |
| 2690 __ B(&next_capture); | 2679 __ B(&next_capture); |
| 2691 __ Bind(&done); | 2680 __ Bind(&done); |
| 2692 | 2681 |
| 2693 // Return last match info. | 2682 // Return last match info. |
| 2694 __ Peek(x0, kLastMatchInfoOffset); | 2683 __ Peek(x0, kLastMatchInfoOffset); |
| 2695 __ PopCPURegList(used_callee_saved_registers); | |
| 2696 // Drop the 4 arguments of the stub from the stack. | 2684 // Drop the 4 arguments of the stub from the stack. |
| 2697 __ Drop(4); | 2685 __ Drop(4); |
| 2698 __ Ret(); | 2686 __ Ret(); |
| 2699 | 2687 |
| 2700 __ Bind(&exception); | 2688 __ Bind(&exception); |
| 2701 Register exception_value = x0; | 2689 Register exception_value = x0; |
| 2702 // A stack overflow (on the backtrack stack) may have occured | 2690 // A stack overflow (on the backtrack stack) may have occured |
| 2703 // in the RegExp code but no exception has been created yet. | 2691 // in the RegExp code but no exception has been created yet. |
| 2704 // If there is no pending exception, handle that in the runtime system. | 2692 // If there is no pending exception, handle that in the runtime system. |
| 2705 __ Mov(x10, Operand(isolate()->factory()->the_hole_value())); | 2693 __ Mov(x10, Operand(isolate()->factory()->the_hole_value())); |
| 2706 __ Mov(x11, | 2694 __ Mov(x11, |
| 2707 Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 2695 Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 2708 isolate()))); | 2696 isolate()))); |
| 2709 __ Ldr(exception_value, MemOperand(x11)); | 2697 __ Ldr(exception_value, MemOperand(x11)); |
| 2710 __ Cmp(x10, exception_value); | 2698 __ Cmp(x10, exception_value); |
| 2711 __ B(eq, &runtime); | 2699 __ B(eq, &runtime); |
| 2712 | 2700 |
| 2713 // For exception, throw the exception again. | 2701 // For exception, throw the exception again. |
| 2714 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1); | 2702 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1); |
| 2715 | 2703 |
| 2716 __ Bind(&failure); | 2704 __ Bind(&failure); |
| 2717 __ Mov(x0, Operand(isolate()->factory()->null_value())); | 2705 __ Mov(x0, Operand(isolate()->factory()->null_value())); |
| 2718 __ PopCPURegList(used_callee_saved_registers); | |
| 2719 // Drop the 4 arguments of the stub from the stack. | 2706 // Drop the 4 arguments of the stub from the stack. |
| 2720 __ Drop(4); | 2707 __ Drop(4); |
| 2721 __ Ret(); | 2708 __ Ret(); |
| 2722 | 2709 |
| 2723 __ Bind(&runtime); | 2710 __ Bind(&runtime); |
| 2724 __ PopCPURegList(used_callee_saved_registers); | |
| 2725 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 2711 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
| 2726 | 2712 |
| 2727 // Deferred code for string handling. | 2713 // Deferred code for string handling. |
| 2728 // (6) Not a long external string? If yes, go to (8). | 2714 // (6) Not a long external string? If yes, go to (8). |
| 2729 __ Bind(¬_seq_nor_cons); | 2715 __ Bind(¬_seq_nor_cons); |
| 2730 // Compare flags are still set. | 2716 // Compare flags are still set. |
| 2731 __ B(ne, ¬_long_external); // Go to (8). | 2717 __ B(ne, ¬_long_external); // Go to (8). |
| 2732 | 2718 |
| 2733 // (7) External string. Make it, offset-wise, look like a sequential string. | 2719 // (7) External string. Make it, offset-wise, look like a sequential string. |
| 2734 __ Bind(&external_string); | 2720 __ Bind(&external_string); |
| (...skipping 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5831 MemOperand(fp, 6 * kPointerSize), NULL); | 5817 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5832 } | 5818 } |
| 5833 | 5819 |
| 5834 | 5820 |
| 5835 #undef __ | 5821 #undef __ |
| 5836 | 5822 |
| 5837 } // namespace internal | 5823 } // namespace internal |
| 5838 } // namespace v8 | 5824 } // namespace v8 |
| 5839 | 5825 |
| 5840 #endif // V8_TARGET_ARCH_ARM64 | 5826 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |