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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 description = "A Wasm to JavaScript adapter"; | 1560 description = "A Wasm to JavaScript adapter"; |
1561 tag = Logger::STUB_TAG; | 1561 tag = Logger::STUB_TAG; |
1562 break; | 1562 break; |
1563 } | 1563 } |
1564 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); | 1564 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); |
1565 } | 1565 } |
1566 | 1566 |
1567 | 1567 |
1568 void Logger::LogCodeObjects() { | 1568 void Logger::LogCodeObjects() { |
1569 Heap* heap = isolate_->heap(); | 1569 Heap* heap = isolate_->heap(); |
| 1570 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1571 "Logger::LogCodeObjects"); |
1570 HeapIterator iterator(heap); | 1572 HeapIterator iterator(heap); |
1571 DisallowHeapAllocation no_gc; | 1573 DisallowHeapAllocation no_gc; |
1572 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1574 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1573 if (obj->IsCode()) LogCodeObject(obj); | 1575 if (obj->IsCode()) LogCodeObject(obj); |
1574 if (obj->IsBytecodeArray()) LogCodeObject(obj); | 1576 if (obj->IsBytecodeArray()) LogCodeObject(obj); |
1575 } | 1577 } |
1576 } | 1578 } |
1577 | 1579 |
1578 void Logger::LogBytecodeHandlers() { | 1580 void Logger::LogBytecodeHandlers() { |
1579 if (!FLAG_ignition) return; | 1581 if (!FLAG_ignition) return; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } | 1643 } |
1642 } else { | 1644 } else { |
1643 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared, | 1645 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared, |
1644 *func_name)); | 1646 *func_name)); |
1645 } | 1647 } |
1646 } | 1648 } |
1647 | 1649 |
1648 | 1650 |
1649 void Logger::LogCompiledFunctions() { | 1651 void Logger::LogCompiledFunctions() { |
1650 Heap* heap = isolate_->heap(); | 1652 Heap* heap = isolate_->heap(); |
| 1653 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1654 "Logger::LogCompiledFunctions"); |
1651 HandleScope scope(isolate_); | 1655 HandleScope scope(isolate_); |
1652 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 1656 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); |
1653 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1657 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1654 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); | 1658 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); |
1655 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); | 1659 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); |
1656 | 1660 |
1657 // During iteration, there can be heap allocation due to | 1661 // During iteration, there can be heap allocation due to |
1658 // GetScriptLineNumber call. | 1662 // GetScriptLineNumber call. |
1659 for (int i = 0; i < compiled_funcs_count; ++i) { | 1663 for (int i = 0; i < compiled_funcs_count; ++i) { |
1660 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) | 1664 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) |
1661 continue; | 1665 continue; |
1662 LogExistingFunction(sfis[i], code_objects[i]); | 1666 LogExistingFunction(sfis[i], code_objects[i]); |
1663 } | 1667 } |
1664 } | 1668 } |
1665 | 1669 |
1666 | 1670 |
1667 void Logger::LogAccessorCallbacks() { | 1671 void Logger::LogAccessorCallbacks() { |
1668 Heap* heap = isolate_->heap(); | 1672 Heap* heap = isolate_->heap(); |
| 1673 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1674 "Logger::LogAccessorCallbacks"); |
1669 HeapIterator iterator(heap); | 1675 HeapIterator iterator(heap); |
1670 DisallowHeapAllocation no_gc; | 1676 DisallowHeapAllocation no_gc; |
1671 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1677 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1672 if (!obj->IsAccessorInfo()) continue; | 1678 if (!obj->IsAccessorInfo()) continue; |
1673 AccessorInfo* ai = AccessorInfo::cast(obj); | 1679 AccessorInfo* ai = AccessorInfo::cast(obj); |
1674 if (!ai->name()->IsName()) continue; | 1680 if (!ai->name()->IsName()) continue; |
1675 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1681 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1676 Name* name = Name::cast(ai->name()); | 1682 Name* name = Name::cast(ai->name()); |
1677 if (getter_entry != 0) { | 1683 if (getter_entry != 0) { |
1678 #if USES_FUNCTION_DESCRIPTORS | 1684 #if USES_FUNCTION_DESCRIPTORS |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 removeCodeEventListener(jit_logger_); | 1851 removeCodeEventListener(jit_logger_); |
1846 delete jit_logger_; | 1852 delete jit_logger_; |
1847 jit_logger_ = NULL; | 1853 jit_logger_ = NULL; |
1848 } | 1854 } |
1849 | 1855 |
1850 return log_->Close(); | 1856 return log_->Close(); |
1851 } | 1857 } |
1852 | 1858 |
1853 } // namespace internal | 1859 } // namespace internal |
1854 } // namespace v8 | 1860 } // namespace v8 |
OLD | NEW |