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

Side by Side Diff: src/serialize.cc

Issue 689663002: Fix not proper chunk sizes in serializer. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 // have to keep track of multiple chunks. 1908 // have to keep track of multiple chunks.
1909 pending_chunk_[LO_SPACE] += size; 1909 pending_chunk_[LO_SPACE] += size;
1910 return BackReference::LargeObjectReference(seen_large_objects_index_++); 1910 return BackReference::LargeObjectReference(seen_large_objects_index_++);
1911 } 1911 }
1912 1912
1913 1913
1914 BackReference Serializer::Allocate(AllocationSpace space, int size) { 1914 BackReference Serializer::Allocate(AllocationSpace space, int size) {
1915 CHECK(space >= 0 && space < kNumberOfPreallocatedSpaces); 1915 CHECK(space >= 0 && space < kNumberOfPreallocatedSpaces);
1916 DCHECK(size > 0 && size <= Page::kMaxRegularHeapObjectSize); 1916 DCHECK(size > 0 && size <= Page::kMaxRegularHeapObjectSize);
1917 uint32_t new_chunk_size = pending_chunk_[space] + size; 1917 uint32_t new_chunk_size = pending_chunk_[space] + size;
1918 if (new_chunk_size > static_cast<uint32_t>(Page::kMaxRegularHeapObjectSize)) { 1918 const int kMaxChunkSize =
1919 space == CODE_SPACE ?
1920 // Code page has addidional guard areas at the start and at the end.
1921 Page::kPageSize - (MemoryAllocator::CodePageAreaStartOffset() +
1922 MemoryAllocator::CodePageGuardSize()) :
1923 Page::kMaxRegularHeapObjectSize;
Yang 2014/10/30 09:36:29 Wouldn't it be easier to use MemoryAllocator::Code
1924 if (new_chunk_size > static_cast<uint32_t>(kMaxChunkSize)) {
1919 // The new chunk size would not fit onto a single page. Complete the 1925 // The new chunk size would not fit onto a single page. Complete the
1920 // current chunk and start a new one. 1926 // current chunk and start a new one.
1921 completed_chunks_[space].Add(pending_chunk_[space]); 1927 completed_chunks_[space].Add(pending_chunk_[space]);
1922 pending_chunk_[space] = 0; 1928 pending_chunk_[space] = 0;
1923 new_chunk_size = size; 1929 new_chunk_size = size;
1924 } 1930 }
1925 uint32_t offset = pending_chunk_[space]; 1931 uint32_t offset = pending_chunk_[space];
1926 pending_chunk_[space] = new_chunk_size; 1932 pending_chunk_[space] = new_chunk_size;
1927 return BackReference::Reference(space, completed_chunks_[space].length(), 1933 return BackReference::Reference(space, completed_chunks_[space].length(),
1928 offset); 1934 offset);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 2330
2325 int SerializedCodeData::CheckSum(String* string) { 2331 int SerializedCodeData::CheckSum(String* string) {
2326 int checksum = Version::Hash(); 2332 int checksum = Version::Hash();
2327 #ifdef DEBUG 2333 #ifdef DEBUG
2328 uint32_t seed = static_cast<uint32_t>(checksum); 2334 uint32_t seed = static_cast<uint32_t>(checksum);
2329 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 2335 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
2330 #endif // DEBUG 2336 #endif // DEBUG
2331 return checksum; 2337 return checksum;
2332 } 2338 }
2333 } } // namespace v8::internal 2339 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698