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" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 namespace internal { | 38 namespace internal { |
38 | 39 |
39 | 40 |
40 #define __ ACCESS_MASM(masm) | 41 #define __ ACCESS_MASM(masm) |
41 | 42 |
42 | 43 |
43 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 44 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
44 CFunctionId id, | 45 CFunctionId id, |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 __ SmiToInteger32(rax, rax); | 840 __ SmiToInteger32(rax, rax); |
840 } | 841 } |
841 | 842 |
842 // Restore the function to rdi. | 843 // Restore the function to rdi. |
843 __ movq(rdi, args.GetReceiverOperand()); | 844 __ movq(rdi, args.GetReceiverOperand()); |
844 __ jmp(&patch_receiver, Label::kNear); | 845 __ jmp(&patch_receiver, Label::kNear); |
845 | 846 |
846 // Use the global receiver object from the called function as the | 847 // Use the global receiver object from the called function as the |
847 // receiver. | 848 // receiver. |
848 __ bind(&use_global_receiver); | 849 __ bind(&use_global_receiver); |
849 const int kGlobalIndex = | 850 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); |
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)); | |
855 | 851 |
856 __ bind(&patch_receiver); | 852 __ bind(&patch_receiver); |
857 __ movq(args.GetArgumentOperand(1), rbx); | 853 __ movq(args.GetArgumentOperand(1), rbx); |
858 | 854 |
859 __ jmp(&shift_arguments); | 855 __ jmp(&shift_arguments); |
860 } | 856 } |
861 | 857 |
862 // 3b. Check for function proxy. | 858 // 3b. Check for function proxy. |
863 __ bind(&slow); | 859 __ bind(&slow); |
864 __ Set(rdx, 1); // indicate function proxy | 860 __ Set(rdx, 1); // indicate function proxy |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 | 1020 |
1025 // Convert the receiver to an object. | 1021 // Convert the receiver to an object. |
1026 __ bind(&call_to_object); | 1022 __ bind(&call_to_object); |
1027 __ push(rbx); | 1023 __ push(rbx); |
1028 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1024 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1029 __ movq(rbx, rax); | 1025 __ movq(rbx, rax); |
1030 __ jmp(&push_receiver, Label::kNear); | 1026 __ jmp(&push_receiver, Label::kNear); |
1031 | 1027 |
1032 // Use the current global receiver object as the receiver. | 1028 // Use the current global receiver object as the receiver. |
1033 __ bind(&use_global_receiver); | 1029 __ bind(&use_global_receiver); |
1034 const int kGlobalOffset = | 1030 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); |
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 | |
1041 // Push the receiver. | 1031 // Push the receiver. |
1042 __ bind(&push_receiver); | 1032 __ bind(&push_receiver); |
1043 __ push(rbx); | 1033 __ push(rbx); |
1044 | 1034 |
1045 // Copy all arguments from the array to the stack. | 1035 // Copy all arguments from the array to the stack. |
1046 Label entry, loop; | 1036 Label entry, loop; |
1047 __ movq(rax, Operand(rbp, kIndexOffset)); | 1037 __ movq(rax, Operand(rbp, kIndexOffset)); |
1048 __ jmp(&entry); | 1038 __ jmp(&entry); |
1049 __ bind(&loop); | 1039 __ bind(&loop); |
1050 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments | 1040 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 __ bind(&ok); | 1449 __ bind(&ok); |
1460 __ ret(0); | 1450 __ ret(0); |
1461 } | 1451 } |
1462 | 1452 |
1463 | 1453 |
1464 #undef __ | 1454 #undef __ |
1465 | 1455 |
1466 } } // namespace v8::internal | 1456 } } // namespace v8::internal |
1467 | 1457 |
1468 #endif // V8_TARGET_ARCH_X64 | 1458 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |