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