Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 3b7a262ec1f11d1665878956bef300965218d77e..5713537b5ab301076c51706d77f3eef5e5713970 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; |
@@ -3976,7 +3979,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); |
@@ -4003,11 +4008,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; |