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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 13 matching lines...) Expand all Loading... |
24 // -- rdi : target | 24 // -- rdi : target |
25 // -- rdx : new.target | 25 // -- rdx : new.target |
26 // -- rsp[0] : return address | 26 // -- rsp[0] : return address |
27 // -- rsp[8] : last argument | 27 // -- rsp[8] : last argument |
28 // -- ... | 28 // -- ... |
29 // -- rsp[8 * argc] : first argument | 29 // -- rsp[8 * argc] : first argument |
30 // -- rsp[8 * (argc + 1)] : receiver | 30 // -- rsp[8 * (argc + 1)] : receiver |
31 // ----------------------------------- | 31 // ----------------------------------- |
32 __ AssertFunction(rdi); | 32 __ AssertFunction(rdi); |
33 | 33 |
| 34 // Make sure we operate in the context of the called function (for example |
| 35 // ConstructStubs implemented in C++ will be run in the context of the caller |
| 36 // instead of the callee, due to the way that [[Construct]] is defined for |
| 37 // ordinary functions). |
| 38 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 39 |
34 // Insert extra arguments. | 40 // Insert extra arguments. |
35 int num_extra_args = 0; | 41 int num_extra_args = 0; |
36 if (extra_args != BuiltinExtraArguments::kNone) { | 42 if (extra_args != BuiltinExtraArguments::kNone) { |
37 __ PopReturnAddressTo(kScratchRegister); | 43 __ PopReturnAddressTo(kScratchRegister); |
38 if (extra_args & BuiltinExtraArguments::kTarget) { | 44 if (extra_args & BuiltinExtraArguments::kTarget) { |
39 ++num_extra_args; | 45 ++num_extra_args; |
40 __ Push(rdi); | 46 __ Push(rdi); |
41 } | 47 } |
42 if (extra_args & BuiltinExtraArguments::kNewTarget) { | 48 if (extra_args & BuiltinExtraArguments::kNewTarget) { |
43 ++num_extra_args; | 49 ++num_extra_args; |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 __ ret(0); | 2451 __ ret(0); |
2446 } | 2452 } |
2447 | 2453 |
2448 | 2454 |
2449 #undef __ | 2455 #undef __ |
2450 | 2456 |
2451 } // namespace internal | 2457 } // namespace internal |
2452 } // namespace v8 | 2458 } // namespace v8 |
2453 | 2459 |
2454 #endif // V8_TARGET_ARCH_X64 | 2460 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |