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

Side by Side Diff: src/log.cc

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