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

Side by Side Diff: src/compiler.cc

Issue 3356010: Avoid collecting symbol info for one-off preparsing. (Closed)
Patch Set: Addressed review comments. 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 | src/parser.h » ('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 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 if (result.is_null()) { 271 if (result.is_null()) {
272 // No cache entry found. Do pre-parsing, if it makes sense, and compile 272 // No cache entry found. Do pre-parsing, if it makes sense, and compile
273 // the script. 273 // the script.
274 // Building preparse data that is only used immediately after is only a 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. 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 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 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 278 // that would be compiled lazily anyway, so we skip the preparse step
279 // in that case too. 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.
282 ScriptDataImpl* pre_data = input_pre_data; 280 ScriptDataImpl* pre_data = input_pre_data;
283 if (pre_data == NULL 281 if (pre_data == NULL
284 && FLAG_lazy 282 && FLAG_lazy
285 && source_length >= FLAG_min_preparse_length) { 283 && source_length >= FLAG_min_preparse_length) {
286 pre_data = PreParse(source, NULL, extension); 284 pre_data = PartialPreParse(source, NULL, extension);
287 } 285 }
288 286
289 // Create a script object describing the script to be compiled. 287 // Create a script object describing the script to be compiled.
290 Handle<Script> script = Factory::NewScript(source); 288 Handle<Script> script = Factory::NewScript(source);
291 if (natives == NATIVES_CODE) { 289 if (natives == NATIVES_CODE) {
292 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 290 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
293 } 291 }
294 if (!script_name.is_null()) { 292 if (!script_name.is_null()) {
295 script->set_name(*script_name); 293 script->set_name(*script_name);
296 script->set_line_offset(Smi::FromInt(line_offset)); 294 script->set_line_offset(Smi::FromInt(line_offset));
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), 578 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
581 *code, *func_name)); 579 *code, *func_name));
582 OPROFILE(CreateNativeCodeRegion(*func_name, 580 OPROFILE(CreateNativeCodeRegion(*func_name,
583 code->instruction_start(), 581 code->instruction_start(),
584 code->instruction_size())); 582 code->instruction_size()));
585 } 583 }
586 } 584 }
587 } 585 }
588 586
589 } } // namespace v8::internal 587 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698