OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { | 835 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { |
836 PrepareForCall(arg_count, arg_count); | 836 PrepareForCall(arg_count, arg_count); |
837 ASSERT(cgen()->HasValidEntryRegisters()); | 837 ASSERT(cgen()->HasValidEntryRegisters()); |
838 __ CallRuntime(id, arg_count); | 838 __ CallRuntime(id, arg_count); |
839 Result result = cgen()->allocator()->Allocate(rax); | 839 Result result = cgen()->allocator()->Allocate(rax); |
840 ASSERT(result.is_valid()); | 840 ASSERT(result.is_valid()); |
841 return result; | 841 return result; |
842 } | 842 } |
843 | 843 |
844 | 844 |
| 845 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { |
| 846 // Name and receiver are on the top of the frame. The IC expects |
| 847 // name in rcx and receiver on the stack. It does not drop the |
| 848 // receiver. |
| 849 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 850 Result name = Pop(); |
| 851 PrepareForCall(1, 0); // One stack arg, not callee-dropped. |
| 852 name.ToRegister(rcx); |
| 853 name.Unuse(); |
| 854 return RawCallCodeObject(ic, mode); |
| 855 } |
| 856 |
| 857 |
| 858 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { |
| 859 // Key and receiver are on top of the frame. The IC expects them on |
| 860 // the stack. It does not drop them. |
| 861 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 862 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. |
| 863 return RawCallCodeObject(ic, mode); |
| 864 } |
| 865 |
| 866 |
| 867 Result VirtualFrame::CallKeyedStoreIC() { |
| 868 // Value, key, and receiver are on the top of the frame. The IC |
| 869 // expects value in rax and key and receiver on the stack. It does |
| 870 // not drop the key and receiver. |
| 871 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
| 872 // TODO(1222589): Make the IC grab the values from the stack. |
| 873 Result value = Pop(); |
| 874 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. |
| 875 value.ToRegister(rax); |
| 876 value.Unuse(); |
| 877 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
| 878 } |
| 879 |
| 880 |
845 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 881 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
846 int arg_count, | 882 int arg_count, |
847 int loop_nesting) { | 883 int loop_nesting) { |
848 // Arguments, receiver, and function name are on top of the frame. | 884 // Arguments, receiver, and function name are on top of the frame. |
849 // The IC expects them on the stack. It does not drop the function | 885 // The IC expects them on the stack. It does not drop the function |
850 // name slot (but it does drop the rest). | 886 // name slot (but it does drop the rest). |
851 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; | 887 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; |
852 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); | 888 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); |
853 // Spill args, receiver, and function. The call will drop args and | 889 // Spill args, receiver, and function. The call will drop args and |
854 // receiver. | 890 // receiver. |
(...skipping 29 matching lines...) Expand all Loading... |
884 | 920 |
885 name.Unuse(); | 921 name.Unuse(); |
886 value.Unuse(); | 922 value.Unuse(); |
887 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 923 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
888 } | 924 } |
889 | 925 |
890 | 926 |
891 #undef __ | 927 #undef __ |
892 | 928 |
893 } } // namespace v8::internal | 929 } } // namespace v8::internal |
OLD | NEW |