Chromium Code Reviews| 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_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 * | |
| 21 * This assembler uses the following register assignment convention | 23 * This assembler uses the following register assignment convention |
| 22 * - t3 : Temporarily stores the index of capture start after a matching pass | 24 * - t3 : Temporarily stores the index of capture start after a matching pass |
| 23 * for a global regexp. | 25 * for a global regexp. |
| 24 * - a5 : Pointer to current code object (Code*) including heap object tag. | 26 * - a5 : Pointer to current code object (Code*) including heap object tag. |
| 25 * - a6 : Current position in input, as negative offset from end of string. | 27 * - a6 : Current position in input, as negative offset from end of string. |
| 26 * Please notice that this is the byte offset, not the character offset! | 28 * Please notice that this is the byte offset, not the character offset! |
| 27 * - a7 : Currently loaded character. Must be loaded using | 29 * - a7 : Currently loaded character. Must be loaded using |
| 28 * LoadCurrentCharacter before using any of the dispatch methods. | 30 * LoadCurrentCharacter before using any of the dispatch methods. |
| 29 * - t0 : Points to tip of backtrack stack | 31 * - t0 : Points to tip of backtrack stack |
| 30 * - t1 : Unused. | 32 * - t1 : Unused. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 * string, otherwise 0) | 69 * string, otherwise 0) |
| 68 * - fp[-32] register 0 (Only positions must be stored in the first | 70 * - fp[-32] register 0 (Only positions must be stored in the first |
| 69 * - register 1 num_saved_registers_ registers) | 71 * - register 1 num_saved_registers_ registers) |
| 70 * - ... | 72 * - ... |
| 71 * - register num_registers-1 | 73 * - register num_registers-1 |
| 72 * --- sp --- | 74 * --- sp --- |
| 73 * | 75 * |
| 74 * | 76 * |
| 75 * The N64 stack will have the following structure: | 77 * The N64 stack will have the following structure: |
| 76 * | 78 * |
| 77 * - fp[88] Isolate* isolate (address of the current isolate) kIsolate | 79 * - fp[80] Isolate* isolate (address of the current isolate) kIsolate |
|
georgia.kouveli
2017/04/19 15:57:26
The corresponding comments for arm and arm64 are a
jgruber
2017/04/20 09:37:47
Thanks, good point. I made a pass through the comm
| |
| 78 * - fp[80] secondary link/return address used by exit frame on native call. kSecondaryReturnAddress | 80 * kStackFrameHeader |
| 79 kStackFrameHeader | |
| 80 * --- sp when called --- | 81 * --- sp when called --- |
| 81 * - fp[72] ra Return from RegExp code (ra). kReturnAddress | 82 * - fp[72] ra Return from RegExp code (ra). kReturnAddress |
| 82 * - fp[64] s9, old-fp Old fp, callee saved(s9). | 83 * - fp[64] s9, old-fp Old fp, callee saved(s9). |
| 83 * - fp[0..63] s0..s7 Callee-saved registers s0..s7. | 84 * - fp[0..63] s0..s7 Callee-saved registers s0..s7. |
| 84 * --- frame pointer ---- | 85 * --- frame pointer ---- |
| 85 * - fp[-8] direct_call (1 = direct call from JS, 0 = from runtime) kDirectCall | 86 * - fp[-8] direct_call (1 = direct call from JS, 0 = from runtime) kDirectCall |
| 86 * - fp[-16] stack_base (Top of backtracking stack). kStackHighEnd | 87 * - fp[-16] stack_base (Top of backtracking stack). kStackHighEnd |
| 87 * - fp[-24] capture array size (may fit multiple sets of matches) kNumOutputRegisters | 88 * - 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 | 89 * - fp[-32] int* capture_array (int[num_saved_registers_], for output). kRegisterOutput |
| 89 * - fp[-40] end of input (address of end of string). kInputEnd | 90 * - fp[-40] end of input (address of end of string). kInputEnd |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 109 * code and the remaining arguments are passed in registers, e.g. by calling the | 110 * 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: | 111 * code entry as cast to a function with the signature: |
| 111 * int (*match)(String* input_string, | 112 * int (*match)(String* input_string, |
| 112 * int start_index, | 113 * int start_index, |
| 113 * Address start, | 114 * Address start, |
| 114 * Address end, | 115 * Address end, |
| 115 * Address secondary_return_address, // Only used by native call. | 116 * Address secondary_return_address, // Only used by native call. |
| 116 * int* capture_output_array, | 117 * int* capture_output_array, |
| 117 * byte* stack_area_base, | 118 * byte* stack_area_base, |
| 118 * bool direct_call = false, | 119 * bool direct_call = false, |
| 119 * void* return_address, | 120 * void* return_address, |
|
georgia.kouveli
2017/04/19 15:57:26
return_address is removed now?
jgruber
2017/04/20 09:37:47
Removed.
| |
| 120 * Isolate* isolate); | 121 * Isolate* isolate); |
| 121 * The call is performed by NativeRegExpMacroAssembler::Execute() | 122 * The call is performed by NativeRegExpMacroAssembler::Execute() |
| 122 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro | 123 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro |
| 123 * in mips/simulator-mips.h. | 124 * in mips/simulator-mips.h. |
| 124 * When calling as a non-direct call (i.e., from C++ code), the return address | 125 * When calling as a non-direct call (i.e., from C++ code), the return address |
| 125 * area is overwritten with the ra register by the RegExp code. When doing a | 126 * 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 * direct call from generated code, the return address is placed there by |
|
georgia.kouveli
2017/04/19 15:57:26
Another mention of the return address and exit fra
jgruber
2017/04/20 09:37:47
Removed this entire paragraph.
| |
| 127 * the calling code, as in a normal exit frame. | 128 * the calling code, as in a normal exit frame. |
| 129 * | |
| 130 * clang-format on | |
| 128 */ | 131 */ |
| 129 | 132 |
| 130 #define __ ACCESS_MASM(masm_) | 133 #define __ ACCESS_MASM(masm_) |
| 131 | 134 |
| 132 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone, | 135 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone, |
| 133 Mode mode, | 136 Mode mode, |
| 134 int registers_to_save) | 137 int registers_to_save) |
| 135 : NativeRegExpMacroAssembler(isolate, zone), | 138 : NativeRegExpMacroAssembler(isolate, zone), |
| 136 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 139 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
| 137 CodeObjectRequired::kYes)), | 140 CodeObjectRequired::kYes)), |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1328 } | 1331 } |
| 1329 | 1332 |
| 1330 #undef __ | 1333 #undef __ |
| 1331 | 1334 |
| 1332 #endif // V8_INTERPRETED_REGEXP | 1335 #endif // V8_INTERPRETED_REGEXP |
| 1333 | 1336 |
| 1334 } // namespace internal | 1337 } // namespace internal |
| 1335 } // namespace v8 | 1338 } // namespace v8 |
| 1336 | 1339 |
| 1337 #endif // V8_TARGET_ARCH_MIPS64 | 1340 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |