| 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_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 Loading... |
| 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 |
| OLD | NEW |