Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/regexp/mips64/regexp-macro-assembler-mips64.cc

Issue 2832193002: Revert of [regexp] Remove remainder of native RegExpExecStub (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/regexp/mips64/regexp-macro-assembler-mips64.h" 7 #include "src/regexp/mips64/regexp-macro-assembler-mips64.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"
11 #include "src/macro-assembler.h" 11 #include "src/macro-assembler.h"
12 #include "src/regexp/regexp-macro-assembler.h" 12 #include "src/regexp/regexp-macro-assembler.h"
13 #include "src/regexp/regexp-stack.h" 13 #include "src/regexp/regexp-stack.h"
14 #include "src/unicode.h" 14 #include "src/unicode.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 18
19 #ifndef V8_INTERPRETED_REGEXP 19 #ifndef V8_INTERPRETED_REGEXP
20 20 /*
21 /* clang-format off
22 *
23 * This assembler uses the following register assignment convention 21 * This assembler uses the following register assignment convention
24 * - t3 : Temporarily stores the index of capture start after a matching pass 22 * - t3 : Temporarily stores the index of capture start after a matching pass
25 * for a global regexp. 23 * for a global regexp.
26 * - a5 : Pointer to current code object (Code*) including heap object tag. 24 * - a5 : Pointer to current code object (Code*) including heap object tag.
27 * - a6 : Current position in input, as negative offset from end of string. 25 * - a6 : Current position in input, as negative offset from end of string.
28 * Please notice that this is the byte offset, not the character offset! 26 * Please notice that this is the byte offset, not the character offset!
29 * - a7 : Currently loaded character. Must be loaded using 27 * - a7 : Currently loaded character. Must be loaded using
30 * LoadCurrentCharacter before using any of the dispatch methods. 28 * LoadCurrentCharacter before using any of the dispatch methods.
31 * - t0 : Points to tip of backtrack stack 29 * - t0 : Points to tip of backtrack stack
32 * - t1 : Unused. 30 * - t1 : Unused.
33 * - t2 : End of input (points to byte after last character in input). 31 * - t2 : End of input (points to byte after last character in input).
34 * - fp : Frame pointer. Used to access arguments, local variables and 32 * - fp : Frame pointer. Used to access arguments, local variables and
35 * RegExp registers. 33 * RegExp registers.
36 * - sp : Points to tip of C stack. 34 * - sp : Points to tip of C stack.
37 * 35 *
38 * The remaining registers are free for computations. 36 * The remaining registers are free for computations.
39 * Each call to a public method should retain this convention. 37 * Each call to a public method should retain this convention.
40 * 38 *
41 * TODO(plind): O32 documented here with intent of having single 32/64 codebase 39 * TODO(plind): O32 documented here with intent of having single 32/64 codebase
42 * in the future. 40 * in the future.
43 * 41 *
44 * The O32 stack will have the following structure: 42 * The O32 stack will have the following structure:
45 * 43 *
46 * - fp[72] Isolate* isolate (address of the current isolate) 44 * - fp[76] Isolate* isolate (address of the current isolate)
47 * - fp[68] direct_call (if 1, direct call from JavaScript code, 45 * - fp[72] direct_call (if 1, direct call from JavaScript code,
48 * if 0, call through the runtime system). 46 * if 0, call through the runtime system).
49 * - fp[64] stack_area_base (High end of the memory area to use as 47 * - fp[68] stack_area_base (High end of the memory area to use as
50 * backtracking stack). 48 * backtracking stack).
51 * - fp[60] capture array size (may fit multiple sets of matches) 49 * - fp[64] capture array size (may fit multiple sets of matches)
50 * - fp[60] int* capture_array (int[num_saved_registers_], for output).
52 * - fp[44..59] MIPS O32 four argument slots 51 * - fp[44..59] MIPS O32 four argument slots
53 * - fp[40] int* capture_array (int[num_saved_registers_], for output). 52 * - fp[40] secondary link/return address used by native call.
54 * --- sp when called --- 53 * --- sp when called ---
55 * - fp[36] return address (lr). 54 * - fp[36] return address (lr).
56 * - fp[32] old frame pointer (r11). 55 * - fp[32] old frame pointer (r11).
57 * - fp[0..31] backup of registers s0..s7. 56 * - fp[0..31] backup of registers s0..s7.
58 * --- frame pointer ---- 57 * --- frame pointer ----
59 * - fp[-4] end of input (address of end of string). 58 * - fp[-4] end of input (address of end of string).
60 * - fp[-8] start of input (address of first character in string). 59 * - fp[-8] start of input (address of first character in string).
61 * - fp[-12] start index (character index of start). 60 * - fp[-12] start index (character index of start).
62 * - fp[-16] void* input_string (location of a handle containing the string). 61 * - fp[-16] void* input_string (location of a handle containing the string).
63 * - fp[-20] success counter (only for global regexps to count matches). 62 * - fp[-20] success counter (only for global regexps to count matches).
64 * - fp[-24] Offset of location before start of input (effectively character 63 * - fp[-24] Offset of location before start of input (effectively character
65 * string start - 1). Used to initialize capture registers to a 64 * string start - 1). Used to initialize capture registers to a
66 * non-position. 65 * non-position.
67 * - fp[-28] At start (if 1, we are starting at the start of the 66 * - fp[-28] At start (if 1, we are starting at the start of the
68 * string, otherwise 0) 67 * string, otherwise 0)
69 * - fp[-32] register 0 (Only positions must be stored in the first 68 * - fp[-32] register 0 (Only positions must be stored in the first
70 * - register 1 num_saved_registers_ registers) 69 * - register 1 num_saved_registers_ registers)
71 * - ... 70 * - ...
72 * - register num_registers-1 71 * - register num_registers-1
73 * --- sp --- 72 * --- sp ---
74 * 73 *
75 * 74 *
76 * The N64 stack will have the following structure: 75 * The N64 stack will have the following structure:
77 * 76 *
78 * - fp[80] Isolate* isolate (address of the current isolate) kIsolate 77 * - fp[88] Isolate* isolate (address of the current isolate) kIsolate
79 * kStackFrameHeader 78 * - fp[80] secondary link/return address used by exit frame on native call. kSecondaryReturnAddress
79 kStackFrameHeader
80 * --- sp when called --- 80 * --- sp when called ---
81 * - fp[72] ra Return from RegExp code (ra). kReturnAddress 81 * - fp[72] ra Return from RegExp code (ra). kReturnAddress
82 * - fp[64] s9, old-fp Old fp, callee saved(s9). 82 * - fp[64] s9, old-fp Old fp, callee saved(s9).
83 * - fp[0..63] s0..s7 Callee-saved registers s0..s7. 83 * - fp[0..63] s0..s7 Callee-saved registers s0..s7.
84 * --- frame pointer ---- 84 * --- frame pointer ----
85 * - fp[-8] direct_call (1 = direct call from JS, 0 = from runtime) kDirectCall 85 * - fp[-8] direct_call (1 = direct call from JS, 0 = from runtime) kDirectCall
86 * - fp[-16] stack_base (Top of backtracking stack). kStackHighEnd 86 * - fp[-16] stack_base (Top of backtracking stack). kStackHighEnd
87 * - fp[-24] capture array size (may fit multiple sets of matches) kNumOutputRegisters 87 * - fp[-24] capture array size (may fit multiple sets of matches) kNumOutputRegisters
88 * - fp[-32] int* capture_array (int[num_saved_registers_], for output). kRegisterOutput 88 * - fp[-32] int* capture_array (int[num_saved_registers_], for output). kRegisterOutput
89 * - fp[-40] end of input (address of end of string). kInputEnd 89 * - fp[-40] end of input (address of end of string). kInputEnd
(...skipping 15 matching lines...) Expand all
105 * "character -1" in the string (i.e., char_size() bytes before the first 105 * "character -1" in the string (i.e., char_size() bytes before the first
106 * character of the string). The remaining registers start out as garbage. 106 * character of the string). The remaining registers start out as garbage.
107 * 107 *
108 * The data up to the return address must be placed there by the calling 108 * The data up to the return address must be placed there by the calling
109 * code and the remaining arguments are passed in registers, e.g. by calling the 109 * code and the remaining arguments are passed in registers, e.g. by calling the
110 * code entry as cast to a function with the signature: 110 * code entry as cast to a function with the signature:
111 * int (*match)(String* input_string, 111 * int (*match)(String* input_string,
112 * int start_index, 112 * int start_index,
113 * Address start, 113 * Address start,
114 * Address end, 114 * Address end,
115 * Address secondary_return_address, // Only used by native call.
115 * int* capture_output_array, 116 * int* capture_output_array,
116 * int num_capture_registers,
117 * byte* stack_area_base, 117 * byte* stack_area_base,
118 * bool direct_call = false, 118 * bool direct_call = false,
119 * void* return_address,
119 * Isolate* isolate); 120 * Isolate* isolate);
120 * The call is performed by NativeRegExpMacroAssembler::Execute() 121 * The call is performed by NativeRegExpMacroAssembler::Execute()
121 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro 122 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro
122 * in mips/simulator-mips.h. 123 * in mips/simulator-mips.h.
123 * 124 * When calling as a non-direct call (i.e., from C++ code), the return address
124 * clang-format on 125 * area is overwritten with the ra register by the RegExp code. When doing a
126 * direct call from generated code, the return address is placed there by
127 * the calling code, as in a normal exit frame.
125 */ 128 */
126 129
127 #define __ ACCESS_MASM(masm_) 130 #define __ ACCESS_MASM(masm_)
128 131
129 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone, 132 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone,
130 Mode mode, 133 Mode mode,
131 int registers_to_save) 134 int registers_to_save)
132 : NativeRegExpMacroAssembler(isolate, zone), 135 : NativeRegExpMacroAssembler(isolate, zone),
133 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, 136 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize,
134 CodeObjectRequired::kYes)), 137 CodeObjectRequired::kYes)),
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 } 1328 }
1326 1329
1327 #undef __ 1330 #undef __
1328 1331
1329 #endif // V8_INTERPRETED_REGEXP 1332 #endif // V8_INTERPRETED_REGEXP
1330 1333
1331 } // namespace internal 1334 } // namespace internal
1332 } // namespace v8 1335 } // namespace v8
1333 1336
1334 #endif // V8_TARGET_ARCH_MIPS64 1337 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/regexp/mips64/regexp-macro-assembler-mips64.h ('k') | src/regexp/ppc/regexp-macro-assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698