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 (tagged) | |
2049 // -- rsi : context | |
2050 // ----------------------------------- | |
2051 __ AssertSmi(rdx); | |
2052 | |
2053 Label runtime; | |
2054 __ SmiToInteger64(rdx, rdx); | |
2055 __ Allocate(rdx, rax, rcx, rdi, &runtime, NO_ALLOCATION_FLAGS); | |
2056 __ Ret(); | |
2057 | |
2058 __ bind(&runtime); | |
2059 __ Integer32ToSmi(rdx, rdx); | |
2060 __ PopReturnAddressTo(rcx); | |
2061 __ Push(rdx); | |
2062 __ PushReturnAddressFrom(rcx); | |
2063 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | |
2064 } | |
2065 | |
2066 // static | |
2067 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | |
2068 // ----------- S t a t e ------------- | |
2069 // -- rdx : requested object size (tagged) | |
2070 // -- rsi : context | |
2071 // ----------------------------------- | |
2072 __ AssertSmi(rdx); | |
2073 | |
2074 Label runtime; | |
2075 __ SmiToInteger64(rdx, rdx); | |
2076 __ Allocate(rdx, rax, rcx, rdi, &runtime, PRETENURE); | |
2077 __ Ret(); | |
2078 | |
2079 __ bind(&runtime); | |
2080 __ Integer32ToSmi(rdx, rdx); | |
2081 __ PopReturnAddressTo(rcx); | |
2082 __ Push(rdx); | |
2083 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | |
2084 __ PushReturnAddressFrom(rcx); | |
2085 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | |
2086 } | |
2087 | 2045 |
2088 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2046 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2089 // ----------- S t a t e ------------- | 2047 // ----------- S t a t e ------------- |
2090 // -- rax : actual number of arguments | 2048 // -- rax : actual number of arguments |
2091 // -- rbx : expected number of arguments | 2049 // -- rbx : expected number of arguments |
2092 // -- rdx : new target (passed through to callee) | 2050 // -- rdx : new target (passed through to callee) |
2093 // -- rdi : function (passed through to callee) | 2051 // -- rdi : function (passed through to callee) |
2094 // ----------------------------------- | 2052 // ----------------------------------- |
2095 | 2053 |
2096 Label invoke, dont_adapt_arguments, stack_overflow; | 2054 Label invoke, dont_adapt_arguments, stack_overflow; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 __ ret(0); | 2928 __ ret(0); |
2971 } | 2929 } |
2972 | 2930 |
2973 | 2931 |
2974 #undef __ | 2932 #undef __ |
2975 | 2933 |
2976 } // namespace internal | 2934 } // namespace internal |
2977 } // namespace v8 | 2935 } // namespace v8 |
2978 | 2936 |
2979 #endif // V8_TARGET_ARCH_X64 | 2937 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |