OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), | 4886 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), |
4887 1); | 4887 1); |
4888 __ PopSafepointRegisters(); | 4888 __ PopSafepointRegisters(); |
4889 } | 4889 } |
4890 | 4890 |
4891 Label prologue; | 4891 Label prologue; |
4892 // Load the value from ReturnValue | 4892 // Load the value from ReturnValue |
4893 __ mov(eax, return_value_operand); | 4893 __ mov(eax, return_value_operand); |
4894 | 4894 |
4895 Label promote_scheduled_exception; | 4895 Label promote_scheduled_exception; |
4896 Label exception_handled; | |
4897 Label delete_allocated_handles; | 4896 Label delete_allocated_handles; |
4898 Label leave_exit_frame; | 4897 Label leave_exit_frame; |
4899 | 4898 |
4900 __ bind(&prologue); | 4899 __ bind(&prologue); |
4901 // No more valid handles (the result handle was the last one). Restore | 4900 // No more valid handles (the result handle was the last one). Restore |
4902 // previous handle scope. | 4901 // previous handle scope. |
4903 __ mov(Operand::StaticVariable(next_address), ebx); | 4902 __ mov(Operand::StaticVariable(next_address), ebx); |
4904 __ sub(Operand::StaticVariable(level_address), Immediate(1)); | 4903 __ sub(Operand::StaticVariable(level_address), Immediate(1)); |
4905 __ Assert(above_equal, kInvalidHandleScopeLevel); | 4904 __ Assert(above_equal, kInvalidHandleScopeLevel); |
4906 __ cmp(edi, Operand::StaticVariable(limit_address)); | 4905 __ cmp(edi, Operand::StaticVariable(limit_address)); |
4907 __ j(not_equal, &delete_allocated_handles); | 4906 __ j(not_equal, &delete_allocated_handles); |
| 4907 |
| 4908 // Leave the API exit frame. |
4908 __ bind(&leave_exit_frame); | 4909 __ bind(&leave_exit_frame); |
| 4910 bool restore_context = context_restore_operand != NULL; |
| 4911 if (restore_context) { |
| 4912 __ mov(esi, *context_restore_operand); |
| 4913 } |
| 4914 if (stack_space_operand != nullptr) { |
| 4915 __ mov(ebx, *stack_space_operand); |
| 4916 } |
| 4917 __ LeaveApiExitFrame(!restore_context); |
4909 | 4918 |
4910 // Check if the function scheduled an exception. | 4919 // Check if the function scheduled an exception. |
4911 ExternalReference scheduled_exception_address = | 4920 ExternalReference scheduled_exception_address = |
4912 ExternalReference::scheduled_exception_address(isolate); | 4921 ExternalReference::scheduled_exception_address(isolate); |
4913 __ cmp(Operand::StaticVariable(scheduled_exception_address), | 4922 __ cmp(Operand::StaticVariable(scheduled_exception_address), |
4914 Immediate(isolate->factory()->the_hole_value())); | 4923 Immediate(isolate->factory()->the_hole_value())); |
4915 __ j(not_equal, &promote_scheduled_exception); | 4924 __ j(not_equal, &promote_scheduled_exception); |
4916 __ bind(&exception_handled); | |
4917 | 4925 |
4918 #if DEBUG | 4926 #if DEBUG |
4919 // Check if the function returned a valid JavaScript value. | 4927 // Check if the function returned a valid JavaScript value. |
4920 Label ok; | 4928 Label ok; |
4921 Register return_value = eax; | 4929 Register return_value = eax; |
4922 Register map = ecx; | 4930 Register map = ecx; |
4923 | 4931 |
4924 __ JumpIfSmi(return_value, &ok, Label::kNear); | 4932 __ JumpIfSmi(return_value, &ok, Label::kNear); |
4925 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); | 4933 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); |
4926 | 4934 |
(...skipping 16 matching lines...) Expand all Loading... |
4943 __ j(equal, &ok, Label::kNear); | 4951 __ j(equal, &ok, Label::kNear); |
4944 | 4952 |
4945 __ cmp(return_value, isolate->factory()->null_value()); | 4953 __ cmp(return_value, isolate->factory()->null_value()); |
4946 __ j(equal, &ok, Label::kNear); | 4954 __ j(equal, &ok, Label::kNear); |
4947 | 4955 |
4948 __ Abort(kAPICallReturnedInvalidObject); | 4956 __ Abort(kAPICallReturnedInvalidObject); |
4949 | 4957 |
4950 __ bind(&ok); | 4958 __ bind(&ok); |
4951 #endif | 4959 #endif |
4952 | 4960 |
4953 bool restore_context = context_restore_operand != NULL; | |
4954 if (restore_context) { | |
4955 __ mov(esi, *context_restore_operand); | |
4956 } | |
4957 if (stack_space_operand != nullptr) { | |
4958 __ mov(ebx, *stack_space_operand); | |
4959 } | |
4960 __ LeaveApiExitFrame(!restore_context); | |
4961 if (stack_space_operand != nullptr) { | 4961 if (stack_space_operand != nullptr) { |
4962 DCHECK_EQ(0, stack_space); | 4962 DCHECK_EQ(0, stack_space); |
4963 __ pop(ecx); | 4963 __ pop(ecx); |
4964 __ add(esp, ebx); | 4964 __ add(esp, ebx); |
4965 __ jmp(ecx); | 4965 __ jmp(ecx); |
4966 } else { | 4966 } else { |
4967 __ ret(stack_space * kPointerSize); | 4967 __ ret(stack_space * kPointerSize); |
4968 } | 4968 } |
4969 | 4969 |
| 4970 // Re-throw by promoting a scheduled exception. |
4970 __ bind(&promote_scheduled_exception); | 4971 __ bind(&promote_scheduled_exception); |
4971 { | 4972 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
4972 FrameScope frame(masm, StackFrame::INTERNAL); | |
4973 __ CallRuntime(Runtime::kPromoteScheduledException, 0); | |
4974 } | |
4975 __ jmp(&exception_handled); | |
4976 | 4973 |
4977 // HandleScope limit has changed. Delete allocated extensions. | 4974 // HandleScope limit has changed. Delete allocated extensions. |
4978 ExternalReference delete_extensions = | 4975 ExternalReference delete_extensions = |
4979 ExternalReference::delete_handle_scope_extensions(isolate); | 4976 ExternalReference::delete_handle_scope_extensions(isolate); |
4980 __ bind(&delete_allocated_handles); | 4977 __ bind(&delete_allocated_handles); |
4981 __ mov(Operand::StaticVariable(limit_address), edi); | 4978 __ mov(Operand::StaticVariable(limit_address), edi); |
4982 __ mov(edi, eax); | 4979 __ mov(edi, eax); |
4983 __ mov(Operand(esp, 0), | 4980 __ mov(Operand(esp, 0), |
4984 Immediate(ExternalReference::isolate_address(isolate))); | 4981 Immediate(ExternalReference::isolate_address(isolate))); |
4985 __ mov(eax, Immediate(delete_extensions)); | 4982 __ mov(eax, Immediate(delete_extensions)); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 ApiParameterOperand(2), kStackSpace, nullptr, | 5184 ApiParameterOperand(2), kStackSpace, nullptr, |
5188 Operand(ebp, 7 * kPointerSize), NULL); | 5185 Operand(ebp, 7 * kPointerSize), NULL); |
5189 } | 5186 } |
5190 | 5187 |
5191 | 5188 |
5192 #undef __ | 5189 #undef __ |
5193 | 5190 |
5194 } } // namespace v8::internal | 5191 } } // namespace v8::internal |
5195 | 5192 |
5196 #endif // V8_TARGET_ARCH_IA32 | 5193 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |