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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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/runtime/runtime.h" | 11 #include "src/runtime/runtime.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 // -- r0 : number of arguments excluding receiver | 24 // -- r0 : number of arguments excluding receiver |
25 // -- r1 : called function | 25 // -- r1 : target |
| 26 // -- r3 : new.target |
26 // -- sp[0] : last argument | 27 // -- sp[0] : last argument |
27 // -- ... | 28 // -- ... |
28 // -- sp[4 * (argc - 1)] : first argument | 29 // -- sp[4 * (argc - 1)] : first argument |
29 // -- sp[4 * argc] : receiver | 30 // -- sp[4 * argc] : receiver |
30 // ----------------------------------- | 31 // ----------------------------------- |
31 __ AssertFunction(r1); | 32 __ AssertFunction(r1); |
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 switch (extra_args) { |
36 num_extra_args = 1; | 37 case BuiltinExtraArguments::kTarget: |
37 __ push(r1); | 38 __ Push(r1); |
38 } else { | 39 ++num_extra_args; |
39 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); | 40 break; |
| 41 case BuiltinExtraArguments::kNewTarget: |
| 42 __ Push(r3); |
| 43 ++num_extra_args; |
| 44 break; |
| 45 case BuiltinExtraArguments::kTargetAndNewTarget: |
| 46 __ Push(r1, r3); |
| 47 num_extra_args += 2; |
| 48 break; |
| 49 case BuiltinExtraArguments::kNone: |
| 50 break; |
40 } | 51 } |
41 | 52 |
42 // JumpToExternalReference expects r0 to contain the number of arguments | 53 // JumpToExternalReference expects r0 to contain the number of arguments |
43 // including the receiver and the extra arguments. | 54 // including the receiver and the extra arguments. |
44 __ add(r0, r0, Operand(num_extra_args + 1)); | 55 __ add(r0, r0, Operand(num_extra_args + 1)); |
45 | 56 |
46 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 57 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
47 } | 58 } |
48 | 59 |
49 | 60 |
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 } | 1951 } |
1941 } | 1952 } |
1942 | 1953 |
1943 | 1954 |
1944 #undef __ | 1955 #undef __ |
1945 | 1956 |
1946 } // namespace internal | 1957 } // namespace internal |
1947 } // namespace v8 | 1958 } // namespace v8 |
1948 | 1959 |
1949 #endif // V8_TARGET_ARCH_ARM | 1960 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |