Reviewers: mvstanton,

Message:
Committed patchset #1 manually as r18117 (presubmit successful).

Description:
Added tracing support for pretenuring.

BUG=
[email protected]

Committed: https://code.google.com/p/v8/source/detail?r=18117

Please review this at https://codereview.chromium.org/94493002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+20, -12 lines):
  M src/flag-definitions.h
  M src/hydrogen-instructions.h
  M src/hydrogen.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 9023b2f31c47dce674d0c2e2182a8296d6adea05..35977e63943f4f95cb6f6ffc865fc6d47ae0c1cf 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -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: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 272c6bdaf044a8906b201348da851e49ac80a815..52e3ba0ef8d6898b55e30edefd616a430b6a24b3 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -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: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 686cf900dd1cabdaace3ada401c60fcabecf4a17..5b9e42f9979195104780f8c89e5cb5ca061b8932 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to