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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 Name* name) { | 1034 Name* name) { |
1035 if (!is_logging_code_events()) return; | 1035 if (!is_logging_code_events()) return; |
1036 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 1036 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { |
1037 InitNameBuffer(tag); | 1037 InitNameBuffer(tag); |
1038 name_buffer_->AppendBytes(ComputeMarker(code)); | 1038 name_buffer_->AppendBytes(ComputeMarker(code)); |
1039 AppendName(name); | 1039 AppendName(name); |
1040 LogRecordedBuffer(code, shared); | 1040 LogRecordedBuffer(code, shared); |
1041 } | 1041 } |
1042 | 1042 |
1043 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1043 if (!FLAG_log_code || !log_->IsEnabled()) return; |
1044 if (code == Isolate::Current()->builtins()->builtin( | 1044 if (code == isolate_->builtins()->builtin( |
1045 Builtins::kLazyCompile)) | 1045 Builtins::kLazyCompile)) |
1046 return; | 1046 return; |
1047 | 1047 |
1048 LogMessageBuilder msg(this); | 1048 LogMessageBuilder msg(this); |
1049 AppendCodeCreateHeader(&msg, tag, code); | 1049 AppendCodeCreateHeader(&msg, tag, code); |
1050 if (name->IsString()) { | 1050 if (name->IsString()) { |
1051 SmartArrayPointer<char> str = | 1051 SmartArrayPointer<char> str = |
1052 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1052 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
1053 msg.Append("\"%s\"", *str); | 1053 msg.Append("\"%s\"", *str); |
1054 } else { | 1054 } else { |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 "Logger::LogCompiledFunctions"); | 1691 "Logger::LogCompiledFunctions"); |
1692 HandleScope scope(isolate_); | 1692 HandleScope scope(isolate_); |
1693 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 1693 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); |
1694 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1694 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1695 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); | 1695 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
1696 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); | 1696 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); |
1697 | 1697 |
1698 // During iteration, there can be heap allocation due to | 1698 // During iteration, there can be heap allocation due to |
1699 // GetScriptLineNumber call. | 1699 // GetScriptLineNumber call. |
1700 for (int i = 0; i < compiled_funcs_count; ++i) { | 1700 for (int i = 0; i < compiled_funcs_count; ++i) { |
1701 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( | 1701 if (*code_objects[i] == isolate_->builtins()->builtin( |
1702 Builtins::kLazyCompile)) | 1702 Builtins::kLazyCompile)) |
1703 continue; | 1703 continue; |
1704 LogExistingFunction(sfis[i], code_objects[i]); | 1704 LogExistingFunction(sfis[i], code_objects[i]); |
1705 } | 1705 } |
1706 } | 1706 } |
1707 | 1707 |
1708 | 1708 |
1709 void Logger::LogAccessorCallbacks() { | 1709 void Logger::LogAccessorCallbacks() { |
1710 Heap* heap = isolate_->heap(); | 1710 Heap* heap = isolate_->heap(); |
1711 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1711 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 | 1771 |
1772 return true; | 1772 return true; |
1773 } | 1773 } |
1774 | 1774 |
1775 | 1775 |
1776 void Logger::SetCodeEventHandler(uint32_t options, | 1776 void Logger::SetCodeEventHandler(uint32_t options, |
1777 JitCodeEventHandler event_handler) { | 1777 JitCodeEventHandler event_handler) { |
1778 code_event_handler_ = event_handler; | 1778 code_event_handler_ = event_handler; |
1779 | 1779 |
1780 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { | 1780 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { |
1781 HandleScope scope(Isolate::Current()); | 1781 HandleScope scope(isolate_); |
1782 LogCodeObjects(); | 1782 LogCodeObjects(); |
1783 LogCompiledFunctions(); | 1783 LogCompiledFunctions(); |
1784 } | 1784 } |
1785 } | 1785 } |
1786 | 1786 |
1787 | 1787 |
1788 Sampler* Logger::sampler() { | 1788 Sampler* Logger::sampler() { |
1789 return ticker_; | 1789 return ticker_; |
1790 } | 1790 } |
1791 | 1791 |
1792 | 1792 |
1793 FILE* Logger::TearDown() { | 1793 FILE* Logger::TearDown() { |
1794 if (!is_initialized_) return NULL; | 1794 if (!is_initialized_) return NULL; |
1795 is_initialized_ = false; | 1795 is_initialized_ = false; |
1796 | 1796 |
1797 // Stop the profiler before closing the file. | 1797 // Stop the profiler before closing the file. |
1798 if (profiler_ != NULL) { | 1798 if (profiler_ != NULL) { |
1799 profiler_->Disengage(); | 1799 profiler_->Disengage(); |
1800 delete profiler_; | 1800 delete profiler_; |
1801 profiler_ = NULL; | 1801 profiler_ = NULL; |
1802 } | 1802 } |
1803 | 1803 |
1804 delete ticker_; | 1804 delete ticker_; |
1805 ticker_ = NULL; | 1805 ticker_ = NULL; |
1806 | 1806 |
1807 return log_->Close(); | 1807 return log_->Close(); |
1808 } | 1808 } |
1809 | 1809 |
1810 } } // namespace v8::internal | 1810 } } // namespace v8::internal |
OLD | NEW |