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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 __ movp(rsp, rbp); | 2035 __ movp(rsp, rbp); |
2036 __ popq(rbp); | 2036 __ popq(rbp); |
2037 | 2037 |
2038 // Remove caller arguments from the stack. | 2038 // Remove caller arguments from the stack. |
2039 __ PopReturnAddressTo(rcx); | 2039 __ PopReturnAddressTo(rcx); |
2040 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); | 2040 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); |
2041 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | 2041 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); |
2042 __ PushReturnAddressFrom(rcx); | 2042 __ PushReturnAddressFrom(rcx); |
2043 } | 2043 } |
2044 | 2044 |
| 2045 // static |
| 2046 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
| 2047 // ----------- S t a t e ------------- |
| 2048 // -- rdx : requested object size (untagged) |
| 2049 // -- rsp[0] : return address |
| 2050 // ----------------------------------- |
| 2051 Label runtime; |
| 2052 __ Allocate(rdx, rax, rcx, rdi, &runtime, NO_ALLOCATION_FLAGS); |
| 2053 __ Ret(); |
| 2054 |
| 2055 __ bind(&runtime); |
| 2056 __ Integer32ToSmi(rdx, rdx); |
| 2057 __ PopReturnAddressTo(rcx); |
| 2058 __ Push(rdx); |
| 2059 __ PushReturnAddressFrom(rcx); |
| 2060 __ Move(rsi, Smi::FromInt(0)); |
| 2061 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
| 2062 } |
| 2063 |
| 2064 // static |
| 2065 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
| 2066 // ----------- S t a t e ------------- |
| 2067 // -- rdx : requested object size (untagged) |
| 2068 // -- rsp[0] : return address |
| 2069 // ----------------------------------- |
| 2070 Label runtime; |
| 2071 __ Allocate(rdx, rax, rcx, rdi, &runtime, PRETENURE); |
| 2072 __ Ret(); |
| 2073 |
| 2074 __ bind(&runtime); |
| 2075 __ Integer32ToSmi(rdx, rdx); |
| 2076 __ PopReturnAddressTo(rcx); |
| 2077 __ Push(rdx); |
| 2078 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
| 2079 __ PushReturnAddressFrom(rcx); |
| 2080 __ Move(rsi, Smi::FromInt(0)); |
| 2081 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
| 2082 } |
2045 | 2083 |
2046 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2084 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2047 // ----------- S t a t e ------------- | 2085 // ----------- S t a t e ------------- |
2048 // -- rax : actual number of arguments | 2086 // -- rax : actual number of arguments |
2049 // -- rbx : expected number of arguments | 2087 // -- rbx : expected number of arguments |
2050 // -- rdx : new target (passed through to callee) | 2088 // -- rdx : new target (passed through to callee) |
2051 // -- rdi : function (passed through to callee) | 2089 // -- rdi : function (passed through to callee) |
2052 // ----------------------------------- | 2090 // ----------------------------------- |
2053 | 2091 |
2054 Label invoke, dont_adapt_arguments, stack_overflow; | 2092 Label invoke, dont_adapt_arguments, stack_overflow; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2928 __ ret(0); | 2966 __ ret(0); |
2929 } | 2967 } |
2930 | 2968 |
2931 | 2969 |
2932 #undef __ | 2970 #undef __ |
2933 | 2971 |
2934 } // namespace internal | 2972 } // namespace internal |
2935 } // namespace v8 | 2973 } // namespace v8 |
2936 | 2974 |
2937 #endif // V8_TARGET_ARCH_X64 | 2975 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |