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

Side by Side Diff: src/jsregexp.cc

Issue 115352: Consistently use CompilationZoneScope instead of ZoneScope to ensure... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/parser.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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "ast.h" 30 #include "ast.h"
31 #include "compiler.h"
31 #include "execution.h" 32 #include "execution.h"
32 #include "factory.h" 33 #include "factory.h"
33 #include "jsregexp-inl.h" 34 #include "jsregexp-inl.h"
34 #include "platform.h" 35 #include "platform.h"
35 #include "runtime.h" 36 #include "runtime.h"
36 #include "top.h" 37 #include "top.h"
37 #include "compilation-cache.h" 38 #include "compilation-cache.h"
38 #include "string-stream.h" 39 #include "string-stream.h"
39 #include "parser.h" 40 #include "parser.h"
40 #include "regexp-macro-assembler.h" 41 #include "regexp-macro-assembler.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags); 147 Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags);
147 bool in_cache = !cached.is_null(); 148 bool in_cache = !cached.is_null();
148 LOG(RegExpCompileEvent(re, in_cache)); 149 LOG(RegExpCompileEvent(re, in_cache));
149 150
150 Handle<Object> result; 151 Handle<Object> result;
151 if (in_cache) { 152 if (in_cache) {
152 re->set_data(*cached); 153 re->set_data(*cached);
153 return re; 154 return re;
154 } 155 }
155 FlattenString(pattern); 156 FlattenString(pattern);
156 ZoneScope zone_scope(DELETE_ON_EXIT); 157 CompilationZoneScope zone_scope(DELETE_ON_EXIT);
157 RegExpCompileData parse_result; 158 RegExpCompileData parse_result;
158 FlatStringReader reader(pattern); 159 FlatStringReader reader(pattern);
159 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { 160 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) {
160 // Throw an exception if we fail to parse the pattern. 161 // Throw an exception if we fail to parse the pattern.
161 ThrowRegExpException(re, 162 ThrowRegExpException(re,
162 pattern, 163 pattern,
163 parse_result.error, 164 parse_result.error,
164 "malformed_regexp"); 165 "malformed_regexp");
165 return Handle<Object>::null(); 166 return Handle<Object>::null();
166 } 167 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // A value has already been compiled. 279 // A value has already been compiled.
279 if (entry->IsJSObject()) { 280 if (entry->IsJSObject()) {
280 // If it's a JS value, it's an error. 281 // If it's a JS value, it's an error.
281 Top::Throw(entry); 282 Top::Throw(entry);
282 return false; 283 return false;
283 } 284 }
284 return true; 285 return true;
285 } 286 }
286 287
287 // Compile the RegExp. 288 // Compile the RegExp.
288 ZoneScope zone_scope(DELETE_ON_EXIT); 289 CompilationZoneScope zone_scope(DELETE_ON_EXIT);
289 290
290 JSRegExp::Flags flags = re->GetFlags(); 291 JSRegExp::Flags flags = re->GetFlags();
291 292
292 Handle<String> pattern(re->Pattern()); 293 Handle<String> pattern(re->Pattern());
293 if (!pattern->IsFlat()) { 294 if (!pattern->IsFlat()) {
294 FlattenString(pattern); 295 FlattenString(pattern);
295 } 296 }
296 297
297 RegExpCompileData compile_data; 298 RegExpCompileData compile_data;
298 FlatStringReader reader(pattern); 299 FlatStringReader reader(pattern);
(...skipping 4162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4461 EmbeddedVector<byte, 1024> codes; 4462 EmbeddedVector<byte, 1024> codes;
4462 RegExpMacroAssemblerIrregexp macro_assembler(codes); 4463 RegExpMacroAssemblerIrregexp macro_assembler(codes);
4463 return compiler.Assemble(&macro_assembler, 4464 return compiler.Assemble(&macro_assembler,
4464 node, 4465 node,
4465 data->capture_count, 4466 data->capture_count,
4466 pattern); 4467 pattern);
4467 } 4468 }
4468 4469
4469 4470
4470 }} // namespace v8::internal 4471 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698