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

Side by Side Diff: src/arm/code-stubs-arm.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 | « no previous file | src/arm/macro-assembler-arm.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 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 } 3667 }
3668 3668
3669 3669
3670 void CEntryStub::GenerateAheadOfTime() { 3670 void CEntryStub::GenerateAheadOfTime() {
3671 CEntryStub stub(1, kDontSaveFPRegs); 3671 CEntryStub stub(1, kDontSaveFPRegs);
3672 Handle<Code> code = stub.GetCode(); 3672 Handle<Code> code = stub.GetCode();
3673 code->set_is_pregenerated(true); 3673 code->set_is_pregenerated(true);
3674 } 3674 }
3675 3675
3676 3676
3677 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
3678 __ Throw(r0);
3679 }
3680
3681
3682 void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
3683 UncatchableExceptionType type) {
3684 __ ThrowUncatchable(type, r0);
3685 }
3686
3687
3688 void CEntryStub::GenerateCore(MacroAssembler* masm, 3677 void CEntryStub::GenerateCore(MacroAssembler* masm,
3689 Label* throw_normal_exception, 3678 Label* throw_normal_exception,
3690 Label* throw_termination_exception, 3679 Label* throw_termination_exception,
3691 Label* throw_out_of_memory_exception, 3680 Label* throw_out_of_memory_exception,
3692 bool do_gc, 3681 bool do_gc,
3693 bool always_allocate) { 3682 bool always_allocate) {
3694 // r0: result parameter for PerformGC, if any 3683 // r0: result parameter for PerformGC, if any
3695 // r4: number of arguments including receiver (C callee-saved) 3684 // r4: number of arguments including receiver (C callee-saved)
3696 // r5: pointer to builtin function (C callee-saved) 3685 // r5: pointer to builtin function (C callee-saved)
3697 // r6: pointer to the first argument (C callee-saved) 3686 // r6: pointer to the first argument (C callee-saved)
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3858 Failure* failure = Failure::InternalError(); 3847 Failure* failure = Failure::InternalError();
3859 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); 3848 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure)));
3860 GenerateCore(masm, 3849 GenerateCore(masm,
3861 &throw_normal_exception, 3850 &throw_normal_exception,
3862 &throw_termination_exception, 3851 &throw_termination_exception,
3863 &throw_out_of_memory_exception, 3852 &throw_out_of_memory_exception,
3864 true, 3853 true,
3865 true); 3854 true);
3866 3855
3867 __ bind(&throw_out_of_memory_exception); 3856 __ bind(&throw_out_of_memory_exception);
3868 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); 3857 // Set external caught exception to false.
3858 Isolate* isolate = masm->isolate();
3859 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
3860 isolate);
3861 __ mov(r0, Operand(false, RelocInfo::NONE));
3862 __ mov(r2, Operand(external_caught));
3863 __ str(r0, MemOperand(r2));
3864
3865 // Set pending exception and r0 to out of memory exception.
3866 Failure* out_of_memory = Failure::OutOfMemoryException();
3867 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory)));
3868 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
3869 isolate)));
3870 __ str(r0, MemOperand(r2));
3871 // Fall through to the next label.
3869 3872
3870 __ bind(&throw_termination_exception); 3873 __ bind(&throw_termination_exception);
3871 GenerateThrowUncatchable(masm, TERMINATION); 3874 __ ThrowUncatchable(r0);
3872 3875
3873 __ bind(&throw_normal_exception); 3876 __ bind(&throw_normal_exception);
3874 GenerateThrowTOS(masm); 3877 __ Throw(r0);
3875 } 3878 }
3876 3879
3877 3880
3878 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 3881 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
3879 // r0: code entry 3882 // r0: code entry
3880 // r1: function 3883 // r1: function
3881 // r2: receiver 3884 // r2: receiver
3882 // r3: argc 3885 // r3: argc
3883 // [sp+0]: argv 3886 // [sp+0]: argv
3884 3887
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
4905 __ b(eq, &runtime); 4908 __ b(eq, &runtime);
4906 4909
4907 __ str(r1, MemOperand(r2, 0)); // Clear pending exception. 4910 __ str(r1, MemOperand(r2, 0)); // Clear pending exception.
4908 4911
4909 // Check if the exception is a termination. If so, throw as uncatchable. 4912 // Check if the exception is a termination. If so, throw as uncatchable.
4910 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex); 4913 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex);
4911 4914
4912 Label termination_exception; 4915 Label termination_exception;
4913 __ b(eq, &termination_exception); 4916 __ b(eq, &termination_exception);
4914 4917
4915 __ Throw(r0); // Expects thrown value in r0. 4918 __ Throw(r0);
4916 4919
4917 __ bind(&termination_exception); 4920 __ bind(&termination_exception);
4918 __ ThrowUncatchable(TERMINATION, r0); // Expects thrown value in r0. 4921 __ ThrowUncatchable(r0);
4919 4922
4920 __ bind(&failure); 4923 __ bind(&failure);
4921 // For failure and exception return null. 4924 // For failure and exception return null.
4922 __ mov(r0, Operand(masm->isolate()->factory()->null_value())); 4925 __ mov(r0, Operand(masm->isolate()->factory()->null_value()));
4923 __ add(sp, sp, Operand(4 * kPointerSize)); 4926 __ add(sp, sp, Operand(4 * kPointerSize));
4924 __ Ret(); 4927 __ Ret();
4925 4928
4926 // Process the result from the native regexp code. 4929 // Process the result from the native regexp code.
4927 __ bind(&success); 4930 __ bind(&success);
4928 __ ldr(r1, 4931 __ ldr(r1,
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
7361 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, 7364 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2,
7362 &slow_elements); 7365 &slow_elements);
7363 __ Ret(); 7366 __ Ret();
7364 } 7367 }
7365 7368
7366 #undef __ 7369 #undef __
7367 7370
7368 } } // namespace v8::internal 7371 } } // namespace v8::internal
7369 7372
7370 #endif // V8_TARGET_ARCH_ARM 7373 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698