| 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 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { | 19 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, |
| 20 ExitFrameType exit_frame_type) { |
| 20 // ----------- S t a t e ------------- | 21 // ----------- S t a t e ------------- |
| 21 // -- eax : number of arguments excluding receiver | 22 // -- eax : number of arguments excluding receiver |
| 22 // -- edi : target | 23 // -- edi : target |
| 23 // -- edx : new.target | 24 // -- edx : new.target |
| 24 // -- esp[0] : return address | 25 // -- esp[0] : return address |
| 25 // -- esp[4] : last argument | 26 // -- esp[4] : last argument |
| 26 // -- ... | 27 // -- ... |
| 27 // -- esp[4 * argc] : first argument | 28 // -- esp[4 * argc] : first argument |
| 28 // -- esp[4 * (argc +1)] : receiver | 29 // -- esp[4 * (argc +1)] : receiver |
| 29 // ----------------------------------- | 30 // ----------------------------------- |
| 30 __ AssertFunction(edi); | 31 __ AssertFunction(edi); |
| 31 | 32 |
| 32 // Make sure we operate in the context of the called function (for example | 33 // Make sure we operate in the context of the called function (for example |
| 33 // ConstructStubs implemented in C++ will be run in the context of the caller | 34 // ConstructStubs implemented in C++ will be run in the context of the caller |
| 34 // instead of the callee, due to the way that [[Construct]] is defined for | 35 // instead of the callee, due to the way that [[Construct]] is defined for |
| 35 // ordinary functions). | 36 // ordinary functions). |
| 36 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 37 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 37 | 38 |
| 38 // Insert extra arguments. | 39 // Insert extra arguments. |
| 39 const int num_extra_args = 2; | 40 const int num_extra_args = 2; |
| 40 __ PopReturnAddressTo(ecx); | 41 __ PopReturnAddressTo(ecx); |
| 41 __ Push(edi); | 42 __ Push(edi); |
| 42 __ Push(edx); | 43 __ Push(edx); |
| 43 __ PushReturnAddressFrom(ecx); | 44 __ PushReturnAddressFrom(ecx); |
| 44 | 45 |
| 45 // JumpToExternalReference expects eax to contain the number of arguments | 46 // JumpToExternalReference expects eax to contain the number of arguments |
| 46 // including the receiver and the extra arguments. | 47 // including the receiver and the extra arguments. |
| 47 __ add(eax, Immediate(num_extra_args + 1)); | 48 __ add(eax, Immediate(num_extra_args + 1)); |
| 48 | 49 |
| 49 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), |
| 51 exit_frame_type == BUILTIN_EXIT); |
| 50 } | 52 } |
| 51 | 53 |
| 52 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, | 54 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, |
| 53 Runtime::FunctionId function_id) { | 55 Runtime::FunctionId function_id) { |
| 54 // ----------- S t a t e ------------- | 56 // ----------- S t a t e ------------- |
| 55 // -- eax : argument count (preserved for callee) | 57 // -- eax : argument count (preserved for callee) |
| 56 // -- edx : new target (preserved for callee) | 58 // -- edx : new target (preserved for callee) |
| 57 // -- edi : target function (preserved for callee) | 59 // -- edi : target function (preserved for callee) |
| 58 // ----------------------------------- | 60 // ----------------------------------- |
| 59 { | 61 { |
| (...skipping 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 // And "return" to the OSR entry point of the function. | 3046 // And "return" to the OSR entry point of the function. |
| 3045 __ ret(0); | 3047 __ ret(0); |
| 3046 } | 3048 } |
| 3047 | 3049 |
| 3048 | 3050 |
| 3049 #undef __ | 3051 #undef __ |
| 3050 } // namespace internal | 3052 } // namespace internal |
| 3051 } // namespace v8 | 3053 } // namespace v8 |
| 3052 | 3054 |
| 3053 #endif // V8_TARGET_ARCH_X87 | 3055 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |