Index: src/codegen-arm.cc |
=================================================================== |
--- src/codegen-arm.cc (revision 645) |
+++ src/codegen-arm.cc (working copy) |
@@ -3812,7 +3812,8 @@ |
Label* throw_normal_exception, |
Label* throw_out_of_memory_exception, |
StackFrame::Type frame_type, |
- bool do_gc) { |
+ bool do_gc, |
+ bool always_allocate) { |
// r0: result parameter for PerformGC, if any |
// r4: number of arguments including receiver (C callee-saved) |
// r5: pointer to builtin function (C callee-saved) |
@@ -3823,6 +3824,15 @@ |
__ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); |
} |
+ ExternalReference scope_depth = |
+ ExternalReference::heap_always_allocate_scope_depth(); |
+ if (always_allocate) { |
+ __ mov(r0, Operand(scope_depth)); |
+ __ ldr(r1, MemOperand(r0)); |
+ __ add(r1, r1, Operand(1)); |
+ __ str(r1, MemOperand(r0)); |
+ } |
+ |
// Call C built-in. |
// r0 = argc, r1 = argv |
__ mov(r0, Operand(r4)); |
@@ -3843,8 +3853,16 @@ |
#else /* !defined(__arm__) */ |
__ mov(pc, Operand(r5)); |
#endif /* !defined(__arm__) */ |
- // result is in r0 or r0:r1 - do not destroy these registers! |
+ if (always_allocate) { |
+ // It's okay to clobber r2 and r3 here. Don't mess with r0 and r1 |
+ // though (contain the result). |
+ __ mov(r2, Operand(scope_depth)); |
+ __ ldr(r3, MemOperand(r2)); |
+ __ sub(r3, r3, Operand(1)); |
+ __ str(r3, MemOperand(r2)); |
+ } |
+ |
// check for failure result |
Label failure_returned; |
ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
@@ -3929,14 +3947,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(); |
@@ -3945,6 +3965,7 @@ |
&throw_normal_exception, |
&throw_out_of_memory_exception, |
frame_type, |
+ true, |
true); |
__ bind(&throw_out_of_memory_exception); |