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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. | 918 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. |
919 value.ToRegister(eax); | 919 value.ToRegister(eax); |
920 value.Unuse(); | 920 value.Unuse(); |
921 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 921 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
922 } | 922 } |
923 | 923 |
924 | 924 |
925 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 925 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
926 int arg_count, | 926 int arg_count, |
927 int loop_nesting) { | 927 int loop_nesting) { |
928 // Arguments, receiver, and function name are on top of the frame. | 928 // Function name, arguments, and receiver are on top of the frame. |
929 // The IC expects them on the stack. It does not drop the function | 929 // The IC expects the name in ecx and the rest on the stack and |
930 // name slot (but it does drop the rest). | 930 // drops them all. |
931 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; | 931 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; |
932 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); | 932 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); |
933 // Spill args, receiver, and function. The call will drop args and | 933 // Spill args, receiver, and function. The call will drop args and |
934 // receiver. | 934 // receiver. |
935 PrepareForCall(arg_count + 2, arg_count + 1); | 935 Result name = Pop(); |
| 936 PrepareForCall(arg_count + 1, arg_count + 1); // Arguments + receiver. |
| 937 name.ToRegister(ecx); |
| 938 name.Unuse(); |
936 return RawCallCodeObject(ic, mode); | 939 return RawCallCodeObject(ic, mode); |
937 } | 940 } |
938 | 941 |
939 | 942 |
940 Result VirtualFrame::CallConstructor(int arg_count) { | 943 Result VirtualFrame::CallConstructor(int arg_count) { |
941 // Arguments, receiver, and function are on top of the frame. The | 944 // Arguments, receiver, and function are on top of the frame. The |
942 // IC expects arg count in eax, function in edi, and the arguments | 945 // IC expects arg count in eax, function in edi, and the arguments |
943 // and receiver on the stack. | 946 // and receiver on the stack. |
944 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); | 947 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); |
945 // Duplicate the function before preparing the frame. | 948 // Duplicate the function before preparing the frame. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 ASSERT(stack_pointer_ == element_count() - 1); | 1076 ASSERT(stack_pointer_ == element_count() - 1); |
1074 elements_.Add(FrameElement::MemoryElement()); | 1077 elements_.Add(FrameElement::MemoryElement()); |
1075 stack_pointer_++; | 1078 stack_pointer_++; |
1076 __ push(immediate); | 1079 __ push(immediate); |
1077 } | 1080 } |
1078 | 1081 |
1079 | 1082 |
1080 #undef __ | 1083 #undef __ |
1081 | 1084 |
1082 } } // namespace v8::internal | 1085 } } // namespace v8::internal |
OLD | NEW |