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

Side by Side Diff: src/log.cc

Issue 1992913004: [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « src/heap/heap.cc ('k') | src/profiler/heap-profiler.cc » ('j') | 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 <sstream> 8 #include <sstream>
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 description = "A Wasm to JavaScript adapter"; 1558 description = "A Wasm to JavaScript adapter";
1559 tag = Logger::STUB_TAG; 1559 tag = Logger::STUB_TAG;
1560 break; 1560 break;
1561 } 1561 }
1562 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); 1562 PROFILE(isolate_, CodeCreateEvent(tag, code_object, description));
1563 } 1563 }
1564 1564
1565 1565
1566 void Logger::LogCodeObjects() { 1566 void Logger::LogCodeObjects() {
1567 Heap* heap = isolate_->heap(); 1567 Heap* heap = isolate_->heap();
1568 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1569 "Logger::LogCodeObjects");
1570 HeapIterator iterator(heap); 1568 HeapIterator iterator(heap);
1571 DisallowHeapAllocation no_gc; 1569 DisallowHeapAllocation no_gc;
1572 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1570 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1573 if (obj->IsCode()) LogCodeObject(obj); 1571 if (obj->IsCode()) LogCodeObject(obj);
1574 if (obj->IsBytecodeArray()) LogCodeObject(obj); 1572 if (obj->IsBytecodeArray()) LogCodeObject(obj);
1575 } 1573 }
1576 } 1574 }
1577 1575
1578 void Logger::LogBytecodeHandlers() { 1576 void Logger::LogBytecodeHandlers() {
1579 if (!FLAG_ignition) return; 1577 if (!FLAG_ignition) return;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 } 1641 }
1644 } else { 1642 } else {
1645 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared, 1643 PROFILE(isolate_, CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *shared,
1646 *func_name)); 1644 *func_name));
1647 } 1645 }
1648 } 1646 }
1649 1647
1650 1648
1651 void Logger::LogCompiledFunctions() { 1649 void Logger::LogCompiledFunctions() {
1652 Heap* heap = isolate_->heap(); 1650 Heap* heap = isolate_->heap();
1653 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1654 "Logger::LogCompiledFunctions");
1655 HandleScope scope(isolate_); 1651 HandleScope scope(isolate_);
1656 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); 1652 int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL);
1657 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); 1653 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count);
1658 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); 1654 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count);
1659 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); 1655 compiled_funcs_count =
1656 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start());
1660 1657
1661 // During iteration, there can be heap allocation due to 1658 // During iteration, there can be heap allocation due to
1662 // GetScriptLineNumber call. 1659 // GetScriptLineNumber call.
1663 for (int i = 0; i < compiled_funcs_count; ++i) { 1660 for (int i = 0; i < compiled_funcs_count; ++i) {
1664 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) 1661 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy()))
1665 continue; 1662 continue;
1666 LogExistingFunction(sfis[i], code_objects[i]); 1663 LogExistingFunction(sfis[i], code_objects[i]);
1667 } 1664 }
1668 } 1665 }
1669 1666
1670 1667
1671 void Logger::LogAccessorCallbacks() { 1668 void Logger::LogAccessorCallbacks() {
1672 Heap* heap = isolate_->heap(); 1669 Heap* heap = isolate_->heap();
1673 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1674 "Logger::LogAccessorCallbacks");
1675 HeapIterator iterator(heap); 1670 HeapIterator iterator(heap);
1676 DisallowHeapAllocation no_gc; 1671 DisallowHeapAllocation no_gc;
1677 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1672 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1678 if (!obj->IsAccessorInfo()) continue; 1673 if (!obj->IsAccessorInfo()) continue;
1679 AccessorInfo* ai = AccessorInfo::cast(obj); 1674 AccessorInfo* ai = AccessorInfo::cast(obj);
1680 if (!ai->name()->IsName()) continue; 1675 if (!ai->name()->IsName()) continue;
1681 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1676 Address getter_entry = v8::ToCData<Address>(ai->getter());
1682 Name* name = Name::cast(ai->name()); 1677 Name* name = Name::cast(ai->name());
1683 if (getter_entry != 0) { 1678 if (getter_entry != 0) {
1684 #if USES_FUNCTION_DESCRIPTORS 1679 #if USES_FUNCTION_DESCRIPTORS
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 removeCodeEventListener(jit_logger_); 1846 removeCodeEventListener(jit_logger_);
1852 delete jit_logger_; 1847 delete jit_logger_;
1853 jit_logger_ = NULL; 1848 jit_logger_ = NULL;
1854 } 1849 }
1855 1850
1856 return log_->Close(); 1851 return log_->Close();
1857 } 1852 }
1858 1853
1859 } // namespace internal 1854 } // namespace internal
1860 } // namespace v8 1855 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/profiler/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698