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 5545006: Optimized scanner to avoid virtual calls for every character read. (Closed)
Patch Set: Addressed review comments. Created 10 years 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/checks.h ('k') | 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // the script. 454 // the script.
455 // Building preparse data that is only used immediately after is only a 455 // Building preparse data that is only used immediately after is only a
456 // saving if we might skip building the AST for lazily compiled functions. 456 // saving if we might skip building the AST for lazily compiled functions.
457 // I.e., preparse data isn't relevant when the lazy flag is off, and 457 // I.e., preparse data isn't relevant when the lazy flag is off, and
458 // for small sources, odds are that there aren't many functions 458 // for small sources, odds are that there aren't many functions
459 // that would be compiled lazily anyway, so we skip the preparse step 459 // that would be compiled lazily anyway, so we skip the preparse step
460 // in that case too. 460 // in that case too.
461 ScriptDataImpl* pre_data = input_pre_data; 461 ScriptDataImpl* pre_data = input_pre_data;
462 if (pre_data == NULL 462 if (pre_data == NULL
463 && source_length >= FLAG_min_preparse_length) { 463 && source_length >= FLAG_min_preparse_length) {
464 pre_data = ParserApi::PartialPreParse(source, NULL, extension); 464 if (source->IsExternalTwoByteString()) {
465 ExternalTwoByteStringUC16CharacterStream stream(
466 Handle<ExternalTwoByteString>::cast(source), 0, source->length());
467 pre_data = ParserApi::PartialPreParse(&stream, extension);
468 } else {
469 GenericStringUC16CharacterStream stream(source, 0, source->length());
470 pre_data = ParserApi::PartialPreParse(&stream, extension);
471 }
465 } 472 }
466 473
467 // Create a script object describing the script to be compiled. 474 // Create a script object describing the script to be compiled.
468 Handle<Script> script = Factory::NewScript(source); 475 Handle<Script> script = Factory::NewScript(source);
469 if (natives == NATIVES_CODE) { 476 if (natives == NATIVES_CODE) {
470 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 477 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
471 } 478 }
472 if (!script_name.is_null()) { 479 if (!script_name.is_null()) {
473 script->set_name(*script_name); 480 script->set_name(*script_name);
474 script->set_line_offset(Smi::FromInt(line_offset)); 481 script->set_line_offset(Smi::FromInt(line_offset));
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 *code, 755 *code,
749 *name)); 756 *name));
750 OPROFILE(CreateNativeCodeRegion(*name, 757 OPROFILE(CreateNativeCodeRegion(*name,
751 code->instruction_start(), 758 code->instruction_start(),
752 code->instruction_size())); 759 code->instruction_size()));
753 } 760 }
754 } 761 }
755 } 762 }
756 763
757 } } // namespace v8::internal 764 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/checks.h ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698