Index: src/jsregexp.cc |
=================================================================== |
--- src/jsregexp.cc (revision 469) |
+++ src/jsregexp.cc (working copy) |
@@ -279,19 +279,23 @@ |
multiline_option, &number_of_captures, |
&error_message, &JSREMalloc, &JSREFree); |
- if (code == NULL && malloc_failure->IsRetryAfterGC()) { |
- // Performs a GC, then retries. |
- if (!Heap::CollectGarbage(malloc_failure->requested(), |
- malloc_failure->allocation_space())) { |
- // TODO(1181417): Fix this. |
- V8::FatalProcessOutOfMemory("RegExpImpl::JsreCompile"); |
+ if (code == NULL) { |
+ if (malloc_failure->IsRetryAfterGC()) { |
+ // Performs a GC, then retries. |
+ if (!Heap::CollectGarbage(malloc_failure->requested(), |
+ malloc_failure->allocation_space())) { |
+ // TODO(1181417): Fix this. |
+ V8::FatalProcessOutOfMemory("RegExpImpl::JsreCompile"); |
+ } |
+ malloc_failure = Failure::Exception(); |
+ code = jsRegExpCompile(two_byte_pattern->GetTwoByteData(), |
+ pattern->length(), case_option, |
+ multiline_option, &number_of_captures, |
+ &error_message, &JSREMalloc, &JSREFree); |
} |
- malloc_failure = Failure::Exception(); |
- code = jsRegExpCompile(two_byte_pattern->GetTwoByteData(), |
- pattern->length(), case_option, |
- multiline_option, &number_of_captures, |
- &error_message, &JSREMalloc, &JSREFree); |
- if (code == NULL && malloc_failure->IsRetryAfterGC()) { |
+ if (code == NULL && |
+ (malloc_failure->IsRetryAfterGC() || |
+ malloc_failure->IsOutOfMemoryFailure())) { |
// TODO(1181417): Fix this. |
V8::FatalProcessOutOfMemory("RegExpImpl::JsreCompile"); |
} |