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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // builtins cannot be handled lazily by the parser, since we have to know | 703 // builtins cannot be handled lazily by the parser, since we have to know |
704 // if a function uses the special natives syntax, which is something the | 704 // if a function uses the special natives syntax, which is something the |
705 // parser records. | 705 // parser records. |
706 bool allow_lazy = literal->AllowsLazyCompilation() && | 706 bool allow_lazy = literal->AllowsLazyCompilation() && |
707 !LiveEditFunctionTracker::IsActive(info.isolate()); | 707 !LiveEditFunctionTracker::IsActive(info.isolate()); |
708 | 708 |
709 Handle<SerializedScopeInfo> scope_info(SerializedScopeInfo::Empty()); | 709 Handle<SerializedScopeInfo> scope_info(SerializedScopeInfo::Empty()); |
710 | 710 |
711 // Generate code | 711 // Generate code |
712 if (FLAG_lazy && allow_lazy) { | 712 if (FLAG_lazy && allow_lazy) { |
713 Handle<Code> code( | 713 Handle<Code> code = info.isolate()->builtins()->LazyCompile(); |
714 info.isolate()->builtins()->builtin(Builtins::LazyCompile)); | |
715 info.SetCode(code); | 714 info.SetCode(code); |
716 } else { | 715 } else { |
717 if (V8::UseCrankshaft()) { | 716 if (V8::UseCrankshaft()) { |
718 if (!MakeCrankshaftCode(&info)) { | 717 if (!MakeCrankshaftCode(&info)) { |
719 return Handle<SharedFunctionInfo>::null(); | 718 return Handle<SharedFunctionInfo>::null(); |
720 } | 719 } |
721 } else { | 720 } else { |
722 // The bodies of function literals have not yet been visited by the | 721 // The bodies of function literals have not yet been visited by the |
723 // AST optimizer/analyzer. | 722 // AST optimizer/analyzer. |
724 if (!Rewriter::Analyze(&info)) return Handle<SharedFunctionInfo>::null(); | 723 if (!Rewriter::Analyze(&info)) return Handle<SharedFunctionInfo>::null(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 Handle<SharedFunctionInfo> shared) { | 793 Handle<SharedFunctionInfo> shared) { |
795 // SharedFunctionInfo is passed separately, because if CompilationInfo | 794 // SharedFunctionInfo is passed separately, because if CompilationInfo |
796 // was created using Script object, it will not have it. | 795 // was created using Script object, it will not have it. |
797 | 796 |
798 // Log the code generation. If source information is available include | 797 // Log the code generation. If source information is available include |
799 // script name and line number. Check explicitly whether logging is | 798 // script name and line number. Check explicitly whether logging is |
800 // enabled as finding the line number is not free. | 799 // enabled as finding the line number is not free. |
801 if (info->isolate()->logger()->is_logging() || CpuProfiler::is_profiling()) { | 800 if (info->isolate()->logger()->is_logging() || CpuProfiler::is_profiling()) { |
802 Handle<Script> script = info->script(); | 801 Handle<Script> script = info->script(); |
803 Handle<Code> code = info->code(); | 802 Handle<Code> code = info->code(); |
804 if (*code == info->isolate()->builtins()->builtin(Builtins::LazyCompile)) | 803 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
805 return; | 804 return; |
806 if (script->name()->IsString()) { | 805 if (script->name()->IsString()) { |
807 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; | 806 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
808 USE(line_num); | 807 USE(line_num); |
809 PROFILE(info->isolate(), | 808 PROFILE(info->isolate(), |
810 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 809 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
811 *code, | 810 *code, |
812 *shared, | 811 *shared, |
813 String::cast(script->name()), | 812 String::cast(script->name()), |
814 line_num)); | 813 line_num)); |
815 } else { | 814 } else { |
816 PROFILE(info->isolate(), | 815 PROFILE(info->isolate(), |
817 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 816 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
818 *code, | 817 *code, |
819 *shared, | 818 *shared, |
820 shared->DebugName())); | 819 shared->DebugName())); |
821 } | 820 } |
822 } | 821 } |
823 | 822 |
824 GDBJIT(AddCode(name, | 823 GDBJIT(AddCode(name, |
825 Handle<Script>(info->script()), | 824 Handle<Script>(info->script()), |
826 Handle<Code>(info->code()))); | 825 Handle<Code>(info->code()))); |
827 } | 826 } |
828 | 827 |
829 } } // namespace v8::internal | 828 } } // namespace v8::internal |
OLD | NEW |