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[52] Isolate* isolate (address of the current isolate) | 44 * - fp[56] Isolate* isolate (address of the current isolate) |
45 * - fp[48] direct_call (if 1, direct call from JavaScript code, | 45 * - fp[52] 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[44] stack_area_base (high end of the memory area to use as | 47 * - fp[48] stack_area_base (high end of the memory area to use as |
48 * backtracking stack). | 48 * backtracking stack). |
49 * - fp[40] capture array size (may fit multiple sets of matches) | 49 * - fp[44] capture array size (may fit multiple sets of matches) |
50 * - fp[36] int* capture_array (int[num_saved_registers_], for output). | 50 * - fp[40] int* capture_array (int[num_saved_registers_], for output). |
| 51 * - fp[36] secondary link/return address used by native call. |
51 * --- sp when called --- | 52 * --- sp when called --- |
52 * - fp[32] return address (lr). | 53 * - fp[32] return address (lr). |
53 * - fp[28] old frame pointer (r11). | 54 * - fp[28] old frame pointer (r11). |
54 * - fp[0..24] backup of registers r4..r10. | 55 * - fp[0..24] backup of registers r4..r10. |
55 * --- frame pointer ---- | 56 * --- frame pointer ---- |
56 * - fp[-4] end of input (address of end of string). | 57 * - fp[-4] end of input (address of end of string). |
57 * - fp[-8] start of input (address of first character in string). | 58 * - fp[-8] start of input (address of first character in string). |
58 * - fp[-12] start index (character index of start). | 59 * - fp[-12] start index (character index of start). |
59 * - fp[-16] void* input_string (location of a handle containing the string). | 60 * - fp[-16] void* input_string (location of a handle containing the string). |
60 * - fp[-20] success counter (only for global regexps to count matches). | 61 * - fp[-20] success counter (only for global regexps to count matches). |
(...skipping 12 matching lines...) Expand all Loading... |
73 * "character -1" in the string (i.e., char_size() bytes before the first | 74 * "character -1" in the string (i.e., char_size() bytes before the first |
74 * character of the string). The remaining registers start out as garbage. | 75 * character of the string). The remaining registers start out as garbage. |
75 * | 76 * |
76 * The data up to the return address must be placed there by the calling | 77 * The data up to the return address must be placed there by the calling |
77 * code and the remaining arguments are passed in registers, e.g. by calling the | 78 * code and the remaining arguments are passed in registers, e.g. by calling the |
78 * code entry as cast to a function with the signature: | 79 * code entry as cast to a function with the signature: |
79 * int (*match)(String* input_string, | 80 * int (*match)(String* input_string, |
80 * int start_index, | 81 * int start_index, |
81 * Address start, | 82 * Address start, |
82 * Address end, | 83 * Address end, |
| 84 * Address secondary_return_address, // Only used by native call. |
83 * int* capture_output_array, | 85 * int* capture_output_array, |
84 * int num_capture_registers, | |
85 * byte* stack_area_base, | 86 * byte* stack_area_base, |
86 * bool direct_call = false, | 87 * 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. |
91 */ | 95 */ |
92 | 96 |
93 #define __ ACCESS_MASM(masm_) | 97 #define __ ACCESS_MASM(masm_) |
94 | 98 |
95 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(Isolate* isolate, Zone* zone, | 99 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(Isolate* isolate, Zone* zone, |
96 Mode mode, | 100 Mode mode, |
97 int registers_to_save) | 101 int registers_to_save) |
98 : NativeRegExpMacroAssembler(isolate, zone), | 102 : NativeRegExpMacroAssembler(isolate, zone), |
99 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 103 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
100 CodeObjectRequired::kYes)), | 104 CodeObjectRequired::kYes)), |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 | 1241 |
1238 | 1242 |
1239 #undef __ | 1243 #undef __ |
1240 | 1244 |
1241 #endif // V8_INTERPRETED_REGEXP | 1245 #endif // V8_INTERPRETED_REGEXP |
1242 | 1246 |
1243 } // namespace internal | 1247 } // namespace internal |
1244 } // namespace v8 | 1248 } // namespace v8 |
1245 | 1249 |
1246 #endif // V8_TARGET_ARCH_ARM | 1250 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |