| OLD | NEW | 
|     1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |     1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 
|     2 // Redistribution and use in source and binary forms, with or without |     2 // Redistribution and use in source and binary forms, with or without | 
|     3 // modification, are permitted provided that the following conditions are |     3 // modification, are permitted provided that the following conditions are | 
|     4 // met: |     4 // met: | 
|     5 // |     5 // | 
|     6 //     * Redistributions of source code must retain the above copyright |     6 //     * Redistributions of source code must retain the above copyright | 
|     7 //       notice, this list of conditions and the following disclaimer. |     7 //       notice, this list of conditions and the following disclaimer. | 
|     8 //     * Redistributions in binary form must reproduce the above |     8 //     * Redistributions in binary form must reproduce the above | 
|     9 //       copyright notice, this list of conditions and the following |     9 //       copyright notice, this list of conditions and the following | 
|    10 //       disclaimer in the documentation and/or other materials provided |    10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 3794 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3805   __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |  3805   __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | 
|  3806   if (kDebug && FLAG_debug_code) __ mov(lr, Operand(pc)); |  3806   if (kDebug && FLAG_debug_code) __ mov(lr, Operand(pc)); | 
|  3807   __ pop(pc); |  3807   __ pop(pc); | 
|  3808 } |  3808 } | 
|  3809  |  3809  | 
|  3810  |  3810  | 
|  3811 void CEntryStub::GenerateCore(MacroAssembler* masm, |  3811 void CEntryStub::GenerateCore(MacroAssembler* masm, | 
|  3812                               Label* throw_normal_exception, |  3812                               Label* throw_normal_exception, | 
|  3813                               Label* throw_out_of_memory_exception, |  3813                               Label* throw_out_of_memory_exception, | 
|  3814                               StackFrame::Type frame_type, |  3814                               StackFrame::Type frame_type, | 
|  3815                               bool do_gc) { |  3815                               bool do_gc, | 
 |  3816                               bool always_allocate) { | 
|  3816   // r0: result parameter for PerformGC, if any |  3817   // r0: result parameter for PerformGC, if any | 
|  3817   // r4: number of arguments including receiver  (C callee-saved) |  3818   // r4: number of arguments including receiver  (C callee-saved) | 
|  3818   // r5: pointer to builtin function  (C callee-saved) |  3819   // r5: pointer to builtin function  (C callee-saved) | 
|  3819   // r6: pointer to the first argument (C callee-saved) |  3820   // r6: pointer to the first argument (C callee-saved) | 
|  3820  |  3821  | 
|  3821   if (do_gc) { |  3822   if (do_gc) { | 
|  3822     // Passing r0. |  3823     // Passing r0. | 
|  3823     __ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); |  3824     __ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); | 
|  3824   } |  3825   } | 
|  3825  |  3826  | 
 |  3827   ExternalReference scope_depth = | 
 |  3828       ExternalReference::heap_always_allocate_scope_depth(); | 
 |  3829   if (always_allocate) { | 
 |  3830     __ mov(r0, Operand(scope_depth)); | 
 |  3831     __ ldr(r1, MemOperand(r0)); | 
 |  3832     __ add(r1, r1, Operand(1)); | 
 |  3833     __ str(r1, MemOperand(r0)); | 
 |  3834   } | 
 |  3835  | 
|  3826   // Call C built-in. |  3836   // Call C built-in. | 
|  3827   // r0 = argc, r1 = argv |  3837   // r0 = argc, r1 = argv | 
|  3828   __ mov(r0, Operand(r4)); |  3838   __ mov(r0, Operand(r4)); | 
|  3829   __ mov(r1, Operand(r6)); |  3839   __ mov(r1, Operand(r6)); | 
|  3830  |  3840  | 
|  3831   // TODO(1242173): To let the GC traverse the return address of the exit |  3841   // TODO(1242173): To let the GC traverse the return address of the exit | 
|  3832   // frames, we need to know where the return address is. Right now, |  3842   // frames, we need to know where the return address is. Right now, | 
|  3833   // we push it on the stack to be able to find it again, but we never |  3843   // we push it on the stack to be able to find it again, but we never | 
|  3834   // restore from it in case of changes, which makes it impossible to |  3844   // restore from it in case of changes, which makes it impossible to | 
|  3835   // support moving the C entry code stub. This should be fixed, but currently |  3845   // support moving the C entry code stub. This should be fixed, but currently | 
|  3836   // this is OK because the CEntryStub gets generated so early in the V8 boot |  3846   // this is OK because the CEntryStub gets generated so early in the V8 boot | 
|  3837   // sequence that it is not moving ever. |  3847   // sequence that it is not moving ever. | 
|  3838   __ add(lr, pc, Operand(4));  // compute return address: (pc + 8) + 4 |  3848   __ add(lr, pc, Operand(4));  // compute return address: (pc + 8) + 4 | 
|  3839   __ push(lr); |  3849   __ push(lr); | 
|  3840 #if !defined(__arm__) |  3850 #if !defined(__arm__) | 
|  3841   // Notify the simulator of the transition to C code. |  3851   // Notify the simulator of the transition to C code. | 
|  3842   __ swi(assembler::arm::call_rt_r5); |  3852   __ swi(assembler::arm::call_rt_r5); | 
|  3843 #else /* !defined(__arm__) */ |  3853 #else /* !defined(__arm__) */ | 
|  3844   __ mov(pc, Operand(r5)); |  3854   __ mov(pc, Operand(r5)); | 
|  3845 #endif /* !defined(__arm__) */ |  3855 #endif /* !defined(__arm__) */ | 
|  3846   // result is in r0 or r0:r1 - do not destroy these registers! |  3856  | 
 |  3857   if (always_allocate) { | 
 |  3858     // It's okay to clobber r2 and r3 here. Don't mess with r0 and r1 | 
 |  3859     // though (contain the result). | 
 |  3860     __ mov(r2, Operand(scope_depth)); | 
 |  3861     __ ldr(r3, MemOperand(r2)); | 
 |  3862     __ sub(r3, r3, Operand(1)); | 
 |  3863     __ str(r3, MemOperand(r2)); | 
 |  3864   } | 
|  3847  |  3865  | 
|  3848   // check for failure result |  3866   // check for failure result | 
|  3849   Label failure_returned; |  3867   Label failure_returned; | 
|  3850   ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |  3868   ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 
|  3851   // Lower 2 bits of r2 are 0 iff r0 has failure tag. |  3869   // Lower 2 bits of r2 are 0 iff r0 has failure tag. | 
|  3852   __ add(r2, r0, Operand(1)); |  3870   __ add(r2, r0, Operand(1)); | 
|  3853   __ tst(r2, Operand(kFailureTagMask)); |  3871   __ tst(r2, Operand(kFailureTagMask)); | 
|  3854   __ b(eq, &failure_returned); |  3872   __ b(eq, &failure_returned); | 
|  3855  |  3873  | 
|  3856   // Exit C frame and return. |  3874   // Exit C frame and return. | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3922  |  3940  | 
|  3923   // Call into the runtime system. Collect garbage before the call if |  3941   // Call into the runtime system. Collect garbage before the call if | 
|  3924   // running with --gc-greedy set. |  3942   // running with --gc-greedy set. | 
|  3925   if (FLAG_gc_greedy) { |  3943   if (FLAG_gc_greedy) { | 
|  3926     Failure* failure = Failure::RetryAfterGC(0); |  3944     Failure* failure = Failure::RetryAfterGC(0); | 
|  3927     __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); |  3945     __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); | 
|  3928   } |  3946   } | 
|  3929   GenerateCore(masm, &throw_normal_exception, |  3947   GenerateCore(masm, &throw_normal_exception, | 
|  3930                &throw_out_of_memory_exception, |  3948                &throw_out_of_memory_exception, | 
|  3931                frame_type, |  3949                frame_type, | 
|  3932                FLAG_gc_greedy); |  3950                FLAG_gc_greedy, | 
 |  3951                false); | 
|  3933  |  3952  | 
|  3934   // Do space-specific GC and retry runtime call. |  3953   // Do space-specific GC and retry runtime call. | 
|  3935   GenerateCore(masm, |  3954   GenerateCore(masm, | 
|  3936                &throw_normal_exception, |  3955                &throw_normal_exception, | 
|  3937                &throw_out_of_memory_exception, |  3956                &throw_out_of_memory_exception, | 
|  3938                frame_type, |  3957                frame_type, | 
|  3939                true); |  3958                true, | 
 |  3959                false); | 
|  3940  |  3960  | 
|  3941   // Do full GC and retry runtime call one final time. |  3961   // Do full GC and retry runtime call one final time. | 
|  3942   Failure* failure = Failure::InternalError(); |  3962   Failure* failure = Failure::InternalError(); | 
|  3943   __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |  3963   __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); | 
|  3944   GenerateCore(masm, |  3964   GenerateCore(masm, | 
|  3945                &throw_normal_exception, |  3965                &throw_normal_exception, | 
|  3946                &throw_out_of_memory_exception, |  3966                &throw_out_of_memory_exception, | 
|  3947                frame_type, |  3967                frame_type, | 
 |  3968                true, | 
|  3948                true); |  3969                true); | 
|  3949  |  3970  | 
|  3950   __ bind(&throw_out_of_memory_exception); |  3971   __ bind(&throw_out_of_memory_exception); | 
|  3951   GenerateThrowOutOfMemory(masm); |  3972   GenerateThrowOutOfMemory(masm); | 
|  3952   // control flow for generated will not return. |  3973   // control flow for generated will not return. | 
|  3953  |  3974  | 
|  3954   __ bind(&throw_normal_exception); |  3975   __ bind(&throw_normal_exception); | 
|  3955   GenerateThrowTOS(masm); |  3976   GenerateThrowTOS(masm); | 
|  3956 } |  3977 } | 
|  3957  |  3978  | 
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4189   // Slow-case: Non-function called. |  4210   // Slow-case: Non-function called. | 
|  4190   __ bind(&slow); |  4211   __ bind(&slow); | 
|  4191   __ mov(r0, Operand(argc_));  // Setup the number of arguments. |  4212   __ mov(r0, Operand(argc_));  // Setup the number of arguments. | 
|  4192   __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); |  4213   __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); | 
|  4193 } |  4214 } | 
|  4194  |  4215  | 
|  4195  |  4216  | 
|  4196 #undef __ |  4217 #undef __ | 
|  4197  |  4218  | 
|  4198 } }  // namespace v8::internal |  4219 } }  // namespace v8::internal | 
| OLD | NEW |