Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: src/log.cc

Issue 2231363002: Logger does not need to invoke the garbage collector to iterate the heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 break; 1539 break;
1540 case AbstractCode::NUMBER_OF_KINDS: 1540 case AbstractCode::NUMBER_OF_KINDS:
1541 UNIMPLEMENTED(); 1541 UNIMPLEMENTED();
1542 } 1542 }
1543 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); 1543 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description));
1544 } 1544 }
1545 1545
1546 1546
1547 void Logger::LogCodeObjects() { 1547 void Logger::LogCodeObjects() {
1548 Heap* heap = isolate_->heap(); 1548 Heap* heap = isolate_->heap();
1549 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1550 "Logger::LogCodeObjects");
1551 HeapIterator iterator(heap); 1549 HeapIterator iterator(heap);
1552 DisallowHeapAllocation no_gc; 1550 DisallowHeapAllocation no_gc;
1553 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1551 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1554 if (obj->IsCode()) LogCodeObject(obj); 1552 if (obj->IsCode()) LogCodeObject(obj);
1555 if (obj->IsBytecodeArray()) LogCodeObject(obj); 1553 if (obj->IsBytecodeArray()) LogCodeObject(obj);
1556 } 1554 }
1557 } 1555 }
1558 1556
1559 void Logger::LogBytecodeHandlers() { 1557 void Logger::LogBytecodeHandlers() {
1560 if (!FLAG_ignition) return; 1558 if (!FLAG_ignition) return;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 } 1625 }
1628 } else { 1626 } else {
1629 PROFILE(isolate_, CodeCreateEvent(CodeEventListener::LAZY_COMPILE_TAG, 1627 PROFILE(isolate_, CodeCreateEvent(CodeEventListener::LAZY_COMPILE_TAG,
1630 *code, *shared, *func_name)); 1628 *code, *shared, *func_name));
1631 } 1629 }
1632 } 1630 }
1633 1631
1634 1632
1635 void Logger::LogCompiledFunctions() { 1633 void Logger::LogCompiledFunctions() {
1636 Heap* heap = isolate_->heap(); 1634 Heap* heap = isolate_->heap();
1637 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1638 "Logger::LogCompiledFunctions");
1639 HandleScope scope(isolate_); 1635 HandleScope scope(isolate_);
1640 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); 1636 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL);
1641 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); 1637 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count);
1642 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); 1638 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count);
1643 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); 1639 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start());
1644 1640
1645 // During iteration, there can be heap allocation due to 1641 // During iteration, there can be heap allocation due to
1646 // GetScriptLineNumber call. 1642 // GetScriptLineNumber call.
1647 for (int i = 0; i < compiled_funcs_count; ++i) { 1643 for (int i = 0; i < compiled_funcs_count; ++i) {
1648 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) 1644 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy()))
1649 continue; 1645 continue;
1650 LogExistingFunction(sfis[i], code_objects[i]); 1646 LogExistingFunction(sfis[i], code_objects[i]);
1651 } 1647 }
1652 } 1648 }
1653 1649
1654 1650
1655 void Logger::LogAccessorCallbacks() { 1651 void Logger::LogAccessorCallbacks() {
1656 Heap* heap = isolate_->heap(); 1652 Heap* heap = isolate_->heap();
1657 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1658 "Logger::LogAccessorCallbacks");
1659 HeapIterator iterator(heap); 1653 HeapIterator iterator(heap);
1660 DisallowHeapAllocation no_gc; 1654 DisallowHeapAllocation no_gc;
1661 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1655 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1662 if (!obj->IsAccessorInfo()) continue; 1656 if (!obj->IsAccessorInfo()) continue;
1663 AccessorInfo* ai = AccessorInfo::cast(obj); 1657 AccessorInfo* ai = AccessorInfo::cast(obj);
1664 if (!ai->name()->IsName()) continue; 1658 if (!ai->name()->IsName()) continue;
1665 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1659 Address getter_entry = v8::ToCData<Address>(ai->getter());
1666 Name* name = Name::cast(ai->name()); 1660 Name* name = Name::cast(ai->name());
1667 if (getter_entry != 0) { 1661 if (getter_entry != 0) {
1668 #if USES_FUNCTION_DESCRIPTORS 1662 #if USES_FUNCTION_DESCRIPTORS
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 1850
1857 if (profiler_listener_.get() != nullptr) { 1851 if (profiler_listener_.get() != nullptr) {
1858 removeCodeEventListener(profiler_listener_.get()); 1852 removeCodeEventListener(profiler_listener_.get());
1859 } 1853 }
1860 1854
1861 return log_->Close(); 1855 return log_->Close();
1862 } 1856 }
1863 1857
1864 } // namespace internal 1858 } // namespace internal
1865 } // namespace v8 1859 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698