OLD | NEW |
---|---|
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 ScriptDataImpl* pre_data = input_pre_data; | 280 ScriptDataImpl* pre_data = input_pre_data; |
281 if (pre_data == NULL | 281 if (pre_data == NULL |
282 && source_length >= FLAG_min_preparse_length) { | 282 && source_length >= FLAG_min_preparse_length) { |
283 pre_data = ParserApi::PartialPreParse(source, NULL, extension); | 283 if (source->IsExternalTwoByteString()) { |
284 ExternalTwoByteStringUC16CharacterStream stream( | |
285 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | |
Erik Corry
2010/12/07 12:27:30
This is found several places. Perhaps the constru
Lasse Reichstein
2010/12/07 14:05:54
As discussed offline, let's leave it so that the c
| |
286 pre_data = ParserApi::PartialPreParse(&stream, extension); | |
287 } else { | |
288 GenericStringUC16CharacterStream stream(source, 0, source->length()); | |
289 pre_data = ParserApi::PartialPreParse(&stream, extension); | |
290 } | |
284 } | 291 } |
285 | 292 |
286 // Create a script object describing the script to be compiled. | 293 // Create a script object describing the script to be compiled. |
287 Handle<Script> script = Factory::NewScript(source); | 294 Handle<Script> script = Factory::NewScript(source); |
288 if (natives == NATIVES_CODE) { | 295 if (natives == NATIVES_CODE) { |
289 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 296 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
290 } | 297 } |
291 if (!script_name.is_null()) { | 298 if (!script_name.is_null()) { |
292 script->set_name(*script_name); | 299 script->set_name(*script_name); |
293 script->set_line_offset(Smi::FromInt(line_offset)); | 300 script->set_line_offset(Smi::FromInt(line_offset)); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 *code, | 556 *code, |
550 *name)); | 557 *name)); |
551 OPROFILE(CreateNativeCodeRegion(*name, | 558 OPROFILE(CreateNativeCodeRegion(*name, |
552 code->instruction_start(), | 559 code->instruction_start(), |
553 code->instruction_size())); | 560 code->instruction_size())); |
554 } | 561 } |
555 } | 562 } |
556 } | 563 } |
557 | 564 |
558 } } // namespace v8::internal | 565 } } // namespace v8::internal |
OLD | NEW |