OLD | NEW |
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 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 // There is a string and a number per entry so the length is twice the number | 2815 // There is a string and a number per entry so the length is twice the number |
2816 // of entries. | 2816 // of entries. |
2817 return number_string_cache_size * 2; | 2817 return number_string_cache_size * 2; |
2818 } | 2818 } |
2819 | 2819 |
2820 | 2820 |
2821 void Heap::AllocateFullSizeNumberStringCache() { | 2821 void Heap::AllocateFullSizeNumberStringCache() { |
2822 // The idea is to have a small number string cache in the snapshot to keep | 2822 // The idea is to have a small number string cache in the snapshot to keep |
2823 // boot-time memory usage down. If we expand the number string cache already | 2823 // boot-time memory usage down. If we expand the number string cache already |
2824 // while creating the snapshot then that didn't work out. | 2824 // while creating the snapshot then that didn't work out. |
2825 ASSERT(!Serializer::enabled()); | 2825 ASSERT(!Serializer::enabled() || FLAG_extra_code != NULL); |
2826 MaybeObject* maybe_obj = | 2826 MaybeObject* maybe_obj = |
2827 AllocateFixedArray(FullSizeNumberStringCacheLength(), TENURED); | 2827 AllocateFixedArray(FullSizeNumberStringCacheLength(), TENURED); |
2828 Object* new_cache; | 2828 Object* new_cache; |
2829 if (maybe_obj->ToObject(&new_cache)) { | 2829 if (maybe_obj->ToObject(&new_cache)) { |
2830 // We don't bother to repopulate the cache with entries from the old cache. | 2830 // We don't bother to repopulate the cache with entries from the old cache. |
2831 // It will be repopulated soon enough with new strings. | 2831 // It will be repopulated soon enough with new strings. |
2832 set_number_string_cache(FixedArray::cast(new_cache)); | 2832 set_number_string_cache(FixedArray::cast(new_cache)); |
2833 } | 2833 } |
2834 // If allocation fails then we just return without doing anything. It is only | 2834 // If allocation fails then we just return without doing anything. It is only |
2835 // a cache, so best effort is OK here. | 2835 // a cache, so best effort is OK here. |
(...skipping 4316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7152 } else { | 7152 } else { |
7153 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 7153 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
7154 } | 7154 } |
7155 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 7155 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
7156 reinterpret_cast<Address>(p); | 7156 reinterpret_cast<Address>(p); |
7157 remembered_unmapped_pages_index_++; | 7157 remembered_unmapped_pages_index_++; |
7158 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 7158 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
7159 } | 7159 } |
7160 | 7160 |
7161 } } // namespace v8::internal | 7161 } } // namespace v8::internal |
OLD | NEW |