Chromium Code Reviews| Index: src/heap-inl.h |
| diff --git a/src/heap-inl.h b/src/heap-inl.h |
| index 64125bc302c7d275133974a54f0566eb0126c916..02d1352ebe6b622aaadd667179b0da95c394832d 100644 |
| --- a/src/heap-inl.h |
| +++ b/src/heap-inl.h |
| @@ -98,9 +98,7 @@ AllocationResult Heap::AllocateInternalizedStringImpl( |
| AllocationResult Heap::AllocateOneByteInternalizedString( |
| Vector<const uint8_t> str, |
| uint32_t hash_field) { |
| - if (str.length() > String::kMaxLength) { |
| - return isolate()->ThrowInvalidStringLength(); |
| - } |
| + CHECK_GE(String::kMaxLength, str.length()); |
| // Compute map and object size. |
| Map* map = ascii_internalized_string_map(); |
| int size = SeqOneByteString::SizeFor(str.length()); |
| @@ -131,9 +129,7 @@ AllocationResult Heap::AllocateOneByteInternalizedString( |
| AllocationResult Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str, |
| uint32_t hash_field) { |
| - if (str.length() > String::kMaxLength) { |
| - return isolate()->ThrowInvalidStringLength(); |
| - } |
| + CHECK_GE(String::kMaxLength, str.length()); |
| // Compute map and object size. |
| Map* map = internalized_string_map(); |
| int size = SeqTwoByteString::SizeFor(str.length()); |
| @@ -540,10 +536,10 @@ Isolate* Heap::isolate() { |
| // Warning: Do not use the identifiers __object__, __maybe_object__ or |
| // __scope__ in a call to this macro. |
| -#define RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RETURN_EMPTY) \ |
| +#define RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
| if (!__allocation__.IsRetry()) { \ |
| __object__ = __allocation__.ToObjectChecked(); \ |
|
Igor Sheludko
2014/06/18 13:10:13
While we are here: what about
if (__allocation_
Yang
2014/06/18 13:27:26
Done.
|
| - if (__object__ == (ISOLATE)->heap()->exception()) { RETURN_EMPTY; } \ |
| + ASSERT(__object__ != (ISOLATE)->heap()->exception()); \ |
| RETURN_VALUE; \ |
| } |
| @@ -551,18 +547,18 @@ Isolate* Heap::isolate() { |
| do { \ |
| AllocationResult __allocation__ = FUNCTION_CALL; \ |
| Object* __object__ = NULL; \ |
| - RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RETURN_EMPTY) \ |
| + RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
| (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ |
| "allocation failure"); \ |
| __allocation__ = FUNCTION_CALL; \ |
| - RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RETURN_EMPTY) \ |
| + RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
| (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
| (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
| { \ |
| AlwaysAllocateScope __scope__(ISOLATE); \ |
| __allocation__ = FUNCTION_CALL; \ |
| } \ |
| - RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RETURN_EMPTY) \ |
| + RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
| /* TODO(1181417): Fix this. */ \ |
| v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ |
| RETURN_EMPTY; \ |