OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/regexp/ppc/regexp-macro-assembler-ppc.h" | 7 #include "src/regexp/ppc/regexp-macro-assembler-ppc.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 * - r30: End of input (points to byte after last character in input). | 31 * - r30: End of input (points to byte after last character in input). |
32 * - r31: Frame pointer. Used to access arguments, local variables and | 32 * - r31: Frame pointer. Used to access arguments, local variables and |
33 * RegExp registers. | 33 * RegExp registers. |
34 * - r12: IP register, used by assembler. Very volatile. | 34 * - r12: IP register, used by assembler. Very volatile. |
35 * - r1/sp : Points to tip of C stack. | 35 * - r1/sp : Points to tip of C stack. |
36 * | 36 * |
37 * The remaining registers are free for computations. | 37 * The remaining registers are free for computations. |
38 * Each call to a public method should retain this convention. | 38 * Each call to a public method should retain this convention. |
39 * | 39 * |
40 * The stack will have the following structure: | 40 * The stack will have the following structure: |
41 * - fp[40] Isolate* isolate (address of the current isolate) | 41 * - fp[44] Isolate* isolate (address of the current isolate) |
| 42 * - fp[40] secondary link/return address used by native call. |
42 * - fp[36] lr save area (currently unused) | 43 * - fp[36] lr save area (currently unused) |
43 * - fp[32] backchain (currently unused) | 44 * - fp[32] backchain (currently unused) |
44 * --- sp when called --- | 45 * --- sp when called --- |
45 * - fp[28] return address (lr). | 46 * - fp[28] return address (lr). |
46 * - fp[24] old frame pointer (r31). | 47 * - fp[24] old frame pointer (r31). |
47 * - fp[0..20] backup of registers r25..r30 | 48 * - fp[0..20] backup of registers r25..r30 |
48 * --- frame pointer ---- | 49 * --- frame pointer ---- |
49 * - fp[-4] direct_call (if 1, direct call from JavaScript code, | 50 * - fp[-4] direct_call (if 1, direct call from JavaScript code, |
50 * if 0, call through the runtime system). | 51 * if 0, call through the runtime system). |
51 * - fp[-8] stack_area_base (high end of the memory area to use as | 52 * - fp[-8] stack_area_base (high end of the memory area to use as |
(...skipping 21 matching lines...) Expand all Loading... |
73 * character of the string). The remaining registers start out as garbage. | 74 * character of the string). The remaining registers start out as garbage. |
74 * | 75 * |
75 * 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 |
76 * 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 |
77 * code entry as cast to a function with the signature: | 78 * code entry as cast to a function with the signature: |
78 * int (*match)(String* input_string, | 79 * int (*match)(String* input_string, |
79 * int start_index, | 80 * int start_index, |
80 * Address start, | 81 * Address start, |
81 * Address end, | 82 * Address end, |
82 * int* capture_output_array, | 83 * int* capture_output_array, |
83 * int num_capture_registers, | |
84 * byte* stack_area_base, | 84 * byte* stack_area_base, |
85 * bool direct_call = false, | 85 * Address secondary_return_address, // Only used by native call. |
86 * Isolate* isolate); | 86 * bool direct_call = false) |
87 * The call is performed by NativeRegExpMacroAssembler::Execute() | 87 * The call is performed by NativeRegExpMacroAssembler::Execute() |
88 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro | 88 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro |
89 * in ppc/simulator-ppc.h. | 89 * in ppc/simulator-ppc.h. |
| 90 * When calling as a non-direct call (i.e., from C++ code), the return address |
| 91 * area is overwritten with the LR register by the RegExp code. When doing a |
| 92 * direct call from generated code, the return address is placed there by |
| 93 * the calling code, as in a normal exit frame. |
90 */ | 94 */ |
91 | 95 |
92 #define __ ACCESS_MASM(masm_) | 96 #define __ ACCESS_MASM(masm_) |
93 | 97 |
94 RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone, | 98 RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone, |
95 Mode mode, | 99 Mode mode, |
96 int registers_to_save) | 100 int registers_to_save) |
97 : NativeRegExpMacroAssembler(isolate, zone), | 101 : NativeRegExpMacroAssembler(isolate, zone), |
98 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, | 102 masm_(new MacroAssembler(isolate, NULL, kRegExpCodeSize, |
99 CodeObjectRequired::kYes)), | 103 CodeObjectRequired::kYes)), |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 } | 1326 } |
1323 | 1327 |
1324 | 1328 |
1325 #undef __ | 1329 #undef __ |
1326 | 1330 |
1327 #endif // V8_INTERPRETED_REGEXP | 1331 #endif // V8_INTERPRETED_REGEXP |
1328 } // namespace internal | 1332 } // namespace internal |
1329 } // namespace v8 | 1333 } // namespace v8 |
1330 | 1334 |
1331 #endif // V8_TARGET_ARCH_PPC | 1335 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |