Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 9373022: Streamline throwing in the C entry stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/macro-assembler.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3825 } 3825 }
3826 3826
3827 3827
3828 void CEntryStub::GenerateAheadOfTime() { 3828 void CEntryStub::GenerateAheadOfTime() {
3829 CEntryStub stub(1, kDontSaveFPRegs); 3829 CEntryStub stub(1, kDontSaveFPRegs);
3830 Handle<Code> code = stub.GetCode(); 3830 Handle<Code> code = stub.GetCode();
3831 code->set_is_pregenerated(true); 3831 code->set_is_pregenerated(true);
3832 } 3832 }
3833 3833
3834 3834
3835 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
3836 __ Throw(v0);
3837 }
3838
3839
3840 void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
3841 UncatchableExceptionType type) {
3842 __ ThrowUncatchable(type, v0);
3843 }
3844
3845
3846 void CEntryStub::GenerateCore(MacroAssembler* masm, 3835 void CEntryStub::GenerateCore(MacroAssembler* masm,
3847 Label* throw_normal_exception, 3836 Label* throw_normal_exception,
3848 Label* throw_termination_exception, 3837 Label* throw_termination_exception,
3849 Label* throw_out_of_memory_exception, 3838 Label* throw_out_of_memory_exception,
3850 bool do_gc, 3839 bool do_gc,
3851 bool always_allocate) { 3840 bool always_allocate) {
3852 // v0: result parameter for PerformGC, if any 3841 // v0: result parameter for PerformGC, if any
3853 // s0: number of arguments including receiver (C callee-saved) 3842 // s0: number of arguments including receiver (C callee-saved)
3854 // s1: pointer to the first argument (C callee-saved) 3843 // s1: pointer to the first argument (C callee-saved)
3855 // s2: pointer to builtin function (C callee-saved) 3844 // s2: pointer to builtin function (C callee-saved)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
4026 Failure* failure = Failure::InternalError(); 4015 Failure* failure = Failure::InternalError();
4027 __ li(v0, Operand(reinterpret_cast<int32_t>(failure))); 4016 __ li(v0, Operand(reinterpret_cast<int32_t>(failure)));
4028 GenerateCore(masm, 4017 GenerateCore(masm,
4029 &throw_normal_exception, 4018 &throw_normal_exception,
4030 &throw_termination_exception, 4019 &throw_termination_exception,
4031 &throw_out_of_memory_exception, 4020 &throw_out_of_memory_exception,
4032 true, 4021 true,
4033 true); 4022 true);
4034 4023
4035 __ bind(&throw_out_of_memory_exception); 4024 __ bind(&throw_out_of_memory_exception);
4036 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); 4025 // Set external caught exception to false.
4026 Isolate* isolate = masm->isolate();
4027 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
4028 isolate);
4029 __ li(a0, Operand(false, RelocInfo::NONE));
4030 __ li(a2, Operand(external_caught));
4031 __ sw(a0, MemOperand(a2));
4032
4033 // Set pending exception and v0 to out of memory exception.
4034 Failure* out_of_memory = Failure::OutOfMemoryException();
4035 __ li(v0, Operand(reinterpret_cast<int32_t>(out_of_memory)));
4036 __ li(a2, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
4037 isolate)));
4038 __ sw(v0, MemOperand(a2));
4039 // Fall through to the next label.
4037 4040
4038 __ bind(&throw_termination_exception); 4041 __ bind(&throw_termination_exception);
4039 GenerateThrowUncatchable(masm, TERMINATION); 4042 __ ThrowUncatchable(v0);
4040 4043
4041 __ bind(&throw_normal_exception); 4044 __ bind(&throw_normal_exception);
4042 GenerateThrowTOS(masm); 4045 __ Throw(v0);
4043 } 4046 }
4044 4047
4045 4048
4046 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 4049 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
4047 Label invoke, handler_entry, exit; 4050 Label invoke, handler_entry, exit;
4048 Isolate* isolate = masm->isolate(); 4051 Isolate* isolate = masm->isolate();
4049 4052
4050 // Registers: 4053 // Registers:
4051 // a0: entry address 4054 // a0: entry address
4052 // a1: function 4055 // a1: function
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
5126 __ lw(v0, MemOperand(a2, 0)); 5129 __ lw(v0, MemOperand(a2, 0));
5127 __ Branch(&runtime, eq, v0, Operand(a1)); 5130 __ Branch(&runtime, eq, v0, Operand(a1));
5128 5131
5129 __ sw(a1, MemOperand(a2, 0)); // Clear pending exception. 5132 __ sw(a1, MemOperand(a2, 0)); // Clear pending exception.
5130 5133
5131 // Check if the exception is a termination. If so, throw as uncatchable. 5134 // Check if the exception is a termination. If so, throw as uncatchable.
5132 __ LoadRoot(a0, Heap::kTerminationExceptionRootIndex); 5135 __ LoadRoot(a0, Heap::kTerminationExceptionRootIndex);
5133 Label termination_exception; 5136 Label termination_exception;
5134 __ Branch(&termination_exception, eq, v0, Operand(a0)); 5137 __ Branch(&termination_exception, eq, v0, Operand(a0));
5135 5138
5136 __ Throw(v0); // Expects thrown value in v0. 5139 __ Throw(v0);
5137 5140
5138 __ bind(&termination_exception); 5141 __ bind(&termination_exception);
5139 __ ThrowUncatchable(TERMINATION, v0); // Expects thrown value in v0. 5142 __ ThrowUncatchable(v0);
5140 5143
5141 __ bind(&failure); 5144 __ bind(&failure);
5142 // For failure and exception return null. 5145 // For failure and exception return null.
5143 __ li(v0, Operand(isolate->factory()->null_value())); 5146 __ li(v0, Operand(isolate->factory()->null_value()));
5144 __ Addu(sp, sp, Operand(4 * kPointerSize)); 5147 __ Addu(sp, sp, Operand(4 * kPointerSize));
5145 __ Ret(); 5148 __ Ret();
5146 5149
5147 // Process the result from the native regexp code. 5150 // Process the result from the native regexp code.
5148 __ bind(&success); 5151 __ bind(&success);
5149 __ lw(a1, 5152 __ lw(a1,
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after
7636 __ Ret(USE_DELAY_SLOT); 7639 __ Ret(USE_DELAY_SLOT);
7637 __ mov(v0, a0); 7640 __ mov(v0, a0);
7638 } 7641 }
7639 7642
7640 7643
7641 #undef __ 7644 #undef __
7642 7645
7643 } } // namespace v8::internal 7646 } } // namespace v8::internal
7644 7647
7645 #endif // V8_TARGET_ARCH_MIPS 7648 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/macro-assembler.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698