OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 break; | 1649 break; |
1650 case Code::NUMBER_OF_KINDS: | 1650 case Code::NUMBER_OF_KINDS: |
1651 break; | 1651 break; |
1652 } | 1652 } |
1653 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); | 1653 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); |
1654 } | 1654 } |
1655 | 1655 |
1656 | 1656 |
1657 void Logger::LogCodeObjects() { | 1657 void Logger::LogCodeObjects() { |
1658 Heap* heap = isolate_->heap(); | 1658 Heap* heap = isolate_->heap(); |
1659 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1659 heap->CollectAllGarbage("Logger::LogCodeObjects", |
1660 "Logger::LogCodeObjects"); | 1660 Heap::kMakeHeapIterableMask); |
1661 HeapIterator iterator(heap); | 1661 HeapIterator iterator(heap); |
1662 DisallowHeapAllocation no_gc; | 1662 DisallowHeapAllocation no_gc; |
1663 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1663 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1664 if (obj->IsCode()) LogCodeObject(obj); | 1664 if (obj->IsCode()) LogCodeObject(obj); |
1665 } | 1665 } |
1666 } | 1666 } |
1667 | 1667 |
1668 | 1668 |
1669 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1669 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1670 Handle<Code> code) { | 1670 Handle<Code> code) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 } else { | 1709 } else { |
1710 PROFILE(isolate_, | 1710 PROFILE(isolate_, |
1711 CodeCreateEvent( | 1711 CodeCreateEvent( |
1712 Logger::LAZY_COMPILE_TAG, *code, *shared, NULL, *func_name)); | 1712 Logger::LAZY_COMPILE_TAG, *code, *shared, NULL, *func_name)); |
1713 } | 1713 } |
1714 } | 1714 } |
1715 | 1715 |
1716 | 1716 |
1717 void Logger::LogCompiledFunctions() { | 1717 void Logger::LogCompiledFunctions() { |
1718 Heap* heap = isolate_->heap(); | 1718 Heap* heap = isolate_->heap(); |
1719 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1719 heap->CollectAllGarbage("Logger::LogCompiledFunctions", |
1720 "Logger::LogCompiledFunctions"); | 1720 Heap::kMakeHeapIterableMask); |
1721 HandleScope scope(isolate_); | 1721 HandleScope scope(isolate_); |
1722 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 1722 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); |
1723 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1723 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1724 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); | 1724 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
1725 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); | 1725 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); |
1726 | 1726 |
1727 // During iteration, there can be heap allocation due to | 1727 // During iteration, there can be heap allocation due to |
1728 // GetScriptLineNumber call. | 1728 // GetScriptLineNumber call. |
1729 for (int i = 0; i < compiled_funcs_count; ++i) { | 1729 for (int i = 0; i < compiled_funcs_count; ++i) { |
1730 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) | 1730 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) |
1731 continue; | 1731 continue; |
1732 LogExistingFunction(sfis[i], code_objects[i]); | 1732 LogExistingFunction(sfis[i], code_objects[i]); |
1733 } | 1733 } |
1734 } | 1734 } |
1735 | 1735 |
1736 | 1736 |
1737 void Logger::LogAccessorCallbacks() { | 1737 void Logger::LogAccessorCallbacks() { |
1738 Heap* heap = isolate_->heap(); | 1738 Heap* heap = isolate_->heap(); |
1739 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1739 heap->CollectAllGarbage("Logger::LogAccessorCallbacks", |
1740 "Logger::LogAccessorCallbacks"); | 1740 Heap::kMakeHeapIterableMask); |
1741 HeapIterator iterator(heap); | 1741 HeapIterator iterator(heap); |
1742 DisallowHeapAllocation no_gc; | 1742 DisallowHeapAllocation no_gc; |
1743 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1743 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1744 if (!obj->IsExecutableAccessorInfo()) continue; | 1744 if (!obj->IsExecutableAccessorInfo()) continue; |
1745 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); | 1745 ExecutableAccessorInfo* ai = ExecutableAccessorInfo::cast(obj); |
1746 if (!ai->name()->IsName()) continue; | 1746 if (!ai->name()->IsName()) continue; |
1747 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1747 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1748 Name* name = Name::cast(ai->name()); | 1748 Name* name = Name::cast(ai->name()); |
1749 if (getter_entry != 0) { | 1749 if (getter_entry != 0) { |
1750 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); | 1750 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 removeCodeEventListener(jit_logger_); | 1905 removeCodeEventListener(jit_logger_); |
1906 delete jit_logger_; | 1906 delete jit_logger_; |
1907 jit_logger_ = NULL; | 1907 jit_logger_ = NULL; |
1908 } | 1908 } |
1909 | 1909 |
1910 return log_->Close(); | 1910 return log_->Close(); |
1911 } | 1911 } |
1912 | 1912 |
1913 } // namespace internal | 1913 } // namespace internal |
1914 } // namespace v8 | 1914 } // namespace v8 |
OLD | NEW |