OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #if V8_TARGET_ARCH_X64 | 30 #if V8_TARGET_ARCH_X64 |
31 | 31 |
32 #include "codegen.h" | 32 #include "codegen.h" |
33 #include "deoptimizer.h" | 33 #include "deoptimizer.h" |
34 #include "full-codegen.h" | 34 #include "full-codegen.h" |
35 #include "stub-cache.h" | |
36 | 35 |
37 namespace v8 { | 36 namespace v8 { |
38 namespace internal { | 37 namespace internal { |
39 | 38 |
40 | 39 |
41 #define __ ACCESS_MASM(masm) | 40 #define __ ACCESS_MASM(masm) |
42 | 41 |
43 | 42 |
44 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 43 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
45 CFunctionId id, | 44 CFunctionId id, |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 __ SmiToInteger32(rax, rax); | 839 __ SmiToInteger32(rax, rax); |
841 } | 840 } |
842 | 841 |
843 // Restore the function to rdi. | 842 // Restore the function to rdi. |
844 __ movq(rdi, args.GetReceiverOperand()); | 843 __ movq(rdi, args.GetReceiverOperand()); |
845 __ jmp(&patch_receiver, Label::kNear); | 844 __ jmp(&patch_receiver, Label::kNear); |
846 | 845 |
847 // Use the global receiver object from the called function as the | 846 // Use the global receiver object from the called function as the |
848 // receiver. | 847 // receiver. |
849 __ bind(&use_global_receiver); | 848 __ bind(&use_global_receiver); |
850 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); | 849 const int kGlobalIndex = |
| 850 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 851 __ movq(rbx, FieldOperand(rsi, kGlobalIndex)); |
| 852 __ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); |
| 853 __ movq(rbx, FieldOperand(rbx, kGlobalIndex)); |
| 854 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
851 | 855 |
852 __ bind(&patch_receiver); | 856 __ bind(&patch_receiver); |
853 __ movq(args.GetArgumentOperand(1), rbx); | 857 __ movq(args.GetArgumentOperand(1), rbx); |
854 | 858 |
855 __ jmp(&shift_arguments); | 859 __ jmp(&shift_arguments); |
856 } | 860 } |
857 | 861 |
858 // 3b. Check for function proxy. | 862 // 3b. Check for function proxy. |
859 __ bind(&slow); | 863 __ bind(&slow); |
860 __ Set(rdx, 1); // indicate function proxy | 864 __ Set(rdx, 1); // indicate function proxy |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 | 1024 |
1021 // Convert the receiver to an object. | 1025 // Convert the receiver to an object. |
1022 __ bind(&call_to_object); | 1026 __ bind(&call_to_object); |
1023 __ push(rbx); | 1027 __ push(rbx); |
1024 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1028 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1025 __ movq(rbx, rax); | 1029 __ movq(rbx, rax); |
1026 __ jmp(&push_receiver, Label::kNear); | 1030 __ jmp(&push_receiver, Label::kNear); |
1027 | 1031 |
1028 // Use the current global receiver object as the receiver. | 1032 // Use the current global receiver object as the receiver. |
1029 __ bind(&use_global_receiver); | 1033 __ bind(&use_global_receiver); |
1030 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); | 1034 const int kGlobalOffset = |
| 1035 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 1036 __ movq(rbx, FieldOperand(rsi, kGlobalOffset)); |
| 1037 __ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); |
| 1038 __ movq(rbx, FieldOperand(rbx, kGlobalOffset)); |
| 1039 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
| 1040 |
1031 // Push the receiver. | 1041 // Push the receiver. |
1032 __ bind(&push_receiver); | 1042 __ bind(&push_receiver); |
1033 __ push(rbx); | 1043 __ push(rbx); |
1034 | 1044 |
1035 // Copy all arguments from the array to the stack. | 1045 // Copy all arguments from the array to the stack. |
1036 Label entry, loop; | 1046 Label entry, loop; |
1037 __ movq(rax, Operand(rbp, kIndexOffset)); | 1047 __ movq(rax, Operand(rbp, kIndexOffset)); |
1038 __ jmp(&entry); | 1048 __ jmp(&entry); |
1039 __ bind(&loop); | 1049 __ bind(&loop); |
1040 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments | 1050 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 __ bind(&ok); | 1459 __ bind(&ok); |
1450 __ ret(0); | 1460 __ ret(0); |
1451 } | 1461 } |
1452 | 1462 |
1453 | 1463 |
1454 #undef __ | 1464 #undef __ |
1455 | 1465 |
1456 } } // namespace v8::internal | 1466 } } // namespace v8::internal |
1457 | 1467 |
1458 #endif // V8_TARGET_ARCH_X64 | 1468 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |