| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index 0d884303b152042da7a477daa67aca0af557a57b..6628a80a3d99d07698576af08e72b0d45b2202d8 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -2499,6 +2499,9 @@ bool Heap::CreateInitialMaps() {
|
| Oddball::cast(obj)->set_kind(Oddball::kUndefined);
|
| ASSERT(!InNewSpace(undefined_value()));
|
|
|
| + // Set preliminary exception sentinel value before actually initializing it.
|
| + set_exception(null_value());
|
| +
|
| // Allocate the empty descriptor array.
|
| { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
|
| if (!maybe_obj->ToObject(&obj)) return false;
|
| @@ -3972,7 +3975,9 @@ MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string,
|
| {
|
| int chars = non_ascii_start + utf16_length;
|
| MaybeObject* maybe_result = AllocateRawTwoByteString(chars, pretenure);
|
| - if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + if (!maybe_result->ToObject(&result) || result->IsException()) {
|
| + return maybe_result;
|
| + }
|
| }
|
| // Convert and copy the characters into the new object.
|
| SeqTwoByteString* twobyte = SeqTwoByteString::cast(result);
|
| @@ -3999,11 +4004,15 @@ MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string,
|
|
|
| if (String::IsOneByte(start, length)) {
|
| MaybeObject* maybe_result = AllocateRawOneByteString(length, pretenure);
|
| - if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + if (!maybe_result->ToObject(&result) || result->IsException()) {
|
| + return maybe_result;
|
| + }
|
| CopyChars(SeqOneByteString::cast(result)->GetChars(), start, length);
|
| } else { // It's not a one byte string.
|
| MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure);
|
| - if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + if (!maybe_result->ToObject(&result) || result->IsException()) {
|
| + return maybe_result;
|
| + }
|
| CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length);
|
| }
|
| return result;
|
|
|