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

Side by Side Diff: src/compiler.cc

Issue 3304012: Don't generate preparse data if lazy-flag is false. (Closed)
Patch Set: Address review comment. Created 10 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Do a lookup in the compilation cache but not for extensions. 262 // Do a lookup in the compilation cache but not for extensions.
263 Handle<SharedFunctionInfo> result; 263 Handle<SharedFunctionInfo> result;
264 if (extension == NULL) { 264 if (extension == NULL) {
265 result = CompilationCache::LookupScript(source, 265 result = CompilationCache::LookupScript(source,
266 script_name, 266 script_name,
267 line_offset, 267 line_offset,
268 column_offset); 268 column_offset);
269 } 269 }
270 270
271 if (result.is_null()) { 271 if (result.is_null()) {
272 // No cache entry found. Do pre-parsing and compile the script. 272 // No cache entry found. Do pre-parsing, if it makes sense, and compile
273 // the script.
274 // Building preparse data that is only used immediately after is only a
275 // saving if we might skip building the AST for lazily compiled functions.
276 // I.e., preparse data isn't relevant when the lazy flag is off, and
277 // for small sources, odds are that there aren't many functions
278 // that would be compiled lazily anyway, so we skip the preparse step
279 // in that case too.
280 // TODO(lrn): Maybe *only* collect function info, not symbol info, in
281 // this case, since it's just replacing one hash-lookup with another.
273 ScriptDataImpl* pre_data = input_pre_data; 282 ScriptDataImpl* pre_data = input_pre_data;
274 if (pre_data == NULL && source_length >= FLAG_min_preparse_length) { 283 if (pre_data == NULL
284 && FLAG_lazy
285 && source_length >= FLAG_min_preparse_length) {
275 pre_data = PreParse(source, NULL, extension); 286 pre_data = PreParse(source, NULL, extension);
276 } 287 }
277 288
278 // Create a script object describing the script to be compiled. 289 // Create a script object describing the script to be compiled.
279 Handle<Script> script = Factory::NewScript(source); 290 Handle<Script> script = Factory::NewScript(source);
280 if (natives == NATIVES_CODE) { 291 if (natives == NATIVES_CODE) {
281 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 292 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
282 } 293 }
283 if (!script_name.is_null()) { 294 if (!script_name.is_null()) {
284 script->set_name(*script_name); 295 script->set_name(*script_name);
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), 580 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
570 *code, *func_name)); 581 *code, *func_name));
571 OPROFILE(CreateNativeCodeRegion(*func_name, 582 OPROFILE(CreateNativeCodeRegion(*func_name,
572 code->instruction_start(), 583 code->instruction_start(),
573 code->instruction_size())); 584 code->instruction_size()));
574 } 585 }
575 } 586 }
576 } 587 }
577 588
578 } } // namespace v8::internal 589 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698