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

Side by Side Diff: src/jsregexp.cc

Issue 11231: Flat string reader (Closed)
Patch Set: Created 12 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/heap.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Handle<String> flag_str) { 201 Handle<String> flag_str) {
202 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str); 202 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str);
203 Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags); 203 Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags);
204 bool in_cache = !cached.is_null(); 204 bool in_cache = !cached.is_null();
205 Handle<Object> result; 205 Handle<Object> result;
206 StringShape shape(*pattern); 206 StringShape shape(*pattern);
207 if (in_cache) { 207 if (in_cache) {
208 re->set_data(*cached); 208 re->set_data(*cached);
209 result = re; 209 result = re;
210 } else { 210 } else {
211 SafeStringInputBuffer buffer(pattern.location()); 211 pattern->Flatten(shape);
Erik Corry 2008/11/19 09:45:38 Since this shape is only used once I think you sho
212 RegExpParseResult parse_result; 212 RegExpParseResult parse_result;
213 if (!ParseRegExp(&buffer, &parse_result)) { 213 FlatStringReader reader(pattern);
214 if (!ParseRegExp(&reader, &parse_result)) {
214 // Throw an exception if we fail to parse the pattern. 215 // Throw an exception if we fail to parse the pattern.
215 ThrowRegExpException(re, 216 ThrowRegExpException(re,
216 pattern, 217 pattern,
217 parse_result.error, 218 parse_result.error,
218 "malformed_regexp"); 219 "malformed_regexp");
219 return Handle<Object>(); 220 return Handle<Object>();
220 } 221 }
221 RegExpAtom* atom = parse_result.tree->AsAtom(); 222 RegExpAtom* atom = parse_result.tree->AsAtom();
222 if (atom != NULL && !flags.is_ignore_case()) { 223 if (atom != NULL && !flags.is_ignore_case()) {
223 if (parse_result.has_character_escapes) { 224 if (parse_result.has_character_escapes) {
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 } 2066 }
2066 2067
2067 RegExpMacroAssembler::RegExpMacroAssembler() { 2068 RegExpMacroAssembler::RegExpMacroAssembler() {
2068 } 2069 }
2069 2070
2070 RegExpMacroAssembler::~RegExpMacroAssembler() { 2071 RegExpMacroAssembler::~RegExpMacroAssembler() {
2071 } 2072 }
2072 2073
2073 2074
2074 }} // namespace v8::internal 2075 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698