| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 ASSERT(index < elements_.length()); | 630 ASSERT(index < elements_.length()); |
| 631 | 631 |
| 632 int top_index = elements_.length() - 1; | 632 int top_index = elements_.length() - 1; |
| 633 FrameElement top = elements_[top_index]; | 633 FrameElement top = elements_[top_index]; |
| 634 FrameElement original = elements_[index]; | 634 FrameElement original = elements_[index]; |
| 635 if (top.is_copy() && top.index() == index) return; | 635 if (top.is_copy() && top.index() == index) return; |
| 636 ASSERT(top.is_valid()); | 636 ASSERT(top.is_valid()); |
| 637 | 637 |
| 638 InvalidateFrameSlotAt(index); | 638 InvalidateFrameSlotAt(index); |
| 639 | 639 |
| 640 // InvalidateFrameSlotAt can potentially change any frame element, due |
| 641 // to spilling registers to allocate temporaries in order to preserve |
| 642 // the copy-on-write semantics of aliased elements. Reload top from |
| 643 // the frame. |
| 644 top = elements_[top_index]; |
| 645 |
| 640 if (top.is_copy()) { | 646 if (top.is_copy()) { |
| 641 // There are two cases based on the relative positions of the | 647 // There are two cases based on the relative positions of the |
| 642 // stored-to slot and the backing slot of the top element. | 648 // stored-to slot and the backing slot of the top element. |
| 643 int backing_index = top.index(); | 649 int backing_index = top.index(); |
| 644 ASSERT(backing_index != index); | 650 ASSERT(backing_index != index); |
| 645 if (backing_index < index) { | 651 if (backing_index < index) { |
| 646 // 1. The top element is a copy of a slot below the stored-to | 652 // 1. The top element is a copy of a slot below the stored-to |
| 647 // slot. The stored-to slot becomes an unsynced copy of that | 653 // slot. The stored-to slot becomes an unsynced copy of that |
| 648 // same backing slot. | 654 // same backing slot. |
| 649 elements_[index] = CopyElementAt(backing_index); | 655 elements_[index] = CopyElementAt(backing_index); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 ASSERT(stack_pointer_ == elements_.length() - 1); | 1059 ASSERT(stack_pointer_ == elements_.length() - 1); |
| 1054 elements_.Add(FrameElement::MemoryElement()); | 1060 elements_.Add(FrameElement::MemoryElement()); |
| 1055 stack_pointer_++; | 1061 stack_pointer_++; |
| 1056 __ push(immediate); | 1062 __ push(immediate); |
| 1057 } | 1063 } |
| 1058 | 1064 |
| 1059 | 1065 |
| 1060 #undef __ | 1066 #undef __ |
| 1061 | 1067 |
| 1062 } } // namespace v8::internal | 1068 } } // namespace v8::internal |
| OLD | NEW |