| OLD | NEW |
| 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 720 |
| 721 if (element.is_memory()) { | 721 if (element.is_memory()) { |
| 722 ASSERT(index <= stack_pointer_); | 722 ASSERT(index <= stack_pointer_); |
| 723 // Eagerly load memory elements into a register. The element at | 723 // Eagerly load memory elements into a register. The element at |
| 724 // the index and the new top of the frame are backed by the same | 724 // the index and the new top of the frame are backed by the same |
| 725 // register location. | 725 // register location. |
| 726 Result temp = cgen_->allocator()->Allocate(); | 726 Result temp = cgen_->allocator()->Allocate(); |
| 727 ASSERT(temp.is_valid()); | 727 ASSERT(temp.is_valid()); |
| 728 FrameElement new_element | 728 FrameElement new_element |
| 729 = FrameElement::RegisterElement(temp.reg(), | 729 = FrameElement::RegisterElement(temp.reg(), |
| 730 FrameElement::NOT_SYNCED); | 730 FrameElement::SYNCED); |
| 731 Use(temp.reg()); | 731 Use(temp.reg()); |
| 732 elements_[index] = new_element; | 732 elements_[index] = new_element; |
| 733 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); |
| 734 |
| 733 Use(temp.reg()); | 735 Use(temp.reg()); |
| 736 new_element.clear_sync(); |
| 734 elements_.Add(new_element); | 737 elements_.Add(new_element); |
| 735 | |
| 736 // Finally, move the element at the index into its new location. | |
| 737 elements_[index].set_sync(); | |
| 738 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); | |
| 739 } else { | 738 } else { |
| 740 // For constants and registers, add an (unsynced) copy of the element to | 739 // For constants and registers, add an (unsynced) copy of the element to |
| 741 // the top of the frame. | 740 // the top of the frame. |
| 742 ASSERT(element.is_register() || element.is_constant()); | 741 ASSERT(element.is_register() || element.is_constant()); |
| 743 if (element.is_register()) { | 742 if (element.is_register()) { |
| 744 Use(element.reg()); | 743 Use(element.reg()); |
| 745 } | 744 } |
| 746 element.clear_sync(); | 745 element.clear_sync(); |
| 747 elements_.Add(element); | 746 elements_.Add(element); |
| 748 } | 747 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 // Discard elements from the virtual frame and free any registers. | 890 // Discard elements from the virtual frame and free any registers. |
| 892 for (int i = 0; i < count; i++) { | 891 for (int i = 0; i < count; i++) { |
| 893 FrameElement dropped = elements_.RemoveLast(); | 892 FrameElement dropped = elements_.RemoveLast(); |
| 894 if (dropped.is_register()) { | 893 if (dropped.is_register()) { |
| 895 Unuse(dropped.reg()); | 894 Unuse(dropped.reg()); |
| 896 } | 895 } |
| 897 } | 896 } |
| 898 } | 897 } |
| 899 | 898 |
| 900 | 899 |
| 901 void VirtualFrame::Drop() { Drop(1); } | |
| 902 | |
| 903 | |
| 904 Result VirtualFrame::Pop() { | 900 Result VirtualFrame::Pop() { |
| 905 FrameElement popped = elements_.RemoveLast(); | 901 FrameElement popped = elements_.RemoveLast(); |
| 906 bool pop_needed = (stack_pointer_ == elements_.length()); | 902 bool pop_needed = (stack_pointer_ == elements_.length()); |
| 907 | 903 |
| 908 if (popped.is_constant()) { | 904 if (popped.is_constant()) { |
| 909 if (pop_needed) { | 905 if (pop_needed) { |
| 910 stack_pointer_--; | 906 stack_pointer_--; |
| 911 __ add(Operand(esp), Immediate(kPointerSize)); | 907 __ add(Operand(esp), Immediate(kPointerSize)); |
| 912 } | 908 } |
| 913 return Result(popped.handle(), cgen_); | 909 return Result(popped.handle(), cgen_); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 return false; | 997 return false; |
| 1002 } | 998 } |
| 1003 } | 999 } |
| 1004 return true; | 1000 return true; |
| 1005 } | 1001 } |
| 1006 #endif | 1002 #endif |
| 1007 | 1003 |
| 1008 #undef __ | 1004 #undef __ |
| 1009 | 1005 |
| 1010 } } // namespace v8::internal | 1006 } } // namespace v8::internal |
| OLD | NEW |