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

Side by Side Diff: src/x87/builtins-x87.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: Address feedback. 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') | test/mjsunit/es6/symbols.js » ('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_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 // (only guaranteed when the called function
26 // is not marked as DontAdaptArguments)
27 // -- edi : called function 25 // -- edi : called function
28 // -- esp[0] : return address 26 // -- esp[0] : return address
29 // -- esp[4] : last argument 27 // -- esp[4] : last argument
30 // -- ... 28 // -- ...
31 // -- esp[4 * argc] : first argument 29 // -- esp[4 * argc] : first argument
32 // -- esp[4 * (argc +1)] : receiver 30 // -- esp[4 * (argc +1)] : receiver
33 // ----------------------------------- 31 // -----------------------------------
34 __ AssertFunction(edi); 32 __ AssertFunction(edi);
35 33
36 // Make sure we operate in the context of the called function (for example
37 // ConstructStubs implemented in C++ will be run in the context of the caller
38 // instead of the callee, due to the way that [[Construct]] is defined for
39 // ordinary functions).
40 // TODO(bmeurer): Can we make this more robust?
41 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
42
43 // Insert extra arguments. 34 // Insert extra arguments.
44 int num_extra_args = 0; 35 int num_extra_args = 0;
45 if (extra_args == NEEDS_CALLED_FUNCTION) { 36 if (extra_args == NEEDS_CALLED_FUNCTION) {
46 num_extra_args = 1; 37 num_extra_args = 1;
47 Register scratch = ebx; 38 Register scratch = ebx;
48 __ pop(scratch); // Save return address. 39 __ pop(scratch); // Save return address.
49 __ push(edi); 40 __ push(edi);
50 __ push(scratch); // Restore return address. 41 __ push(scratch); // Restore return address.
51 } else { 42 } else {
52 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); 43 DCHECK(extra_args == NO_EXTRA_ARGUMENTS);
53 } 44 }
54 45
55 // JumpToExternalReference expects eax to contain the number of arguments 46 // JumpToExternalReference expects eax to contain the number of arguments
56 // including the receiver and the extra arguments. But eax is only valid 47 // including the receiver and the extra arguments.
57 // if the called function is marked as DontAdaptArguments, otherwise we
58 // need to load the argument count from the SharedFunctionInfo.
59 Label argc, done_argc;
60 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
61 __ mov(ebx,
62 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
63 __ SmiUntag(ebx);
64 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel);
65 __ j(equal, &argc, Label::kNear);
66 __ lea(eax, Operand(ebx, num_extra_args + 1));
67 __ jmp(&done_argc, Label::kNear);
68 __ bind(&argc);
69 __ add(eax, Immediate(num_extra_args + 1)); 48 __ add(eax, Immediate(num_extra_args + 1));
70 __ bind(&done_argc);
71 49
72 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
73 } 51 }
74 52
75 53
76 static void CallRuntimePassFunction( 54 static void CallRuntimePassFunction(
77 MacroAssembler* masm, Runtime::FunctionId function_id) { 55 MacroAssembler* masm, Runtime::FunctionId function_id) {
78 // ----------- S t a t e ------------- 56 // ----------- S t a t e -------------
79 // -- edx : new target (preserved for callee) 57 // -- edx : new target (preserved for callee)
80 // -- edi : target function (preserved for callee) 58 // -- edi : target function (preserved for callee)
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 1971
1994 __ bind(&ok); 1972 __ bind(&ok);
1995 __ ret(0); 1973 __ ret(0);
1996 } 1974 }
1997 1975
1998 #undef __ 1976 #undef __
1999 } // namespace internal 1977 } // namespace internal
2000 } // namespace v8 1978 } // namespace v8
2001 1979
2002 #endif // V8_TARGET_ARCH_X87 1980 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698