From: kasperl@chromium.org Date: Wed, 29 Oct 2008 12:16:34 +0000 (+0000) Subject: Allow three runtime call attempts before throwing an out of X-Git-Tag: upstream/4.7.83~25082 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a26b3535ded7410852d87e1a95aa7574979aca2f;p=platform%2Fupstream%2Fv8.git Allow three runtime call attempts before throwing an out of memory exception. Still needs work in Runtime_PerformGC to make sure we'll allow future allocations. Review URL: http://codereview.chromium.org/8873 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@638 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc index 4b1ada1..256dec5 100644 --- a/src/codegen-arm.cc +++ b/src/codegen-arm.cc @@ -3920,23 +3920,27 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { Label throw_out_of_memory_exception; Label throw_normal_exception; -#ifdef DEBUG + // Call into the runtime system. Collect garbage before the call if + // running with --gc-greedy set. if (FLAG_gc_greedy) { Failure* failure = Failure::RetryAfterGC(0); __ mov(r0, Operand(reinterpret_cast(failure))); } - GenerateCore(masm, - &throw_normal_exception, + GenerateCore(masm, &throw_normal_exception, &throw_out_of_memory_exception, frame_type, FLAG_gc_greedy); -#else + + // Do space-specific GC and retry runtime call. GenerateCore(masm, &throw_normal_exception, &throw_out_of_memory_exception, frame_type, - false); -#endif + true); + + // Do full GC and retry runtime call one final time. + Failure* failure = Failure::InternalError(); + __ mov(r0, Operand(reinterpret_cast(failure))); GenerateCore(masm, &throw_normal_exception, &throw_out_of_memory_exception, diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc index cf76fe9..582e430 100644 --- a/src/codegen-ia32.cc +++ b/src/codegen-ia32.cc @@ -4955,7 +4955,8 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { Label throw_out_of_memory_exception; Label throw_normal_exception; -#ifdef DEBUG + // Call into the runtime system. Collect garbage before the call if + // running with --gc-greedy set. if (FLAG_gc_greedy) { Failure* failure = Failure::RetryAfterGC(0); __ mov(Operand(eax), Immediate(reinterpret_cast(failure))); @@ -4964,14 +4965,17 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { &throw_out_of_memory_exception, frame_type, FLAG_gc_greedy); -#else + + // Do space-specific GC and retry runtime call. GenerateCore(masm, &throw_normal_exception, &throw_out_of_memory_exception, frame_type, - false); -#endif + true); + // Do full GC and retry runtime call one final time. + Failure* failure = Failure::InternalError(); + __ mov(Operand(eax), Immediate(reinterpret_cast(failure))); GenerateCore(masm, &throw_normal_exception, &throw_out_of_memory_exception, diff --git a/src/handles.cc b/src/handles.cc index 1a600db..5b0e1ce 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -39,16 +39,6 @@ namespace v8 { namespace internal { -#define CALL_GC(RESULT) \ - { \ - Failure* __failure__ = Failure::cast(RESULT); \ - if (!Heap::CollectGarbage(__failure__->requested(), \ - __failure__->allocation_space())) { \ - /* TODO(1181417): Fix this. */ \ - V8::FatalProcessOutOfMemory("Handles"); \ - } \ - } - Handle AddKeysFromJSArray(Handle content, Handle array) { @@ -283,10 +273,6 @@ Handle GetScriptWrapper(Handle