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 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 __ cmpq(rax, rdx); | 3047 __ cmpq(rax, rdx); |
3048 __ j(equal, &runtime); | 3048 __ j(equal, &runtime); |
3049 __ movq(pending_exception_operand, rdx); | 3049 __ movq(pending_exception_operand, rdx); |
3050 | 3050 |
3051 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 3051 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
3052 Label termination_exception; | 3052 Label termination_exception; |
3053 __ j(equal, &termination_exception, Label::kNear); | 3053 __ j(equal, &termination_exception, Label::kNear); |
3054 __ Throw(rax); | 3054 __ Throw(rax); |
3055 | 3055 |
3056 __ bind(&termination_exception); | 3056 __ bind(&termination_exception); |
3057 __ ThrowUncatchable(TERMINATION, rax); | 3057 __ ThrowUncatchable(rax); |
3058 | 3058 |
3059 // External string. Short external strings have already been ruled out. | 3059 // External string. Short external strings have already been ruled out. |
3060 // rdi: subject string (expected to be external) | 3060 // rdi: subject string (expected to be external) |
3061 // rbx: scratch | 3061 // rbx: scratch |
3062 __ bind(&external_string); | 3062 __ bind(&external_string); |
3063 __ movq(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); | 3063 __ movq(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); |
3064 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); | 3064 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); |
3065 if (FLAG_debug_code) { | 3065 if (FLAG_debug_code) { |
3066 // Assert that we do not have a cons or slice (indirect strings) here. | 3066 // Assert that we do not have a cons or slice (indirect strings) here. |
3067 // Sequential strings have already been ruled out. | 3067 // Sequential strings have already been ruled out. |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3768 | 3768 |
3769 | 3769 |
3770 void CEntryStub::GenerateAheadOfTime() { | 3770 void CEntryStub::GenerateAheadOfTime() { |
3771 CEntryStub stub(1, kDontSaveFPRegs); | 3771 CEntryStub stub(1, kDontSaveFPRegs); |
3772 stub.GetCode()->set_is_pregenerated(true); | 3772 stub.GetCode()->set_is_pregenerated(true); |
3773 CEntryStub save_doubles(1, kSaveFPRegs); | 3773 CEntryStub save_doubles(1, kSaveFPRegs); |
3774 save_doubles.GetCode()->set_is_pregenerated(true); | 3774 save_doubles.GetCode()->set_is_pregenerated(true); |
3775 } | 3775 } |
3776 | 3776 |
3777 | 3777 |
3778 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | |
3779 // Throw exception in eax. | |
3780 __ Throw(rax); | |
3781 } | |
3782 | |
3783 | |
3784 void CEntryStub::GenerateCore(MacroAssembler* masm, | 3778 void CEntryStub::GenerateCore(MacroAssembler* masm, |
3785 Label* throw_normal_exception, | 3779 Label* throw_normal_exception, |
3786 Label* throw_termination_exception, | 3780 Label* throw_termination_exception, |
3787 Label* throw_out_of_memory_exception, | 3781 Label* throw_out_of_memory_exception, |
3788 bool do_gc, | 3782 bool do_gc, |
3789 bool always_allocate_scope) { | 3783 bool always_allocate_scope) { |
3790 // rax: result parameter for PerformGC, if any. | 3784 // rax: result parameter for PerformGC, if any. |
3791 // rbx: pointer to C function (C callee-saved). | 3785 // rbx: pointer to C function (C callee-saved). |
3792 // rbp: frame pointer (restored after C call). | 3786 // rbp: frame pointer (restored after C call). |
3793 // rsp: stack pointer (restored after C call). | 3787 // rsp: stack pointer (restored after C call). |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3914 __ j(equal, throw_termination_exception); | 3908 __ j(equal, throw_termination_exception); |
3915 | 3909 |
3916 // Handle normal exception. | 3910 // Handle normal exception. |
3917 __ jmp(throw_normal_exception); | 3911 __ jmp(throw_normal_exception); |
3918 | 3912 |
3919 // Retry. | 3913 // Retry. |
3920 __ bind(&retry); | 3914 __ bind(&retry); |
3921 } | 3915 } |
3922 | 3916 |
3923 | 3917 |
3924 void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm, | |
3925 UncatchableExceptionType type) { | |
3926 __ ThrowUncatchable(type, rax); | |
3927 } | |
3928 | |
3929 | |
3930 void CEntryStub::Generate(MacroAssembler* masm) { | 3918 void CEntryStub::Generate(MacroAssembler* masm) { |
3931 // rax: number of arguments including receiver | 3919 // rax: number of arguments including receiver |
3932 // rbx: pointer to C function (C callee-saved) | 3920 // rbx: pointer to C function (C callee-saved) |
3933 // rbp: frame pointer of calling JS frame (restored after C call) | 3921 // rbp: frame pointer of calling JS frame (restored after C call) |
3934 // rsp: stack pointer (restored after C call) | 3922 // rsp: stack pointer (restored after C call) |
3935 // rsi: current context (restored) | 3923 // rsi: current context (restored) |
3936 | 3924 |
3937 // NOTE: Invocations of builtins may return failure objects | 3925 // NOTE: Invocations of builtins may return failure objects |
3938 // instead of a proper result. The builtin entry handles | 3926 // instead of a proper result. The builtin entry handles |
3939 // this by performing a garbage collection and retrying the | 3927 // this by performing a garbage collection and retrying the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3983 Failure* failure = Failure::InternalError(); | 3971 Failure* failure = Failure::InternalError(); |
3984 __ movq(rax, failure, RelocInfo::NONE); | 3972 __ movq(rax, failure, RelocInfo::NONE); |
3985 GenerateCore(masm, | 3973 GenerateCore(masm, |
3986 &throw_normal_exception, | 3974 &throw_normal_exception, |
3987 &throw_termination_exception, | 3975 &throw_termination_exception, |
3988 &throw_out_of_memory_exception, | 3976 &throw_out_of_memory_exception, |
3989 true, | 3977 true, |
3990 true); | 3978 true); |
3991 | 3979 |
3992 __ bind(&throw_out_of_memory_exception); | 3980 __ bind(&throw_out_of_memory_exception); |
3993 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 3981 // Set external caught exception to false. |
| 3982 Isolate* isolate = masm->isolate(); |
| 3983 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, |
| 3984 isolate); |
| 3985 __ Set(rax, static_cast<int64_t>(false)); |
| 3986 __ Store(external_caught, rax); |
| 3987 |
| 3988 // Set pending exception and rax to out of memory exception. |
| 3989 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 3990 isolate); |
| 3991 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); |
| 3992 __ Store(pending_exception, rax); |
| 3993 // Fall through to the next label. |
3994 | 3994 |
3995 __ bind(&throw_termination_exception); | 3995 __ bind(&throw_termination_exception); |
3996 GenerateThrowUncatchable(masm, TERMINATION); | 3996 __ ThrowUncatchable(rax); |
3997 | 3997 |
3998 __ bind(&throw_normal_exception); | 3998 __ bind(&throw_normal_exception); |
3999 GenerateThrowTOS(masm); | 3999 __ Throw(rax); |
4000 } | 4000 } |
4001 | 4001 |
4002 | 4002 |
4003 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 4003 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
4004 Label invoke, handler_entry, exit; | 4004 Label invoke, handler_entry, exit; |
4005 Label not_outermost_js, not_outermost_js_2; | 4005 Label not_outermost_js, not_outermost_js_2; |
4006 { // NOLINT. Scope block confuses linter. | 4006 { // NOLINT. Scope block confuses linter. |
4007 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); | 4007 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); |
4008 // Set up frame. | 4008 // Set up frame. |
4009 __ push(rbp); | 4009 __ push(rbp); |
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6298 xmm0, | 6298 xmm0, |
6299 &slow_elements); | 6299 &slow_elements); |
6300 __ ret(0); | 6300 __ ret(0); |
6301 } | 6301 } |
6302 | 6302 |
6303 #undef __ | 6303 #undef __ |
6304 | 6304 |
6305 } } // namespace v8::internal | 6305 } } // namespace v8::internal |
6306 | 6306 |
6307 #endif // V8_TARGET_ARCH_X64 | 6307 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |