| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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, CFunctionId id, | 20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, |
| 21 BuiltinExtraArguments extra_args) { | 21 BuiltinExtraArguments extra_args) { |
| 22 // ----------- S t a t e ------------- | 22 // ----------- S t a t e ------------- |
| 23 // -- r3 : number of arguments excluding receiver | 23 // -- r3 : number of arguments excluding receiver |
| 24 // -- r4 : called function | 24 // -- r4 : target |
| 25 // -- r6 : new.target |
| 25 // -- sp[0] : last argument | 26 // -- sp[0] : last argument |
| 26 // -- ... | 27 // -- ... |
| 27 // -- sp[4 * (argc - 1)] : first argument | 28 // -- sp[4 * (argc - 1)] : first argument |
| 28 // -- sp[4 * argc] : receiver | 29 // -- sp[4 * argc] : receiver |
| 29 // ----------------------------------- | 30 // ----------------------------------- |
| 30 __ AssertFunction(r4); | 31 __ AssertFunction(r4); |
| 31 | 32 |
| 32 // Insert extra arguments. | 33 // Insert extra arguments. |
| 33 int num_extra_args = 0; | 34 int num_extra_args = 0; |
| 34 if (extra_args == NEEDS_CALLED_FUNCTION) { | 35 switch (extra_args) { |
| 35 num_extra_args = 1; | 36 case BuiltinExtraArguments::kTarget: |
| 36 __ push(r4); | 37 __ Push(r4); |
| 37 } else { | 38 ++num_extra_args; |
| 38 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); | 39 break; |
| 40 case BuiltinExtraArguments::kNewTarget: |
| 41 __ Push(r6); |
| 42 ++num_extra_args; |
| 43 break; |
| 44 case BuiltinExtraArguments::kTargetAndNewTarget: |
| 45 __ Push(r4, r6); |
| 46 num_extra_args += 2; |
| 47 break; |
| 48 case BuiltinExtraArguments::kNone: |
| 49 break; |
| 39 } | 50 } |
| 40 | 51 |
| 41 // JumpToExternalReference expects r3 to contain the number of arguments | 52 // JumpToExternalReference expects r3 to contain the number of arguments |
| 42 // including the receiver and the extra arguments. | 53 // including the receiver and the extra arguments. |
| 43 __ addi(r3, r3, Operand(num_extra_args + 1)); | 54 __ addi(r3, r3, Operand(num_extra_args + 1)); |
| 44 | 55 |
| 45 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 56 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 46 } | 57 } |
| 47 | 58 |
| 48 | 59 |
| (...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 __ bkpt(0); | 1979 __ bkpt(0); |
| 1969 } | 1980 } |
| 1970 } | 1981 } |
| 1971 | 1982 |
| 1972 | 1983 |
| 1973 #undef __ | 1984 #undef __ |
| 1974 } // namespace internal | 1985 } // namespace internal |
| 1975 } // namespace v8 | 1986 } // namespace v8 |
| 1976 | 1987 |
| 1977 #endif // V8_TARGET_ARCH_PPC | 1988 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |