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

Side by Side Diff: src/log.cc

Issue 1961373003: [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, 7 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-snapshot-generator.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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
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");
1572 HeapIterator iterator(heap); 1570 HeapIterator iterator(heap);
1573 DisallowHeapAllocation no_gc; 1571 DisallowHeapAllocation no_gc;
1574 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1572 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1575 if (obj->IsCode()) LogCodeObject(obj); 1573 if (obj->IsCode()) LogCodeObject(obj);
1576 if (obj->IsBytecodeArray()) LogCodeObject(obj); 1574 if (obj->IsBytecodeArray()) LogCodeObject(obj);
1577 } 1575 }
1578 } 1576 }
1579 1577
1580 void Logger::LogBytecodeHandlers() { 1578 void Logger::LogBytecodeHandlers() {
1581 if (!FLAG_ignition) return; 1579 if (!FLAG_ignition) return;
(...skipping 61 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 const 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 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start());
1660 1656
1661 // During iteration, there can be heap allocation due to 1657 // During iteration, there can be heap allocation due to
1662 // GetScriptLineNumber call. 1658 // GetScriptLineNumber call.
1663 for (int i = 0; i < compiled_funcs_count; ++i) { 1659 for (int i = 0; i < compiled_funcs_count; ++i) {
1664 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy())) 1660 if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy()))
1665 continue; 1661 continue;
1666 LogExistingFunction(sfis[i], code_objects[i]); 1662 LogExistingFunction(sfis[i], code_objects[i]);
1667 } 1663 }
1668 } 1664 }
1669 1665
1670 1666
1671 void Logger::LogAccessorCallbacks() { 1667 void Logger::LogAccessorCallbacks() {
1672 Heap* heap = isolate_->heap(); 1668 Heap* heap = isolate_->heap();
1673 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1674 "Logger::LogAccessorCallbacks");
1675 HeapIterator iterator(heap); 1669 HeapIterator iterator(heap);
1676 DisallowHeapAllocation no_gc; 1670 DisallowHeapAllocation no_gc;
1677 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1671 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1678 if (!obj->IsAccessorInfo()) continue; 1672 if (!obj->IsAccessorInfo()) continue;
1679 AccessorInfo* ai = AccessorInfo::cast(obj); 1673 AccessorInfo* ai = AccessorInfo::cast(obj);
1680 if (!ai->name()->IsName()) continue; 1674 if (!ai->name()->IsName()) continue;
1681 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1675 Address getter_entry = v8::ToCData<Address>(ai->getter());
1682 Name* name = Name::cast(ai->name()); 1676 Name* name = Name::cast(ai->name());
1683 if (getter_entry != 0) { 1677 if (getter_entry != 0) {
1684 #if USES_FUNCTION_DESCRIPTORS 1678 #if USES_FUNCTION_DESCRIPTORS
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 removeCodeEventListener(jit_logger_); 1845 removeCodeEventListener(jit_logger_);
1852 delete jit_logger_; 1846 delete jit_logger_;
1853 jit_logger_ = NULL; 1847 jit_logger_ = NULL;
1854 } 1848 }
1855 1849
1856 return log_->Close(); 1850 return log_->Close();
1857 } 1851 }
1858 1852
1859 } // namespace internal 1853 } // namespace internal
1860 } // namespace v8 1854 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/profiler/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698