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

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

Issue 149002: X64: Count operations (increment, decrement) (Closed)
Patch Set: Created 11 years, 5 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
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 for (int i = new_backing_index + 1; i < element_count(); i++) { 277 for (int i = new_backing_index + 1; i < element_count(); i++) {
278 if (elements_[i].is_copy() && elements_[i].index() == index) { 278 if (elements_[i].is_copy() && elements_[i].index() == index) {
279 elements_[i].set_index(new_backing_index); 279 elements_[i].set_index(new_backing_index);
280 elements_[new_backing_index].set_copied(); 280 elements_[new_backing_index].set_copied();
281 } 281 }
282 } 282 }
283 return new_backing_index; 283 return new_backing_index;
284 } 284 }
285 285
286 286
287 void VirtualFrame::TakeFrameSlotAt(int index) {
288 ASSERT(index >= 0);
289 ASSERT(index <= element_count());
290 FrameElement original = elements_[index];
291 int new_backing_store_index = InvalidateFrameSlotAt(index);
292 if (new_backing_store_index != kIllegalIndex) {
293 elements_.Add(CopyElementAt(new_backing_store_index));
294 return;
295 }
296
297 switch (original.type()) {
298 case FrameElement::MEMORY: {
299 // Emit code to load the original element's data into a register.
300 // Push that register as a FrameElement on top of the frame.
301 Result fresh = cgen()->allocator()->Allocate();
302 ASSERT(fresh.is_valid());
303 FrameElement new_element =
304 FrameElement::RegisterElement(fresh.reg(),
305 FrameElement::NOT_SYNCED);
306 Use(fresh.reg(), element_count());
307 elements_.Add(new_element);
308 __ movq(fresh.reg(), Operand(rbp, fp_relative(index)));
309 break;
310 }
311 case FrameElement::REGISTER:
312 Use(original.reg(), element_count());
313 // Fall through.
314 case FrameElement::CONSTANT:
315 case FrameElement::COPY:
316 original.clear_sync();
317 elements_.Add(original);
318 break;
319 case FrameElement::INVALID:
320 UNREACHABLE();
321 break;
322 }
323 }
324
325
287 void VirtualFrame::StoreToFrameSlotAt(int index) { 326 void VirtualFrame::StoreToFrameSlotAt(int index) {
288 // Store the value on top of the frame to the virtual frame slot at 327 // Store the value on top of the frame to the virtual frame slot at
289 // a given index. The value on top of the frame is left in place. 328 // a given index. The value on top of the frame is left in place.
290 // This is a duplicating operation, so it can create copies. 329 // This is a duplicating operation, so it can create copies.
291 ASSERT(index >= 0); 330 ASSERT(index >= 0);
292 ASSERT(index < element_count()); 331 ASSERT(index < element_count());
293 332
294 int top_index = element_count() - 1; 333 int top_index = element_count() - 1;
295 FrameElement top = elements_[top_index]; 334 FrameElement top = elements_[top_index];
296 FrameElement original = elements_[index]; 335 FrameElement original = elements_[index];
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 1034
996 name.Unuse(); 1035 name.Unuse();
997 value.Unuse(); 1036 value.Unuse();
998 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 1037 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
999 } 1038 }
1000 1039
1001 1040
1002 #undef __ 1041 #undef __
1003 1042
1004 } } // namespace v8::internal 1043 } } // namespace v8::internal
OLDNEW
« src/x64/register-allocator-x64.cc ('K') | « src/x64/register-allocator-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698