OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 } | 3896 } |
3897 | 3897 |
3898 | 3898 |
3899 void CEntryStub::GenerateAheadOfTime() { | 3899 void CEntryStub::GenerateAheadOfTime() { |
3900 CEntryStub stub(1, kDontSaveFPRegs); | 3900 CEntryStub stub(1, kDontSaveFPRegs); |
3901 Handle<Code> code = stub.GetCode(); | 3901 Handle<Code> code = stub.GetCode(); |
3902 code->set_is_pregenerated(true); | 3902 code->set_is_pregenerated(true); |
3903 } | 3903 } |
3904 | 3904 |
3905 | 3905 |
| 3906 static void JumpIfOOM(MacroAssembler* masm, |
| 3907 Register value, |
| 3908 Register scratch, |
| 3909 Label* oom_label) { |
| 3910 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); |
| 3911 STATIC_ASSERT(kFailureTag == 3); |
| 3912 __ and_(scratch, value, Operand(0xf)); |
| 3913 __ cmp(scratch, Operand(0xf)); |
| 3914 __ b(eq, oom_label); |
| 3915 } |
| 3916 |
| 3917 |
3906 void CEntryStub::GenerateCore(MacroAssembler* masm, | 3918 void CEntryStub::GenerateCore(MacroAssembler* masm, |
3907 Label* throw_normal_exception, | 3919 Label* throw_normal_exception, |
3908 Label* throw_termination_exception, | 3920 Label* throw_termination_exception, |
3909 Label* throw_out_of_memory_exception, | 3921 Label* throw_out_of_memory_exception, |
3910 bool do_gc, | 3922 bool do_gc, |
3911 bool always_allocate) { | 3923 bool always_allocate) { |
3912 // r0: result parameter for PerformGC, if any | 3924 // r0: result parameter for PerformGC, if any |
3913 // r4: number of arguments including receiver (C callee-saved) | 3925 // r4: number of arguments including receiver (C callee-saved) |
3914 // r5: pointer to builtin function (C callee-saved) | 3926 // r5: pointer to builtin function (C callee-saved) |
3915 // r6: pointer to the first argument (C callee-saved) | 3927 // r6: pointer to the first argument (C callee-saved) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 __ mov(pc, lr); | 4007 __ mov(pc, lr); |
3996 | 4008 |
3997 // check if we should retry or throw exception | 4009 // check if we should retry or throw exception |
3998 Label retry; | 4010 Label retry; |
3999 __ bind(&failure_returned); | 4011 __ bind(&failure_returned); |
4000 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 4012 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
4001 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 4013 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
4002 __ b(eq, &retry); | 4014 __ b(eq, &retry); |
4003 | 4015 |
4004 // Special handling of out of memory exceptions. | 4016 // Special handling of out of memory exceptions. |
4005 Failure* out_of_memory = Failure::OutOfMemoryException(); | 4017 JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception); |
4006 __ cmp(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | |
4007 __ b(eq, throw_out_of_memory_exception); | |
4008 | 4018 |
4009 // Retrieve the pending exception and clear the variable. | 4019 // Retrieve the pending exception and clear the variable. |
4010 __ mov(r3, Operand(isolate->factory()->the_hole_value())); | 4020 __ mov(r3, Operand(isolate->factory()->the_hole_value())); |
4011 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 4021 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
4012 isolate))); | 4022 isolate))); |
4013 __ ldr(r0, MemOperand(ip)); | 4023 __ ldr(r0, MemOperand(ip)); |
4014 __ str(r3, MemOperand(ip)); | 4024 __ str(r3, MemOperand(ip)); |
4015 | 4025 |
4016 // Special handling of termination exceptions which are uncatchable | 4026 // Special handling of termination exceptions which are uncatchable |
4017 // by javascript code. | 4027 // by javascript code. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 __ bind(&throw_out_of_memory_exception); | 4099 __ bind(&throw_out_of_memory_exception); |
4090 // Set external caught exception to false. | 4100 // Set external caught exception to false. |
4091 Isolate* isolate = masm->isolate(); | 4101 Isolate* isolate = masm->isolate(); |
4092 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, | 4102 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, |
4093 isolate); | 4103 isolate); |
4094 __ mov(r0, Operand(false, RelocInfo::NONE32)); | 4104 __ mov(r0, Operand(false, RelocInfo::NONE32)); |
4095 __ mov(r2, Operand(external_caught)); | 4105 __ mov(r2, Operand(external_caught)); |
4096 __ str(r0, MemOperand(r2)); | 4106 __ str(r0, MemOperand(r2)); |
4097 | 4107 |
4098 // Set pending exception and r0 to out of memory exception. | 4108 // Set pending exception and r0 to out of memory exception. |
4099 Failure* out_of_memory = Failure::OutOfMemoryException(); | 4109 Label already_have_failure; |
| 4110 JumpIfOOM(masm, r0, ip, &already_have_failure); |
| 4111 Failure* out_of_memory = Failure::OutOfMemoryException(0x1); |
4100 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 4112 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
| 4113 __ bind(&already_have_failure); |
4101 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 4114 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
4102 isolate))); | 4115 isolate))); |
4103 __ str(r0, MemOperand(r2)); | 4116 __ str(r0, MemOperand(r2)); |
4104 // Fall through to the next label. | 4117 // Fall through to the next label. |
4105 | 4118 |
4106 __ bind(&throw_termination_exception); | 4119 __ bind(&throw_termination_exception); |
4107 __ ThrowUncatchable(r0); | 4120 __ ThrowUncatchable(r0); |
4108 | 4121 |
4109 __ bind(&throw_normal_exception); | 4122 __ bind(&throw_normal_exception); |
4110 __ Throw(r0); | 4123 __ Throw(r0); |
(...skipping 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7710 | 7723 |
7711 __ Pop(lr, r5, r1); | 7724 __ Pop(lr, r5, r1); |
7712 __ Ret(); | 7725 __ Ret(); |
7713 } | 7726 } |
7714 | 7727 |
7715 #undef __ | 7728 #undef __ |
7716 | 7729 |
7717 } } // namespace v8::internal | 7730 } } // namespace v8::internal |
7718 | 7731 |
7719 #endif // V8_TARGET_ARCH_ARM | 7732 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |