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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 script->set_data(script_data.is_null() ? HEAP->undefined_value() | 504 script->set_data(script_data.is_null() ? HEAP->undefined_value() |
505 : *script_data); | 505 : *script_data); |
506 | 506 |
507 // Compile the function and add it to the cache. | 507 // Compile the function and add it to the cache. |
508 CompilationInfo info(script); | 508 CompilationInfo info(script); |
509 info.MarkAsGlobal(); | 509 info.MarkAsGlobal(); |
510 info.SetExtension(extension); | 510 info.SetExtension(extension); |
511 info.SetPreParseData(pre_data); | 511 info.SetPreParseData(pre_data); |
512 if (natives == NATIVES_CODE) { | 512 if (natives == NATIVES_CODE) { |
513 info.MarkAsAllowingNativesSyntax(); | 513 info.MarkAsAllowingNativesSyntax(); |
514 info.MarkAsNative(); | |
515 } | 514 } |
516 result = MakeFunctionInfo(&info); | 515 result = MakeFunctionInfo(&info); |
517 if (extension == NULL && !result.is_null()) { | 516 if (extension == NULL && !result.is_null()) { |
518 compilation_cache->PutScript(source, result); | 517 compilation_cache->PutScript(source, result); |
519 } | 518 } |
520 | 519 |
521 // Get rid of the pre-parsing data (if necessary). | 520 // Get rid of the pre-parsing data (if necessary). |
522 if (input_pre_data == NULL && pre_data != NULL) { | 521 if (input_pre_data == NULL && pre_data != NULL) { |
523 delete pre_data; | 522 delete pre_data; |
524 } | 523 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 671 } |
673 | 672 |
674 | 673 |
675 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, | 674 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, |
676 Handle<Script> script) { | 675 Handle<Script> script) { |
677 // Precondition: code has been parsed and scopes have been analyzed. | 676 // Precondition: code has been parsed and scopes have been analyzed. |
678 CompilationInfo info(script); | 677 CompilationInfo info(script); |
679 info.SetFunction(literal); | 678 info.SetFunction(literal); |
680 info.SetScope(literal->scope()); | 679 info.SetScope(literal->scope()); |
681 if (literal->scope()->is_strict_mode()) info.MarkAsStrictMode(); | 680 if (literal->scope()->is_strict_mode()) info.MarkAsStrictMode(); |
682 if (script->type()->value() == Script::TYPE_NATIVE) info.MarkAsNative(); | |
683 | 681 |
684 LiveEditFunctionTracker live_edit_tracker(info.isolate(), literal); | 682 LiveEditFunctionTracker live_edit_tracker(info.isolate(), literal); |
685 // Determine if the function can be lazily compiled. This is necessary to | 683 // Determine if the function can be lazily compiled. This is necessary to |
686 // allow some of our builtin JS files to be lazily compiled. These | 684 // allow some of our builtin JS files to be lazily compiled. These |
687 // builtins cannot be handled lazily by the parser, since we have to know | 685 // builtins cannot be handled lazily by the parser, since we have to know |
688 // if a function uses the special natives syntax, which is something the | 686 // if a function uses the special natives syntax, which is something the |
689 // parser records. | 687 // parser records. |
690 bool allow_lazy = literal->AllowsLazyCompilation() && | 688 bool allow_lazy = literal->AllowsLazyCompilation() && |
691 !LiveEditFunctionTracker::IsActive(info.isolate()); | 689 !LiveEditFunctionTracker::IsActive(info.isolate()); |
692 | 690 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 } | 781 } |
784 } | 782 } |
785 | 783 |
786 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 784 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
787 Handle<Script>(info->script()), | 785 Handle<Script>(info->script()), |
788 Handle<Code>(info->code()), | 786 Handle<Code>(info->code()), |
789 info)); | 787 info)); |
790 } | 788 } |
791 | 789 |
792 } } // namespace v8::internal | 790 } } // namespace v8::internal |
OLD | NEW |