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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // -- esp[4 * (argc +1)] : receiver | 29 // -- esp[4 * (argc +1)] : receiver |
30 // ----------------------------------- | 30 // ----------------------------------- |
31 __ AssertFunction(edi); | 31 __ AssertFunction(edi); |
32 | 32 |
33 // 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 |
34 // 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 |
35 // 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 |
36 // ordinary functions). | 36 // ordinary functions). |
37 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 37 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
38 | 38 |
| 39 // JumpToExternalReference expects eax to contain the number of arguments |
| 40 // including the receiver and the extra arguments. |
| 41 const int num_extra_args = 3; |
| 42 __ add(eax, Immediate(num_extra_args + 1)); |
| 43 |
39 // Insert extra arguments. | 44 // Insert extra arguments. |
40 const int num_extra_args = 2; | |
41 __ PopReturnAddressTo(ecx); | 45 __ PopReturnAddressTo(ecx); |
| 46 __ SmiTag(eax); |
| 47 __ Push(eax); |
| 48 __ SmiUntag(eax); |
42 __ Push(edi); | 49 __ Push(edi); |
43 __ Push(edx); | 50 __ Push(edx); |
44 __ PushReturnAddressFrom(ecx); | 51 __ PushReturnAddressFrom(ecx); |
45 | 52 |
46 // JumpToExternalReference expects eax to contain the number of arguments | |
47 // including the receiver and the extra arguments. | |
48 __ add(eax, Immediate(num_extra_args + 1)); | |
49 | |
50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), | 53 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), |
51 exit_frame_type == BUILTIN_EXIT); | 54 exit_frame_type == BUILTIN_EXIT); |
52 } | 55 } |
53 | 56 |
54 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, | 57 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, |
55 Runtime::FunctionId function_id) { | 58 Runtime::FunctionId function_id) { |
56 // ----------- S t a t e ------------- | 59 // ----------- S t a t e ------------- |
57 // -- eax : argument count (preserved for callee) | 60 // -- eax : argument count (preserved for callee) |
58 // -- edx : new target (preserved for callee) | 61 // -- edx : new target (preserved for callee) |
59 // -- edi : target function (preserved for callee) | 62 // -- edi : target function (preserved for callee) |
(...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 // And "return" to the OSR entry point of the function. | 3049 // And "return" to the OSR entry point of the function. |
3047 __ ret(0); | 3050 __ ret(0); |
3048 } | 3051 } |
3049 | 3052 |
3050 | 3053 |
3051 #undef __ | 3054 #undef __ |
3052 } // namespace internal | 3055 } // namespace internal |
3053 } // namespace v8 | 3056 } // namespace v8 |
3054 | 3057 |
3055 #endif // V8_TARGET_ARCH_X87 | 3058 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |