Revision: 22654
Author:   [email protected]
Date:     Mon Jul 28 18:15:35 2014 UTC
Log:      More accurate usages of Heap::AdjustLiveBytes().

[email protected]

Review URL: https://codereview.chromium.org/424663004
http://code.google.com/p/v8/source/detail?r=22654

Modified:
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/factory.cc      Tue Jul 22 08:28:49 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc      Mon Jul 28 18:15:35 2014 UTC
@@ -1796,8 +1796,8 @@

   // Put in filler if the new object is smaller than the old.
   if (size_difference > 0) {
-    Address address = object->address() + map->instance_size();
-    heap->CreateFillerObjectAt(address, size_difference);
+    Address address = object->address();
+ heap->CreateFillerObjectAt(address + map->instance_size(), size_difference);
     heap->AdjustLiveBytes(address, -size_difference, Heap::FROM_MUTATOR);
   }

=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Jul 28 13:12:26 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Jul 28 18:15:35 2014 UTC
@@ -4584,12 +4584,14 @@
   int new_instance_size = new_map->instance_size();
   int instance_size_delta = map->instance_size() - new_instance_size;
   ASSERT(instance_size_delta >= 0);
-  Heap* heap = isolate->heap();
-  heap->CreateFillerObjectAt(object->address() + new_instance_size,
-                             instance_size_delta);
-  heap->AdjustLiveBytes(object->address(),
-                        -instance_size_delta,
-                        Heap::FROM_MUTATOR);
+
+  if (instance_size_delta > 0) {
+    Heap* heap = isolate->heap();
+    heap->CreateFillerObjectAt(object->address() + new_instance_size,
+                               instance_size_delta);
+    heap->AdjustLiveBytes(object->address(), -instance_size_delta,
+                          Heap::FROM_MUTATOR);
+  }

// We are storing the new map using release store after creating a filler for
   // the left-over space to avoid races with the sweeper thread.

--
--
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/d/optout.

Reply via email to