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

Unified Diff: src/heap/heap.cc

Issue 1103843002: Preprocess structured stack trace on GC to get rid of code reference. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index e9379ac5658c9653cb21023f180d567a2364c068..d4038c78e52e5b284d2a0fc6e6d996afcf938014 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -706,6 +706,26 @@ void Heap::GarbageCollectionEpilogue() {
}
+void Heap::PreprocessStackTraces() {
+ if (!weak_stack_trace_list()->IsWeakFixedArray()) return;
+ WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list());
+ int length = array->Length();
+ for (int i = 0; i < length; i++) {
+ if (array->IsEmptySlot(i)) continue;
+ FixedArray* elements = FixedArray::cast(array->Get(i));
+ for (int j = 1; j < elements->length(); j += 4) {
+ Code* code = Code::cast(elements->get(j + 2));
+ int offset = Smi::cast(elements->get(j + 3))->value();
+ Address pc = code->address() + offset;
+ int pos = code->SourcePosition(pc);
+ elements->set(j + 2, Smi::FromInt(pos));
+ }
+ array->Clear(i);
+ }
+ array->Compact();
+}
+
+
void Heap::HandleGCRequest() {
if (incremental_marking()->request_type() ==
IncrementalMarking::COMPLETE_MARKING) {
@@ -1272,6 +1292,8 @@ void Heap::MarkCompactEpilogue() {
isolate_->counters()->objs_since_last_full()->Set(0);
incremental_marking()->Epilogue();
+
+ PreprocessStackTraces();
}
@@ -3082,6 +3104,8 @@ void Heap::CreateInitialObjects() {
cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid));
set_array_protector(*cell);
+ set_weak_stack_trace_list(Smi::FromInt(0));
+
set_allocation_sites_scratchpad(
*factory->NewFixedArray(kAllocationSiteScratchpadSize, TENURED));
InitializeAllocationSitesScratchpad();
@@ -3118,6 +3142,7 @@ bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
case kDetachedContextsRootIndex:
case kWeakObjectToCodeTableRootIndex:
case kRetainedMapsRootIndex:
+ case kWeakStackTraceListRootIndex:
// Smi values
#define SMI_ENTRY(type, name, Name) case k##Name##RootIndex:
SMI_ROOT_LIST(SMI_ENTRY)
« no previous file with comments | « src/heap/heap.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698