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/regexp/arm64/regexp-macro-assembler-arm64.h" | 7 #include "src/regexp/arm64/regexp-macro-assembler-arm64.h" |
8 | 8 |
9 #include "src/arm64/macro-assembler-arm64-inl.h" | 9 #include "src/arm64/macro-assembler-arm64-inl.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 * | 49 * |
50 * The remaining registers are free for computations. | 50 * The remaining registers are free for computations. |
51 * Each call to a public method should retain this convention. | 51 * Each call to a public method should retain this convention. |
52 * | 52 * |
53 * The stack will have the following structure: | 53 * The stack will have the following structure: |
54 * | 54 * |
55 * Location Name Description | 55 * Location Name Description |
56 * (as referred to in | 56 * (as referred to in |
57 * the code) | 57 * the code) |
58 * | 58 * |
59 * - fp[96] isolate Address of the current isolate. | 59 * - fp[104] isolate Address of the current isolate. |
| 60 * - fp[96] return_address Secondary link/return address |
| 61 * used by an exit frame if this is a |
| 62 * native call. |
60 * ^^^ csp when called ^^^ | 63 * ^^^ csp when called ^^^ |
61 * - fp[88] lr Return from the RegExp code. | 64 * - fp[88] lr Return from the RegExp code. |
62 * - fp[80] r29 Old frame pointer (CalleeSaved). | 65 * - fp[80] r29 Old frame pointer (CalleeSaved). |
63 * - fp[0..72] r19-r28 Backup of CalleeSaved registers. | 66 * - fp[0..72] r19-r28 Backup of CalleeSaved registers. |
64 * - fp[-8] direct_call 1 => Direct call from JavaScript code. | 67 * - fp[-8] direct_call 1 => Direct call from JavaScript code. |
65 * 0 => Call through the runtime system. | 68 * 0 => Call through the runtime system. |
66 * - fp[-16] stack_base High end of the memory area to use as | 69 * - fp[-16] stack_base High end of the memory area to use as |
67 * the backtracking stack. | 70 * the backtracking stack. |
68 * - fp[-24] output_size Output may fit multiple sets of matches. | 71 * - fp[-24] output_size Output may fit multiple sets of matches. |
69 * - fp[-32] input Handle containing the input string. | 72 * - fp[-32] input Handle containing the input string. |
70 * - fp[-40] success_counter | 73 * - fp[-40] success_counter |
71 * ^^^^^^^^^^^^^ From here and downwards we store 32 bit values ^^^^^^^^^^^^^ | 74 * ^^^^^^^^^^^^^ From here and downwards we store 32 bit values ^^^^^^^^^^^^^ |
72 * - fp[-44] register N Capture registers initialized with | 75 * - fp[-44] register N Capture registers initialized with |
73 * - fp[-48] register N + 1 non_position_value. | 76 * - fp[-48] register N + 1 non_position_value. |
74 * ... The first kNumCachedRegisters (N) registers | 77 * ... The first kNumCachedRegisters (N) registers |
75 * ... are cached in x0 to x7. | 78 * ... are cached in x0 to x7. |
76 * ... Only positions must be stored in the first | 79 * ... Only positions must be stored in the first |
77 * - ... num_saved_registers_ registers. | 80 * - ... num_saved_registers_ registers. |
78 * - ... | 81 * - ... |
79 * - register N + num_registers - 1 | 82 * - register N + num_registers - 1 |
80 * ^^^^^^^^^ csp ^^^^^^^^^ | 83 * ^^^^^^^^^ csp ^^^^^^^^^ |
81 * | 84 * |
82 * The first num_saved_registers_ registers are initialized to point to | 85 * The first num_saved_registers_ registers are initialized to point to |
83 * "character -1" in the string (i.e., char_size() bytes before the first | 86 * "character -1" in the string (i.e., char_size() bytes before the first |
84 * character of the string). The remaining registers start out as garbage. | 87 * character of the string). The remaining registers start out as garbage. |
85 * | 88 * |
86 * The data up to the return address must be placed there by the calling | 89 * The data up to the return address must be placed there by the calling |
87 * code and the remaining arguments are passed in registers, e.g. by calling the | 90 * code and the remaining arguments are passed in registers, e.g. by calling the |
88 * code entry as cast to a function with the signature: | 91 * code entry as cast to a function with the signature: |
89 * int (*match)(String* input_string, | 92 * int (*match)(String* input, |
90 * int start_index, | 93 * int start_offset, |
91 * Address start, | 94 * Address input_start, |
92 * Address end, | 95 * Address input_end, |
93 * int* capture_output_array, | 96 * int* output, |
94 * int num_capture_registers, | 97 * int output_size, |
95 * byte* stack_area_base, | 98 * Address stack_base, |
96 * bool direct_call = false, | 99 * bool direct_call = false, |
97 * Isolate* isolate); | 100 * Address secondary_return_address, // Only used by native call. |
| 101 * Isolate* isolate) |
98 * The call is performed by NativeRegExpMacroAssembler::Execute() | 102 * The call is performed by NativeRegExpMacroAssembler::Execute() |
99 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro | 103 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro |
100 * in arm64/simulator-arm64.h. | 104 * in arm64/simulator-arm64.h. |
| 105 * When calling as a non-direct call (i.e., from C++ code), the return address |
| 106 * area is overwritten with the LR register by the RegExp code. When doing a |
| 107 * direct call from generated code, the return address is placed there by |
| 108 * the calling code, as in a normal exit frame. |
101 */ | 109 */ |
102 | 110 |
103 #define __ ACCESS_MASM(masm_) | 111 #define __ ACCESS_MASM(masm_) |
104 | 112 |
105 RegExpMacroAssemblerARM64::RegExpMacroAssemblerARM64(Isolate* isolate, | 113 RegExpMacroAssemblerARM64::RegExpMacroAssemblerARM64(Isolate* isolate, |
106 Zone* zone, Mode mode, | 114 Zone* zone, Mode mode, |
107 int registers_to_save) | 115 int registers_to_save) |
108 : NativeRegExpMacroAssembler(isolate, zone), | 116 : NativeRegExpMacroAssembler(isolate, zone), |
109 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 117 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
110 CodeObjectRequired::kYes)), | 118 CodeObjectRequired::kYes)), |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 } | 1657 } |
1650 } | 1658 } |
1651 } | 1659 } |
1652 | 1660 |
1653 #endif // V8_INTERPRETED_REGEXP | 1661 #endif // V8_INTERPRETED_REGEXP |
1654 | 1662 |
1655 } // namespace internal | 1663 } // namespace internal |
1656 } // namespace v8 | 1664 } // namespace v8 |
1657 | 1665 |
1658 #endif // V8_TARGET_ARCH_ARM64 | 1666 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |