Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1446)

Side by Side Diff: src/x64/virtual-frame-x64.cc

Issue 3136032: Simplify the way constructors are called and avoid pushing... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 return RawCallCodeObject(ic, mode); 1223 return RawCallCodeObject(ic, mode);
1224 } 1224 }
1225 1225
1226 1226
1227 Result VirtualFrame::CallConstructor(int arg_count) { 1227 Result VirtualFrame::CallConstructor(int arg_count) {
1228 // Arguments, receiver, and function are on top of the frame. The 1228 // Arguments, receiver, and function are on top of the frame. The
1229 // IC expects arg count in rax, function in rdi, and the arguments 1229 // IC expects arg count in rax, function in rdi, and the arguments
1230 // and receiver on the stack. 1230 // and receiver on the stack.
1231 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); 1231 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall));
1232 // Duplicate the function before preparing the frame. 1232 // Duplicate the function before preparing the frame.
1233 PushElementAt(arg_count + 1); 1233 PushElementAt(arg_count);
1234 Result function = Pop(); 1234 Result function = Pop();
1235 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver. 1235 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args.
1236 function.ToRegister(rdi); 1236 function.ToRegister(rdi);
1237 1237
1238 // Constructors are called with the number of arguments in register 1238 // Constructors are called with the number of arguments in register
1239 // rax for now. Another option would be to have separate construct 1239 // rax for now. Another option would be to have separate construct
1240 // call trampolines per different arguments counts encountered. 1240 // call trampolines per different arguments counts encountered.
1241 Result num_args = cgen()->allocator()->Allocate(rax); 1241 Result num_args = cgen()->allocator()->Allocate(rax);
1242 ASSERT(num_args.is_valid()); 1242 ASSERT(num_args.is_valid());
1243 __ Set(num_args.reg(), arg_count); 1243 __ Set(num_args.reg(), arg_count);
1244 1244
1245 function.Unuse(); 1245 function.Unuse();
1246 num_args.Unuse(); 1246 num_args.Unuse();
1247 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL); 1247 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL);
1248 } 1248 }
1249 1249
1250 1250
1251 void VirtualFrame::PushTryHandler(HandlerType type) { 1251 void VirtualFrame::PushTryHandler(HandlerType type) {
1252 ASSERT(cgen()->HasValidEntryRegisters()); 1252 ASSERT(cgen()->HasValidEntryRegisters());
1253 // Grow the expression stack by handler size less one (the return 1253 // Grow the expression stack by handler size less one (the return
1254 // address is already pushed by a call instruction). 1254 // address is already pushed by a call instruction).
1255 Adjust(kHandlerSize - 1); 1255 Adjust(kHandlerSize - 1);
1256 __ PushTryHandler(IN_JAVASCRIPT, type); 1256 __ PushTryHandler(IN_JAVASCRIPT, type);
1257 } 1257 }
1258 1258
1259 1259
1260 #undef __ 1260 #undef __
1261 1261
1262 } } // namespace v8::internal 1262 } } // namespace v8::internal
1263 1263
1264 #endif // V8_TARGET_ARCH_X64 1264 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698