OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 ASSERT_EQ(kLargeCode, space_index); | 605 ASSERT_EQ(kLargeCode, space_index); |
606 new_allocation = | 606 new_allocation = |
607 lo_space->AllocateRaw(size, EXECUTABLE)->ToObjectUnchecked(); | 607 lo_space->AllocateRaw(size, EXECUTABLE)->ToObjectUnchecked(); |
608 } | 608 } |
609 HeapObject* new_object = HeapObject::cast(new_allocation); | 609 HeapObject* new_object = HeapObject::cast(new_allocation); |
610 // Record all large objects in the same space. | 610 // Record all large objects in the same space. |
611 address = new_object->address(); | 611 address = new_object->address(); |
612 pages_[LO_SPACE].Add(address); | 612 pages_[LO_SPACE].Add(address); |
613 } | 613 } |
614 last_object_address_ = address; | 614 last_object_address_ = address; |
615 ASSERT(address >= Page::FromAddress(address)->ObjectAreaStart()); | |
616 return address; | 615 return address; |
617 } | 616 } |
618 | 617 |
619 | 618 |
620 // This returns the address of an object that has been described in the | 619 // This returns the address of an object that has been described in the |
621 // snapshot as being offset bytes back in a particular space. | 620 // snapshot as being offset bytes back in a particular space. |
622 HeapObject* Deserializer::GetAddressFromEnd(int space) { | 621 HeapObject* Deserializer::GetAddressFromEnd(int space) { |
623 int offset = source_->GetInt(); | 622 int offset = source_->GetInt(); |
624 ASSERT(!SpaceIsLarge(space)); | 623 ASSERT(!SpaceIsLarge(space)); |
625 offset <<= kObjectAlignmentBits; | 624 offset <<= kObjectAlignmentBits; |
626 Address address = high_water_[space] - offset; | 625 return HeapObject::FromAddress(high_water_[space] - offset); |
627 // This assert will fail if kMinimumSpaceSizes is too small for a space, | |
628 // because we rely on the fact that all allocation is linear when the VM | |
629 // is very young. | |
630 ASSERT(address >= Page::FromAddress(address)->ObjectAreaStart()); | |
631 return HeapObject::FromAddress(address); | |
632 } | 626 } |
633 | 627 |
634 | 628 |
635 // This returns the address of an object that has been described in the | 629 // This returns the address of an object that has been described in the |
636 // snapshot as being offset bytes into a particular space. | 630 // snapshot as being offset bytes into a particular space. |
637 HeapObject* Deserializer::GetAddressFromStart(int space) { | 631 HeapObject* Deserializer::GetAddressFromStart(int space) { |
638 int offset = source_->GetInt(); | 632 int offset = source_->GetInt(); |
639 if (SpaceIsLarge(space)) { | 633 if (SpaceIsLarge(space)) { |
640 // Large spaces have one object per 'page'. | 634 // Large spaces have one object per 'page'. |
641 return HeapObject::FromAddress(pages_[LO_SPACE][offset]); | 635 return HeapObject::FromAddress(pages_[LO_SPACE][offset]); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1671 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1678 } | 1672 } |
1679 } | 1673 } |
1680 int allocation_address = fullness_[space]; | 1674 int allocation_address = fullness_[space]; |
1681 fullness_[space] = allocation_address + size; | 1675 fullness_[space] = allocation_address + size; |
1682 return allocation_address; | 1676 return allocation_address; |
1683 } | 1677 } |
1684 | 1678 |
1685 | 1679 |
1686 } } // namespace v8::internal | 1680 } } // namespace v8::internal |
OLD | NEW |