Use Heap::CreateFillerArrayAt to create a filler instead of copied code.
authorantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 22 Apr 2010 18:50:27 +0000 (18:50 +0000)
committerantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 22 Apr 2010 18:50:27 +0000 (18:50 +0000)
Review URL: http://codereview.chromium.org/1770001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/builtins.cc
src/heap.cc

index 767820acb8cccba53a88ea01fe05ef90eed3a5c0..9850f5583830664fb52330b712df461fb29154bd 100644 (file)
@@ -348,15 +348,7 @@ static FixedArray* LeftTrimFixedArray(FixedArray* elms, int to_trim) {
   // Technically in new space this write might be omitted (except for
   // debug mode which iterates through the heap), but to play safer
   // we still do it.
-  if (to_trim == 1) {
-    former_start[0] = Heap::raw_unchecked_one_pointer_filler_map();
-  } else if (to_trim == 2) {
-    former_start[0] = Heap::raw_unchecked_two_pointer_filler_map();
-  } else {
-    former_start[0] = Heap::raw_unchecked_byte_array_map();
-    ByteArray* as_byte_array = reinterpret_cast<ByteArray*>(elms);
-    as_byte_array->set_length(ByteArray::LengthFor(to_trim * kPointerSize));
-  }
+  Heap::CreateFillerObjectAt(elms->address(), to_trim * kPointerSize);
 
   former_start[to_trim] = Heap::fixed_array_map();
   former_start[to_trim + 1] = reinterpret_cast<Object*>(len - to_trim);
index eb478846a3957d51c72b6264edf870f817d02189..0cd17917a6af909a23b006f83906820f5bfac787 100644 (file)
@@ -2188,9 +2188,11 @@ void Heap::CreateFillerObjectAt(Address addr, int size) {
   if (size == 0) return;
   HeapObject* filler = HeapObject::FromAddress(addr);
   if (size == kPointerSize) {
-    filler->set_map(Heap::one_pointer_filler_map());
+    filler->set_map(one_pointer_filler_map());
+  } else if (size == 2 * kPointerSize) {
+    filler->set_map(two_pointer_filler_map());
   } else {
-    filler->set_map(Heap::byte_array_map());
+    filler->set_map(byte_array_map());
     ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
   }
 }