Reviewers: Jakob,

Description:
JSArray can go slow case during String.split.  Guard against
that eventuality.

Please review this at http://codereview.chromium.org/7840031/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/objects-debug.cc
  M     src/runtime.cc


Index: src/objects-debug.cc
===================================================================
--- src/objects-debug.cc        (revision 9139)
+++ src/objects-debug.cc        (working copy)
@@ -257,9 +257,9 @@
              (map()->inobject_properties() + properties()->length() -
               map()->NextFreePropertyIndex()));
   }
-  ASSERT(map()->has_fast_elements() ==
-         (elements()->map() == GetHeap()->fixed_array_map() ||
-          elements()->map() == GetHeap()->fixed_cow_array_map()));
+  ASSERT_EQ(map()->has_fast_elements(),
+            (elements()->map() == GetHeap()->fixed_array_map() ||
+             elements()->map() == GetHeap()->fixed_cow_array_map()));
   ASSERT(map()->has_fast_elements() == HasFastElements());
 }

Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 9164)
+++ src/runtime.cc      (working copy)
@@ -6091,11 +6091,13 @@
   }

   if (limit == 0xffffffffu) {
-    StringSplitCache::Enter(isolate->heap(),
-                            isolate->heap()->string_split_cache(),
-                            *subject,
-                            *pattern,
-                            *elements);
+    if (result->HasFastElements()) {
+      StringSplitCache::Enter(isolate->heap(),
+                              isolate->heap()->string_split_cache(),
+                              *subject,
+                              *pattern,
+                              *elements);
+    }
   }

   return *result;


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

Reply via email to