Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Side by Side Diff: src/jsregexp.cc

Issue 4146006: Make Parser class have no friends and fewer things to depend on it. (Closed)
Patch Set: Addressed review comments. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (!Parser::ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { 128 if (!RegExpParser::ParseRegExp(&reader, flags.is_multiline(),
129 &parse_result)) {
129 // Throw an exception if we fail to parse the pattern. 130 // Throw an exception if we fail to parse the pattern.
130 ThrowRegExpException(re, 131 ThrowRegExpException(re,
131 pattern, 132 pattern,
132 parse_result.error, 133 parse_result.error,
133 "malformed_regexp"); 134 "malformed_regexp");
134 return Handle<Object>::null(); 135 return Handle<Object>::null();
135 } 136 }
136 137
137 if (parse_result.simple && !flags.is_ignore_case()) { 138 if (parse_result.simple && !flags.is_ignore_case()) {
138 // Parse-tree is a single atom that is equal to the pattern. 139 // Parse-tree is a single atom that is equal to the pattern.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 261
261 JSRegExp::Flags flags = re->GetFlags(); 262 JSRegExp::Flags flags = re->GetFlags();
262 263
263 Handle<String> pattern(re->Pattern()); 264 Handle<String> pattern(re->Pattern());
264 if (!pattern->IsFlat()) { 265 if (!pattern->IsFlat()) {
265 FlattenString(pattern); 266 FlattenString(pattern);
266 } 267 }
267 268
268 RegExpCompileData compile_data; 269 RegExpCompileData compile_data;
269 FlatStringReader reader(pattern); 270 FlatStringReader reader(pattern);
270 if (!Parser::ParseRegExp(&reader, flags.is_multiline(), &compile_data)) { 271 if (!RegExpParser::ParseRegExp(&reader, flags.is_multiline(),
272 &compile_data)) {
271 // Throw an exception if we fail to parse the pattern. 273 // Throw an exception if we fail to parse the pattern.
272 // THIS SHOULD NOT HAPPEN. We already pre-parsed it successfully once. 274 // THIS SHOULD NOT HAPPEN. We already pre-parsed it successfully once.
273 ThrowRegExpException(re, 275 ThrowRegExpException(re,
274 pattern, 276 pattern,
275 compile_data.error, 277 compile_data.error,
276 "malformed_regexp"); 278 "malformed_regexp");
277 return false; 279 return false;
278 } 280 }
279 RegExpEngine::CompilationResult result = 281 RegExpEngine::CompilationResult result =
280 RegExpEngine::Compile(&compile_data, 282 RegExpEngine::Compile(&compile_data,
(...skipping 4971 matching lines...) Expand 10 before | Expand all | Expand 10 after
5252 node, 5254 node,
5253 data->capture_count, 5255 data->capture_count,
5254 pattern); 5256 pattern);
5255 } 5257 }
5256 5258
5257 5259
5258 int OffsetsVector::static_offsets_vector_[ 5260 int OffsetsVector::static_offsets_vector_[
5259 OffsetsVector::kStaticOffsetsVectorSize]; 5261 OffsetsVector::kStaticOffsetsVectorSize];
5260 5262
5261 }} // namespace v8::internal 5263 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698