Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 01e261a95b6470f4857bc8ef841d59727df87741..6d09722035fc610f52b4ee3262164236038ace9f 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -555,6 +555,33 @@ static bool DebuggerWantsEagerCompilation(CompilationInfo* info, |
} |
+// Sets the expected number of properties based on estimate from compiler. |
+void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, |
+ int estimate) { |
+ // See the comment in SetExpectedNofProperties. |
+ if (shared->live_objects_may_exist()) return; |
+ |
+ // If no properties are added in the constructor, they are more likely |
+ // to be added later. |
+ 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 (Serializer::enabled()) { |
+ estimate += 2; |
+ } else if (FLAG_clever_optimizations) { |
+ // Inobject slack tracking will reclaim redundant inobject space later, |
+ // so we can afford to adjust the estimate generously. |
+ estimate += 8; |
+ } else { |
+ estimate += 3; |
+ } |
+ |
+ shared->set_expected_nof_properties(estimate); |
+} |
+ |
+ |
static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { |
Isolate* isolate = info->isolate(); |
PostponeInterruptsScope postpone(isolate); |