OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Handle<Object> result; | 118 Handle<Object> result; |
119 if (in_cache) { | 119 if (in_cache) { |
120 re->set_data(*cached); | 120 re->set_data(*cached); |
121 return re; | 121 return re; |
122 } | 122 } |
123 FlattenString(pattern); | 123 FlattenString(pattern); |
124 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 124 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
125 PostponeInterruptsScope postpone; | 125 PostponeInterruptsScope postpone; |
126 RegExpCompileData parse_result; | 126 RegExpCompileData parse_result; |
127 FlatStringReader reader(pattern); | 127 FlatStringReader reader(pattern); |
128 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { | 128 if (!Parser::ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { |
129 // Throw an exception if we fail to parse the pattern. | 129 // Throw an exception if we fail to parse the pattern. |
130 ThrowRegExpException(re, | 130 ThrowRegExpException(re, |
131 pattern, | 131 pattern, |
132 parse_result.error, | 132 parse_result.error, |
133 "malformed_regexp"); | 133 "malformed_regexp"); |
134 return Handle<Object>::null(); | 134 return Handle<Object>::null(); |
135 } | 135 } |
136 | 136 |
137 if (parse_result.simple && !flags.is_ignore_case()) { | 137 if (parse_result.simple && !flags.is_ignore_case()) { |
138 // Parse-tree is a single atom that is equal to the pattern. | 138 // Parse-tree is a single atom that is equal to the pattern. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 JSRegExp::Flags flags = re->GetFlags(); | 261 JSRegExp::Flags flags = re->GetFlags(); |
262 | 262 |
263 Handle<String> pattern(re->Pattern()); | 263 Handle<String> pattern(re->Pattern()); |
264 if (!pattern->IsFlat()) { | 264 if (!pattern->IsFlat()) { |
265 FlattenString(pattern); | 265 FlattenString(pattern); |
266 } | 266 } |
267 | 267 |
268 RegExpCompileData compile_data; | 268 RegExpCompileData compile_data; |
269 FlatStringReader reader(pattern); | 269 FlatStringReader reader(pattern); |
270 if (!ParseRegExp(&reader, flags.is_multiline(), &compile_data)) { | 270 if (!Parser::ParseRegExp(&reader, flags.is_multiline(), &compile_data)) { |
271 // Throw an exception if we fail to parse the pattern. | 271 // Throw an exception if we fail to parse the pattern. |
272 // THIS SHOULD NOT HAPPEN. We already pre-parsed it successfully once. | 272 // THIS SHOULD NOT HAPPEN. We already pre-parsed it successfully once. |
273 ThrowRegExpException(re, | 273 ThrowRegExpException(re, |
274 pattern, | 274 pattern, |
275 compile_data.error, | 275 compile_data.error, |
276 "malformed_regexp"); | 276 "malformed_regexp"); |
277 return false; | 277 return false; |
278 } | 278 } |
279 RegExpEngine::CompilationResult result = | 279 RegExpEngine::CompilationResult result = |
280 RegExpEngine::Compile(&compile_data, | 280 RegExpEngine::Compile(&compile_data, |
(...skipping 4959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 node, | 5240 node, |
5241 data->capture_count, | 5241 data->capture_count, |
5242 pattern); | 5242 pattern); |
5243 } | 5243 } |
5244 | 5244 |
5245 | 5245 |
5246 int OffsetsVector::static_offsets_vector_[ | 5246 int OffsetsVector::static_offsets_vector_[ |
5247 OffsetsVector::kStaticOffsetsVectorSize]; | 5247 OffsetsVector::kStaticOffsetsVectorSize]; |
5248 | 5248 |
5249 }} // namespace v8::internal | 5249 }} // namespace v8::internal |
OLD | NEW |