| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 __ SmiToInteger32(rax, rax); | 820 __ SmiToInteger32(rax, rax); |
| 820 } | 821 } |
| 821 | 822 |
| 822 // Restore the function to rdi. | 823 // Restore the function to rdi. |
| 823 __ movq(rdi, args.GetReceiverOperand()); | 824 __ movq(rdi, args.GetReceiverOperand()); |
| 824 __ jmp(&patch_receiver, Label::kNear); | 825 __ jmp(&patch_receiver, Label::kNear); |
| 825 | 826 |
| 826 // Use the global receiver object from the called function as the | 827 // Use the global receiver object from the called function as the |
| 827 // receiver. | 828 // receiver. |
| 828 __ bind(&use_global_receiver); | 829 __ bind(&use_global_receiver); |
| 829 const int kGlobalIndex = | 830 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); |
| 830 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | |
| 831 __ movq(rbx, FieldOperand(rsi, kGlobalIndex)); | |
| 832 __ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); | |
| 833 __ movq(rbx, FieldOperand(rbx, kGlobalIndex)); | |
| 834 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); | |
| 835 | 831 |
| 836 __ bind(&patch_receiver); | 832 __ bind(&patch_receiver); |
| 837 __ movq(args.GetArgumentOperand(1), rbx); | 833 __ movq(args.GetArgumentOperand(1), rbx); |
| 838 | 834 |
| 839 __ jmp(&shift_arguments); | 835 __ jmp(&shift_arguments); |
| 840 } | 836 } |
| 841 | 837 |
| 842 // 3b. Check for function proxy. | 838 // 3b. Check for function proxy. |
| 843 __ bind(&slow); | 839 __ bind(&slow); |
| 844 __ Set(rdx, 1); // indicate function proxy | 840 __ Set(rdx, 1); // indicate function proxy |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 | 1000 |
| 1005 // Convert the receiver to an object. | 1001 // Convert the receiver to an object. |
| 1006 __ bind(&call_to_object); | 1002 __ bind(&call_to_object); |
| 1007 __ push(rbx); | 1003 __ push(rbx); |
| 1008 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1004 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1009 __ movq(rbx, rax); | 1005 __ movq(rbx, rax); |
| 1010 __ jmp(&push_receiver, Label::kNear); | 1006 __ jmp(&push_receiver, Label::kNear); |
| 1011 | 1007 |
| 1012 // Use the current global receiver object as the receiver. | 1008 // Use the current global receiver object as the receiver. |
| 1013 __ bind(&use_global_receiver); | 1009 __ bind(&use_global_receiver); |
| 1014 const int kGlobalOffset = | 1010 CallStubCompiler::FetchGlobalProxy(masm, rbx, rdi); |
| 1015 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | |
| 1016 __ movq(rbx, FieldOperand(rsi, kGlobalOffset)); | |
| 1017 __ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); | |
| 1018 __ movq(rbx, FieldOperand(rbx, kGlobalOffset)); | |
| 1019 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); | |
| 1020 | |
| 1021 // Push the receiver. | 1011 // Push the receiver. |
| 1022 __ bind(&push_receiver); | 1012 __ bind(&push_receiver); |
| 1023 __ push(rbx); | 1013 __ push(rbx); |
| 1024 | 1014 |
| 1025 // Copy all arguments from the array to the stack. | 1015 // Copy all arguments from the array to the stack. |
| 1026 Label entry, loop; | 1016 Label entry, loop; |
| 1027 __ movq(rax, Operand(rbp, kIndexOffset)); | 1017 __ movq(rax, Operand(rbp, kIndexOffset)); |
| 1028 __ jmp(&entry); | 1018 __ jmp(&entry); |
| 1029 __ bind(&loop); | 1019 __ bind(&loop); |
| 1030 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments | 1020 __ movq(rdx, Operand(rbp, kArgumentsOffset)); // load arguments |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 __ bind(&ok); | 1429 __ bind(&ok); |
| 1440 __ ret(0); | 1430 __ ret(0); |
| 1441 } | 1431 } |
| 1442 | 1432 |
| 1443 | 1433 |
| 1444 #undef __ | 1434 #undef __ |
| 1445 | 1435 |
| 1446 } } // namespace v8::internal | 1436 } } // namespace v8::internal |
| 1447 | 1437 |
| 1448 #endif // V8_TARGET_ARCH_X64 | 1438 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |