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 21 matching lines...) Expand all Loading... |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "codegen-inl.h" | 33 #include "codegen-inl.h" |
34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
35 #include "data-flow.h" | 35 #include "data-flow.h" |
36 #include "debug.h" | 36 #include "debug.h" |
37 #include "full-codegen.h" | 37 #include "full-codegen.h" |
38 #include "gdb-jit.h" | 38 #include "gdb-jit.h" |
39 #include "hydrogen.h" | 39 #include "hydrogen.h" |
40 #include "lithium.h" | 40 #include "lithium.h" |
41 #include "liveedit.h" | 41 #include "liveedit.h" |
42 #include "oprofile-agent.h" | |
43 #include "parser.h" | 42 #include "parser.h" |
44 #include "rewriter.h" | 43 #include "rewriter.h" |
45 #include "runtime-profiler.h" | 44 #include "runtime-profiler.h" |
46 #include "scopeinfo.h" | 45 #include "scopeinfo.h" |
47 #include "scopes.h" | 46 #include "scopes.h" |
48 #include "vm-state-inl.h" | 47 #include "vm-state-inl.h" |
49 | 48 |
50 namespace v8 { | 49 namespace v8 { |
51 namespace internal { | 50 namespace internal { |
52 | 51 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 411 } |
413 | 412 |
414 ASSERT(!info->code().is_null()); | 413 ASSERT(!info->code().is_null()); |
415 if (script->name()->IsString()) { | 414 if (script->name()->IsString()) { |
416 PROFILE(CodeCreateEvent( | 415 PROFILE(CodeCreateEvent( |
417 info->is_eval() | 416 info->is_eval() |
418 ? Logger::EVAL_TAG | 417 ? Logger::EVAL_TAG |
419 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 418 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
420 *info->code(), | 419 *info->code(), |
421 String::cast(script->name()))); | 420 String::cast(script->name()))); |
422 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), | |
423 info->code()->instruction_start(), | |
424 info->code()->instruction_size())); | |
425 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), | 421 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), |
426 script, | 422 script, |
427 info->code())); | 423 info->code())); |
428 } else { | 424 } else { |
429 PROFILE(CodeCreateEvent( | 425 PROFILE(CodeCreateEvent( |
430 info->is_eval() | 426 info->is_eval() |
431 ? Logger::EVAL_TAG | 427 ? Logger::EVAL_TAG |
432 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 428 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
433 *info->code(), | 429 *info->code(), |
434 "")); | 430 "")); |
435 OPROFILE(CreateNativeCodeRegion(info->is_eval() ? "Eval" : "Script", | |
436 info->code()->instruction_start(), | |
437 info->code()->instruction_size())); | |
438 GDBJIT(AddCode(Handle<String>(), script, info->code())); | 431 GDBJIT(AddCode(Handle<String>(), script, info->code())); |
439 } | 432 } |
440 | 433 |
441 // Allocate function. | 434 // Allocate function. |
442 Handle<SharedFunctionInfo> result = | 435 Handle<SharedFunctionInfo> result = |
443 Factory::NewSharedFunctionInfo( | 436 Factory::NewSharedFunctionInfo( |
444 lit->name(), | 437 lit->name(), |
445 lit->materialized_literal_count(), | 438 lit->materialized_literal_count(), |
446 info->code(), | 439 info->code(), |
447 SerializedScopeInfo::Create(info->scope())); | 440 SerializedScopeInfo::Create(info->scope())); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 769 |
777 | 770 |
778 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 771 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
779 Handle<String> name, | 772 Handle<String> name, |
780 int start_position, | 773 int start_position, |
781 CompilationInfo* info) { | 774 CompilationInfo* info) { |
782 // Log the code generation. If source information is available include | 775 // Log the code generation. If source information is available include |
783 // script name and line number. Check explicitly whether logging is | 776 // script name and line number. Check explicitly whether logging is |
784 // enabled as finding the line number is not free. | 777 // enabled as finding the line number is not free. |
785 if (Logger::is_logging() || | 778 if (Logger::is_logging() || |
786 OProfileAgent::is_enabled() || | |
787 CpuProfiler::is_profiling()) { | 779 CpuProfiler::is_profiling()) { |
788 Handle<Script> script = info->script(); | 780 Handle<Script> script = info->script(); |
789 Handle<Code> code = info->code(); | 781 Handle<Code> code = info->code(); |
790 if (script->name()->IsString()) { | 782 if (script->name()->IsString()) { |
791 int line_num = GetScriptLineNumber(script, start_position) + 1; | 783 int line_num = GetScriptLineNumber(script, start_position) + 1; |
792 USE(line_num); | 784 USE(line_num); |
793 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 785 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
794 *code, | 786 *code, |
795 *name, | 787 *name, |
796 String::cast(script->name()), | 788 String::cast(script->name()), |
797 line_num)); | 789 line_num)); |
798 OPROFILE(CreateNativeCodeRegion(*name, | |
799 String::cast(script->name()), | |
800 line_num, | |
801 code->instruction_start(), | |
802 code->instruction_size())); | |
803 } else { | 790 } else { |
804 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 791 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
805 *code, | 792 *code, |
806 *name)); | 793 *name)); |
807 OPROFILE(CreateNativeCodeRegion(*name, | |
808 code->instruction_start(), | |
809 code->instruction_size())); | |
810 } | 794 } |
811 } | 795 } |
812 | 796 |
813 GDBJIT(AddCode(name, | 797 GDBJIT(AddCode(name, |
814 Handle<Script>(info->script()), | 798 Handle<Script>(info->script()), |
815 Handle<Code>(info->code()))); | 799 Handle<Code>(info->code()))); |
816 } | 800 } |
817 | 801 |
818 } } // namespace v8::internal | 802 } } // namespace v8::internal |
OLD | NEW |