| OLD | NEW |
| 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 * - esi : end of input (points to byte after last character in input). | 48 * - esi : end of input (points to byte after last character in input). |
| 49 * - ebp : frame pointer. Used to access arguments, local variables and | 49 * - ebp : frame pointer. Used to access arguments, local variables and |
| 50 * RegExp registers. | 50 * RegExp registers. |
| 51 * - esp : points to tip of C stack. | 51 * - esp : points to tip of C stack. |
| 52 * - ecx : points to tip of backtrack stack | 52 * - ecx : points to tip of backtrack stack |
| 53 * | 53 * |
| 54 * The registers eax, ebx and ecx are free to use for computations. | 54 * The registers eax, ebx and ecx are free to use for computations. |
| 55 * | 55 * |
| 56 * Each call to a public method should retain this convention. | 56 * Each call to a public method should retain this convention. |
| 57 * The stack will have the following structure: | 57 * The stack will have the following structure: |
| 58 * - stack_area_base (High end of the memory area to use as | 58 * - direct_call (if 1, direct call from JavaScript code, if 0 |
| 59 * backtracking stack) | 59 * call through the runtime system) |
| 60 * - at_start (if 1, start at start of string, if 0, don't) | 60 * - stack_area_base (High end of the memory area to use as |
| 61 * - int* capture_array (int[num_saved_registers_], for output). | 61 * backtracking stack) |
| 62 * - end of input (Address of end of string) | 62 * - at_start (if 1, we are starting at the start of the |
| 63 * - start of input (Address of first character in string) | 63 * string, otherwise 0) |
| 64 * - void* input_string (location of a handle containing the string) | 64 * - int* capture_array (int[num_saved_registers_], for output). |
| 65 * - end of input (Address of end of string) |
| 66 * - start of input (Address of first character in string) |
| 67 * - start index (character index of start) |
| 68 * - String* input_string (location of a handle containing the string) |
| 65 * --- frame alignment (if applicable) --- | 69 * --- frame alignment (if applicable) --- |
| 66 * - return address | 70 * - return address |
| 67 * ebp-> - old ebp | 71 * ebp-> - old ebp |
| 68 * - backup of caller esi | 72 * - backup of caller esi |
| 69 * - backup of caller edi | 73 * - backup of caller edi |
| 70 * - backup of caller ebx | 74 * - backup of caller ebx |
| 71 * - Offset of location before start of input (effectively character | 75 * - Offset of location before start of input (effectively character |
| 72 * position -1). Used to initialize capture registers to a non-position. | 76 * position -1). Used to initialize capture registers to a non-position. |
| 73 * - register 0 ebp[-4] (Only positions must be stored in the first | 77 * - register 0 ebp[-4] (Only positions must be stored in the first |
| 74 * - register 1 ebp[-8] num_saved_registers_ registers) | 78 * - register 1 ebp[-8] num_saved_registers_ registers) |
| 75 * - ... | 79 * - ... |
| 76 * | 80 * |
| 77 * The first num_saved_registers_ registers are initialized to point to | 81 * The first num_saved_registers_ registers are initialized to point to |
| 78 * "character -1" in the string (i.e., char_size() bytes before the first | 82 * "character -1" in the string (i.e., char_size() bytes before the first |
| 79 * character of the string). The remaining registers starts out as garbage. | 83 * character of the string). The remaining registers starts out as garbage. |
| 80 * | 84 * |
| 81 * The data up to the return address must be placed there by the calling | 85 * The data up to the return address must be placed there by the calling |
| 82 * code, by calling the code entry as cast to a function with the signature: | 86 * code, by calling the code entry as cast to a function with the signature: |
| 83 * int (*match)(String* input_string, | 87 * int (*match)(String* input_string, |
| 88 * int start_index, |
| 84 * Address start, | 89 * Address start, |
| 85 * Address end, | 90 * Address end, |
| 86 * int* capture_output_array, | 91 * int* capture_output_array, |
| 87 * bool at_start, | 92 * bool at_start, |
| 88 * byte* stack_area_base) | 93 * byte* stack_area_base, |
| 94 * bool direct_call) |
| 89 */ | 95 */ |
| 90 | 96 |
| 91 #define __ ACCESS_MASM(masm_) | 97 #define __ ACCESS_MASM(masm_) |
| 92 | 98 |
| 93 RegExpMacroAssemblerIA32::RegExpMacroAssemblerIA32( | 99 RegExpMacroAssemblerIA32::RegExpMacroAssemblerIA32( |
| 94 Mode mode, | 100 Mode mode, |
| 95 int registers_to_save) | 101 int registers_to_save) |
| 96 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)), | 102 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)), |
| 97 mode_(mode), | 103 mode_(mode), |
| 98 num_registers_(registers_to_save), | 104 num_registers_(registers_to_save), |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 Code* re_code, | 941 Code* re_code, |
| 936 Address re_frame) { | 942 Address re_frame) { |
| 937 if (StackGuard::IsStackOverflow()) { | 943 if (StackGuard::IsStackOverflow()) { |
| 938 Top::StackOverflow(); | 944 Top::StackOverflow(); |
| 939 return EXCEPTION; | 945 return EXCEPTION; |
| 940 } | 946 } |
| 941 | 947 |
| 942 // If not real stack overflow the stack guard was used to interrupt | 948 // If not real stack overflow the stack guard was used to interrupt |
| 943 // execution for another purpose. | 949 // execution for another purpose. |
| 944 | 950 |
| 951 // If this is a direct call from JavaScript retry the RegExp forcing the call |
| 952 // through the runtime system. Currently the direct call cannot handle a GC. |
| 953 if (frame_entry<int>(re_frame, kDirectCall) == 1) { |
| 954 return RETRY; |
| 955 } |
| 956 |
| 945 // Prepare for possible GC. | 957 // Prepare for possible GC. |
| 946 HandleScope handles; | 958 HandleScope handles; |
| 947 Handle<Code> code_handle(re_code); | 959 Handle<Code> code_handle(re_code); |
| 948 | 960 |
| 949 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); | 961 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); |
| 950 // Current string. | 962 // Current string. |
| 951 bool is_ascii = subject->IsAsciiRepresentation(); | 963 bool is_ascii = subject->IsAsciiRepresentation(); |
| 952 | 964 |
| 953 ASSERT(re_code->instruction_start() <= *return_address); | 965 ASSERT(re_code->instruction_start() <= *return_address); |
| 954 ASSERT(*return_address <= | 966 ASSERT(*return_address <= |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 } | 1171 } |
| 1160 } | 1172 } |
| 1161 } | 1173 } |
| 1162 | 1174 |
| 1163 | 1175 |
| 1164 #undef __ | 1176 #undef __ |
| 1165 | 1177 |
| 1166 #endif // V8_NATIVE_REGEXP | 1178 #endif // V8_NATIVE_REGEXP |
| 1167 | 1179 |
| 1168 }} // namespace v8::internal | 1180 }} // namespace v8::internal |
| OLD | NEW |