Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: src/heap.cc

Issue 240053010: Return Object* instead of MaybeObject* from runtime calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cmpp Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/execution.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/execution.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698