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

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

Issue 969533004: [turbofan] Implement throwing exceptions into TurboFan code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix code lookup. Created 5 years, 9 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
« no previous file with comments | « src/isolate.cc ('k') | test/cctest/compiler/test-run-jsexceptions.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 4764 matching lines...) Expand 10 before | Expand all | Expand 10 after
4775 // stack_space * kPointerSize (GCed). 4775 // stack_space * kPointerSize (GCed).
4776 static void CallApiFunctionAndReturn(MacroAssembler* masm, 4776 static void CallApiFunctionAndReturn(MacroAssembler* masm,
4777 Register function_address, 4777 Register function_address,
4778 ExternalReference thunk_ref, 4778 ExternalReference thunk_ref,
4779 Register thunk_last_arg, int stack_space, 4779 Register thunk_last_arg, int stack_space,
4780 Operand* stack_space_operand, 4780 Operand* stack_space_operand,
4781 Operand return_value_operand, 4781 Operand return_value_operand,
4782 Operand* context_restore_operand) { 4782 Operand* context_restore_operand) {
4783 Label prologue; 4783 Label prologue;
4784 Label promote_scheduled_exception; 4784 Label promote_scheduled_exception;
4785 Label exception_handled;
4786 Label delete_allocated_handles; 4785 Label delete_allocated_handles;
4787 Label leave_exit_frame; 4786 Label leave_exit_frame;
4788 Label write_back; 4787 Label write_back;
4789 4788
4790 Isolate* isolate = masm->isolate(); 4789 Isolate* isolate = masm->isolate();
4791 Factory* factory = isolate->factory(); 4790 Factory* factory = isolate->factory();
4792 ExternalReference next_address = 4791 ExternalReference next_address =
4793 ExternalReference::handle_scope_next_address(isolate); 4792 ExternalReference::handle_scope_next_address(isolate);
4794 const int kNextOffset = 0; 4793 const int kNextOffset = 0;
4795 const int kLimitOffset = Offset( 4794 const int kLimitOffset = Offset(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4852 // Load the value from ReturnValue 4851 // Load the value from ReturnValue
4853 __ movp(rax, return_value_operand); 4852 __ movp(rax, return_value_operand);
4854 __ bind(&prologue); 4853 __ bind(&prologue);
4855 4854
4856 // No more valid handles (the result handle was the last one). Restore 4855 // No more valid handles (the result handle was the last one). Restore
4857 // previous handle scope. 4856 // previous handle scope.
4858 __ subl(Operand(base_reg, kLevelOffset), Immediate(1)); 4857 __ subl(Operand(base_reg, kLevelOffset), Immediate(1));
4859 __ movp(Operand(base_reg, kNextOffset), prev_next_address_reg); 4858 __ movp(Operand(base_reg, kNextOffset), prev_next_address_reg);
4860 __ cmpp(prev_limit_reg, Operand(base_reg, kLimitOffset)); 4859 __ cmpp(prev_limit_reg, Operand(base_reg, kLimitOffset));
4861 __ j(not_equal, &delete_allocated_handles); 4860 __ j(not_equal, &delete_allocated_handles);
4861
4862 // Leave the API exit frame.
4862 __ bind(&leave_exit_frame); 4863 __ bind(&leave_exit_frame);
4864 bool restore_context = context_restore_operand != NULL;
4865 if (restore_context) {
4866 __ movp(rsi, *context_restore_operand);
4867 }
4868 if (stack_space_operand != nullptr) {
4869 __ movp(rbx, *stack_space_operand);
4870 }
4871 __ LeaveApiExitFrame(!restore_context);
4863 4872
4864 // Check if the function scheduled an exception. 4873 // Check if the function scheduled an exception.
4865 __ Move(rsi, scheduled_exception_address); 4874 __ Move(rdi, scheduled_exception_address);
4866 __ Cmp(Operand(rsi, 0), factory->the_hole_value()); 4875 __ Cmp(Operand(rdi, 0), factory->the_hole_value());
4867 __ j(not_equal, &promote_scheduled_exception); 4876 __ j(not_equal, &promote_scheduled_exception);
4868 __ bind(&exception_handled);
4869 4877
4870 #if DEBUG 4878 #if DEBUG
4871 // Check if the function returned a valid JavaScript value. 4879 // Check if the function returned a valid JavaScript value.
4872 Label ok; 4880 Label ok;
4873 Register return_value = rax; 4881 Register return_value = rax;
4874 Register map = rcx; 4882 Register map = rcx;
4875 4883
4876 __ JumpIfSmi(return_value, &ok, Label::kNear); 4884 __ JumpIfSmi(return_value, &ok, Label::kNear);
4877 __ movp(map, FieldOperand(return_value, HeapObject::kMapOffset)); 4885 __ movp(map, FieldOperand(return_value, HeapObject::kMapOffset));
4878 4886
(...skipping 16 matching lines...) Expand all
4895 __ j(equal, &ok, Label::kNear); 4903 __ j(equal, &ok, Label::kNear);
4896 4904
4897 __ CompareRoot(return_value, Heap::kNullValueRootIndex); 4905 __ CompareRoot(return_value, Heap::kNullValueRootIndex);
4898 __ j(equal, &ok, Label::kNear); 4906 __ j(equal, &ok, Label::kNear);
4899 4907
4900 __ Abort(kAPICallReturnedInvalidObject); 4908 __ Abort(kAPICallReturnedInvalidObject);
4901 4909
4902 __ bind(&ok); 4910 __ bind(&ok);
4903 #endif 4911 #endif
4904 4912
4905 bool restore_context = context_restore_operand != NULL;
4906 if (restore_context) {
4907 __ movp(rsi, *context_restore_operand);
4908 }
4909 if (stack_space_operand != nullptr) {
4910 __ movp(rbx, *stack_space_operand);
4911 }
4912 __ LeaveApiExitFrame(!restore_context);
4913 if (stack_space_operand != nullptr) { 4913 if (stack_space_operand != nullptr) {
4914 DCHECK_EQ(stack_space, 0); 4914 DCHECK_EQ(stack_space, 0);
4915 __ PopReturnAddressTo(rcx); 4915 __ PopReturnAddressTo(rcx);
4916 __ addq(rsp, rbx); 4916 __ addq(rsp, rbx);
4917 __ jmp(rcx); 4917 __ jmp(rcx);
4918 } else { 4918 } else {
4919 __ ret(stack_space * kPointerSize); 4919 __ ret(stack_space * kPointerSize);
4920 } 4920 }
4921 4921
4922 // Re-throw by promoting a scheduled exception.
4922 __ bind(&promote_scheduled_exception); 4923 __ bind(&promote_scheduled_exception);
4923 { 4924 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1);
4924 FrameScope frame(masm, StackFrame::INTERNAL);
4925 __ CallRuntime(Runtime::kPromoteScheduledException, 0);
4926 }
4927 __ jmp(&exception_handled);
4928 4925
4929 // HandleScope limit has changed. Delete allocated extensions. 4926 // HandleScope limit has changed. Delete allocated extensions.
4930 __ bind(&delete_allocated_handles); 4927 __ bind(&delete_allocated_handles);
4931 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg); 4928 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg);
4932 __ movp(prev_limit_reg, rax); 4929 __ movp(prev_limit_reg, rax);
4933 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate)); 4930 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate));
4934 __ LoadAddress(rax, 4931 __ LoadAddress(rax,
4935 ExternalReference::delete_handle_scope_extensions(isolate)); 4932 ExternalReference::delete_handle_scope_extensions(isolate));
4936 __ call(rax); 4933 __ call(rax);
4937 __ movp(rax, prev_limit_reg); 4934 __ movp(rax, prev_limit_reg);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
5148 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, 5145 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg,
5149 kStackSpace, nullptr, return_value_operand, NULL); 5146 kStackSpace, nullptr, return_value_operand, NULL);
5150 } 5147 }
5151 5148
5152 5149
5153 #undef __ 5150 #undef __
5154 5151
5155 } } // namespace v8::internal 5152 } } // namespace v8::internal
5156 5153
5157 #endif // V8_TARGET_ARCH_X64 5154 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | test/cctest/compiler/test-run-jsexceptions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698