| 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)
|
|
|