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

Side by Side Diff: src/x87/builtins-x87.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/x64/builtins-x64.cc ('k') | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 #include "src/x87/frames-x87.h" 11 #include "src/x87/frames-x87.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 16
17 #define __ ACCESS_MASM(masm) 17 #define __ ACCESS_MASM(masm)
18 18
19 19
20 void Builtins::Generate_Adaptor(MacroAssembler* masm, 20 void Builtins::Generate_Adaptor(MacroAssembler* masm,
21 CFunctionId id, 21 CFunctionId id,
22 BuiltinExtraArguments extra_args) { 22 BuiltinExtraArguments extra_args) {
23 // ----------- S t a t e ------------- 23 // ----------- S t a t e -------------
24 // -- eax : number of arguments excluding receiver 24 // -- eax : number of arguments excluding receiver
25 // -- edi : called function 25 // -- edi : target
26 // -- edx : new.target
26 // -- esp[0] : return address 27 // -- esp[0] : return address
27 // -- esp[4] : last argument 28 // -- esp[4] : last argument
28 // -- ... 29 // -- ...
29 // -- esp[4 * argc] : first argument 30 // -- esp[4 * argc] : first argument
30 // -- esp[4 * (argc +1)] : receiver 31 // -- esp[4 * (argc +1)] : receiver
31 // ----------------------------------- 32 // -----------------------------------
32 __ AssertFunction(edi); 33 __ AssertFunction(edi);
33 34
34 // Insert extra arguments. 35 // Insert extra arguments.
35 int num_extra_args = 0; 36 int num_extra_args = 0;
36 if (extra_args == NEEDS_CALLED_FUNCTION) { 37 if (extra_args != BuiltinExtraArguments::kNone) {
37 num_extra_args = 1; 38 __ PopReturnAddressTo(ecx);
38 Register scratch = ebx; 39 if (extra_args & BuiltinExtraArguments::kTarget) {
39 __ pop(scratch); // Save return address. 40 ++num_extra_args;
40 __ push(edi); 41 __ Push(edi);
41 __ push(scratch); // Restore return address. 42 }
42 } else { 43 if (extra_args & BuiltinExtraArguments::kNewTarget) {
43 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); 44 ++num_extra_args;
45 __ Push(edx);
46 }
47 __ PushReturnAddressFrom(ecx);
44 } 48 }
45 49
46 // JumpToExternalReference expects eax to contain the number of arguments 50 // JumpToExternalReference expects eax to contain the number of arguments
47 // including the receiver and the extra arguments. 51 // including the receiver and the extra arguments.
48 __ add(eax, Immediate(num_extra_args + 1)); 52 __ add(eax, Immediate(num_extra_args + 1));
49 53
50 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 54 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
51 } 55 }
52 56
53 57
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 1975
1972 __ bind(&ok); 1976 __ bind(&ok);
1973 __ ret(0); 1977 __ ret(0);
1974 } 1978 }
1975 1979
1976 #undef __ 1980 #undef __
1977 } // namespace internal 1981 } // namespace internal
1978 } // namespace v8 1982 } // namespace v8
1979 1983
1980 #endif // V8_TARGET_ARCH_X87 1984 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698