Commit b7b2975e authored by yangguo's avatar yangguo Committed by Commit bot

[serializer] complete slack tracking when creating context snapshot.

R=verwaest@chromium.org
BUG=v8:6071

Review-Url: https://codereview.chromium.org/2740033002
Cr-Commit-Position: refs/heads/master@{#43823}
parent bb927eb4
...@@ -625,6 +625,14 @@ StartupData SnapshotCreator::CreateBlob( ...@@ -625,6 +625,14 @@ StartupData SnapshotCreator::CreateBlob(
data->contexts_.Clear(); data->contexts_.Clear();
} }
// Complete in-object slack tracking for all functions.
i::HeapIterator heap_iterator(isolate->heap());
while (i::HeapObject* current_obj = heap_iterator.next()) {
if (!current_obj->IsJSFunction()) continue;
i::JSFunction* fun = i::JSFunction::cast(current_obj);
fun->CompleteInobjectSlackTrackingIfActive();
}
#ifdef DEBUG #ifdef DEBUG
i::ExternalReferenceTable::instance(isolate)->ResetCount(); i::ExternalReferenceTable::instance(isolate)->ResetCount();
#endif // DEBUG #endif // DEBUG
......
...@@ -13577,16 +13577,9 @@ void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, ...@@ -13577,16 +13577,9 @@ void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared,
// to be added later. // to be added later.
if (estimate == 0) estimate = 2; if (estimate == 0) estimate = 2;
// TODO(yangguo): check whether those heuristics are still up-to-date.
// We do not shrink objects that go into a snapshot (yet), so we adjust
// the estimate conservatively.
if (shared->GetIsolate()->serializer_enabled()) {
estimate += 2;
} else {
// Inobject slack tracking will reclaim redundant inobject space later, // Inobject slack tracking will reclaim redundant inobject space later,
// so we can afford to adjust the estimate generously. // so we can afford to adjust the estimate generously.
estimate += 8; estimate += 8;
}
shared->set_expected_nof_properties(estimate); shared->set_expected_nof_properties(estimate);
} }
...@@ -13639,13 +13632,7 @@ void SharedFunctionInfo::SetConstructStub(Code* code) { ...@@ -13639,13 +13632,7 @@ void SharedFunctionInfo::SetConstructStub(Code* code) {
void Map::StartInobjectSlackTracking() { void Map::StartInobjectSlackTracking() {
DCHECK(!IsInobjectSlackTrackingInProgress()); DCHECK(!IsInobjectSlackTrackingInProgress());
// No tracking during the snapshot construction phase.
Isolate* isolate = GetIsolate();
if (isolate->serializer_enabled()) return;
if (unused_property_fields() == 0) return; if (unused_property_fields() == 0) return;
set_construction_counter(Map::kSlackTrackingCounterStart); set_construction_counter(Map::kSlackTrackingCounterStart);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment