Revision: 9622
Author:   [email protected]
Date:     Fri Oct 14 02:20:19 2011
Log:      Speed up cloning objects by avoiding a write barrier check.
Review URL: http://codereview.chromium.org/8274032
http://code.google.com/p/v8/source/detail?r=9622

Modified:
 /branches/bleeding_edge/src/heap.cc

=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Oct 13 04:50:00 2011
+++ /branches/bleeding_edge/src/heap.cc Fri Oct 14 02:20:19 2011
@@ -3695,6 +3695,8 @@
   int object_size = map->instance_size();
   Object* clone;

+  WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER;
+
   // If we're forced to always allocate, we use the general allocation
   // functions which may leave us with an object in old space.
   if (always_allocate()) {
@@ -3711,6 +3713,7 @@
                  JSObject::kHeaderSize,
                  (object_size - JSObject::kHeaderSize) / kPointerSize);
   } else {
+    wb_mode = SKIP_WRITE_BARRIER;
     { MaybeObject* maybe_clone = new_space_.AllocateRaw(object_size);
       if (!maybe_clone->ToObject(&clone)) return maybe_clone;
     }
@@ -3739,7 +3742,7 @@
       }
       if (!maybe_elem->ToObject(&elem)) return maybe_elem;
     }
-    JSObject::cast(clone)->set_elements(FixedArrayBase::cast(elem));
+ JSObject::cast(clone)->set_elements(FixedArrayBase::cast(elem), wb_mode);
   }
   // Update properties if necessary.
   if (properties->length() > 0) {
@@ -3747,7 +3750,7 @@
     { MaybeObject* maybe_prop = CopyFixedArray(properties);
       if (!maybe_prop->ToObject(&prop)) return maybe_prop;
     }
-    JSObject::cast(clone)->set_properties(FixedArray::cast(prop));
+    JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode);
   }
   // Return the new clone.
   return clone;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to