Added tracing support for pretenuring.
authorhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 28 Nov 2013 10:49:02 +0000 (10:49 +0000)
committerhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 28 Nov 2013 10:49:02 +0000 (10:49 +0000)
BUG=
R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/94493002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18117 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/flag-definitions.h
src/hydrogen-instructions.h
src/hydrogen.cc

index 9023b2f..35977e6 100644 (file)
@@ -215,6 +215,8 @@ DEFINE_bool(pretenuring, true, "allocate objects in old space")
 DEFINE_bool(pretenuring_call_new, false, "pretenure call new")
 DEFINE_bool(allocation_site_pretenuring, false,
             "pretenure with allocation sites")
+DEFINE_bool(trace_pretenuring, false,
+            "trace pretenuring decisions of HAllocate instructions")
 DEFINE_bool(track_fields, true, "track fields with only smi values")
 DEFINE_bool(track_double_fields, true, "track fields with double values")
 DEFINE_bool(track_heap_object_fields, true, "track fields with heap values")
index 272c6bd..52e3ba0 100644 (file)
@@ -5439,9 +5439,11 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> {
                         HValue* size,
                         HType type,
                         PretenureFlag pretenure_flag,
-                        InstanceType instance_type) {
+                        InstanceType instance_type,
+                        Handle<AllocationSite> allocation_site =
+                            Handle<AllocationSite>::null()) {
     return new(zone) HAllocate(context, size, type, pretenure_flag,
-        instance_type);
+        instance_type, allocation_site);
   }
 
   // Maximum instance size for which allocations will be inlined.
@@ -5514,7 +5516,9 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> {
             HValue* size,
             HType type,
             PretenureFlag pretenure_flag,
-            InstanceType instance_type)
+            InstanceType instance_type,
+            Handle<AllocationSite> allocation_site =
+                Handle<AllocationSite>::null())
       : HTemplateInstruction<2>(type),
         dominating_allocate_(NULL),
         filler_free_space_size_(NULL),
@@ -5542,6 +5546,14 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> {
     }
     clear_next_map_word_ = pretenure_flag == NOT_TENURED &&
         AllocationSite::CanTrack(instance_type);
+
+    if (FLAG_trace_pretenuring) {
+      PrintF("HAllocate with AllocationSite %p %s\n",
+             allocation_site.is_null()
+                 ? static_cast<void*>(NULL)
+                 : static_cast<void*>(*allocation_site),
+             pretenure_flag == TENURED ? "tenured" : "not tenured");
+    }
   }
 
   void UpdateSize(HValue* size) {
index 686cf90..5b9e42f 100644 (file)
@@ -9359,16 +9359,10 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
     pretenure_flag = site_context->current()->GetPretenureMode()
         ? TENURED
         : NOT_TENURED;
-    if (FLAG_trace_track_allocation_sites) {
-      PrintF("Hydrogen: AllocationSite %p boilerplate %p %s\n",
-             static_cast<void*>(*(site_context->current())),
-             static_cast<void*>(*boilerplate_object),
-             pretenure_flag == TENURED ? "tenured" : "not tenured");
-    }
   }
 
   HInstruction* object = Add<HAllocate>(object_size_constant, type,
-      pretenure_flag, instance_type);
+      pretenure_flag, instance_type, site_context->current());
 
   BuildEmitObjectHeader(boilerplate_object, object);
 
@@ -9382,10 +9376,10 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
     HValue* object_elements_size = Add<HConstant>(elements_size);
     if (boilerplate_object->HasFastDoubleElements()) {
       object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(),
-          pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE);
+          pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current());
     } else {
       object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(),
-          pretenure_flag, FIXED_ARRAY_TYPE);
+          pretenure_flag, FIXED_ARRAY_TYPE, site_context->current());
     }
   }
   BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements);