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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 ASSERT(index < elements_.length()); | 616 ASSERT(index < elements_.length()); |
617 | 617 |
618 int top_index = elements_.length() - 1; | 618 int top_index = elements_.length() - 1; |
619 FrameElement top = elements_[top_index]; | 619 FrameElement top = elements_[top_index]; |
620 FrameElement original = elements_[index]; | 620 FrameElement original = elements_[index]; |
621 if (top.is_copy() && top.index() == index) return; | 621 if (top.is_copy() && top.index() == index) return; |
622 ASSERT(top.is_valid()); | 622 ASSERT(top.is_valid()); |
623 | 623 |
624 InvalidateFrameSlotAt(index); | 624 InvalidateFrameSlotAt(index); |
625 | 625 |
| 626 // InvalidateFrameSlotAt can potentially change any frame element, due |
| 627 // to spilling registers to allocate temporaries in order to preserve |
| 628 // the copy-on-write semantics of aliased elements. Reload top from |
| 629 // the frame. |
| 630 top = elements_[top_index]; |
| 631 |
626 if (top.is_copy()) { | 632 if (top.is_copy()) { |
627 // There are two cases based on the relative positions of the | 633 // There are two cases based on the relative positions of the |
628 // stored-to slot and the backing slot of the top element. | 634 // stored-to slot and the backing slot of the top element. |
629 int backing_index = top.index(); | 635 int backing_index = top.index(); |
630 ASSERT(backing_index != index); | 636 ASSERT(backing_index != index); |
631 if (backing_index < index) { | 637 if (backing_index < index) { |
632 // 1. The top element is a copy of a slot below the stored-to | 638 // 1. The top element is a copy of a slot below the stored-to |
633 // slot. The stored-to slot becomes an unsynced copy of that | 639 // slot. The stored-to slot becomes an unsynced copy of that |
634 // same backing slot. | 640 // same backing slot. |
635 elements_[index] = CopyElementAt(backing_index); | 641 elements_[index] = CopyElementAt(backing_index); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 ASSERT(stack_pointer_ == elements_.length() - 1); | 1045 ASSERT(stack_pointer_ == elements_.length() - 1); |
1040 elements_.Add(FrameElement::MemoryElement()); | 1046 elements_.Add(FrameElement::MemoryElement()); |
1041 stack_pointer_++; | 1047 stack_pointer_++; |
1042 __ push(immediate); | 1048 __ push(immediate); |
1043 } | 1049 } |
1044 | 1050 |
1045 | 1051 |
1046 #undef __ | 1052 #undef __ |
1047 | 1053 |
1048 } } // namespace v8::internal | 1054 } } // namespace v8::internal |
OLD | NEW |