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

Side by Side Diff: src/serialize.cc

Issue 9535013: Merge r10809 from the bleeding_edge to the 3.8 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.8/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « src/serialize.h ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 PutSection(static_cast<int>(integer & 0x7f), "IntLastPart"); 1081 PutSection(static_cast<int>(integer & 0x7f), "IntLastPart");
1082 } 1082 }
1083 1083
1084 1084
1085 Serializer::Serializer(SnapshotByteSink* sink) 1085 Serializer::Serializer(SnapshotByteSink* sink)
1086 : sink_(sink), 1086 : sink_(sink),
1087 current_root_index_(0), 1087 current_root_index_(0),
1088 external_reference_encoder_(new ExternalReferenceEncoder), 1088 external_reference_encoder_(new ExternalReferenceEncoder),
1089 large_object_total_(0), 1089 large_object_total_(0),
1090 root_index_wave_front_(0) { 1090 root_index_wave_front_(0) {
1091 isolate_ = Isolate::Current();
1091 // The serializer is meant to be used only to generate initial heap images 1092 // The serializer is meant to be used only to generate initial heap images
1092 // from a context in which there is only one isolate. 1093 // from a context in which there is only one isolate.
1093 ASSERT(Isolate::Current()->IsDefaultIsolate()); 1094 ASSERT(isolate_->IsDefaultIsolate());
1094 for (int i = 0; i <= LAST_SPACE; i++) { 1095 for (int i = 0; i <= LAST_SPACE; i++) {
1095 fullness_[i] = 0; 1096 fullness_[i] = 0;
1096 } 1097 }
1097 } 1098 }
1098 1099
1099 1100
1100 Serializer::~Serializer() { 1101 Serializer::~Serializer() {
1101 delete external_reference_encoder_; 1102 delete external_reference_encoder_;
1102 } 1103 }
1103 1104
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 } 1636 }
1636 if (SpaceIsPaged(space)) { 1637 if (SpaceIsPaged(space)) {
1637 // Paged spaces are a little special. We encode their addresses as if the 1638 // Paged spaces are a little special. We encode their addresses as if the
1638 // pages were all contiguous and each page were filled up in the range 1639 // pages were all contiguous and each page were filled up in the range
1639 // 0 - Page::kObjectAreaSize. In practice the pages may not be contiguous 1640 // 0 - Page::kObjectAreaSize. In practice the pages may not be contiguous
1640 // and allocation does not start at offset 0 in the page, but this scheme 1641 // and allocation does not start at offset 0 in the page, but this scheme
1641 // means the deserializer can get the page number quickly by shifting the 1642 // means the deserializer can get the page number quickly by shifting the
1642 // serialized address. 1643 // serialized address.
1643 CHECK(IsPowerOf2(Page::kPageSize)); 1644 CHECK(IsPowerOf2(Page::kPageSize));
1644 int used_in_this_page = (fullness_[space] & (Page::kPageSize - 1)); 1645 int used_in_this_page = (fullness_[space] & (Page::kPageSize - 1));
1645 CHECK(size <= Page::kObjectAreaSize); 1646 CHECK(size <= SpaceAreaSize(space));
1646 if (used_in_this_page + size > Page::kObjectAreaSize) { 1647 if (used_in_this_page + size > SpaceAreaSize(space)) {
1647 *new_page = true; 1648 *new_page = true;
1648 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1649 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1649 } 1650 }
1650 } 1651 }
1651 int allocation_address = fullness_[space]; 1652 int allocation_address = fullness_[space];
1652 fullness_[space] = allocation_address + size; 1653 fullness_[space] = allocation_address + size;
1653 return allocation_address; 1654 return allocation_address;
1654 } 1655 }
1655 1656
1656 1657
1658 int Serializer::SpaceAreaSize(int space) {
1659 if (space == CODE_SPACE) {
1660 return isolate_->memory_allocator()->CodePageAreaSize();
1661 } else {
1662 return Page::kPageSize - Page::kObjectStartOffset;
1663 }
1664 }
1665
1666
1657 } } // namespace v8::internal 1667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698