| 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 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 // x19 subject subject string | 2279 // x19 subject subject string |
| 2280 // x20 regexp_data RegExp data (FixedArray) | 2280 // x20 regexp_data RegExp data (FixedArray) |
| 2281 // x21 last_match_info_elements info relative to the last match | 2281 // x21 last_match_info_elements info relative to the last match |
| 2282 // (FixedArray) | 2282 // (FixedArray) |
| 2283 // x22 code_object generated regexp code | 2283 // x22 code_object generated regexp code |
| 2284 Register subject = x19; | 2284 Register subject = x19; |
| 2285 Register regexp_data = x20; | 2285 Register regexp_data = x20; |
| 2286 Register last_match_info_elements = x21; | 2286 Register last_match_info_elements = x21; |
| 2287 Register code_object = x22; | 2287 Register code_object = x22; |
| 2288 | 2288 |
| 2289 // TODO(jbramley): Is it necessary to preserve these? I don't think ARM does. | 2289 // Stack frame. |
| 2290 CPURegList used_callee_saved_registers(subject, | 2290 // jssp[00]: last_match_info (JSArray) |
| 2291 regexp_data, | 2291 // jssp[08]: previous index |
| 2292 last_match_info_elements, | 2292 // jssp[16]: subject string |
| 2293 code_object); | 2293 // jssp[24]: JSRegExp object |
| 2294 __ PushCPURegList(used_callee_saved_registers); | |
| 2295 | 2294 |
| 2296 // Stack frame. | 2295 const int kLastMatchInfoOffset = 0 * kPointerSize; |
| 2297 // jssp[0] : x19 | 2296 const int kPreviousIndexOffset = 1 * kPointerSize; |
| 2298 // jssp[8] : x20 | 2297 const int kSubjectOffset = 2 * kPointerSize; |
| 2299 // jssp[16]: x21 | 2298 const int kJSRegExpOffset = 3 * kPointerSize; |
| 2300 // jssp[24]: x22 | |
| 2301 // jssp[32]: last_match_info (JSArray) | |
| 2302 // jssp[40]: previous index | |
| 2303 // jssp[48]: subject string | |
| 2304 // jssp[56]: JSRegExp object | |
| 2305 | |
| 2306 const int kLastMatchInfoOffset = 4 * kPointerSize; | |
| 2307 const int kPreviousIndexOffset = 5 * kPointerSize; | |
| 2308 const int kSubjectOffset = 6 * kPointerSize; | |
| 2309 const int kJSRegExpOffset = 7 * kPointerSize; | |
| 2310 | 2299 |
| 2311 // Ensure that a RegExp stack is allocated. | 2300 // Ensure that a RegExp stack is allocated. |
| 2312 ExternalReference address_of_regexp_stack_memory_address = | 2301 ExternalReference address_of_regexp_stack_memory_address = |
| 2313 ExternalReference::address_of_regexp_stack_memory_address(isolate()); | 2302 ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
| 2314 ExternalReference address_of_regexp_stack_memory_size = | 2303 ExternalReference address_of_regexp_stack_memory_size = |
| 2315 ExternalReference::address_of_regexp_stack_memory_size(isolate()); | 2304 ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
| 2316 __ Mov(x10, address_of_regexp_stack_memory_size); | 2305 __ Mov(x10, address_of_regexp_stack_memory_size); |
| 2317 __ Ldr(x10, MemOperand(x10)); | 2306 __ Ldr(x10, MemOperand(x10)); |
| 2318 __ Cbz(x10, &runtime); | 2307 __ Cbz(x10, &runtime); |
| 2319 | 2308 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 STATIC_ASSERT(kSmiTag == 0); | 2655 STATIC_ASSERT(kSmiTag == 0); |
| 2667 __ Bic(x11, current_offset, kSmiShiftMask); | 2656 __ Bic(x11, current_offset, kSmiShiftMask); |
| 2668 __ Stp(x10, | 2657 __ Stp(x10, |
| 2669 x11, | 2658 x11, |
| 2670 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); | 2659 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); |
| 2671 __ B(&next_capture); | 2660 __ B(&next_capture); |
| 2672 __ Bind(&done); | 2661 __ Bind(&done); |
| 2673 | 2662 |
| 2674 // Return last match info. | 2663 // Return last match info. |
| 2675 __ Peek(x0, kLastMatchInfoOffset); | 2664 __ Peek(x0, kLastMatchInfoOffset); |
| 2676 __ PopCPURegList(used_callee_saved_registers); | |
| 2677 // Drop the 4 arguments of the stub from the stack. | 2665 // Drop the 4 arguments of the stub from the stack. |
| 2678 __ Drop(4); | 2666 __ Drop(4); |
| 2679 __ Ret(); | 2667 __ Ret(); |
| 2680 | 2668 |
| 2681 __ Bind(&exception); | 2669 __ Bind(&exception); |
| 2682 Register exception_value = x0; | 2670 Register exception_value = x0; |
| 2683 // A stack overflow (on the backtrack stack) may have occured | 2671 // A stack overflow (on the backtrack stack) may have occured |
| 2684 // in the RegExp code but no exception has been created yet. | 2672 // in the RegExp code but no exception has been created yet. |
| 2685 // If there is no pending exception, handle that in the runtime system. | 2673 // If there is no pending exception, handle that in the runtime system. |
| 2686 __ Mov(x10, Operand(isolate()->factory()->the_hole_value())); | 2674 __ Mov(x10, Operand(isolate()->factory()->the_hole_value())); |
| 2687 __ Mov(x11, | 2675 __ Mov(x11, |
| 2688 Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 2676 Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 2689 isolate()))); | 2677 isolate()))); |
| 2690 __ Ldr(exception_value, MemOperand(x11)); | 2678 __ Ldr(exception_value, MemOperand(x11)); |
| 2691 __ Cmp(x10, exception_value); | 2679 __ Cmp(x10, exception_value); |
| 2692 __ B(eq, &runtime); | 2680 __ B(eq, &runtime); |
| 2693 | 2681 |
| 2694 // For exception, throw the exception again. | 2682 // For exception, throw the exception again. |
| 2695 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1); | 2683 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1); |
| 2696 | 2684 |
| 2697 __ Bind(&failure); | 2685 __ Bind(&failure); |
| 2698 __ Mov(x0, Operand(isolate()->factory()->null_value())); | 2686 __ Mov(x0, Operand(isolate()->factory()->null_value())); |
| 2699 __ PopCPURegList(used_callee_saved_registers); | |
| 2700 // Drop the 4 arguments of the stub from the stack. | 2687 // Drop the 4 arguments of the stub from the stack. |
| 2701 __ Drop(4); | 2688 __ Drop(4); |
| 2702 __ Ret(); | 2689 __ Ret(); |
| 2703 | 2690 |
| 2704 __ Bind(&runtime); | 2691 __ Bind(&runtime); |
| 2705 __ PopCPURegList(used_callee_saved_registers); | |
| 2706 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 2692 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
| 2707 | 2693 |
| 2708 // Deferred code for string handling. | 2694 // Deferred code for string handling. |
| 2709 // (6) Not a long external string? If yes, go to (8). | 2695 // (6) Not a long external string? If yes, go to (8). |
| 2710 __ Bind(¬_seq_nor_cons); | 2696 __ Bind(¬_seq_nor_cons); |
| 2711 // Compare flags are still set. | 2697 // Compare flags are still set. |
| 2712 __ B(ne, ¬_long_external); // Go to (8). | 2698 __ B(ne, ¬_long_external); // Go to (8). |
| 2713 | 2699 |
| 2714 // (7) External string. Make it, offset-wise, look like a sequential string. | 2700 // (7) External string. Make it, offset-wise, look like a sequential string. |
| 2715 __ Bind(&external_string); | 2701 __ Bind(&external_string); |
| (...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5761 kStackUnwindSpace, NULL, spill_offset, | 5747 kStackUnwindSpace, NULL, spill_offset, |
| 5762 MemOperand(fp, 6 * kPointerSize), NULL); | 5748 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5763 } | 5749 } |
| 5764 | 5750 |
| 5765 | 5751 |
| 5766 #undef __ | 5752 #undef __ |
| 5767 | 5753 |
| 5768 } } // namespace v8::internal | 5754 } } // namespace v8::internal |
| 5769 | 5755 |
| 5770 #endif // V8_TARGET_ARCH_ARM64 | 5756 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |