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

Review URL: http://codereview.chromium.org/8540006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9980 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2011-11-11 17:21:16 +00:00
parent 8bdb3ffbca
commit 0e47d6e417

View File

@ -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());