| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 657 |
| 658 // Check the function has compiled code. | 658 // Check the function has compiled code. |
| 659 ASSERT(shared->is_compiled()); | 659 ASSERT(shared->is_compiled()); |
| 660 shared->set_code_age(0); | 660 shared->set_code_age(0); |
| 661 | 661 |
| 662 if (info->AllowOptimize() && !shared->optimization_disabled()) { | 662 if (info->AllowOptimize() && !shared->optimization_disabled()) { |
| 663 // If we're asked to always optimize, we compile the optimized | 663 // If we're asked to always optimize, we compile the optimized |
| 664 // version of the function right away - unless the debugger is | 664 // version of the function right away - unless the debugger is |
| 665 // active as it makes no sense to compile optimized code then. | 665 // active as it makes no sense to compile optimized code then. |
| 666 if (FLAG_always_opt && | 666 if (FLAG_always_opt && |
| 667 !Isolate::Current()->debug()->has_break_points()) { | 667 !Isolate::Current()->DebuggerHasBreakPoints()) { |
| 668 CompilationInfo optimized(function); | 668 CompilationInfo optimized(function); |
| 669 optimized.SetOptimizing(AstNode::kNoNumber); | 669 optimized.SetOptimizing(AstNode::kNoNumber); |
| 670 return CompileLazy(&optimized); | 670 return CompileLazy(&optimized); |
| 671 } else if (isolate->compilation_cache()->ShouldOptimizeEagerly( | 671 } else if (isolate->compilation_cache()->ShouldOptimizeEagerly( |
| 672 function)) { | 672 function)) { |
| 673 isolate->runtime_profiler()->OptimizeSoon(*function); | 673 isolate->runtime_profiler()->OptimizeSoon(*function); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 | 760 |
| 761 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 761 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 762 CompilationInfo* info, | 762 CompilationInfo* info, |
| 763 Handle<SharedFunctionInfo> shared) { | 763 Handle<SharedFunctionInfo> shared) { |
| 764 // SharedFunctionInfo is passed separately, because if CompilationInfo | 764 // SharedFunctionInfo is passed separately, because if CompilationInfo |
| 765 // was created using Script object, it will not have it. | 765 // was created using Script object, it will not have it. |
| 766 | 766 |
| 767 // Log the code generation. If source information is available include | 767 // Log the code generation. If source information is available include |
| 768 // script name and line number. Check explicitly whether logging is | 768 // script name and line number. Check explicitly whether logging is |
| 769 // enabled as finding the line number is not free. | 769 // enabled as finding the line number is not free. |
| 770 if (info->isolate()->logger()->is_logging() || CpuProfiler::is_profiling()) { | 770 if (info->isolate()->logger()->is_logging() || |
| 771 CpuProfiler::is_profiling(info->isolate())) { |
| 771 Handle<Script> script = info->script(); | 772 Handle<Script> script = info->script(); |
| 772 Handle<Code> code = info->code(); | 773 Handle<Code> code = info->code(); |
| 773 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) | 774 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
| 774 return; | 775 return; |
| 775 if (script->name()->IsString()) { | 776 if (script->name()->IsString()) { |
| 776 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; | 777 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
| 777 USE(line_num); | 778 USE(line_num); |
| 778 PROFILE(info->isolate(), | 779 PROFILE(info->isolate(), |
| 779 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 780 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 780 *code, | 781 *code, |
| 781 *shared, | 782 *shared, |
| 782 String::cast(script->name()), | 783 String::cast(script->name()), |
| 783 line_num)); | 784 line_num)); |
| 784 } else { | 785 } else { |
| 785 PROFILE(info->isolate(), | 786 PROFILE(info->isolate(), |
| 786 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 787 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 787 *code, | 788 *code, |
| 788 *shared, | 789 *shared, |
| 789 shared->DebugName())); | 790 shared->DebugName())); |
| 790 } | 791 } |
| 791 } | 792 } |
| 792 | 793 |
| 793 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 794 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 794 Handle<Script>(info->script()), | 795 Handle<Script>(info->script()), |
| 795 Handle<Code>(info->code()))); | 796 Handle<Code>(info->code()))); |
| 796 } | 797 } |
| 797 | 798 |
| 798 } } // namespace v8::internal | 799 } } // namespace v8::internal |
| OLD | NEW |