Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1489323002: [builtins] Remove some (now) unused code from C++ builtin adaptor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 // is not marked as DontAdaptArguments) 25 // is not marked as DontAdaptArguments)
26 // -- rdi : called function 26 // -- rdi : called function
27 // -- rsp[0] : return address 27 // -- rsp[0] : return address
28 // -- rsp[8] : last argument 28 // -- rsp[8] : last argument
29 // -- ... 29 // -- ...
30 // -- rsp[8 * argc] : first argument 30 // -- rsp[8 * argc] : first argument
31 // -- rsp[8 * (argc + 1)] : receiver 31 // -- rsp[8 * (argc + 1)] : receiver
32 // ----------------------------------- 32 // -----------------------------------
33 __ AssertFunction(rdi); 33 __ AssertFunction(rdi);
34 34
35 // Make sure we operate in the context of the called function (for example
36 // ConstructStubs implemented in C++ will be run in the context of the caller
37 // instead of the callee, due to the way that [[Construct]] is defined for
38 // ordinary functions).
39 // TODO(bmeurer): Can we make this more robust?
40 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
41
42 // Insert extra arguments. 35 // Insert extra arguments.
43 int num_extra_args = 0; 36 int num_extra_args = 0;
44 if (extra_args == NEEDS_CALLED_FUNCTION) { 37 if (extra_args == NEEDS_CALLED_FUNCTION) {
45 num_extra_args = 1; 38 num_extra_args = 1;
46 __ PopReturnAddressTo(kScratchRegister); 39 __ PopReturnAddressTo(kScratchRegister);
47 __ Push(rdi); 40 __ Push(rdi);
48 __ PushReturnAddressFrom(kScratchRegister); 41 __ PushReturnAddressFrom(kScratchRegister);
49 } else { 42 } else {
50 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); 43 DCHECK(extra_args == NO_EXTRA_ARGUMENTS);
51 } 44 }
52 45
53 // JumpToExternalReference expects rax to contain the number of arguments 46 // JumpToExternalReference expects rax to contain the number of arguments
54 // including the receiver and the extra arguments. But rax is only valid 47 // including the receiver and the extra arguments.
55 // if the called function is marked as DontAdaptArguments, otherwise we
56 // need to load the argument count from the SharedFunctionInfo.
57 Label argc, done_argc;
58 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
59 __ LoadSharedFunctionInfoSpecialField(
60 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset);
61 __ cmpp(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
62 __ j(equal, &argc, Label::kNear);
63 __ leap(rax, Operand(rbx, num_extra_args + 1));
64 __ jmp(&done_argc, Label::kNear);
65 __ bind(&argc);
66 __ addp(rax, Immediate(num_extra_args + 1)); 48 __ addp(rax, Immediate(num_extra_args + 1));
67 __ bind(&done_argc);
68 49
69 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1);
70 } 51 }
71 52
72 53
73 static void CallRuntimePassFunction( 54 static void CallRuntimePassFunction(
74 MacroAssembler* masm, Runtime::FunctionId function_id) { 55 MacroAssembler* masm, Runtime::FunctionId function_id) {
75 // ----------- S t a t e ------------- 56 // ----------- S t a t e -------------
76 // -- rdx : new target (preserved for callee) 57 // -- rdx : new target (preserved for callee)
77 // -- rdi : target function (preserved for callee) 58 // -- rdi : target function (preserved for callee)
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 __ ret(0); 2042 __ ret(0);
2062 } 2043 }
2063 2044
2064 2045
2065 #undef __ 2046 #undef __
2066 2047
2067 } // namespace internal 2048 } // namespace internal
2068 } // namespace v8 2049 } // namespace v8
2069 2050
2070 #endif // V8_TARGET_ARCH_X64 2051 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698