Revision: 20333
Author:   [email protected]
Date:     Fri Mar 28 13:05:23 2014 UTC
Log: Move FillWithHoles FixedArray and FixedDoubleArray functions to the given classes.

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/builtins.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/builtins.cc     Thu Mar 27 16:41:09 2014 UTC
+++ /branches/bleeding_edge/src/builtins.cc     Fri Mar 28 13:05:23 2014 UTC
@@ -205,19 +205,6 @@
               src->data_start() + src_index,
               len * kDoubleSize);
 }
-
-
-static void FillWithHoles(Heap* heap, FixedArray* dst, int from, int to) {
-  ASSERT(dst->map() != heap->fixed_cow_array_map());
- MemsetPointer(dst->data_start() + from, heap->the_hole_value(), to - from);
-}
-
-
-static void FillWithHoles(FixedDoubleArray* dst, int from, int to) {
-  for (int i = from; i < to; i++) {
-    dst->set_the_hole(i);
-  }
-}


 static FixedArrayBase* LeftTrimFixedArray(Heap* heap,
@@ -898,12 +885,12 @@
           Handle<FixedDoubleArray> elms =
               Handle<FixedDoubleArray>::cast(elms_obj);
           MoveDoubleElements(*elms, 0, *elms, delta, len - delta);
-          FillWithHoles(*elms, len - delta, len);
+          elms->FillWithHoles(len - delta, len);
         } else {
           Handle<FixedArray> elms = Handle<FixedArray>::cast(elms_obj);
           DisallowHeapAllocation no_gc;
           heap->MoveElements(*elms, 0, delta, len - delta);
-          FillWithHoles(heap, *elms, len - delta, len);
+          elms->FillWithHoles(len - delta, len);
         }
       }
       elms_changed = true;
@@ -914,14 +901,14 @@
         MoveDoubleElements(*elms, actual_start + item_count,
                            *elms, actual_start + actual_delete_count,
                            (len - actual_delete_count - actual_start));
-        FillWithHoles(*elms, new_length, len);
+        elms->FillWithHoles(new_length, len);
       } else {
         Handle<FixedArray> elms = Handle<FixedArray>::cast(elms_obj);
         DisallowHeapAllocation no_gc;
         heap->MoveElements(*elms, actual_start + item_count,
                            actual_start + actual_delete_count,
                            (len - actual_delete_count - actual_start));
-        FillWithHoles(heap, *elms, new_length, len);
+        elms->FillWithHoles(new_length, len);
       }
     }
   } else if (item_count > actual_delete_count) {
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Thu Mar 27 16:41:09 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Fri Mar 28 13:05:23 2014 UTC
@@ -2225,6 +2225,18 @@
   int offset = kHeaderSize + index * kDoubleSize;
   return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset));
 }
+
+
+double* FixedDoubleArray::data_start() {
+  return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
+}
+
+
+void FixedDoubleArray::FillWithHoles(int from, int to) {
+  for (int i = from; i < to; i++) {
+    set_the_hole(i);
+  }
+}


 SMI_ACCESSORS(
@@ -2420,8 +2432,10 @@
 }


-double* FixedDoubleArray::data_start() {
-  return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
+void FixedArray::FillWithHoles(int from, int to) {
+  for (int i = from; i < to; i++) {
+    set_the_hole(i);
+  }
 }


=======================================
--- /branches/bleeding_edge/src/objects.h       Fri Mar 28 09:49:27 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Fri Mar 28 13:05:23 2014 UTC
@@ -3049,6 +3049,8 @@
   // Gives access to raw memory which stores the array's data.
   inline Object** data_start();

+  inline void FillWithHoles(int from, int to);
+
   // Shrink length and insert filler objects.
   void Shrink(int length);

@@ -3159,6 +3161,8 @@
   // Gives access to raw memory which stores the array's data.
   inline double* data_start();

+  inline void FillWithHoles(int from, int to);
+
   // Code Generation support.
   static int OffsetOfElementAt(int index) { return SizeFor(index); }

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