| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_X64) | 30 #if defined(V8_TARGET_ARCH_X64) |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "builtins-decls.h" |
| 33 #include "code-stubs.h" | 34 #include "code-stubs.h" |
| 34 #include "regexp-macro-assembler.h" | 35 #include "regexp-macro-assembler.h" |
| 35 #include "stub-cache.h" | 36 #include "stub-cache.h" |
| 36 #include "runtime.h" | 37 #include "runtime.h" |
| 37 | 38 |
| 38 namespace v8 { | 39 namespace v8 { |
| 39 namespace internal { | 40 namespace internal { |
| 40 | 41 |
| 41 | 42 |
| 42 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 43 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
| (...skipping 4056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4099 | 4100 |
| 4100 ExternalReference scope_depth = | 4101 ExternalReference scope_depth = |
| 4101 ExternalReference::heap_always_allocate_scope_depth(masm->isolate()); | 4102 ExternalReference::heap_always_allocate_scope_depth(masm->isolate()); |
| 4102 if (always_allocate_scope) { | 4103 if (always_allocate_scope) { |
| 4103 Operand scope_depth_operand = masm->ExternalOperand(scope_depth); | 4104 Operand scope_depth_operand = masm->ExternalOperand(scope_depth); |
| 4104 __ incl(scope_depth_operand); | 4105 __ incl(scope_depth_operand); |
| 4105 } | 4106 } |
| 4106 | 4107 |
| 4107 // Call C function. | 4108 // Call C function. |
| 4108 #ifdef _WIN64 | 4109 #ifdef _WIN64 |
| 4109 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 | 4110 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9. |
| 4110 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. | 4111 // Pass argv and argc as two parameters. The arguments object will |
| 4111 __ movq(StackSpaceOperand(0), r14); // argc. | 4112 // be created by stubs declared by DECLARE_RUNTIME_FUNCTION(). |
| 4112 __ movq(StackSpaceOperand(1), r15); // argv. | |
| 4113 if (result_size_ < 2) { | 4113 if (result_size_ < 2) { |
| 4114 // Pass a pointer to the Arguments object as the first argument. | 4114 // Pass a pointer to the Arguments object as the first argument. |
| 4115 // Return result in single register (rax). | 4115 // Return result in single register (rax). |
| 4116 __ lea(rcx, StackSpaceOperand(0)); | 4116 __ movq(rcx, r14); // argc. |
| 4117 __ LoadAddress(rdx, ExternalReference::isolate_address(masm->isolate())); | 4117 __ movq(rdx, r15); // argv. |
| 4118 __ movq(r8, ExternalReference::isolate_address(masm->isolate())); |
| 4118 } else { | 4119 } else { |
| 4119 ASSERT_EQ(2, result_size_); | 4120 ASSERT_EQ(2, result_size_); |
| 4120 // Pass a pointer to the result location as the first argument. | 4121 // Pass a pointer to the result location as the first argument. |
| 4121 __ lea(rcx, StackSpaceOperand(2)); | 4122 __ lea(rcx, StackSpaceOperand(2)); |
| 4122 // Pass a pointer to the Arguments object as the second argument. | 4123 // Pass a pointer to the Arguments object as the second argument. |
| 4123 __ lea(rdx, StackSpaceOperand(0)); | 4124 __ movq(rdx, r14); // argc. |
| 4124 __ LoadAddress(r8, ExternalReference::isolate_address(masm->isolate())); | 4125 __ movq(r8, r15); // argv. |
| 4126 __ movq(r9, ExternalReference::isolate_address(masm->isolate())); |
| 4125 } | 4127 } |
| 4126 | 4128 |
| 4127 #else // _WIN64 | 4129 #else // _WIN64 |
| 4128 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. | 4130 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. |
| 4129 __ movq(rdi, r14); // argc. | 4131 __ movq(rdi, r14); // argc. |
| 4130 __ movq(rsi, r15); // argv. | 4132 __ movq(rsi, r15); // argv. |
| 4131 __ movq(rdx, ExternalReference::isolate_address(masm->isolate())); | 4133 __ movq(rdx, ExternalReference::isolate_address(masm->isolate())); |
| 4132 #endif | 4134 #endif |
| 4133 __ call(rbx); | 4135 __ call(rbx); |
| 4134 // Result is in rax - do not destroy this register! | 4136 // Result is in rax - do not destroy this register! |
| (...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6949 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 6951 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 6950 } | 6952 } |
| 6951 } | 6953 } |
| 6952 | 6954 |
| 6953 | 6955 |
| 6954 #undef __ | 6956 #undef __ |
| 6955 | 6957 |
| 6956 } } // namespace v8::internal | 6958 } } // namespace v8::internal |
| 6957 | 6959 |
| 6958 #endif // V8_TARGET_ARCH_X64 | 6960 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |