| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 if (result.is_null()) { | 473 if (result.is_null()) { |
| 474 // No cache entry found. Do pre-parsing, if it makes sense, and compile | 474 // No cache entry found. Do pre-parsing, if it makes sense, and compile |
| 475 // the script. | 475 // the script. |
| 476 // Building preparse data that is only used immediately after is only a | 476 // Building preparse data that is only used immediately after is only a |
| 477 // saving if we might skip building the AST for lazily compiled functions. | 477 // saving if we might skip building the AST for lazily compiled functions. |
| 478 // I.e., preparse data isn't relevant when the lazy flag is off, and | 478 // I.e., preparse data isn't relevant when the lazy flag is off, and |
| 479 // for small sources, odds are that there aren't many functions | 479 // for small sources, odds are that there aren't many functions |
| 480 // that would be compiled lazily anyway, so we skip the preparse step | 480 // that would be compiled lazily anyway, so we skip the preparse step |
| 481 // in that case too. | 481 // in that case too. |
| 482 ScriptDataImpl* pre_data = input_pre_data; | 482 ScriptDataImpl* pre_data = input_pre_data; |
| 483 bool harmony_block_scoping = natives != NATIVES_CODE && | 483 bool harmony_scoping = natives != NATIVES_CODE && FLAG_harmony_scoping; |
| 484 FLAG_harmony_block_scoping; | |
| 485 if (pre_data == NULL | 484 if (pre_data == NULL |
| 486 && source_length >= FLAG_min_preparse_length) { | 485 && source_length >= FLAG_min_preparse_length) { |
| 487 if (source->IsExternalTwoByteString()) { | 486 if (source->IsExternalTwoByteString()) { |
| 488 ExternalTwoByteStringUC16CharacterStream stream( | 487 ExternalTwoByteStringUC16CharacterStream stream( |
| 489 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | 488 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); |
| 490 pre_data = ParserApi::PartialPreParse(&stream, | 489 pre_data = ParserApi::PartialPreParse(&stream, |
| 491 extension, | 490 extension, |
| 492 harmony_block_scoping); | 491 harmony_scoping); |
| 493 } else { | 492 } else { |
| 494 GenericStringUC16CharacterStream stream(source, 0, source->length()); | 493 GenericStringUC16CharacterStream stream(source, 0, source->length()); |
| 495 pre_data = ParserApi::PartialPreParse(&stream, | 494 pre_data = ParserApi::PartialPreParse(&stream, |
| 496 extension, | 495 extension, |
| 497 harmony_block_scoping); | 496 harmony_scoping); |
| 498 } | 497 } |
| 499 } | 498 } |
| 500 | 499 |
| 501 // Create a script object describing the script to be compiled. | 500 // Create a script object describing the script to be compiled. |
| 502 Handle<Script> script = FACTORY->NewScript(source); | 501 Handle<Script> script = FACTORY->NewScript(source); |
| 503 if (natives == NATIVES_CODE) { | 502 if (natives == NATIVES_CODE) { |
| 504 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 503 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 505 } | 504 } |
| 506 if (!script_name.is_null()) { | 505 if (!script_name.is_null()) { |
| 507 script->set_name(*script_name); | 506 script->set_name(*script_name); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 } | 789 } |
| 791 } | 790 } |
| 792 | 791 |
| 793 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 792 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 794 Handle<Script>(info->script()), | 793 Handle<Script>(info->script()), |
| 795 Handle<Code>(info->code()), | 794 Handle<Code>(info->code()), |
| 796 info)); | 795 info)); |
| 797 } | 796 } |
| 798 | 797 |
| 799 } } // namespace v8::internal | 798 } } // namespace v8::internal |
| OLD | NEW |