OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 16 matching lines...) Expand all Loading... |
28 #include "v8.h" | 28 #include "v8.h" |
29 #include "ast.h" | 29 #include "ast.h" |
30 #include "assembler.h" | 30 #include "assembler.h" |
31 #include "regexp-stack.h" | 31 #include "regexp-stack.h" |
32 #include "regexp-macro-assembler.h" | 32 #include "regexp-macro-assembler.h" |
33 #include "simulator.h" | 33 #include "simulator.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 RegExpMacroAssembler::RegExpMacroAssembler() : slow_safe_compiler_(false) { | 38 RegExpMacroAssembler::RegExpMacroAssembler() |
| 39 : slow_safe_compiler_(false), |
| 40 global_(false) { |
39 } | 41 } |
40 | 42 |
41 | 43 |
42 RegExpMacroAssembler::~RegExpMacroAssembler() { | 44 RegExpMacroAssembler::~RegExpMacroAssembler() { |
43 } | 45 } |
44 | 46 |
45 | 47 |
46 bool RegExpMacroAssembler::CanReadUnaligned() { | 48 bool RegExpMacroAssembler::CanReadUnaligned() { |
47 #ifdef V8_HOST_CAN_READ_UNALIGNED | 49 #ifdef V8_HOST_CAN_READ_UNALIGNED |
48 return true; | 50 return true; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 const byte* input_start = | 144 const byte* input_start = |
143 StringCharacterPosition(subject_ptr, start_offset + slice_offset); | 145 StringCharacterPosition(subject_ptr, start_offset + slice_offset); |
144 int byte_length = char_length << char_size_shift; | 146 int byte_length = char_length << char_size_shift; |
145 const byte* input_end = input_start + byte_length; | 147 const byte* input_end = input_start + byte_length; |
146 Result res = Execute(*regexp_code, | 148 Result res = Execute(*regexp_code, |
147 *subject, | 149 *subject, |
148 start_offset, | 150 start_offset, |
149 input_start, | 151 input_start, |
150 input_end, | 152 input_end, |
151 offsets_vector, | 153 offsets_vector, |
| 154 offsets_vector_length, |
152 isolate); | 155 isolate); |
153 return res; | 156 return res; |
154 } | 157 } |
155 | 158 |
156 | 159 |
157 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( | 160 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( |
158 Code* code, | 161 Code* code, |
159 String* input, // This needs to be the unpacked (sliced, cons) string. | 162 String* input, // This needs to be the unpacked (sliced, cons) string. |
160 int start_offset, | 163 int start_offset, |
161 const byte* input_start, | 164 const byte* input_start, |
162 const byte* input_end, | 165 const byte* input_end, |
163 int* output, | 166 int* output, |
| 167 int output_size, |
164 Isolate* isolate) { | 168 Isolate* isolate) { |
165 ASSERT(isolate == Isolate::Current()); | 169 ASSERT(isolate == Isolate::Current()); |
166 // Ensure that the minimum stack has been allocated. | 170 // Ensure that the minimum stack has been allocated. |
167 RegExpStackScope stack_scope(isolate); | 171 RegExpStackScope stack_scope(isolate); |
168 Address stack_base = stack_scope.stack()->stack_base(); | 172 Address stack_base = stack_scope.stack()->stack_base(); |
169 | 173 |
170 int direct_call = 0; | 174 int direct_call = 0; |
171 int result = CALL_GENERATED_REGEXP_CODE(code->entry(), | 175 int result = CALL_GENERATED_REGEXP_CODE(code->entry(), |
172 input, | 176 input, |
173 start_offset, | 177 start_offset, |
174 input_start, | 178 input_start, |
175 input_end, | 179 input_end, |
176 output, | 180 output, |
| 181 output_size, |
177 stack_base, | 182 stack_base, |
178 direct_call, | 183 direct_call, |
179 isolate); | 184 isolate); |
180 ASSERT(result <= SUCCESS); | |
181 ASSERT(result >= RETRY); | 185 ASSERT(result >= RETRY); |
182 | 186 |
183 if (result == EXCEPTION && !isolate->has_pending_exception()) { | 187 if (result == EXCEPTION && !isolate->has_pending_exception()) { |
184 // We detected a stack overflow (on the backtrack stack) in RegExp code, | 188 // We detected a stack overflow (on the backtrack stack) in RegExp code, |
185 // but haven't created the exception yet. | 189 // but haven't created the exception yet. |
186 isolate->StackOverflow(); | 190 isolate->StackOverflow(); |
187 } | 191 } |
188 return static_cast<Result>(result); | 192 return static_cast<Result>(result); |
189 } | 193 } |
190 | 194 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return NULL; | 266 return NULL; |
263 } | 267 } |
264 *stack_base = new_stack_base; | 268 *stack_base = new_stack_base; |
265 intptr_t stack_content_size = old_stack_base - stack_pointer; | 269 intptr_t stack_content_size = old_stack_base - stack_pointer; |
266 return new_stack_base - stack_content_size; | 270 return new_stack_base - stack_content_size; |
267 } | 271 } |
268 | 272 |
269 #endif // V8_INTERPRETED_REGEXP | 273 #endif // V8_INTERPRETED_REGEXP |
270 | 274 |
271 } } // namespace v8::internal | 275 } } // namespace v8::internal |
OLD | NEW |