| OLD | NEW |
| 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 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 pending_chunk_[LO_SPACE] += size; | 1911 pending_chunk_[LO_SPACE] += size; |
| 1912 return seen_large_objects_index_++; | 1912 return seen_large_objects_index_++; |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 | 1915 |
| 1916 uint32_t Serializer::Allocate(int space, int size) { | 1916 uint32_t Serializer::Allocate(int space, int size) { |
| 1917 CHECK(space >= 0 && space < kNumberOfPreallocatedSpaces); | 1917 CHECK(space >= 0 && space < kNumberOfPreallocatedSpaces); |
| 1918 DCHECK(size > 0 && size < Page::kMaxRegularHeapObjectSize); | 1918 DCHECK(size > 0 && size < Page::kMaxRegularHeapObjectSize); |
| 1919 uint32_t new_chunk_size = pending_chunk_[space] + size; | 1919 uint32_t new_chunk_size = pending_chunk_[space] + size; |
| 1920 uint32_t allocation; | 1920 uint32_t allocation; |
| 1921 if (new_chunk_size > Page::kMaxRegularHeapObjectSize) { | 1921 if (new_chunk_size > static_cast<uint32_t>(Page::kMaxRegularHeapObjectSize)) { |
| 1922 // The new chunk size would not fit onto a single page. Complete the | 1922 // The new chunk size would not fit onto a single page. Complete the |
| 1923 // current chunk and start a new one. | 1923 // current chunk and start a new one. |
| 1924 completed_chunks_[space].Add(pending_chunk_[space]); | 1924 completed_chunks_[space].Add(pending_chunk_[space]); |
| 1925 pending_chunk_[space] = 0; | 1925 pending_chunk_[space] = 0; |
| 1926 new_chunk_size = size; | 1926 new_chunk_size = size; |
| 1927 } | 1927 } |
| 1928 // For back-referencing, each allocation is encoded as a combination | 1928 // For back-referencing, each allocation is encoded as a combination |
| 1929 // of chunk index and offset inside the chunk. | 1929 // of chunk index and offset inside the chunk. |
| 1930 allocation = ChunkIndexBits::encode(completed_chunks_[space].length()) | | 1930 allocation = ChunkIndexBits::encode(completed_chunks_[space].length()) | |
| 1931 OffsetBits::encode(pending_chunk_[space]); | 1931 OffsetBits::encode(pending_chunk_[space]); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 | 2261 |
| 2262 int SerializedCodeData::CheckSum(String* string) { | 2262 int SerializedCodeData::CheckSum(String* string) { |
| 2263 int checksum = Version::Hash(); | 2263 int checksum = Version::Hash(); |
| 2264 #ifdef DEBUG | 2264 #ifdef DEBUG |
| 2265 uint32_t seed = static_cast<uint32_t>(checksum); | 2265 uint32_t seed = static_cast<uint32_t>(checksum); |
| 2266 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 2266 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
| 2267 #endif // DEBUG | 2267 #endif // DEBUG |
| 2268 return checksum; | 2268 return checksum; |
| 2269 } | 2269 } |
| 2270 } } // namespace v8::internal | 2270 } } // namespace v8::internal |
| OLD | NEW |