| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 798 |
| 799 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \ | 799 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \ |
| 800 { \ | 800 { \ |
| 801 bool emit_write_barrier = false; \ | 801 bool emit_write_barrier = false; \ |
| 802 bool current_was_incremented = false; \ | 802 bool current_was_incremented = false; \ |
| 803 int space_number = space_number_if_any == kAnyOldSpace ? \ | 803 int space_number = space_number_if_any == kAnyOldSpace ? \ |
| 804 (data & kSpaceMask) : space_number_if_any; \ | 804 (data & kSpaceMask) : space_number_if_any; \ |
| 805 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ | 805 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ |
| 806 ASSIGN_DEST_SPACE(space_number) \ | 806 ASSIGN_DEST_SPACE(space_number) \ |
| 807 ReadObject(space_number, dest_space, current); \ | 807 ReadObject(space_number, dest_space, current); \ |
| 808 emit_write_barrier = \ | 808 emit_write_barrier = (space_number == NEW_SPACE && \ |
| 809 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 809 source_space != NEW_SPACE && \ |
| 810 source_space != CELL_SPACE); \ |
| 810 } else { \ | 811 } else { \ |
| 811 Object* new_object = NULL; /* May not be a real Object pointer. */ \ | 812 Object* new_object = NULL; /* May not be a real Object pointer. */ \ |
| 812 if (where == kNewObject) { \ | 813 if (where == kNewObject) { \ |
| 813 ASSIGN_DEST_SPACE(space_number) \ | 814 ASSIGN_DEST_SPACE(space_number) \ |
| 814 ReadObject(space_number, dest_space, &new_object); \ | 815 ReadObject(space_number, dest_space, &new_object); \ |
| 815 } else if (where == kRootArray) { \ | 816 } else if (where == kRootArray) { \ |
| 816 int root_id = source_->GetInt(); \ | 817 int root_id = source_->GetInt(); \ |
| 817 new_object = isolate->heap()->roots_address()[root_id]; \ | 818 new_object = isolate->heap()->roots_address()[root_id]; \ |
| 818 } else if (where == kPartialSnapshotCache) { \ | 819 } else if (where == kPartialSnapshotCache) { \ |
| 819 int cache_index = source_->GetInt(); \ | 820 int cache_index = source_->GetInt(); \ |
| 820 new_object = isolate->serialize_partial_snapshot_cache() \ | 821 new_object = isolate->serialize_partial_snapshot_cache() \ |
| 821 [cache_index]; \ | 822 [cache_index]; \ |
| 822 } else if (where == kExternalReference) { \ | 823 } else if (where == kExternalReference) { \ |
| 823 int reference_id = source_->GetInt(); \ | 824 int reference_id = source_->GetInt(); \ |
| 824 Address address = external_reference_decoder_-> \ | 825 Address address = external_reference_decoder_-> \ |
| 825 Decode(reference_id); \ | 826 Decode(reference_id); \ |
| 826 new_object = reinterpret_cast<Object*>(address); \ | 827 new_object = reinterpret_cast<Object*>(address); \ |
| 827 } else if (where == kBackref) { \ | 828 } else if (where == kBackref) { \ |
| 828 emit_write_barrier = \ | 829 emit_write_barrier = (space_number == NEW_SPACE && \ |
| 829 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 830 source_space != NEW_SPACE && \ |
| 831 source_space != CELL_SPACE); \ |
| 830 new_object = GetAddressFromEnd(data & kSpaceMask); \ | 832 new_object = GetAddressFromEnd(data & kSpaceMask); \ |
| 831 } else { \ | 833 } else { \ |
| 832 ASSERT(where == kFromStart); \ | 834 ASSERT(where == kFromStart); \ |
| 833 if (offset_from_start == kUnknownOffsetFromStart) { \ | 835 if (offset_from_start == kUnknownOffsetFromStart) { \ |
| 834 emit_write_barrier = \ | 836 emit_write_barrier = (space_number == NEW_SPACE && \ |
| 835 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 837 source_space != NEW_SPACE && \ |
| 838 source_space != CELL_SPACE); \ |
| 836 new_object = GetAddressFromStart(data & kSpaceMask); \ | 839 new_object = GetAddressFromStart(data & kSpaceMask); \ |
| 837 } else { \ | 840 } else { \ |
| 838 Address object_address = pages_[space_number][0] + \ | 841 Address object_address = pages_[space_number][0] + \ |
| 839 (offset_from_start << kObjectAlignmentBits); \ | 842 (offset_from_start << kObjectAlignmentBits); \ |
| 840 new_object = HeapObject::FromAddress(object_address); \ | 843 new_object = HeapObject::FromAddress(object_address); \ |
| 841 } \ | 844 } \ |
| 842 } \ | 845 } \ |
| 843 if (within == kFirstInstruction) { \ | 846 if (within == kFirstInstruction) { \ |
| 844 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ | 847 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ |
| 845 new_object = reinterpret_cast<Object*>( \ | 848 new_object = reinterpret_cast<Object*>( \ |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1583 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1581 } | 1584 } |
| 1582 } | 1585 } |
| 1583 int allocation_address = fullness_[space]; | 1586 int allocation_address = fullness_[space]; |
| 1584 fullness_[space] = allocation_address + size; | 1587 fullness_[space] = allocation_address + size; |
| 1585 return allocation_address; | 1588 return allocation_address; |
| 1586 } | 1589 } |
| 1587 | 1590 |
| 1588 | 1591 |
| 1589 } } // namespace v8::internal | 1592 } } // namespace v8::internal |
| OLD | NEW |