OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/regexp/arm/regexp-macro-assembler-arm.h" | 7 #include "src/regexp/arm/regexp-macro-assembler-arm.h" |
8 | 8 |
9 #include "src/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 * - r10 : End of input (points to byte after last character in input). | 34 * - r10 : End of input (points to byte after last character in input). |
35 * - r11 : Frame pointer. Used to access arguments, local variables and | 35 * - r11 : Frame pointer. Used to access arguments, local variables and |
36 * RegExp registers. | 36 * RegExp registers. |
37 * - r12 : IP register, used by assembler. Very volatile. | 37 * - r12 : IP register, used by assembler. Very volatile. |
38 * - r13/sp : Points to tip of C stack. | 38 * - r13/sp : Points to tip of C stack. |
39 * | 39 * |
40 * The remaining registers are free for computations. | 40 * The remaining registers are free for computations. |
41 * Each call to a public method should retain this convention. | 41 * Each call to a public method should retain this convention. |
42 * | 42 * |
43 * The stack will have the following structure: | 43 * The stack will have the following structure: |
44 * - fp[56] Isolate* isolate (address of the current isolate) | 44 * - fp[52] Isolate* isolate (address of the current isolate) |
45 * - fp[52] direct_call (if 1, direct call from JavaScript code, | 45 * - fp[48] direct_call (if 1, direct call from JavaScript code, |
46 * if 0, call through the runtime system). | 46 * if 0, call through the runtime system). |
47 * - fp[48] stack_area_base (high end of the memory area to use as | 47 * - fp[44] stack_area_base (high end of the memory area to use as |
48 * backtracking stack). | 48 * backtracking stack). |
49 * - fp[44] capture array size (may fit multiple sets of matches) | 49 * - fp[40] capture array size (may fit multiple sets of matches) |
50 * - fp[40] int* capture_array (int[num_saved_registers_], for output). | 50 * - fp[36] int* capture_array (int[num_saved_registers_], for output). |
51 * - fp[36] secondary link/return address used by native call. | |
52 * --- sp when called --- | 51 * --- sp when called --- |
53 * - fp[32] return address (lr). | 52 * - fp[32] return address (lr). |
54 * - fp[28] old frame pointer (r11). | 53 * - fp[28] old frame pointer (r11). |
55 * - fp[0..24] backup of registers r4..r10. | 54 * - fp[0..24] backup of registers r4..r10. |
56 * --- frame pointer ---- | 55 * --- frame pointer ---- |
57 * - fp[-4] end of input (address of end of string). | 56 * - fp[-4] end of input (address of end of string). |
58 * - fp[-8] start of input (address of first character in string). | 57 * - fp[-8] start of input (address of first character in string). |
59 * - fp[-12] start index (character index of start). | 58 * - fp[-12] start index (character index of start). |
60 * - fp[-16] void* input_string (location of a handle containing the string). | 59 * - fp[-16] void* input_string (location of a handle containing the string). |
61 * - fp[-20] success counter (only for global regexps to count matches). | 60 * - fp[-20] success counter (only for global regexps to count matches). |
(...skipping 12 matching lines...) Expand all Loading... |
74 * "character -1" in the string (i.e., char_size() bytes before the first | 73 * "character -1" in the string (i.e., char_size() bytes before the first |
75 * character of the string). The remaining registers start out as garbage. | 74 * character of the string). The remaining registers start out as garbage. |
76 * | 75 * |
77 * The data up to the return address must be placed there by the calling | 76 * The data up to the return address must be placed there by the calling |
78 * code and the remaining arguments are passed in registers, e.g. by calling the | 77 * code and the remaining arguments are passed in registers, e.g. by calling the |
79 * code entry as cast to a function with the signature: | 78 * code entry as cast to a function with the signature: |
80 * int (*match)(String* input_string, | 79 * int (*match)(String* input_string, |
81 * int start_index, | 80 * int start_index, |
82 * Address start, | 81 * Address start, |
83 * Address end, | 82 * Address end, |
84 * Address secondary_return_address, // Only used by native call. | |
85 * int* capture_output_array, | 83 * int* capture_output_array, |
| 84 * int num_capture_registers, |
86 * byte* stack_area_base, | 85 * byte* stack_area_base, |
87 * bool direct_call = false) | 86 * bool direct_call = false, |
| 87 * Isolate* isolate); |
88 * The call is performed by NativeRegExpMacroAssembler::Execute() | 88 * The call is performed by NativeRegExpMacroAssembler::Execute() |
89 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro | 89 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro |
90 * in arm/simulator-arm.h. | 90 * in arm/simulator-arm.h. |
91 * When calling as a non-direct call (i.e., from C++ code), the return address | |
92 * area is overwritten with the LR register by the RegExp code. When doing a | |
93 * direct call from generated code, the return address is placed there by | |
94 * the calling code, as in a normal exit frame. | |
95 */ | 91 */ |
96 | 92 |
97 #define __ ACCESS_MASM(masm_) | 93 #define __ ACCESS_MASM(masm_) |
98 | 94 |
99 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(Isolate* isolate, Zone* zone, | 95 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(Isolate* isolate, Zone* zone, |
100 Mode mode, | 96 Mode mode, |
101 int registers_to_save) | 97 int registers_to_save) |
102 : NativeRegExpMacroAssembler(isolate, zone), | 98 : NativeRegExpMacroAssembler(isolate, zone), |
103 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 99 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
104 CodeObjectRequired::kYes)), | 100 CodeObjectRequired::kYes)), |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 | 1237 |
1242 | 1238 |
1243 #undef __ | 1239 #undef __ |
1244 | 1240 |
1245 #endif // V8_INTERPRETED_REGEXP | 1241 #endif // V8_INTERPRETED_REGEXP |
1246 | 1242 |
1247 } // namespace internal | 1243 } // namespace internal |
1248 } // namespace v8 | 1244 } // namespace v8 |
1249 | 1245 |
1250 #endif // V8_TARGET_ARCH_ARM | 1246 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |