Reviewers: Jakob,

Message:
PTAL.

Description:
Catch OOM when sparse array join results in too large array.


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

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

Affected files:
  M src/runtime.cc


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 7b61c3e13fe4e6203080af0138269175b4b0a07b..4e6355c6ae1edbfd6d6d179de2a051ba53477ce4 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6970,7 +6970,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) {
   // Find total length of join result.
   int string_length = 0;
   bool is_ascii = separator->IsAsciiRepresentation();
-  int max_string_length = SeqAsciiString::kMaxLength;
+  int max_string_length = is_ascii ? SeqAsciiString::kMaxLength
+                                   : SeqTwoByteString::kMaxLength;
   bool overflow = false;
   CONVERT_NUMBER_CHECKED(int, elements_length,
                          Int32, elements_array->length());


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

Reply via email to