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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 // rsp[argc * 8] : argument 1 | 903 // rsp[argc * 8] : argument 1 |
904 // rsp[(argc + 1) * 8] : argument 0 = receiver | 904 // rsp[(argc + 1) * 8] : argument 0 = receiver |
905 // ----------------------------------- | 905 // ----------------------------------- |
906 __ JumpIfSmi(rdi, miss); | 906 __ JumpIfSmi(rdi, miss); |
907 // Check that the value is a JavaScript function. | 907 // Check that the value is a JavaScript function. |
908 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rdx); | 908 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rdx); |
909 __ j(not_equal, miss); | 909 __ j(not_equal, miss); |
910 | 910 |
911 // Invoke the function. | 911 // Invoke the function. |
912 ParameterCount actual(argc); | 912 ParameterCount actual(argc); |
913 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, | 913 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); |
914 NullCallWrapper(), CALL_AS_METHOD); | |
915 } | 914 } |
916 | 915 |
917 | 916 |
918 // The generated code falls through if the call should be handled by runtime. | 917 // The generated code falls through if the call should be handled by runtime. |
919 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) { | 918 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) { |
920 // ----------- S t a t e ------------- | 919 // ----------- S t a t e ------------- |
921 // rcx : function name | 920 // rcx : function name |
922 // rsp[0] : return address | 921 // rsp[0] : return address |
923 // rsp[8] : argument argc | 922 // rsp[8] : argument argc |
924 // rsp[16] : argument argc - 1 | 923 // rsp[16] : argument argc - 1 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 __ j(not_equal, &invoke); | 996 __ j(not_equal, &invoke); |
998 | 997 |
999 // Patch the receiver on the stack. | 998 // Patch the receiver on the stack. |
1000 __ bind(&global); | 999 __ bind(&global); |
1001 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | 1000 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
1002 __ movq(args.GetReceiverOperand(), rdx); | 1001 __ movq(args.GetReceiverOperand(), rdx); |
1003 __ bind(&invoke); | 1002 __ bind(&invoke); |
1004 } | 1003 } |
1005 | 1004 |
1006 // Invoke the function. | 1005 // Invoke the function. |
1007 CallKind call_kind = CallICBase::Contextual::decode(extra_state) | |
1008 ? CALL_AS_FUNCTION | |
1009 : CALL_AS_METHOD; | |
1010 ParameterCount actual(argc); | 1006 ParameterCount actual(argc); |
1011 __ InvokeFunction(rdi, | 1007 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); |
1012 actual, | |
1013 JUMP_FUNCTION, | |
1014 NullCallWrapper(), | |
1015 call_kind); | |
1016 } | 1008 } |
1017 | 1009 |
1018 | 1010 |
1019 void CallIC::GenerateMegamorphic(MacroAssembler* masm, | 1011 void CallIC::GenerateMegamorphic(MacroAssembler* masm, |
1020 int argc, | 1012 int argc, |
1021 ExtraICState extra_ic_state) { | 1013 ExtraICState extra_ic_state) { |
1022 // ----------- S t a t e ------------- | 1014 // ----------- S t a t e ------------- |
1023 // rcx : function name | 1015 // rcx : function name |
1024 // rsp[0] : return address | 1016 // rsp[0] : return address |
1025 // rsp[8] : argument argc | 1017 // rsp[8] : argument argc |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1691 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1700 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1692 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1701 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1693 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1702 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1694 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1703 } | 1695 } |
1704 | 1696 |
1705 | 1697 |
1706 } } // namespace v8::internal | 1698 } } // namespace v8::internal |
1707 | 1699 |
1708 #endif // V8_TARGET_ARCH_X64 | 1700 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |