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 749 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 |