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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapPage.h

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Move OOM_CRASH into its own, more specific header. Fixes Windows build. Created 4 years 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
OLDNEW
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 24 matching lines...) Expand all
35 #include "platform/PlatformExport.h" 35 #include "platform/PlatformExport.h"
36 #include "platform/heap/BlinkGC.h" 36 #include "platform/heap/BlinkGC.h"
37 #include "platform/heap/GCInfo.h" 37 #include "platform/heap/GCInfo.h"
38 #include "platform/heap/ThreadState.h" 38 #include "platform/heap/ThreadState.h"
39 #include "platform/heap/Visitor.h" 39 #include "platform/heap/Visitor.h"
40 #include "wtf/AddressSanitizer.h" 40 #include "wtf/AddressSanitizer.h"
41 #include "wtf/Allocator.h" 41 #include "wtf/Allocator.h"
42 #include "wtf/Assertions.h" 42 #include "wtf/Assertions.h"
43 #include "wtf/ContainerAnnotations.h" 43 #include "wtf/ContainerAnnotations.h"
44 #include "wtf/Forward.h" 44 #include "wtf/Forward.h"
45 #include "wtf/allocator/PageAllocator.h" 45 #include "wtf/allocator/Partitions.h"
46 #include <stdint.h> 46 #include <stdint.h>
47 47
48 namespace blink { 48 namespace blink {
49 49
50 const size_t blinkPageSizeLog2 = 17; 50 const size_t blinkPageSizeLog2 = 17;
51 const size_t blinkPageSize = 1 << blinkPageSizeLog2; 51 const size_t blinkPageSize = 1 << blinkPageSizeLog2;
52 const size_t blinkPageOffsetMask = blinkPageSize - 1; 52 const size_t blinkPageOffsetMask = blinkPageSize - 1;
53 const size_t blinkPageBaseMask = ~blinkPageOffsetMask; 53 const size_t blinkPageBaseMask = ~blinkPageOffsetMask;
54 54
55 // We allocate pages at random addresses but in groups of 55 // We allocate pages at random addresses but in groups of
56 // blinkPagesPerRegion at a given random address. We group pages to 56 // blinkPagesPerRegion at a given random address. We group pages to
57 // not spread out too much over the address space which would blow 57 // not spread out too much over the address space which would blow
58 // away the page tables and lead to bad performance. 58 // away the page tables and lead to bad performance.
59 const size_t blinkPagesPerRegion = 10; 59 const size_t blinkPagesPerRegion = 10;
60 60
61 // TODO(nya): Replace this with something like #if ENABLE_NACL. 61 // TODO(nya): Replace this with something like #if ENABLE_NACL.
62 #if 0 62 #if 0
63 // NaCl's system page size is 64 KB. This causes a problem in Oilpan's heap 63 // NaCl's system page size is 64 KB. This causes a problem in Oilpan's heap
64 // layout because Oilpan allocates two guard pages for each blink page 64 // layout because Oilpan allocates two guard pages for each blink page
65 // (whose size is 128 KB). So we don't use guard pages in NaCl. 65 // (whose size is 128 KB). So we don't use guard pages in NaCl.
66 const size_t blinkGuardPageSize = 0; 66 const size_t blinkGuardPageSize = 0;
67 #else 67 #else
68 const size_t blinkGuardPageSize = WTF::kSystemPageSize; 68 const size_t blinkGuardPageSize = base::kSystemPageSize;
69 #endif 69 #endif
70 70
71 // Double precision floats are more efficient when 8 byte aligned, so we 8 byte 71 // Double precision floats are more efficient when 8 byte aligned, so we 8 byte
72 // align all allocations even on 32 bit. 72 // align all allocations even on 32 bit.
73 const size_t allocationGranularity = 8; 73 const size_t allocationGranularity = 8;
74 const size_t allocationMask = allocationGranularity - 1; 74 const size_t allocationMask = allocationGranularity - 1;
75 const size_t objectStartBitMapSize = 75 const size_t objectStartBitMapSize =
76 (blinkPageSize + ((8 * allocationGranularity) - 1)) / 76 (blinkPageSize + ((8 * allocationGranularity) - 1)) /
77 (8 * allocationGranularity); 77 (8 * allocationGranularity);
78 const size_t reservedForObjectBitMap = 78 const size_t reservedForObjectBitMap =
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 return outOfLineAllocate(allocationSize, gcInfoIndex); 948 return outOfLineAllocate(allocationSize, gcInfoIndex);
949 } 949 }
950 950
951 inline NormalPageArena* NormalPage::arenaForNormalPage() const { 951 inline NormalPageArena* NormalPage::arenaForNormalPage() const {
952 return static_cast<NormalPageArena*>(arena()); 952 return static_cast<NormalPageArena*>(arena());
953 } 953 }
954 954
955 } // namespace blink 955 } // namespace blink
956 956
957 #endif // HeapPage_h 957 #endif // HeapPage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698