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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 #include "src/regexp/mips/regexp-macro-assembler-mips.h" | 7 #include "src/regexp/mips/regexp-macro-assembler-mips.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/log.h" | 10 #include "src/log.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 * - t6 : End of input (points to byte after last character in input). | 31 * - t6 : End of input (points to byte after last character in input). |
32 * - fp : Frame pointer. Used to access arguments, local variables and | 32 * - fp : Frame pointer. Used to access arguments, local variables and |
33 * RegExp registers. | 33 * RegExp registers. |
34 * - sp : Points to tip of C stack. | 34 * - sp : Points to tip of C stack. |
35 * | 35 * |
36 * The remaining registers are free for computations. | 36 * The remaining registers are free for computations. |
37 * Each call to a public method should retain this convention. | 37 * Each call to a public method should retain this convention. |
38 * | 38 * |
39 * The stack will have the following structure: | 39 * The stack will have the following structure: |
40 * | 40 * |
41 * - fp[60] Isolate* isolate (address of the current isolate) | 41 * - fp[64] Isolate* isolate (address of the current isolate) |
42 * - fp[56] direct_call (if 1, direct call from JavaScript code, | 42 * - fp[60] direct_call (if 1, direct call from JavaScript code, |
43 * if 0, call through the runtime system). | 43 * if 0, call through the runtime system). |
44 * - fp[52] stack_area_base (High end of the memory area to use as | 44 * - fp[56] stack_area_base (High end of the memory area to use as |
45 * backtracking stack). | 45 * backtracking stack). |
46 * - fp[48] capture array size (may fit multiple sets of matches) | 46 * - fp[52] capture array size (may fit multiple sets of matches) |
47 * - fp[44] int* capture_array (int[num_saved_registers_], for output). | 47 * - fp[48] int* capture_array (int[num_saved_registers_], for output). |
| 48 * - fp[44] secondary link/return address used by native call. |
48 * --- sp when called --- | 49 * --- sp when called --- |
49 * - fp[40] return address (lr). | 50 * - fp[40] return address (lr). |
50 * - fp[36] old frame pointer (r11). | 51 * - fp[36] old frame pointer (r11). |
51 * - fp[0..32] backup of registers s0..s7. | 52 * - fp[0..32] backup of registers s0..s7. |
52 * --- frame pointer ---- | 53 * --- frame pointer ---- |
53 * - fp[-4] end of input (address of end of string). | 54 * - fp[-4] end of input (address of end of string). |
54 * - fp[-8] start of input (address of first character in string). | 55 * - fp[-8] start of input (address of first character in string). |
55 * - fp[-12] start index (character index of start). | 56 * - fp[-12] start index (character index of start). |
56 * - fp[-16] void* input_string (location of a handle containing the string). | 57 * - fp[-16] void* input_string (location of a handle containing the string). |
57 * - fp[-20] success counter (only for global regexps to count matches). | 58 * - fp[-20] success counter (only for global regexps to count matches). |
(...skipping 12 matching lines...) Expand all Loading... |
70 * "character -1" in the string (i.e., char_size() bytes before the first | 71 * "character -1" in the string (i.e., char_size() bytes before the first |
71 * character of the string). The remaining registers start out as garbage. | 72 * character of the string). The remaining registers start out as garbage. |
72 * | 73 * |
73 * The data up to the return address must be placed there by the calling | 74 * The data up to the return address must be placed there by the calling |
74 * code and the remaining arguments are passed in registers, e.g. by calling the | 75 * code and the remaining arguments are passed in registers, e.g. by calling the |
75 * code entry as cast to a function with the signature: | 76 * code entry as cast to a function with the signature: |
76 * int (*match)(String* input_string, | 77 * int (*match)(String* input_string, |
77 * int start_index, | 78 * int start_index, |
78 * Address start, | 79 * Address start, |
79 * Address end, | 80 * Address end, |
| 81 * Address secondary_return_address, // Only used by native call. |
80 * int* capture_output_array, | 82 * int* capture_output_array, |
81 * int num_capture_registers, | |
82 * byte* stack_area_base, | 83 * byte* stack_area_base, |
83 * bool direct_call = false, | 84 * bool direct_call = false) |
84 * Isolate* isolate); | |
85 * The call is performed by NativeRegExpMacroAssembler::Execute() | 85 * The call is performed by NativeRegExpMacroAssembler::Execute() |
86 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro | 86 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro |
87 * in mips/simulator-mips.h. | 87 * in mips/simulator-mips.h. |
| 88 * When calling as a non-direct call (i.e., from C++ code), the return address |
| 89 * area is overwritten with the ra register by the RegExp code. When doing a |
| 90 * direct call from generated code, the return address is placed there by |
| 91 * the calling code, as in a normal exit frame. |
88 */ | 92 */ |
89 | 93 |
90 #define __ ACCESS_MASM(masm_) | 94 #define __ ACCESS_MASM(masm_) |
91 | 95 |
92 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone, | 96 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone, |
93 Mode mode, | 97 Mode mode, |
94 int registers_to_save) | 98 int registers_to_save) |
95 : NativeRegExpMacroAssembler(isolate, zone), | 99 : NativeRegExpMacroAssembler(isolate, zone), |
96 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 100 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
97 CodeObjectRequired::kYes)), | 101 CodeObjectRequired::kYes)), |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 | 1292 |
1289 | 1293 |
1290 #undef __ | 1294 #undef __ |
1291 | 1295 |
1292 #endif // V8_INTERPRETED_REGEXP | 1296 #endif // V8_INTERPRETED_REGEXP |
1293 | 1297 |
1294 } // namespace internal | 1298 } // namespace internal |
1295 } // namespace v8 | 1299 } // namespace v8 |
1296 | 1300 |
1297 #endif // V8_TARGET_ARCH_MIPS | 1301 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |