Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Side by Side Diff: src/serialize.cc

Issue 9233050: Reduce memory use immediately after boot. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
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());
615 return address; 616 return address;
616 } 617 }
617 618
618 619
619 // This returns the address of an object that has been described in the 620 // This returns the address of an object that has been described in the
620 // snapshot as being offset bytes back in a particular space. 621 // snapshot as being offset bytes back in a particular space.
621 HeapObject* Deserializer::GetAddressFromEnd(int space) { 622 HeapObject* Deserializer::GetAddressFromEnd(int space) {
622 int offset = source_->GetInt(); 623 int offset = source_->GetInt();
623 ASSERT(!SpaceIsLarge(space)); 624 ASSERT(!SpaceIsLarge(space));
624 offset <<= kObjectAlignmentBits; 625 offset <<= kObjectAlignmentBits;
625 return HeapObject::FromAddress(high_water_[space] - offset); 626 Address address = 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);
626 } 632 }
627 633
628 634
629 // This returns the address of an object that has been described in the 635 // This returns the address of an object that has been described in the
630 // snapshot as being offset bytes into a particular space. 636 // snapshot as being offset bytes into a particular space.
631 HeapObject* Deserializer::GetAddressFromStart(int space) { 637 HeapObject* Deserializer::GetAddressFromStart(int space) {
632 int offset = source_->GetInt(); 638 int offset = source_->GetInt();
633 if (SpaceIsLarge(space)) { 639 if (SpaceIsLarge(space)) {
634 // Large spaces have one object per 'page'. 640 // Large spaces have one object per 'page'.
635 return HeapObject::FromAddress(pages_[LO_SPACE][offset]); 641 return HeapObject::FromAddress(pages_[LO_SPACE][offset]);
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1654 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1649 } 1655 }
1650 } 1656 }
1651 int allocation_address = fullness_[space]; 1657 int allocation_address = fullness_[space];
1652 fullness_[space] = allocation_address + size; 1658 fullness_[space] = allocation_address + size;
1653 return allocation_address; 1659 return allocation_address;
1654 } 1660 }
1655 1661
1656 1662
1657 } } // namespace v8::internal 1663 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698