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

Side by Side Diff: src/parser.cc

Issue 172753002: Re-enable Parser::symbol_cache_ (after a long time!) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: adding safeguards Created 6 years, 10 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/preparser.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 2012 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
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 UNREACHABLE(); 200 UNREACHABLE();
201 return; 201 return;
202 } 202 }
203 terms_.Add( 203 terms_.Add(
204 new(zone()) RegExpQuantifier(min, max, quantifier_type, atom), zone()); 204 new(zone()) RegExpQuantifier(min, max, quantifier_type, atom), zone());
205 LAST(ADD_TERM); 205 LAST(ADD_TERM);
206 } 206 }
207 207
208 208
209 Handle<String> Parser::LookupSymbol(int symbol_id) { 209 Handle<String> Parser::LookupSymbol(int symbol_id) {
210 // Length of symbol cache is the number of identified symbols. 210 // If there is no preparser symbol data, a negative number will be passed. In
211 // If we are larger than that, or negative, it's not a cached symbol. 211 // that case, we'll just read the literal from Scanner. This also guards
212 // This might also happen if there is no preparser symbol data, even 212 // against corrupt preparse data where the symbol id is larger than the symbol
213 // if there is some preparser data. 213 // count.
214 if (static_cast<unsigned>(symbol_id) 214 if (symbol_id < 0 ||
215 >= static_cast<unsigned>(symbol_cache_.length())) { 215 (pre_parse_data_ && symbol_id >= pre_parse_data_->symbol_count())) {
216 if (scanner()->is_literal_ascii()) { 216 if (scanner()->is_literal_ascii()) {
217 return isolate()->factory()->InternalizeOneByteString( 217 return isolate()->factory()->InternalizeOneByteString(
218 Vector<const uint8_t>::cast(scanner()->literal_ascii_string())); 218 Vector<const uint8_t>::cast(scanner()->literal_ascii_string()));
219 } else { 219 } else {
220 return isolate()->factory()->InternalizeTwoByteString( 220 return isolate()->factory()->InternalizeTwoByteString(
221 scanner()->literal_utf16_string()); 221 scanner()->literal_utf16_string());
222 } 222 }
223 } 223 }
224 return LookupCachedSymbol(symbol_id); 224 return LookupCachedSymbol(symbol_id);
225 } 225 }
(...skipping 5127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5353 ASSERT(info()->isolate()->has_pending_exception()); 5353 ASSERT(info()->isolate()->has_pending_exception());
5354 } else { 5354 } else {
5355 result = ParseProgram(); 5355 result = ParseProgram();
5356 } 5356 }
5357 } 5357 }
5358 info()->SetFunction(result); 5358 info()->SetFunction(result);
5359 return (result != NULL); 5359 return (result != NULL);
5360 } 5360 }
5361 5361
5362 } } // namespace v8::internal 5362 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698