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

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

Issue 42324: Add a bit to a virtual frame element telling if it's been copied. Set... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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
« src/virtual-frame.h ('K') | « src/virtual-frame.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 copy.clear_sync(); 543 copy.clear_sync();
544 } 544 }
545 elements_[j] = copy; 545 elements_[j] = copy;
546 } 546 }
547 } 547 }
548 548
549 copy.clear_sync(); 549 copy.clear_sync();
550 return copy; 550 return copy;
551 } 551 }
552 552
553 elements_[index].clear_copied();
553 return FrameElement::InvalidElement(); 554 return FrameElement::InvalidElement();
554 } 555 }
555 556
556 557
557 void VirtualFrame::TakeFrameSlotAt(int index) { 558 void VirtualFrame::TakeFrameSlotAt(int index) {
558 ASSERT(index >= 0); 559 ASSERT(index >= 0);
559 ASSERT(index <= elements_.length()); 560 ASSERT(index <= elements_.length());
560 FrameElement original = elements_[index]; 561 FrameElement original = elements_[index];
561 562
562 switch (original.type()) { 563 switch (original.type()) {
563 case FrameElement::INVALID: 564 case FrameElement::INVALID:
564 UNREACHABLE(); 565 UNREACHABLE();
565 break; 566 break;
566 567
567 case FrameElement::MEMORY: { 568 case FrameElement::MEMORY: {
568 // Allocate the element to a register. If it is not copied, 569 // Allocate the element to a register. If it is not copied,
569 // push that register on top of the frame. If it is copied, 570 // push that register on top of the frame. If it is copied,
570 // make the first copy the backing store and push a fresh copy 571 // make the first copy the backing store and push a fresh copy
571 // on top of the frame. 572 // on top of the frame.
572 FrameElement copy = AdjustCopies(index); 573 FrameElement copy = original.is_copied()
574 ? AdjustCopies(index)
575 : FrameElement::InvalidElement();
573 if (copy.is_valid()) { 576 if (copy.is_valid()) {
574 // The original element was a copy. Push the copy of the new 577 // The original element was a copy. Push the copy of the new
575 // backing store. 578 // backing store.
576 elements_.Add(copy); 579 elements_.Add(copy);
577 } else { 580 } else {
578 // The element was not a copy. Move it to a register and push 581 // The element was not a copy. Move it to a register and push
579 // that. 582 // that.
580 Result fresh = cgen_->allocator()->Allocate(); 583 Result fresh = cgen_->allocator()->Allocate();
581 ASSERT(fresh.is_valid()); 584 ASSERT(fresh.is_valid());
582 FrameElement new_element = 585 FrameElement new_element =
583 FrameElement::RegisterElement(fresh.reg(), 586 FrameElement::RegisterElement(fresh.reg(),
584 FrameElement::NOT_SYNCED); 587 FrameElement::NOT_SYNCED);
585 Use(fresh.reg()); 588 Use(fresh.reg());
586 elements_.Add(new_element); 589 elements_.Add(new_element);
587 __ mov(fresh.reg(), Operand(ebp, fp_relative(index))); 590 __ mov(fresh.reg(), Operand(ebp, fp_relative(index)));
588 } 591 }
589 break; 592 break;
590 } 593 }
591 594
592 case FrameElement::REGISTER: { 595 case FrameElement::REGISTER: {
593 // If the element is not copied, push it on top of the frame. 596 // If the element is not copied, push it on top of the frame.
594 // If it is copied, make the first copy be the new backing store 597 // If it is copied, make the first copy be the new backing store
595 // and push a fresh copy on top of the frame. 598 // and push a fresh copy on top of the frame.
596 FrameElement copy = AdjustCopies(index); 599 FrameElement copy = original.is_copied()
600 ? AdjustCopies(index)
601 : FrameElement::InvalidElement();
597 if (copy.is_valid()) { 602 if (copy.is_valid()) {
598 // The original element was a copy. Push the copy of the new 603 // The original element was a copy. Push the copy of the new
599 // backing store. 604 // backing store.
600 elements_.Add(copy); 605 elements_.Add(copy);
601 // This is the only case where we have to unuse the original 606 // This is the only case where we have to unuse the original
602 // register. The original is still counted and so is the new 607 // register. The original is still counted and so is the new
603 // backing store of the copies. 608 // backing store of the copies.
604 Unuse(original.reg()); 609 Unuse(original.reg());
605 } else { 610 } else {
606 // The element was not a copy. Push it. 611 // The element was not a copy. Push it.
(...skipping 20 matching lines...) Expand all
627 void VirtualFrame::StoreToFrameSlotAt(int index) { 632 void VirtualFrame::StoreToFrameSlotAt(int index) {
628 // Store the value on top of the frame to the virtual frame slot at 633 // Store the value on top of the frame to the virtual frame slot at
629 // a given index. The value on top of the frame is left in place. 634 // a given index. The value on top of the frame is left in place.
630 // This is a duplicating operation, so it can create copies. 635 // This is a duplicating operation, so it can create copies.
631 ASSERT(index >= 0); 636 ASSERT(index >= 0);
632 ASSERT(index < elements_.length()); 637 ASSERT(index < elements_.length());
633 638
634 FrameElement original = elements_[index]; 639 FrameElement original = elements_[index];
635 // If the stored-to slot may be copied, adjust to preserve the 640 // If the stored-to slot may be copied, adjust to preserve the
636 // copy-on-write semantics of copied elements. 641 // copy-on-write semantics of copied elements.
637 if (original.is_register() || original.is_memory()) { 642 if (original.is_copied() &&
643 (original.is_register() || original.is_memory())) {
638 FrameElement ignored = AdjustCopies(index); 644 FrameElement ignored = AdjustCopies(index);
639 } 645 }
640 646
641 // If the stored-to slot is a register reference, deallocate it. 647 // If the stored-to slot is a register reference, deallocate it.
642 if (original.is_register()) { 648 if (original.is_register()) {
643 Unuse(original.reg()); 649 Unuse(original.reg());
644 } 650 }
645 651
646 int top_index = elements_.length() - 1; 652 int top_index = elements_.length() - 1;
647 FrameElement top = elements_[top_index]; 653 FrameElement top = elements_[top_index];
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 ASSERT(stack_pointer_ == elements_.length() - 1); 992 ASSERT(stack_pointer_ == elements_.length() - 1);
987 elements_.Add(FrameElement::MemoryElement()); 993 elements_.Add(FrameElement::MemoryElement());
988 stack_pointer_++; 994 stack_pointer_++;
989 __ push(immediate); 995 __ push(immediate);
990 } 996 }
991 997
992 998
993 #undef __ 999 #undef __
994 1000
995 } } // namespace v8::internal 1001 } } // namespace v8::internal
OLDNEW
« src/virtual-frame.h ('K') | « src/virtual-frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698