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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2832 __ Push(rdi); | 2832 __ Push(rdi); |
2833 __ Push(rdx); | 2833 __ Push(rdx); |
2834 __ PushReturnAddressFrom(kScratchRegister); | 2834 __ PushReturnAddressFrom(kScratchRegister); |
2835 // Include the pushed new_target, constructor and the receiver. | 2835 // Include the pushed new_target, constructor and the receiver. |
2836 __ addp(rax, Immediate(3)); | 2836 __ addp(rax, Immediate(3)); |
2837 __ JumpToExternalReference( | 2837 __ JumpToExternalReference( |
2838 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); | 2838 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); |
2839 } | 2839 } |
2840 | 2840 |
2841 // static | 2841 // static |
2842 void Builtins::Generate_PromiseConstructorHelper(MacroAssembler* masm) { | |
Benedikt Meurer
2016/11/22 06:03:28
Unless I'm missing something, this is 100% identic
| |
2843 // ----------- S t a t e ------------- | |
2844 // -- rax: number of arguments | |
2845 // -- rsi: context | |
2846 // -- rdi: constructor function | |
2847 // -- rdx: new target | |
2848 // ----------------------------------- | |
2849 | |
2850 // Enter a construct frame. | |
2851 { | |
2852 FrameScope scope(masm, StackFrame::CONSTRUCT); | |
2853 | |
2854 // Preserve the incoming parameters on the stack. | |
2855 __ Integer32ToSmi(rcx, rax); | |
2856 __ Push(rsi); | |
2857 __ Push(rcx); | |
2858 __ PushRoot(Heap::kTheHoleValueRootIndex); | |
2859 | |
2860 // Set up pointer to last argument. | |
2861 __ leap(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset)); | |
2862 | |
2863 // Copy arguments and receiver to the expression stack. | |
2864 Label loop, entry; | |
2865 __ movp(rcx, rax); | |
2866 __ jmp(&entry); | |
2867 __ bind(&loop); | |
2868 __ Push(Operand(rbx, rcx, times_pointer_size, 0)); | |
2869 __ bind(&entry); | |
2870 __ decp(rcx); | |
2871 __ j(greater_equal, &loop); | |
2872 | |
2873 // Call the function. | |
2874 ParameterCount actual(rax); | |
2875 __ InvokeFunction(rdi, rdx, actual, CALL_FUNCTION, | |
2876 CheckDebugStepCallWrapper()); | |
2877 | |
2878 // Restore context from the frame. | |
2879 __ movp(rsi, Operand(rbp, ConstructFrameConstants::kContextOffset)); | |
2880 | |
2881 __ movp(rbx, Operand(rsp, 0)); | |
2882 | |
2883 // Leave construct frame. | |
2884 } | |
2885 | |
2886 // Remove caller arguments from the stack and return. | |
2887 __ PopReturnAddressTo(rcx); | |
2888 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); | |
2889 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | |
2890 __ PushReturnAddressFrom(rcx); | |
2891 __ ret(0); | |
2892 } | |
2893 | |
2894 // static | |
2842 void Builtins::Generate_Construct(MacroAssembler* masm) { | 2895 void Builtins::Generate_Construct(MacroAssembler* masm) { |
2843 // ----------- S t a t e ------------- | 2896 // ----------- S t a t e ------------- |
2844 // -- rax : the number of arguments (not including the receiver) | 2897 // -- rax : the number of arguments (not including the receiver) |
2845 // -- rdx : the new target (either the same as the constructor or | 2898 // -- rdx : the new target (either the same as the constructor or |
2846 // the JSFunction on which new was invoked initially) | 2899 // the JSFunction on which new was invoked initially) |
2847 // -- rdi : the constructor to call (can be any Object) | 2900 // -- rdi : the constructor to call (can be any Object) |
2848 // ----------------------------------- | 2901 // ----------------------------------- |
2849 StackArgumentsAccessor args(rsp, rax); | 2902 StackArgumentsAccessor args(rsp, rax); |
2850 | 2903 |
2851 // Check if target is a Smi. | 2904 // Check if target is a Smi. |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3055 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3108 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3056 Generate_OnStackReplacementHelper(masm, true); | 3109 Generate_OnStackReplacementHelper(masm, true); |
3057 } | 3110 } |
3058 | 3111 |
3059 #undef __ | 3112 #undef __ |
3060 | 3113 |
3061 } // namespace internal | 3114 } // namespace internal |
3062 } // namespace v8 | 3115 } // namespace v8 |
3063 | 3116 |
3064 #endif // V8_TARGET_ARCH_X64 | 3117 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |