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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ASSERT(cgen()->HasValidEntryRegisters()); | 881 ASSERT(cgen()->HasValidEntryRegisters()); |
882 __ call(code, rmode); | 882 __ call(code, rmode); |
883 Result result = cgen()->allocator()->Allocate(eax); | 883 Result result = cgen()->allocator()->Allocate(eax); |
884 ASSERT(result.is_valid()); | 884 ASSERT(result.is_valid()); |
885 return result; | 885 return result; |
886 } | 886 } |
887 | 887 |
888 | 888 |
889 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { | 889 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { |
890 // Name and receiver are on the top of the frame. The IC expects | 890 // Name and receiver are on the top of the frame. The IC expects |
891 // name in ecx and receiver on the stack. It does not drop the | 891 // name in ecx and receiver in eax. |
892 // receiver. | |
893 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 892 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
894 Result name = Pop(); | 893 Result name = Pop(); |
895 PrepareForCall(1, 0); // One stack arg, not callee-dropped. | 894 Result receiver = Pop(); |
896 name.ToRegister(ecx); | 895 PrepareForCall(0, 0); // No stack arguments. |
| 896 // Move results to the right registers: |
| 897 if (name.is_register() && name.reg().is(eax)) { |
| 898 if (receiver.is_register() && receiver.reg().is(ecx)) { |
| 899 // Wrong registers. |
| 900 __ xchg(eax, ecx); |
| 901 } else { |
| 902 // Register ecx is free for name, which frees eax for receiver. |
| 903 name.ToRegister(ecx); |
| 904 receiver.ToRegister(eax); |
| 905 } |
| 906 } else { |
| 907 // Register eax is free for receiver, which frees ecx for name. |
| 908 receiver.ToRegister(eax); |
| 909 name.ToRegister(ecx); |
| 910 } |
897 name.Unuse(); | 911 name.Unuse(); |
| 912 receiver.Unuse(); |
898 return RawCallCodeObject(ic, mode); | 913 return RawCallCodeObject(ic, mode); |
899 } | 914 } |
900 | 915 |
901 | 916 |
902 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { | 917 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { |
903 // Key and receiver are on top of the frame. The IC expects them on | 918 // Key and receiver are on top of the frame. The IC expects them on |
904 // the stack. It does not drop them. | 919 // the stack. It does not drop them. |
905 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 920 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
906 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. | 921 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. |
907 return RawCallCodeObject(ic, mode); | 922 return RawCallCodeObject(ic, mode); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 ASSERT(stack_pointer_ == element_count() - 1); | 1136 ASSERT(stack_pointer_ == element_count() - 1); |
1122 elements_.Add(FrameElement::MemoryElement()); | 1137 elements_.Add(FrameElement::MemoryElement()); |
1123 stack_pointer_++; | 1138 stack_pointer_++; |
1124 __ push(immediate); | 1139 __ push(immediate); |
1125 } | 1140 } |
1126 | 1141 |
1127 | 1142 |
1128 #undef __ | 1143 #undef __ |
1129 | 1144 |
1130 } } // namespace v8::internal | 1145 } } // namespace v8::internal |
OLD | NEW |