Add missing length check when copying fixed arrays.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Apr 2014 08:24:54 +0000 (08:24 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Apr 2014 08:24:54 +0000 (08:24 +0000)
This was mistakenly removed in r21027.

R=bmeurer@chromium.org

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

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

src/heap-inl.h

index 4f92d08..a728777 100644 (file)
@@ -161,16 +161,19 @@ MaybeObject* Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str,
 }
 
 MaybeObject* Heap::CopyFixedArray(FixedArray* src) {
+  if (src->length() == 0) return src;
   return CopyFixedArrayWithMap(src, src->map());
 }
 
 
 MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) {
+  if (src->length() == 0) return src;
   return CopyFixedDoubleArrayWithMap(src, src->map());
 }
 
 
 MaybeObject* Heap::CopyConstantPoolArray(ConstantPoolArray* src) {
+  if (src->length() == 0) return src;
   return CopyConstantPoolArrayWithMap(src, src->map());
 }