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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 return RawCallCodeObject(ic, mode); | 1136 return RawCallCodeObject(ic, mode); |
1137 } | 1137 } |
1138 | 1138 |
1139 | 1139 |
1140 Result VirtualFrame::CallConstructor(int arg_count) { | 1140 Result VirtualFrame::CallConstructor(int arg_count) { |
1141 // Arguments, receiver, and function are on top of the frame. The | 1141 // Arguments, receiver, and function are on top of the frame. The |
1142 // IC expects arg count in eax, function in edi, and the arguments | 1142 // IC expects arg count in eax, function in edi, and the arguments |
1143 // and receiver on the stack. | 1143 // and receiver on the stack. |
1144 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); | 1144 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); |
1145 // Duplicate the function before preparing the frame. | 1145 // Duplicate the function before preparing the frame. |
1146 PushElementAt(arg_count + 1); | 1146 PushElementAt(arg_count); |
1147 Result function = Pop(); | 1147 Result function = Pop(); |
1148 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver. | 1148 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. |
1149 function.ToRegister(edi); | 1149 function.ToRegister(edi); |
1150 | 1150 |
1151 // Constructors are called with the number of arguments in register | 1151 // Constructors are called with the number of arguments in register |
1152 // eax for now. Another option would be to have separate construct | 1152 // eax for now. Another option would be to have separate construct |
1153 // call trampolines per different arguments counts encountered. | 1153 // call trampolines per different arguments counts encountered. |
1154 Result num_args = cgen()->allocator()->Allocate(eax); | 1154 Result num_args = cgen()->allocator()->Allocate(eax); |
1155 ASSERT(num_args.is_valid()); | 1155 ASSERT(num_args.is_valid()); |
1156 __ Set(num_args.reg(), Immediate(arg_count)); | 1156 __ Set(num_args.reg(), Immediate(arg_count)); |
1157 | 1157 |
1158 function.Unuse(); | 1158 function.Unuse(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 } | 1325 } |
1326 UNREACHABLE(); | 1326 UNREACHABLE(); |
1327 } | 1327 } |
1328 | 1328 |
1329 | 1329 |
1330 #undef __ | 1330 #undef __ |
1331 | 1331 |
1332 } } // namespace v8::internal | 1332 } } // namespace v8::internal |
1333 | 1333 |
1334 #endif // V8_TARGET_ARCH_IA32 | 1334 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |