Revision: 17337
Author:   [email protected]
Date:     Wed Oct 23 12:19:12 2013 UTC
Log:      Disable allocation folding when allocations tracking is on

BUG=chromium:277984
[email protected], [email protected], [email protected], [email protected]

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

Patch from Alexandra Mikhaylova <[email protected]>.
http://code.google.com/p/v8/source/detail?r=17337

Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Oct 21 14:09:32 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Oct 23 12:19:12 2013 UTC
@@ -3308,7 +3308,10 @@
                                           HValue* dominator) {
   ASSERT(side_effect == kChangesNewSpacePromotion);
   Zone* zone = block()->zone();
-  if (!FLAG_use_allocation_folding) return;
+  if (!FLAG_use_allocation_folding ||
+      isolate()->heap_profiler()->is_tracking_allocations()) {
+    return;
+  }

   // Try to fold allocations together with their dominating allocations.
   if (!dominator->IsAllocate()) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Oct 22 11:29:05 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Oct 23 12:19:12 2013 UTC
@@ -5300,7 +5300,7 @@
                         PretenureFlag pretenure_flag,
                         InstanceType instance_type) {
     return new(zone) HAllocate(context, size, type, pretenure_flag,
-        instance_type);
+        instance_type, zone);
   }

   // Maximum instance size for which allocations will be inlined.
@@ -5373,7 +5373,8 @@
             HValue* size,
             HType type,
             PretenureFlag pretenure_flag,
-            InstanceType instance_type)
+            InstanceType instance_type,
+            Zone* zone)
       : HTemplateInstruction<2>(type),
         dominating_allocate_(NULL),
         filler_free_space_size_(NULL),
@@ -5396,7 +5397,8 @@
     // other, i.e., have a pointer to each other. A GC in between these
// allocations may leave such objects behind in a not completely initialized
     // state.
-    if (!FLAG_use_gvn || !FLAG_use_allocation_folding) {
+    if (!FLAG_use_gvn || !FLAG_use_allocation_folding ||
+        zone->isolate()->heap_profiler()->is_tracking_allocations()) {
       flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER);
     }
     clear_next_map_word_ = pretenure_flag == NOT_TENURED &&
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Tue Oct 22 06:56:19 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Wed Oct 23 12:19:12 2013 UTC
@@ -2072,3 +2072,23 @@
     "    a.shift();\n"
     "findUntrackedObjects();\n");
 }
+
+
+// If we don't disable allocation folding when allocations tracking is on, we
+// may have untracked allocations.
+TEST(DisableAllocationFolding) {
+  LocalContext env;
+  v8::HandleScope scope(env->GetIsolate());
+  HeapObjectsTracker tracker;
+  CompileRun(
+    "function literal() {"
+    "    return [1];"
+    "}"
+    "function modify_literal(literal, v) {"
+    "    literal[0] = v;"
+    "    return literal;"
+    "}"
+    "obj = modify_literal(literal(), 1);"
+    "obj = modify_literal(literal(), 1.5);"
+    "obj = modify_literal(literal(), 1);");
+}

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