Index: src/codegen-ia32.cc |
=================================================================== |
--- src/codegen-ia32.cc (revision 645) |
+++ src/codegen-ia32.cc (working copy) |
@@ -4809,7 +4809,8 @@ |
Label* throw_normal_exception, |
Label* throw_out_of_memory_exception, |
StackFrame::Type frame_type, |
- bool do_gc) { |
+ bool do_gc, |
+ bool always_allocate_scope) { |
// eax: result parameter for PerformGC, if any |
// ebx: pointer to C function (C callee-saved) |
// ebp: frame pointer (restored after C call) |
@@ -4822,12 +4823,22 @@ |
__ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); |
} |
+ ExternalReference scope_depth = |
+ ExternalReference::heap_always_allocate_scope_depth(); |
+ if (always_allocate_scope) { |
+ __ inc(Operand::StaticVariable(scope_depth)); |
+ } |
+ |
// Call C function. |
__ mov(Operand(esp, 0 * kPointerSize), edi); // argc. |
__ mov(Operand(esp, 1 * kPointerSize), esi); // argv. |
__ call(Operand(ebx)); |
// Result is in eax or edx:eax - do not destroy these registers! |
+ if (always_allocate_scope) { |
+ __ dec(Operand::StaticVariable(scope_depth)); |
+ } |
+ |
// Check for failure result. |
Label failure_returned; |
ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
@@ -4963,14 +4974,16 @@ |
GenerateCore(masm, &throw_normal_exception, |
&throw_out_of_memory_exception, |
frame_type, |
- FLAG_gc_greedy); |
+ FLAG_gc_greedy, |
+ false); |
// Do space-specific GC and retry runtime call. |
GenerateCore(masm, |
&throw_normal_exception, |
&throw_out_of_memory_exception, |
frame_type, |
- true); |
+ true, |
+ false); |
// Do full GC and retry runtime call one final time. |
Failure* failure = Failure::InternalError(); |
@@ -4979,6 +4992,7 @@ |
&throw_normal_exception, |
&throw_out_of_memory_exception, |
frame_type, |
+ true, |
true); |
__ bind(&throw_out_of_memory_exception); |