Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 } | 163 } |
| 164 | 164 |
| 165 Address base() const { return m_base; } | 165 Address base() const { return m_base; } |
| 166 size_t size() const { return m_size; } | 166 size_t size() const { return m_size; } |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 Address m_base; | 169 Address m_base; |
| 170 size_t m_size; | 170 size_t m_size; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 static NEVER_INLINE void blinkGCOutOfMemory() | |
| 174 { | |
| 175 IMMEDIATE_CRASH(); | |
|
sof
2015/03/30 08:06:33
Could you mimic PartitionAlloc's partitionOutOfMem
haraken
2015/03/30 09:24:13
I investigated but it seems it's involved (we need
| |
| 176 } | |
| 177 | |
| 173 // A PageMemoryRegion represents a chunk of reserved virtual address | 178 // A PageMemoryRegion represents a chunk of reserved virtual address |
| 174 // space containing a number of blink heap pages. On Windows, reserved | 179 // space containing a number of blink heap pages. On Windows, reserved |
| 175 // virtual address space can only be given back to the system as a | 180 // virtual address space can only be given back to the system as a |
| 176 // whole. The PageMemoryRegion allows us to do that by keeping track | 181 // whole. The PageMemoryRegion allows us to do that by keeping track |
| 177 // of the number of pages using it in order to be able to release all | 182 // of the number of pages using it in order to be able to release all |
| 178 // of the virtual address space when there are no more pages using it. | 183 // of the virtual address space when there are no more pages using it. |
| 179 class PageMemoryRegion : public MemoryRegion { | 184 class PageMemoryRegion : public MemoryRegion { |
| 180 public: | 185 public: |
| 181 ~PageMemoryRegion() | 186 ~PageMemoryRegion() |
| 182 { | 187 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 size_t offset = blinkPageAddress(address) - base(); | 246 size_t offset = blinkPageAddress(address) - base(); |
| 242 ASSERT(offset % blinkPageSize == 0); | 247 ASSERT(offset % blinkPageSize == 0); |
| 243 return offset / blinkPageSize; | 248 return offset / blinkPageSize; |
| 244 } | 249 } |
| 245 | 250 |
| 246 static PageMemoryRegion* allocate(size_t size, unsigned numPages) | 251 static PageMemoryRegion* allocate(size_t size, unsigned numPages) |
| 247 { | 252 { |
| 248 // Round size up to the allocation granularity. | 253 // Round size up to the allocation granularity. |
| 249 size = (size + WTF::kPageAllocationGranularityOffsetMask) & WTF::kPageAl locationGranularityBaseMask; | 254 size = (size + WTF::kPageAllocationGranularityOffsetMask) & WTF::kPageAl locationGranularityBaseMask; |
| 250 Address base = static_cast<Address>(WTF::allocPages(nullptr, size, blink PageSize)); | 255 Address base = static_cast<Address>(WTF::allocPages(nullptr, size, blink PageSize)); |
| 251 RELEASE_ASSERT(base); | 256 if (!base) |
| 257 blinkGCOutOfMemory(); | |
| 252 WTF::setSystemPagesInaccessible(base, size); | 258 WTF::setSystemPagesInaccessible(base, size); |
| 253 return new PageMemoryRegion(base, size, numPages); | 259 return new PageMemoryRegion(base, size, numPages); |
| 254 } | 260 } |
| 255 | 261 |
| 256 bool m_isLargePage; | 262 bool m_isLargePage; |
| 257 bool m_inUse[blinkPagesPerRegion]; | 263 bool m_inUse[blinkPagesPerRegion]; |
| 258 unsigned m_numPages; | 264 unsigned m_numPages; |
| 259 }; | 265 }; |
| 260 | 266 |
| 261 // Representation of the memory used for a Blink heap page. | 267 // Representation of the memory used for a Blink heap page. |
| (...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2827 size_t Heap::s_allocatedObjectSize = 0; | 2833 size_t Heap::s_allocatedObjectSize = 0; |
| 2828 size_t Heap::s_allocatedSpace = 0; | 2834 size_t Heap::s_allocatedSpace = 0; |
| 2829 size_t Heap::s_markedObjectSize = 0; | 2835 size_t Heap::s_markedObjectSize = 0; |
| 2830 | 2836 |
| 2831 size_t Heap::s_externallyAllocatedBytes = 0; | 2837 size_t Heap::s_externallyAllocatedBytes = 0; |
| 2832 size_t Heap::s_externallyAllocatedBytesAlive = 0; | 2838 size_t Heap::s_externallyAllocatedBytesAlive = 0; |
| 2833 unsigned Heap::s_requestedUrgentGC = false; | 2839 unsigned Heap::s_requestedUrgentGC = false; |
| 2834 double Heap::s_markingTimeInLastGC = 0.0; | 2840 double Heap::s_markingTimeInLastGC = 0.0; |
| 2835 | 2841 |
| 2836 } // namespace blink | 2842 } // namespace blink |
| OLD | NEW |