OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. | 1012 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. |
1013 value.ToRegister(rax); | 1013 value.ToRegister(rax); |
1014 value.Unuse(); | 1014 value.Unuse(); |
1015 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1015 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
1016 } | 1016 } |
1017 | 1017 |
1018 | 1018 |
1019 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 1019 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
1020 int arg_count, | 1020 int arg_count, |
1021 int loop_nesting) { | 1021 int loop_nesting) { |
1022 // Arguments, receiver, and function name are on top of the frame. | 1022 // Function name, arguments, and receiver are found on top of the frame |
1023 // The IC expects them on the stack. It does not drop the function | 1023 // and dropped by the call. The IC expects the name in rcx and the rest |
1024 // name slot (but it does drop the rest). | 1024 // on the stack, and drops them all. |
1025 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; | 1025 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; |
1026 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); | 1026 Handle<Code> ic = cgen()->ComputeCallInitialize(arg_count, in_loop); |
| 1027 Result name = Pop(); |
1027 // Spill args, receiver, and function. The call will drop args and | 1028 // Spill args, receiver, and function. The call will drop args and |
1028 // receiver. | 1029 // receiver. |
1029 PrepareForCall(arg_count + 2, arg_count + 1); | 1030 PrepareForCall(arg_count + 1, arg_count + 1); |
| 1031 name.ToRegister(rcx); |
| 1032 name.Unuse(); |
1030 return RawCallCodeObject(ic, mode); | 1033 return RawCallCodeObject(ic, mode); |
1031 } | 1034 } |
1032 | 1035 |
1033 | 1036 |
1034 Result VirtualFrame::CallConstructor(int arg_count) { | 1037 Result VirtualFrame::CallConstructor(int arg_count) { |
1035 // Arguments, receiver, and function are on top of the frame. The | 1038 // Arguments, receiver, and function are on top of the frame. The |
1036 // IC expects arg count in rax, function in rdi, and the arguments | 1039 // IC expects arg count in rax, function in rdi, and the arguments |
1037 // and receiver on the stack. | 1040 // and receiver on the stack. |
1038 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); | 1041 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); |
1039 // Duplicate the function before preparing the frame. | 1042 // Duplicate the function before preparing the frame. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // Grow the expression stack by handler size less one (the return | 1108 // Grow the expression stack by handler size less one (the return |
1106 // address is already pushed by a call instruction). | 1109 // address is already pushed by a call instruction). |
1107 Adjust(kHandlerSize - 1); | 1110 Adjust(kHandlerSize - 1); |
1108 __ PushTryHandler(IN_JAVASCRIPT, type); | 1111 __ PushTryHandler(IN_JAVASCRIPT, type); |
1109 } | 1112 } |
1110 | 1113 |
1111 | 1114 |
1112 #undef __ | 1115 #undef __ |
1113 | 1116 |
1114 } } // namespace v8::internal | 1117 } } // namespace v8::internal |
OLD | NEW |