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

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

Issue 1491883002: [builtins] Some refactoring on the builtin mechanism. (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
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 15
16 #define __ ACCESS_MASM(masm) 16 #define __ ACCESS_MASM(masm)
17 17
18 18
19 void Builtins::Generate_Adaptor(MacroAssembler* masm, 19 void Builtins::Generate_Adaptor(MacroAssembler* masm,
20 CFunctionId id, 20 CFunctionId id,
21 BuiltinExtraArguments extra_args) { 21 BuiltinExtraArguments extra_args) {
22 // ----------- S t a t e ------------- 22 // ----------- S t a t e -------------
23 // -- rax : number of arguments excluding receiver 23 // -- rax : number of arguments excluding receiver
24 // -- rdi : called function 24 // -- rdi : target
25 // -- rdx : new.target
25 // -- rsp[0] : return address 26 // -- rsp[0] : return address
26 // -- rsp[8] : last argument 27 // -- rsp[8] : last argument
27 // -- ... 28 // -- ...
28 // -- rsp[8 * argc] : first argument 29 // -- rsp[8 * argc] : first argument
29 // -- rsp[8 * (argc + 1)] : receiver 30 // -- rsp[8 * (argc + 1)] : receiver
30 // ----------------------------------- 31 // -----------------------------------
31 __ AssertFunction(rdi); 32 __ AssertFunction(rdi);
32 33
33 // Insert extra arguments. 34 // Insert extra arguments.
34 int num_extra_args = 0; 35 int num_extra_args = 0;
35 if (extra_args == NEEDS_CALLED_FUNCTION) { 36 if (extra_args != BuiltinExtraArguments::kNone) {
36 num_extra_args = 1;
37 __ PopReturnAddressTo(kScratchRegister); 37 __ PopReturnAddressTo(kScratchRegister);
38 __ Push(rdi); 38 if (extra_args & BuiltinExtraArguments::kTarget) {
39 ++num_extra_args;
40 __ Push(rdi);
41 }
42 if (extra_args & BuiltinExtraArguments::kNewTarget) {
43 ++num_extra_args;
44 __ Push(rdx);
45 }
39 __ PushReturnAddressFrom(kScratchRegister); 46 __ PushReturnAddressFrom(kScratchRegister);
40 } else {
41 DCHECK(extra_args == NO_EXTRA_ARGUMENTS);
42 } 47 }
43 48
44 // JumpToExternalReference expects rax to contain the number of arguments 49 // JumpToExternalReference expects rax to contain the number of arguments
45 // including the receiver and the extra arguments. 50 // including the receiver and the extra arguments.
46 __ addp(rax, Immediate(num_extra_args + 1)); 51 __ addp(rax, Immediate(num_extra_args + 1));
47 52
48 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); 53 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1);
49 } 54 }
50 55
51 56
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 __ ret(0); 2045 __ ret(0);
2041 } 2046 }
2042 2047
2043 2048
2044 #undef __ 2049 #undef __
2045 2050
2046 } // namespace internal 2051 } // namespace internal
2047 } // namespace v8 2052 } // namespace v8
2048 2053
2049 #endif // V8_TARGET_ARCH_X64 2054 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698