| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 4528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4539 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), | 4539 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), |
| 4540 1); | 4540 1); |
| 4541 __ PopSafepointRegisters(); | 4541 __ PopSafepointRegisters(); |
| 4542 } | 4542 } |
| 4543 | 4543 |
| 4544 Label prologue; | 4544 Label prologue; |
| 4545 // Load the value from ReturnValue | 4545 // Load the value from ReturnValue |
| 4546 __ mov(eax, return_value_operand); | 4546 __ mov(eax, return_value_operand); |
| 4547 | 4547 |
| 4548 Label promote_scheduled_exception; | 4548 Label promote_scheduled_exception; |
| 4549 Label exception_handled; | |
| 4550 Label delete_allocated_handles; | 4549 Label delete_allocated_handles; |
| 4551 Label leave_exit_frame; | 4550 Label leave_exit_frame; |
| 4552 | 4551 |
| 4553 __ bind(&prologue); | 4552 __ bind(&prologue); |
| 4554 // No more valid handles (the result handle was the last one). Restore | 4553 // No more valid handles (the result handle was the last one). Restore |
| 4555 // previous handle scope. | 4554 // previous handle scope. |
| 4556 __ mov(Operand::StaticVariable(next_address), ebx); | 4555 __ mov(Operand::StaticVariable(next_address), ebx); |
| 4557 __ sub(Operand::StaticVariable(level_address), Immediate(1)); | 4556 __ sub(Operand::StaticVariable(level_address), Immediate(1)); |
| 4558 __ Assert(above_equal, kInvalidHandleScopeLevel); | 4557 __ Assert(above_equal, kInvalidHandleScopeLevel); |
| 4559 __ cmp(edi, Operand::StaticVariable(limit_address)); | 4558 __ cmp(edi, Operand::StaticVariable(limit_address)); |
| 4560 __ j(not_equal, &delete_allocated_handles); | 4559 __ j(not_equal, &delete_allocated_handles); |
| 4560 |
| 4561 // Leave the API exit frame. |
| 4561 __ bind(&leave_exit_frame); | 4562 __ bind(&leave_exit_frame); |
| 4563 bool restore_context = context_restore_operand != NULL; |
| 4564 if (restore_context) { |
| 4565 __ mov(esi, *context_restore_operand); |
| 4566 } |
| 4567 if (stack_space_operand != nullptr) { |
| 4568 __ mov(ebx, *stack_space_operand); |
| 4569 } |
| 4570 __ LeaveApiExitFrame(!restore_context); |
| 4562 | 4571 |
| 4563 // Check if the function scheduled an exception. | 4572 // Check if the function scheduled an exception. |
| 4564 ExternalReference scheduled_exception_address = | 4573 ExternalReference scheduled_exception_address = |
| 4565 ExternalReference::scheduled_exception_address(isolate); | 4574 ExternalReference::scheduled_exception_address(isolate); |
| 4566 __ cmp(Operand::StaticVariable(scheduled_exception_address), | 4575 __ cmp(Operand::StaticVariable(scheduled_exception_address), |
| 4567 Immediate(isolate->factory()->the_hole_value())); | 4576 Immediate(isolate->factory()->the_hole_value())); |
| 4568 __ j(not_equal, &promote_scheduled_exception); | 4577 __ j(not_equal, &promote_scheduled_exception); |
| 4569 __ bind(&exception_handled); | |
| 4570 | 4578 |
| 4571 #if DEBUG | 4579 #if DEBUG |
| 4572 // Check if the function returned a valid JavaScript value. | 4580 // Check if the function returned a valid JavaScript value. |
| 4573 Label ok; | 4581 Label ok; |
| 4574 Register return_value = eax; | 4582 Register return_value = eax; |
| 4575 Register map = ecx; | 4583 Register map = ecx; |
| 4576 | 4584 |
| 4577 __ JumpIfSmi(return_value, &ok, Label::kNear); | 4585 __ JumpIfSmi(return_value, &ok, Label::kNear); |
| 4578 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); | 4586 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); |
| 4579 | 4587 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4596 __ j(equal, &ok, Label::kNear); | 4604 __ j(equal, &ok, Label::kNear); |
| 4597 | 4605 |
| 4598 __ cmp(return_value, isolate->factory()->null_value()); | 4606 __ cmp(return_value, isolate->factory()->null_value()); |
| 4599 __ j(equal, &ok, Label::kNear); | 4607 __ j(equal, &ok, Label::kNear); |
| 4600 | 4608 |
| 4601 __ Abort(kAPICallReturnedInvalidObject); | 4609 __ Abort(kAPICallReturnedInvalidObject); |
| 4602 | 4610 |
| 4603 __ bind(&ok); | 4611 __ bind(&ok); |
| 4604 #endif | 4612 #endif |
| 4605 | 4613 |
| 4606 bool restore_context = context_restore_operand != NULL; | |
| 4607 if (restore_context) { | |
| 4608 __ mov(esi, *context_restore_operand); | |
| 4609 } | |
| 4610 if (stack_space_operand != nullptr) { | |
| 4611 __ mov(ebx, *stack_space_operand); | |
| 4612 } | |
| 4613 __ LeaveApiExitFrame(!restore_context); | |
| 4614 if (stack_space_operand != nullptr) { | 4614 if (stack_space_operand != nullptr) { |
| 4615 DCHECK_EQ(0, stack_space); | 4615 DCHECK_EQ(0, stack_space); |
| 4616 __ pop(ecx); | 4616 __ pop(ecx); |
| 4617 __ add(esp, ebx); | 4617 __ add(esp, ebx); |
| 4618 __ jmp(ecx); | 4618 __ jmp(ecx); |
| 4619 } else { | 4619 } else { |
| 4620 __ ret(stack_space * kPointerSize); | 4620 __ ret(stack_space * kPointerSize); |
| 4621 } | 4621 } |
| 4622 | 4622 |
| 4623 // Re-throw by promoting a scheduled exception. |
| 4623 __ bind(&promote_scheduled_exception); | 4624 __ bind(&promote_scheduled_exception); |
| 4624 { | 4625 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
| 4625 FrameScope frame(masm, StackFrame::INTERNAL); | |
| 4626 __ CallRuntime(Runtime::kPromoteScheduledException, 0); | |
| 4627 } | |
| 4628 __ jmp(&exception_handled); | |
| 4629 | 4626 |
| 4630 // HandleScope limit has changed. Delete allocated extensions. | 4627 // HandleScope limit has changed. Delete allocated extensions. |
| 4631 ExternalReference delete_extensions = | 4628 ExternalReference delete_extensions = |
| 4632 ExternalReference::delete_handle_scope_extensions(isolate); | 4629 ExternalReference::delete_handle_scope_extensions(isolate); |
| 4633 __ bind(&delete_allocated_handles); | 4630 __ bind(&delete_allocated_handles); |
| 4634 __ mov(Operand::StaticVariable(limit_address), edi); | 4631 __ mov(Operand::StaticVariable(limit_address), edi); |
| 4635 __ mov(edi, eax); | 4632 __ mov(edi, eax); |
| 4636 __ mov(Operand(esp, 0), | 4633 __ mov(Operand(esp, 0), |
| 4637 Immediate(ExternalReference::isolate_address(isolate))); | 4634 Immediate(ExternalReference::isolate_address(isolate))); |
| 4638 __ mov(eax, Immediate(delete_extensions)); | 4635 __ mov(eax, Immediate(delete_extensions)); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4840 ApiParameterOperand(2), kStackSpace, nullptr, | 4837 ApiParameterOperand(2), kStackSpace, nullptr, |
| 4841 Operand(ebp, 7 * kPointerSize), NULL); | 4838 Operand(ebp, 7 * kPointerSize), NULL); |
| 4842 } | 4839 } |
| 4843 | 4840 |
| 4844 | 4841 |
| 4845 #undef __ | 4842 #undef __ |
| 4846 | 4843 |
| 4847 } } // namespace v8::internal | 4844 } } // namespace v8::internal |
| 4848 | 4845 |
| 4849 #endif // V8_TARGET_ARCH_X87 | 4846 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |