| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 ScriptDataImpl* pre_data = input_pre_data; | 481 ScriptDataImpl* pre_data = input_pre_data; |
| 482 int flags = kNoParsingFlags; | 482 int flags = kNoParsingFlags; |
| 483 if ((natives == NATIVES_CODE) || FLAG_allow_natives_syntax) { | 483 if ((natives == NATIVES_CODE) || FLAG_allow_natives_syntax) { |
| 484 flags |= kAllowNativesSyntax; | 484 flags |= kAllowNativesSyntax; |
| 485 } | 485 } |
| 486 if (natives != NATIVES_CODE && FLAG_harmony_scoping) { | 486 if (natives != NATIVES_CODE && FLAG_harmony_scoping) { |
| 487 flags |= kHarmonyScoping; | 487 flags |= kHarmonyScoping; |
| 488 } | 488 } |
| 489 if (pre_data == NULL | 489 if (pre_data == NULL |
| 490 && source_length >= FLAG_min_preparse_length) { | 490 && source_length >= FLAG_min_preparse_length) { |
| 491 if (source->IsExternalTwoByteString()) { | 491 pre_data = ParserApi::PartialPreParse(source, extension, flags); |
| 492 ExternalTwoByteStringUC16CharacterStream stream( | |
| 493 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | |
| 494 pre_data = ParserApi::PartialPreParse(&stream, extension, flags); | |
| 495 } else { | |
| 496 GenericStringUC16CharacterStream stream(source, 0, source->length()); | |
| 497 pre_data = ParserApi::PartialPreParse(&stream, extension, flags); | |
| 498 } | |
| 499 } | 492 } |
| 500 | 493 |
| 501 // Create a script object describing the script to be compiled. | 494 // Create a script object describing the script to be compiled. |
| 502 Handle<Script> script = FACTORY->NewScript(source); | 495 Handle<Script> script = FACTORY->NewScript(source); |
| 503 if (natives == NATIVES_CODE) { | 496 if (natives == NATIVES_CODE) { |
| 504 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 497 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 505 } | 498 } |
| 506 if (!script_name.is_null()) { | 499 if (!script_name.is_null()) { |
| 507 script->set_name(*script_name); | 500 script->set_name(*script_name); |
| 508 script->set_line_offset(Smi::FromInt(line_offset)); | 501 script->set_line_offset(Smi::FromInt(line_offset)); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 785 } |
| 793 } | 786 } |
| 794 | 787 |
| 795 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 788 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 796 Handle<Script>(info->script()), | 789 Handle<Script>(info->script()), |
| 797 Handle<Code>(info->code()), | 790 Handle<Code>(info->code()), |
| 798 info)); | 791 info)); |
| 799 } | 792 } |
| 800 | 793 |
| 801 } } // namespace v8::internal | 794 } } // namespace v8::internal |
| OLD | NEW |