JavaScriptCore is missing debug info for bmalloc because libbmalloc.a is stripped
[WebKit-https.git] / Source / bmalloc / ChangeLog
1 2014-11-01  David Kilzer  <ddkilzer@apple.com>
2
3         JavaScriptCore is missing debug info for bmalloc because libbmalloc.a is stripped
4         <https://webkit.org/b/138286>
5         <rdar://problem/18847087>
6
7         Reviewed by Dan Bernstein.
8
9         * Configurations/bmalloc.xcconfig: Set STRIP_INSTALLED_PRODUCT
10         to NO for the target that produces libbmalloc.a so that the
11         debug symbols will be linked into JavaScriptCore and end up in
12         its dSYM file.
13
14 2014-10-30  Dana Burkart  <dburkart@apple.com>
15
16         <rdar://problem/18821260> Prepare for the mysterious future
17
18         Reviewed by Lucas Forschler.
19
20         * Configurations/Base.xcconfig:
21         * Configurations/DebugRelease.xcconfig:
22
23 2014-09-24  Geoffrey Garen  <ggaren@apple.com>
24
25         bmalloc: cleaned up fast path vs slow path
26         https://bugs.webkit.org/show_bug.cgi?id=137081
27
28         Reviewed by Sam Weinig.
29
30         Might be a 1% speedup on MallocBench. Also cleans up the code a bit.
31
32         * bmalloc/Allocator.cpp:
33         (bmalloc::Allocator::Allocator): Merged the small and medium range
34         caches, just like the small and medium allocators. Ranges are abstract
35         objects that don't really care whether they hold small or medium objects,
36         so they don't need to be segregated.
37
38         (bmalloc::Allocator::scavenge): Ditto.
39
40         (bmalloc::Allocator::allocateBumpRangeSlowCase):
41         (bmalloc::Allocator::allocateBumpRange): Same thing here, except that
42         we do care a tiny bit, because we need to specify small vs medium when
43         allocating new ranges from the heap, to ensure that the heap allocates
44         from the right segment of VM.
45
46         (bmalloc::Allocator::allocateLarge):
47         (bmalloc::Allocator::allocateXLarge): NO_INLINE because this was clouding
48         up the fast path. Large allocation performance is dominated by allocation
49         logic and initialization, so inlining it doesn't help.
50
51         (bmalloc::Allocator::allocateSlowCase): Slow path got a bit cleaner since
52         it doesn't need to distinguish small vs medium objects.
53
54         (bmalloc::Allocator::allocateSmallBumpRange): Deleted.
55         (bmalloc::Allocator::allocateMediumBumpRange): Deleted.
56
57         * bmalloc/Allocator.h:
58         * bmalloc/BumpRange.h:
59
60         * bmalloc/Cache.cpp:
61         (bmalloc::Cache::allocateSlowCase): Deleted.
62         (bmalloc::Cache::deallocateSlowCase): Deleted.
63         * bmalloc/Cache.h:
64         (bmalloc::Cache::allocate):
65         (bmalloc::Cache::deallocate):
66         (bmalloc::Cache::allocateFastCase): Deleted.
67         (bmalloc::Cache::deallocateFastCase): Deleted. Removed the Cache slow
68         paths. The downside to this change is that the fast path branches to two
69         distinct failure cases instead of one. The upside is that the slow path
70         doesn't need to re-read the segment register, which is not as cheap as a
71         normal register, and it doesn't need to do an extra level of function 
72         call. Seems to be worth it.
73
74         * bmalloc/Deallocator.h:
75         * bmalloc/Heap.cpp:
76         (bmalloc::Heap::refillSmallBumpRangeCache):
77         (bmalloc::Heap::refillMediumBumpRangeCache):
78         * bmalloc/Heap.h: Updated for interface changes.
79
80         * bmalloc/Sizes.h: The most ranges a cache will hold is the number of
81         small lines in a page / 2, since any other free lines will coalesce
82         with their neighbors.
83
84 2014-09-23  Geoffrey Garen  <ggaren@apple.com>
85
86         Rolled out r173346.
87
88             bmalloc should honor the FastMalloc statistics API
89             https://bugs.webkit.org/show_bug.cgi?id=136592
90
91         This didn't really work. Because we allow ranges with and without
92         physical pages to merge, and we allow double-committing and
93         double-decommitting, we can't rely on commit actions to track memory
94         footprint.
95
96         * bmalloc/Heap.cpp:
97         (bmalloc::Heap::size): Deleted.
98         (bmalloc::Heap::capacity): Deleted.
99         * bmalloc/Heap.h:
100         * bmalloc/VMHeap.cpp:
101         (bmalloc::VMHeap::VMHeap):
102         (bmalloc::VMHeap::allocateSmallChunk):
103         (bmalloc::VMHeap::allocateMediumChunk):
104         (bmalloc::VMHeap::allocateLargeChunk):
105         * bmalloc/VMHeap.h:
106         (bmalloc::VMHeap::allocateSmallPage):
107         (bmalloc::VMHeap::allocateMediumPage):
108         (bmalloc::VMHeap::allocateLargeRange):
109         (bmalloc::VMHeap::deallocateSmallPage):
110         (bmalloc::VMHeap::deallocateMediumPage):
111         (bmalloc::VMHeap::deallocateLargeRange):
112         (bmalloc::VMHeap::size): Deleted.
113         (bmalloc::VMHeap::capacity): Deleted.
114         * bmalloc/bmalloc.h:
115         (bmalloc::api::heapSize): Deleted.
116         (bmalloc::api::heapCapacity): Deleted.
117
118 2014-09-23  Geoffrey Garen  <ggaren@apple.com>
119
120         bmalloc: Allocation should be more precise
121         https://bugs.webkit.org/show_bug.cgi?id=136993
122
123         Reviewed by Gavin Barraclough.
124
125         13% reduction in heap size on the MallocBench *_memory_warning benchmarks.
126
127         This patch teaches the allocator to merge adjacent free lines into a
128         single allocatable range. This allows us to shrink the size of an
129         individual line without increasing fragmentation or the rate of allocator
130         slow paths.
131
132         We'll only take more slow paths when available memory is sparse, which
133         is exactly when it's worth it. When available memory is dense, we'll
134         take fewer slow paths.
135
136         * bmalloc.xcodeproj/project.pbxproj:
137         * bmalloc/Algorithm.h:
138         (bmalloc::divideRoundingUp):
139
140         * bmalloc/Allocator.cpp:
141         (bmalloc::Allocator::Allocator): Updated for interface changes.
142
143         (bmalloc::Allocator::scavenge): Scavenge by object instead of by line.
144         Now that we merge lines, it's not convenient to scavenge by line.
145
146         (bmalloc::Allocator::allocateSmallBumpRange):
147         (bmalloc::Allocator::allocateMediumBumpRange): Allocate whole ranges
148         instead of individual lines.
149
150         (bmalloc::Allocator::allocateSlowCase):
151         (bmalloc::Allocator::allocateSmallLine): Deleted.
152         (bmalloc::Allocator::allocateMediumLine): Deleted.
153         (bmalloc::Allocator::allocateMedium): Deleted.
154         * bmalloc/Allocator.h:
155         (bmalloc::Allocator::allocateFastCase): Folded medium allocations
156         into the standard fast path with small allocations. Since a BumpAllocator
157         just allocates out of an arbitrary range, it doesn't need to distinguish
158         between small and medium lines.
159
160         * bmalloc/BumpAllocator.h:
161         (bmalloc::BumpAllocator::size):
162         (bmalloc::BumpAllocator::BumpAllocator):
163         (bmalloc::BumpAllocator::init):
164         (bmalloc::BumpAllocator::refill):
165         (bmalloc::BumpAllocator::line): Deleted. No need to track line information
166         anymore: the heap just gives us a pointer and a pre-computed number of
167         objects, and we allocate them.
168
169         * bmalloc/Deallocator.cpp:
170         (bmalloc::Deallocator::processObjectLog): Updated for interface changes.
171
172         * bmalloc/Heap.cpp:
173         (bmalloc::Heap::Heap):
174         (bmalloc::Heap::initializeLineMetadata): Pre-compute precise metadata
175         detailing where all objects will lie in memory. After we merge two lines,
176         we might allocate an object that spans from one line to the next. This
177         metadata details which bits of memory overlap in that way, and how they
178         overlap.
179
180         (bmalloc::Heap::refillSmallBumpRangeCache):
181         (bmalloc::Heap::refillMediumBumpRangeCache): Scan a whole page at a time,
182         and merge adjacent free lines into BumpRanges.
183
184         (bmalloc::Heap::allocateSmallPage):
185         (bmalloc::Heap::allocateMediumPage):
186         (bmalloc::Heap::deallocateSmallLine):
187         (bmalloc::Heap::deallocateMediumLine): Track pages rather than lines,
188         since we scan for free memory a page at a time.
189
190         (bmalloc::Heap::allocateSmallLineSlowCase): Deleted.
191         (bmalloc::Heap::allocateMediumLineSlowCase): Deleted. Folded into the
192         fast path.
193
194         * bmalloc/Heap.h:
195         (bmalloc::Heap::derefSmallLine):
196         (bmalloc::Heap::derefMediumLine):
197         (bmalloc::Heap::deallocateSmallLine): Deleted.
198         (bmalloc::Heap::allocateSmallLine): Deleted.
199         (bmalloc::Heap::deallocateMediumLine): Deleted.
200         (bmalloc::Heap::allocateMediumLine): Deleted. Updated for interface changes.
201
202         * bmalloc/Line.h:
203         (bmalloc::Line<Traits>::ref):
204         (bmalloc::Line<Traits>::deref):
205         (bmalloc::Line<Traits>::concurrentRef): Deleted. We don't pass a derefCount
206         anymore, since we only ever deref by 1 now.
207
208         * bmalloc/MediumAllocator.h:
209         (bmalloc::MediumAllocator::isNull): Deleted.
210         (bmalloc::MediumAllocator::MediumAllocator): Deleted.
211         (bmalloc::MediumAllocator::line): Deleted.
212         (bmalloc::MediumAllocator::allocate): Deleted.
213         (bmalloc::MediumAllocator::derefCount): Deleted.
214         (bmalloc::MediumAllocator::refill): Deleted.
215         (bmalloc::MediumAllocator::clear): Deleted. Deleted some code that's
216         been dead for a while, since it doesn't build anymore with this patch.
217
218         * bmalloc/Page.h:
219         (bmalloc::Page::sizeClass):
220         (bmalloc::Page::setSizeClass):
221         (bmalloc::Page::smallSizeClass): Deleted.
222         (bmalloc::Page::setSmallSizeClass): Deleted. Renamed setSmallSizeClass
223         to sizeClass, since we use it for medium sizes too.
224
225         * bmalloc/Sizes.h:
226         (bmalloc::Sizes::sizeClass):
227         (bmalloc::Sizes::objectSize): Shrank line sizes to save memory.
228
229         (bmalloc::Sizes::smallSizeClassFor): Deleted.
230         (bmalloc::Sizes::mediumSizeClassFor): Deleted.
231
232         * bmalloc/bmalloc.h:
233         (bmalloc::api::realloc): Now that we have precise objects sizes, realloc
234         can be a bit more precise. It also has to be, since we can't guarantee
235         that an object ends at the end of a line anymore.
236
237 2014-09-19  Daniel Bates  <dabates@apple.com>
238
239         Always assume internal SDK when building configuration Production
240         https://bugs.webkit.org/show_bug.cgi?id=136925
241         <rdar://problem/18362399>
242
243         Reviewed by Dan Bernstein.
244
245         * Configurations/Base.xcconfig:
246
247 2014-09-16  Geoffrey Garen  <ggaren@apple.com>
248
249         bmalloc: moved line caches from the deallocator to the allocator
250         https://bugs.webkit.org/show_bug.cgi?id=136868
251
252         Reviewed by Gavin Barraclough.
253
254         I did this mostly as a simplification, to make it easier to change the
255         allocation strategy.
256
257         No throughput change on MallocBench. Saves about 50kB.
258
259         Since the deallocator needs to lock the heap when freeing lines anyway,
260         there isn't much benefit to giving the deallocator a local cache of
261         deallocated lines.
262
263         We still give the allocator a local cache of lines because that does
264         reduce the frequency at which it needs to lock the heap in order to
265         acquire more lines.
266
267         * bmalloc/Allocator.cpp:
268         (bmalloc::Allocator::scavenge):
269         (bmalloc::Allocator::allocateSmallLine):
270         (bmalloc::Allocator::allocateMediumLine):
271         (bmalloc::Allocator::allocateMedium):
272         (bmalloc::Allocator::allocateSlowCase):
273         * bmalloc/Allocator.h:
274         * bmalloc/Deallocator.cpp:
275         (bmalloc::Deallocator::Deallocator):
276         (bmalloc::Deallocator::scavenge):
277         (bmalloc::Deallocator::processObjectLog):
278         (bmalloc::Deallocator::deallocateSmallLine): Deleted.
279         (bmalloc::Deallocator::allocateSmallLine): Deleted.
280         (bmalloc::Deallocator::deallocateMediumLine): Deleted.
281         (bmalloc::Deallocator::allocateMediumLine): Deleted.
282         * bmalloc/Deallocator.h:
283
284         * bmalloc/Sizes.h:
285         * bmalloc/VMAllocate.h: Took the opportunity to make the line cache size
286         exactly one page in size. That's about what we were shooting for anyway,
287         and it may make it easier to switch to per-page allocation in future.
288
289 2014-09-15  Geoffrey Garen  <ggaren@apple.com>
290
291         bmalloc: allocate small and medium objects using the same bump pointer class
292         https://bugs.webkit.org/show_bug.cgi?id=136843
293
294         Reviewed by Gavin Barraclough.
295
296         4% speedup on MallocBench.
297
298         Now that medium-sized objects have dedicated per-size allocators, they
299         don't need to use an arbitrary bump pointer allocator. This means that
300         every allocator knows how many objects it will allocate from the start,
301         and we don't need a post-processing step to adjust refcounts based on
302         real allocation count.
303
304         * bmalloc.xcodeproj/project.pbxproj: Renamed SmallAllocator to BumpAllocator
305         since it's used for small and medium objects now.
306
307         * bmalloc/Allocator.cpp:
308         (bmalloc::Allocator::Allocator): Updated to use new interface.
309         (bmalloc::Allocator::scavenge): To "retire" an allocator, we just need
310         to make sure that we finish allocating all the objects in it.
311
312         (bmalloc::Allocator::allocateMedium):
313         (bmalloc::Allocator::allocateSlowCase):
314         (bmalloc::Allocator::retire): Deleted.
315         (bmalloc::Allocator::processSmallAllocatorLog): Deleted.
316         (bmalloc::Allocator::processMediumAllocatorLog): Deleted.
317         * bmalloc/Allocator.h:
318         (bmalloc::Allocator::allocateFastCase): Removed abstractions and data
319         used to post-process an allocator based on how many objects it allocated.
320
321         * bmalloc/BumpAllocator.h: Copied from Source/bmalloc/bmalloc/SmallAllocator.h.
322         (bmalloc::BumpAllocator::BumpAllocator):
323         (bmalloc::BumpAllocator::init):
324         (bmalloc::BumpAllocator::line):
325         (bmalloc::BumpAllocator::validate):
326         (bmalloc::BumpAllocator::allocate):
327         (bmalloc::BumpAllocator::refill):
328         (bmalloc::BumpAllocator::clear): Updated these functions to be agnostic
329         about the kinds of lines they allocate into. In some cases, the line
330         type must be provided as a template parameter by the caller.
331
332         (bmalloc::SmallAllocator::SmallAllocator): Deleted.
333         (bmalloc::SmallAllocator::line): Deleted.
334         (bmalloc::SmallAllocator::allocate): Deleted.
335         (bmalloc::SmallAllocator::objectCount): Deleted.
336         (bmalloc::SmallAllocator::derefCount): Deleted.
337         (bmalloc::SmallAllocator::refill): Deleted.
338         (bmalloc::SmallAllocator::clear): Deleted.
339
340         * bmalloc/ObjectType.h:
341         (bmalloc::isMedium):
342
343         * bmalloc/SmallAllocator.h:
344         (bmalloc::SmallAllocator::isNull): Deleted.
345         (bmalloc::SmallAllocator::canAllocate): Deleted.
346         (bmalloc::SmallAllocator::SmallAllocator): Deleted.
347         (bmalloc::SmallAllocator::line): Deleted.
348         (bmalloc::SmallAllocator::allocate): Deleted.
349         (bmalloc::SmallAllocator::objectCount): Deleted.
350         (bmalloc::SmallAllocator::derefCount): Deleted.
351         (bmalloc::SmallAllocator::refill): Deleted.
352         (bmalloc::SmallAllocator::clear): Deleted.
353
354 2014-09-12  Geoffrey Garen  <ggaren@apple.com>
355
356         Fixed a goof in bmalloc Vector sizing
357         https://bugs.webkit.org/show_bug.cgi?id=136795
358
359         Reviewed by Gavin Barraclough and Sam Weinig.
360
361         We want our minimum vector to be page-sized since the OS will give us
362         a page no matter what -- but we want that many bytes, and not enough
363         bytes to store that many elements.
364
365         * bmalloc/Vector.h: Math is hard.
366
367 2014-09-11  Geoffrey Garen  <ggaren@apple.com>
368
369         bmalloc should segregate medium-sized objects by line like it does for small-sized objects
370         https://bugs.webkit.org/show_bug.cgi?id=136693
371
372         Reviewed by Gavin Barraclough.
373
374         4% reduction in heap size on the MallocBench *_memory_warning benchmarks.
375
376         No throughput change.
377
378         We keep an array of medium allocators, just like our array of small
379         allocators.
380
381         In future, we can simplify the allocation fast path by merging the small
382         and medium allocator arrays. For now, this is the simplest change that
383         gets the win.
384
385         * bmalloc/Allocator.cpp:
386         (bmalloc::Allocator::Allocator):
387         (bmalloc::Allocator::scavenge):
388         (bmalloc::Allocator::allocateMedium):
389         * bmalloc/Allocator.h:
390         * bmalloc/Sizes.h:
391         (bmalloc::Sizes::mediumSizeClassFor):
392
393 2014-09-11  Geoffrey Garen  <ggaren@apple.com>
394
395         Reviewed by Sam Weinig.
396
397         Renamed log => retire for clarity.
398
399         * bmalloc/Allocator.cpp:
400         (bmalloc::Allocator::scavenge):
401         (bmalloc::Allocator::retire):
402         (bmalloc::Allocator::allocateMedium):
403         (bmalloc::Allocator::allocateSlowCase):
404         (bmalloc::Allocator::log): Deleted.
405         * bmalloc/Allocator.h:
406
407 2014-09-11  Geoffrey Garen  <ggaren@apple.com>
408
409         bmalloc: eager scavenge leaves behind a bogus allocator
410         https://bugs.webkit.org/show_bug.cgi?id=136743
411
412         Reviewed by Sam Weinig.
413
414         Be sure to clear the allocator after logging it in the eager scavenge
415         case, so that we don't later try to allocate out of the lines that we
416         have thrown away.
417
418         We didn't need to do this previously because scavenge would only happen
419         at thread exit time, after which no further allocation from the per-thread
420         cache would take place.
421
422         * bmalloc/Allocator.cpp:
423         (bmalloc::Allocator::scavenge):
424         * bmalloc/MediumAllocator.h:
425         (bmalloc::MediumAllocator::clear):
426         * bmalloc/SmallAllocator.h:
427         (bmalloc::SmallAllocator::clear):
428
429 2014-09-05  Geoffrey Garen  <ggaren@apple.com>
430
431         bmalloc should honor the FastMalloc statistics API
432         https://bugs.webkit.org/show_bug.cgi?id=136592
433
434         Reviewed by Gavin Barraclough.
435
436         We do this by tracking "size" and "capacity" in the VM heap.
437
438         The VM heap's "capacity" is all the VM we ever allocated.
439
440         The VM heap's "size" the subset of VM currently held onto by the
441         VM heap (and therefore not in use by the regular heap).
442
443         Somewhat ironically, reducing the process's memory footprint, increases
444         the size of the VM heap, since the VM heap holds the pages that are
445         purely virtual and not physical.
446
447         * bmalloc/Heap.cpp:
448         (bmalloc::Heap::size):
449         (bmalloc::Heap::capacity):
450         * bmalloc/Heap.h:
451         * bmalloc/VMHeap.cpp:
452         (bmalloc::VMHeap::VMHeap):
453         (bmalloc::VMHeap::allocateSmallChunk):
454         (bmalloc::VMHeap::allocateMediumChunk):
455         (bmalloc::VMHeap::allocateLargeChunk):
456         * bmalloc/VMHeap.h:
457         (bmalloc::VMHeap::size):
458         (bmalloc::VMHeap::capacity):
459         (bmalloc::VMHeap::allocateSmallPage):
460         (bmalloc::VMHeap::allocateMediumPage):
461         (bmalloc::VMHeap::allocateLargeRange):
462         (bmalloc::VMHeap::deallocateSmallPage):
463         (bmalloc::VMHeap::deallocateMediumPage):
464         (bmalloc::VMHeap::deallocateLargeRange):
465         * bmalloc/bmalloc.h:
466         (bmalloc::api::heapSize):
467         (bmalloc::api::heapCapacity):
468
469 2014-09-02  Geoffrey Garen  <ggaren@apple.com>
470
471         bmalloc crashes on the EWS bots (due to bad large object allocation)
472         https://bugs.webkit.org/show_bug.cgi?id=136469
473
474         Reviewed by Andreas Kling.
475
476         It's possible to convince bmalloc to perform a bad large object allocation,
477         through these steps:
478
479         (1) Insert object A into freelist F0.
480
481         (2) Split, merge and split again A's neighbors such that object B is
482         inserted into freelist F0, with boundary tag and size equal to object A,
483         but pointer not completely equal to object A. Put object B at the head of F0.
484
485         (3) Allocate some other object from F0, swapping its position in the
486         freelist with object B, such that object A is now ahead of object B.
487
488         --> Now, the next allocation for size A/B will allocate object A, which
489         has a slightly wrong idea about where the object actually begins.
490         Immediately, you'll corrupt a little memory, and over time, you'll also
491         corrupt boundary tag metadata.
492
493         The solution is to store the begin pointer in the boundary tag. Luckily,
494         this doesn't make the tag any bigger, and it's not a noticeable slowdown
495         on MallocBench.
496
497         * bmalloc/Algorithm.h:
498         (bmalloc::rightShift):
499         * bmalloc/BeginTag.h:
500         (bmalloc::BeginTag::isInFreeList): This is the bug fix. Make sure to
501         validate the start pointer when popping off the free list. Through a
502         very uncommon set of steps, it is possible to have an item in the free
503         list that is valid by all accounts except for its start pointer.
504
505         * bmalloc/BoundaryTag.h:
506         (bmalloc::BoundaryTag::compactBegin):
507         (bmalloc::BoundaryTag::setRange):
508         (bmalloc::BoundaryTag::setSize): Deleted. Record a compact version of the
509         start pointer. We don't need the whole pointer -- just the offset, in
510         largeAlignment increments, into the relevant boundary tag bucket.
511
512         * bmalloc/BoundaryTagInlines.h:
513         (bmalloc::validateNext):
514         (bmalloc::BoundaryTag::init):
515         (bmalloc::BoundaryTag::mergeLarge):
516         (bmalloc::BoundaryTag::splitLarge):
517         * bmalloc/SegregatedFreeList.cpp:
518         (bmalloc::SegregatedFreeList::insert):
519         (bmalloc::SegregatedFreeList::takeGreedy):
520         (bmalloc::SegregatedFreeList::take): Provide the whole range instead of
521         the size when establishing a boundary tag, as required by the new
522         interface.
523
524         * bmalloc/Sizes.h:
525
526 2014-08-14  Geoffrey Garen  <ggaren@apple.com>
527
528         Fixed a bmalloc crash seen on the EWS bot
529         https://bugs.webkit.org/show_bug.cgi?id=135955
530
531         Reviewed by Andreas Kling.
532
533         * bmalloc/Syscall.h: Some CG APIs vm_copy their input buffers. If the
534         input buffer is a malloc region, that region will get marked Copy-On-Write
535         by the kernel. Calls to madvise() for COW regions fail and return EINVAL
536         on older OS X's. In 10.10, they still fail, but they do not return
537         EINVAL.
538
539         So, we can only ASSERT that our syscalls succeed starting with 10.10.
540
541 2014-08-14  Geoffrey Garen  <ggaren@apple.com>
542
543         Fixed the bmalloc build
544         https://bugs.webkit.org/show_bug.cgi?id=135953
545
546         Reviewed by Andreas Kling.
547
548         * bmalloc.xcodeproj/project.pbxproj: Marked a few headers as private.
549         These headers are used, so they must be available outside the project.
550
551 2014-08-13  Daniel Bates  <dabates@apple.com>
552
553         Attempt to fix the build following <http://trac.webkit.org/changeset/172576>
554         (https://bugs.webkit.org/show_bug.cgi?id=135895)
555
556         Substitute PerThreadStorage<T>::initSharedKeyIfNeeded() for initSharedKeyIfNeeded() in
557         implementation of PerThread<T>::getFastCase().
558
559         * bmalloc/PerThread.h:
560         (bmalloc::PerThread<T>::getFastCase):
561
562 2014-08-13  Daniel Bates  <dabates@apple.com>
563
564         Make bmalloc::PerThread work without C++ thread local storage
565         https://bugs.webkit.org/show_bug.cgi?id=135895
566
567         Reviewed by Geoffrey Garen.
568
569         Implement support for building bmalloc without C++ thread local storage.
570
571         * bmalloc/BPlatform.h: Remove macro define BPLATFORM_IOS_SIMULATOR. Added macro function
572         BCOMPILER_SUPPORTS() and macro define BCOMPILER_SUPPORTS_CXX_THREAD_LOCAL that can be used
573         to determine whether the compiler supports C++ thread local storage.
574         * bmalloc/PerThread.h:
575         (bmalloc::PerThreadStorage::get): Modified to call pthread_getspecific() when building
576         without C++ thread local storage.
577         (bmalloc::PerThreadStorage::initSharedKeyIfNeeded): Added.
578         (bmalloc::PerThreadStorage::init): Moved logic to initialize shared Pthread key from here to
579         PerThreadStorage::initSharedKeyIfNeeded().
580         (bmalloc::PerThread<T>::getFastCase): Modified to call PerThreadStorage::initSharedKeyIfNeeded()
581         before querying PerThreadStorage::get() when building without C++ thread local storage so as to
582         ensure that the shared key has been initialized.
583         (_pthread_setspecific_direct): Deleted.
584         (_pthread_getspecific_direct): Deleted.
585
586 2014-08-13  Daniel Bates  <dabates@apple.com>
587
588         [iOS] Make JavaScriptCore and bmalloc build with the public SDK
589         https://bugs.webkit.org/show_bug.cgi?id=135848
590
591         Reviewed by Geoffrey Garen.
592
593         * bmalloc/BPlatform.h: Added macro BPLATFORM_IOS_SIMULATOR, which evaluates to true
594         when building for the iOS Simulator.
595         * bmalloc/PerThread.h: Use pthread_machdep.h code path when building for iOS Simulator
596         using the public SDK.
597         (_pthread_setspecific_direct): Added; only defined when building for the iOS Simulator
598         using the public SDK.
599         (_pthread_getspecific_direct): Added; only defined when building for the iOS Simulator
600         using the public SDK.
601
602 2014-08-12  Daniel Bates  <dabates@apple.com>
603
604         BPLATFORM(IOS) always evaluates to false
605         https://bugs.webkit.org/show_bug.cgi?id=135843
606
607         Reviewed by Geoffrey Garen.
608
609         Fix typo in definition of BPLATFORM() and include system header TargetConditionals.h
610         (when building on an Apple platform) so that BPLATFORM(X) evaluates to true when
611         building for platform X. In particular, so that BPLATFORM(IOS) evaluates to true when
612         building for iOS.
613
614         As a side effect of this change, the change made in <http://trac.webkit.org/changeset/167289>
615         will be honored and iOS will assume a VM page size of 16kB (again) instead of 4kB.
616
617         * bmalloc/BPlatform.h:
618
619 2014-08-11  Andy Estes  <aestes@apple.com>
620
621         [iOS] Get rid of iOS.xcconfig
622         https://bugs.webkit.org/show_bug.cgi?id=135809
623
624         Reviewed by Joseph Pecoraro.
625
626         All iOS.xcconfig did was include AspenFamily.xcconfig, so there's no need for the indirection.
627
628         * Configurations/Base.xcconfig:
629         * Configurations/iOS.xcconfig: Removed.
630         * bmalloc.xcodeproj/project.pbxproj:
631
632 2014-05-01  Dan Bernstein  <mitz@apple.com>
633
634         Fixed production builds for the iOS Simulator.
635         <rdar://problem/16792221>
636
637         * Configurations/bmalloc.xcconfig: Include INSTALL_PATH_PREFIX in
638         PRIVATE_HEADERS_FOLDER_PATH when installing.
639
640 2014-04-20  Geoffrey Garen  <ggaren@apple.com>
641
642         bmalloc: Segregate pages by objects size
643         https://bugs.webkit.org/show_bug.cgi?id=131909
644
645         Reviewed by Andreas Kling.
646
647         2% reduction in memory-at-end on the Membuster memory_warning benchmarks.
648
649         * bmalloc/Allocator.cpp:
650         (bmalloc::Allocator::allocateSlowCase):
651         * bmalloc/Allocator.h:
652         (bmalloc::Allocator::allocateFastCase):
653         (bmalloc::Allocator::smallAllocatorFor): Use the new shared helper
654         function for size class calculation.
655
656         * bmalloc/Deallocator.cpp:
657         (bmalloc::Deallocator::Deallocator):
658         (bmalloc::Deallocator::scavenge):
659         (bmalloc::Deallocator::deallocateSmallLine):
660         (bmalloc::Deallocator::allocateSmallLine):
661         * bmalloc/Deallocator.h: Keep a cache for every size class, since the
662         cache can't be shared anymore.
663
664         * bmalloc/Heap.cpp:
665         (bmalloc::Heap::allocateSmallLineSlowCase):
666         * bmalloc/Heap.h:
667         (bmalloc::Heap::deallocateSmallLine): Ditto.
668
669         (bmalloc::Heap::allocateSmallLine): Check size class in addition to
670         page refcount when allocating a line because we might have deallocated
671         the page and the recycled it for another size class.
672
673         (bmalloc::Heap::deallocateMediumLine):
674         (bmalloc::Heap::allocateMediumLine):
675         * bmalloc/Line.h:
676         (bmalloc::Line::refCount):
677         * bmalloc/Page.h:
678         (bmalloc::Page::refCount):
679         (bmalloc::Page::smallSizeClass):
680         (bmalloc::Page::setSmallSizeClass):
681         (bmalloc::Page<Traits>::refCount): Deleted.
682         * bmalloc/Sizes.h:
683         (bmalloc::Sizes::smallSizeClassFor): New shared API for computing
684         an index into an array from a size.
685
686 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
687
688         bmalloc: Improved alignment in LargeChunk
689         https://bugs.webkit.org/show_bug.cgi?id=131895
690
691         Reviewed by Andreas Kling.
692
693         * bmalloc/Chunk.h:
694         * bmalloc/LargeChunk.h: Align to vmPageSize just like Chunk does.
695         Technically, the previous alignment was harmless, but I would prefer,
696         dear reader, not to have to explain the interlocking set of
697         circumstances that made it so.
698
699 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
700
701         Rolled out r167502 because it caused a crash on the facebook benchmark.
702
703         Unreviewed.
704
705             bmalloc: Added an XSmall line size
706             https://bugs.webkit.org/show_bug.cgi?id=131851
707
708             Reviewed by Sam Weinig.
709
710 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
711
712         bmalloc: Mutex should be harder to use wrong
713         https://bugs.webkit.org/show_bug.cgi?id=131879
714
715         Reviewed by Andreas Kling.
716
717         Mutex now has a proper constructor, so you can't deadlock by forgetting
718         to initialize it.
719
720         * bmalloc.xcodeproj/project.pbxproj:
721         * bmalloc/Allocator.cpp:
722         (bmalloc::Allocator::processXSmallAllocatorLog):
723         (bmalloc::Allocator::processSmallAllocatorLog):
724         (bmalloc::Allocator::processMediumAllocatorLog):
725         (bmalloc::Allocator::allocateLarge):
726         (bmalloc::Allocator::allocateXLarge): Global replace Mutex => StaticMutex,
727         since the Heap mutex is a static.
728
729         * bmalloc/AsyncTask.h:
730         (bmalloc::Function>::AsyncTask): Use Mutex, since we're not static. No
731         need for explicit initialization anymore.
732
733         * bmalloc/Deallocator.cpp:
734         (bmalloc::Deallocator::scavenge):
735         (bmalloc::Deallocator::deallocateLarge):
736         (bmalloc::Deallocator::deallocateXLarge):
737         (bmalloc::Deallocator::processObjectLog):
738         (bmalloc::Deallocator::deallocateSmallLine):
739         (bmalloc::Deallocator::deallocateXSmallLine):
740         (bmalloc::Deallocator::allocateSmallLine):
741         (bmalloc::Deallocator::allocateXSmallLine):
742         (bmalloc::Deallocator::deallocateMediumLine):
743         (bmalloc::Deallocator::allocateMediumLine):
744         * bmalloc/Deallocator.h:
745         * bmalloc/Heap.cpp:
746         (bmalloc::sleep):
747         (bmalloc::Heap::Heap):
748         (bmalloc::Heap::concurrentScavenge):
749         (bmalloc::Heap::scavenge):
750         (bmalloc::Heap::scavengeSmallPages):
751         (bmalloc::Heap::scavengeXSmallPages):
752         (bmalloc::Heap::scavengeMediumPages):
753         (bmalloc::Heap::scavengeLargeRanges):
754         (bmalloc::Heap::allocateXSmallLineSlowCase):
755         (bmalloc::Heap::allocateSmallLineSlowCase):
756         (bmalloc::Heap::allocateMediumLineSlowCase):
757         (bmalloc::Heap::allocateXLarge):
758         (bmalloc::Heap::deallocateXLarge):
759         (bmalloc::Heap::allocateLarge):
760         (bmalloc::Heap::deallocateLarge):
761         * bmalloc/Heap.h:
762         (bmalloc::Heap::deallocateXSmallLine):
763         (bmalloc::Heap::allocateXSmallLine):
764         (bmalloc::Heap::deallocateSmallLine):
765         (bmalloc::Heap::allocateSmallLine):
766         (bmalloc::Heap::deallocateMediumLine):
767         (bmalloc::Heap::allocateMediumLine):
768         * bmalloc/Line.h:
769         (bmalloc::Line<Traits>::deref):
770         * bmalloc/Mutex.cpp: Removed.
771         * bmalloc/Mutex.h:
772         (bmalloc::Mutex::Mutex):
773         (bmalloc::Mutex::init): Deleted.
774         (bmalloc::Mutex::try_lock): Deleted.
775         (bmalloc::Mutex::lock): Deleted.
776         (bmalloc::Mutex::unlock): Deleted.
777         * bmalloc/Page.h:
778         (bmalloc::Page<Traits>::ref):
779         (bmalloc::Page<Traits>::deref):
780         (bmalloc::Page<Traits>::refCount):
781         * bmalloc/PerProcess.h:
782         (bmalloc::PerProcess::mutex):
783         (bmalloc::PerProcess<T>::getSlowCase):
784         * bmalloc/StaticMutex.cpp: Added.
785         (bmalloc::StaticMutex::lockSlowCase):
786         * bmalloc/StaticMutex.h: Added.
787         (bmalloc::StaticMutex::init):
788         (bmalloc::StaticMutex::try_lock):
789         (bmalloc::StaticMutex::lock):
790         (bmalloc::StaticMutex::unlock):
791         * bmalloc/VMHeap.h:
792         (bmalloc::VMHeap::deallocateXSmallPage):
793         (bmalloc::VMHeap::deallocateSmallPage):
794         (bmalloc::VMHeap::deallocateMediumPage):
795         (bmalloc::VMHeap::deallocateLargeRange):
796         * bmalloc/bmalloc.h:
797         (bmalloc::api::scavenge): Global replace Mutex => StaticMutex,
798         since the Heap mutex is a static.
799
800 2014-04-18  Geoffrey Garen  <ggaren@apple.com>
801
802         bmalloc: AsyncTask should use Mutex instead of std::mutex
803         https://bugs.webkit.org/show_bug.cgi?id=131865
804
805         Reviewed by Gavin Barraclough.
806
807         std::mutex is so slow that it makes parallelizing simple tasks through
808         AsyncTask a net regression. Mutex fixes this.
809
810         * bmalloc/AsyncTask.h:
811         (bmalloc::Function>::AsyncTask):
812         (bmalloc::Function>::join):
813         (bmalloc::Function>::runSlowCase):
814         (bmalloc::Function>::entryPoint):
815         * bmalloc/Mutex.h:
816         (bmalloc::Mutex::init):
817
818 2014-04-18  Geoffrey Garen  <ggaren@apple.com>
819
820         bmalloc: Added an XSmall line size
821         https://bugs.webkit.org/show_bug.cgi?id=131851
822
823         Reviewed by Sam Weinig.
824
825         Reduces malloc footprint on Membuster recordings by 10%.
826
827         This is a throughput regression, but we're still way ahead of TCMalloc.
828         I have some ideas for how to recover the regression -- but I wanted to
829         get this win in first.
830
831         Full set of benchmark results:
832
833                 bmalloc> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks --measure-heap nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
834                                                                                                 
835                                                                nopatch                      patch                                Δ
836                 Peak Memory:
837                     reddit_memory_warning                      7,896kB                    7,532kB                  ^ 1.05x smaller
838                     flickr_memory_warning                     12,968kB                   12,324kB                  ^ 1.05x smaller
839                     theverge_memory_warning                   16,672kB                   15,200kB                   ^ 1.1x smaller
840
841                     <geometric mean>                          11,952kB                   11,216kB                  ^ 1.07x smaller
842                     <arithmetic mean>                         12,512kB                   11,685kB                  ^ 1.07x smaller
843                     <harmonic mean>                           11,375kB                   10,726kB                  ^ 1.06x smaller
844
845                 Memory at End:
846                     reddit_memory_warning                      7,320kB                    6,856kB                  ^ 1.07x smaller
847                     flickr_memory_warning                     10,848kB                    9,692kB                  ^ 1.12x smaller
848                     theverge_memory_warning                   16,380kB                   14,872kB                   ^ 1.1x smaller
849
850                     <geometric mean>                          10,916kB                    9,961kB                   ^ 1.1x smaller
851                     <arithmetic mean>                         11,516kB                   10,473kB                   ^ 1.1x smaller
852                     <harmonic mean>                           10,350kB                    9,485kB                  ^ 1.09x smaller
853
854                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
855                                                                                                 
856                                                    nopatch                patch                         Δ
857                 Execution Time:
858                     churn                            127ms                151ms            ! 1.19x slower
859                     list_allocate                    130ms                164ms            ! 1.26x slower
860                     tree_allocate                    109ms                127ms            ! 1.17x slower
861                     tree_churn                       115ms                120ms            ! 1.04x slower
862                     facebook                         240ms                259ms            ! 1.08x slower
863                     fragment                          91ms                131ms            ! 1.44x slower
864                     fragment_iterate                 105ms                106ms            ! 1.01x slower
865                     message_one                      260ms                259ms             ^ 1.0x faster
866                     message_many                     149ms                154ms            ! 1.03x slower
867                     medium                           194ms                248ms            ! 1.28x slower
868                     big                              157ms                160ms            ! 1.02x slower
869
870                     <geometric mean>                 144ms                163ms            ! 1.13x slower
871                     <arithmetic mean>                152ms                171ms            ! 1.12x slower
872                     <harmonic mean>                  137ms                156ms            ! 1.14x slower
873
874                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
875                                                                                                 
876                                                                        nopatch                          patch                                     Δ
877                 Execution Time:
878                     churn                                                126ms                          148ms                        ! 1.17x slower
879                     churn --parallel                                      62ms                           76ms                        ! 1.23x slower
880                     list_allocate                                        130ms                          164ms                        ! 1.26x slower
881                     list_allocate --parallel                             120ms                          175ms                        ! 1.46x slower
882                     tree_allocate                                        111ms                          127ms                        ! 1.14x slower
883                     tree_allocate --parallel                              95ms                          135ms                        ! 1.42x slower
884                     tree_churn                                           115ms                          124ms                        ! 1.08x slower
885                     tree_churn --parallel                                107ms                          126ms                        ! 1.18x slower
886                     facebook                                             240ms                          276ms                        ! 1.15x slower
887                     facebook --parallel                                  802ms                        1,088ms                        ! 1.36x slower
888                     fragment                                              92ms                          130ms                        ! 1.41x slower
889                     fragment --parallel                                   66ms                          124ms                        ! 1.88x slower
890                     fragment_iterate                                     109ms                          127ms                        ! 1.17x slower
891                     fragment_iterate --parallel                           55ms                           64ms                        ! 1.16x slower
892                     message_one                                          260ms                          260ms                                      
893                     message_many                                         170ms                          238ms                         ! 1.4x slower
894                     medium                                               185ms                          250ms                        ! 1.35x slower
895                     medium --parallel                                    210ms                          334ms                        ! 1.59x slower
896                     big                                                  150ms                          169ms                        ! 1.13x slower
897                     big --parallel                                       138ms                          144ms                        ! 1.04x slower
898
899                     <geometric mean>                                     135ms                          170ms                        ! 1.26x slower
900                     <arithmetic mean>                                    167ms                          214ms                        ! 1.28x slower
901                     <harmonic mean>                                      117ms                          148ms                        ! 1.26x slower
902
903                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks TC:~/scratch/Build-TCMalloc/Release/ patch:~/webkit/WebKitBuild/Release/
904
905                                                                     TC                      patch                                Δ
906                 Peak Memory:
907                     reddit_memory_warning                     13,836kB                   13,436kB                  ^ 1.03x smaller
908                     flickr_memory_warning                     24,868kB                   25,188kB                   ! 1.01x bigger
909                     theverge_memory_warning                   24,504kB                   26,636kB                   ! 1.09x bigger
910
911                     <geometric mean>                          20,353kB                   20,812kB                   ! 1.02x bigger
912                     <arithmetic mean>                         21,069kB                   21,753kB                   ! 1.03x bigger
913                     <harmonic mean>                           19,570kB                   19,780kB                   ! 1.01x bigger
914
915                 Memory at End:
916                     reddit_memory_warning                      8,656kB                   10,016kB                   ! 1.16x bigger
917                     flickr_memory_warning                     11,844kB                   13,784kB                   ! 1.16x bigger
918                     theverge_memory_warning                   18,516kB                   22,748kB                   ! 1.23x bigger
919
920                     <geometric mean>                          12,382kB                   14,644kB                   ! 1.18x bigger
921                     <arithmetic mean>                         13,005kB                   15,516kB                   ! 1.19x bigger
922                     <harmonic mean>                           11,813kB                   13,867kB                   ! 1.17x bigger
923
924                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks TC:~/scratch/Build-TCMalloc/Release/ patch:~/webkit/WebKitBuild/Release/
925                                                                                                 
926                                                         TC                patch                         Δ
927                 Execution Time:
928                     churn                            416ms                148ms            ^ 2.81x faster
929                     list_allocate                    463ms                164ms            ^ 2.82x faster
930                     tree_allocate                    292ms                127ms             ^ 2.3x faster
931                     tree_churn                       157ms                120ms            ^ 1.31x faster
932                     facebook                         327ms                276ms            ^ 1.18x faster
933                     fragment                         335ms                129ms             ^ 2.6x faster
934                     fragment_iterate                 344ms                108ms            ^ 3.19x faster
935                     message_one                      386ms                258ms             ^ 1.5x faster
936                     message_many                     410ms                154ms            ^ 2.66x faster
937                     medium                           391ms                245ms             ^ 1.6x faster
938                     big                              261ms                167ms            ^ 1.56x faster
939
940                     <geometric mean>                 332ms                164ms            ^ 2.02x faster
941                     <arithmetic mean>                344ms                172ms            ^ 1.99x faster
942                     <harmonic mean>                  317ms                157ms            ^ 2.02x faster
943
944         * bmalloc.xcodeproj/project.pbxproj:
945         * bmalloc/Allocator.cpp:
946         (bmalloc::Allocator::Allocator): Don't assume that each allocator's
947         index corresponds with its size. Instead, use the size selection function
948         explicitly. Now that we have XSmall, some small allocator entries are
949         unused.
950
951         (bmalloc::Allocator::scavenge):
952         (bmalloc::Allocator::log):
953         (bmalloc::Allocator::processXSmallAllocatorLog):
954         (bmalloc::Allocator::allocateSlowCase):
955         * bmalloc/Allocator.h:
956         (bmalloc::Allocator::xSmallAllocatorFor):
957         (bmalloc::Allocator::allocateFastCase):
958         * bmalloc/Chunk.h:
959         * bmalloc/Deallocator.cpp:
960         (bmalloc::Deallocator::scavenge):
961         (bmalloc::Deallocator::processObjectLog):
962         (bmalloc::Deallocator::deallocateSlowCase):
963         (bmalloc::Deallocator::deallocateXSmallLine):
964         (bmalloc::Deallocator::allocateXSmallLine):
965         * bmalloc/Deallocator.h:
966         (bmalloc::Deallocator::deallocateFastCase):
967         * bmalloc/Heap.cpp:
968         (bmalloc::Heap::scavenge):
969         (bmalloc::Heap::scavengeXSmallPages):
970         (bmalloc::Heap::allocateXSmallLineSlowCase):
971         * bmalloc/Heap.h:
972         (bmalloc::Heap::deallocateXSmallLine):
973         (bmalloc::Heap::allocateXSmallLine):
974         * bmalloc/LargeChunk.h:
975         (bmalloc::LargeChunk::get):
976         (bmalloc::LargeChunk::endTag):
977         * bmalloc/Line.h:
978         * bmalloc/MediumAllocator.h:
979         (bmalloc::MediumAllocator::allocate):
980         (bmalloc::MediumAllocator::refill):
981         * bmalloc/ObjectType.cpp:
982         (bmalloc::objectType):
983         * bmalloc/ObjectType.h:
984         (bmalloc::isXSmall):
985         (bmalloc::isSmall):
986         (bmalloc::isMedium):
987         (bmalloc::isLarge):
988         (bmalloc::isSmallOrMedium): Deleted.
989         * bmalloc/SegregatedFreeList.h: I boiler-plate copied existing code for
990         handling small objects. There's probably a reasonable way to share this
991         code in the future -- I'll look into that once it's stopped changing.
992
993         * bmalloc/Sizes.h: Tweaked size classes to make Membuster happy. This
994         is the main reason things got slower.
995
996         * bmalloc/SmallAllocator.h:
997         (bmalloc::SmallAllocator::allocate):
998         * bmalloc/SmallTraits.h:
999         * bmalloc/VMHeap.cpp:
1000         (bmalloc::VMHeap::allocateXSmallChunk):
1001         * bmalloc/VMHeap.h:
1002         (bmalloc::VMHeap::allocateXSmallPage):
1003         (bmalloc::VMHeap::deallocateXSmallPage):
1004         * bmalloc/XSmallAllocator.h: Added.
1005         (bmalloc::XSmallAllocator::isNull):
1006         (bmalloc::XSmallAllocator::canAllocate):
1007         (bmalloc::XSmallAllocator::XSmallAllocator):
1008         (bmalloc::XSmallAllocator::line):
1009         (bmalloc::XSmallAllocator::allocate):
1010         (bmalloc::XSmallAllocator::objectCount):
1011         (bmalloc::XSmallAllocator::derefCount):
1012         (bmalloc::XSmallAllocator::refill):
1013         * bmalloc/XSmallChunk.h: Added.
1014         * bmalloc/XSmallLine.h: Added.
1015         * bmalloc/XSmallPage.h: Added.
1016         * bmalloc/XSmallTraits.h: Added.
1017         * bmalloc/bmalloc.h:
1018         (bmalloc::api::realloc): Boiler-plate copy, as above.
1019
1020 2014-04-14  Geoffrey Garen  <ggaren@apple.com>
1021
1022         MallocBench should scavenge explicitly instead of waiting
1023         https://bugs.webkit.org/show_bug.cgi?id=131661
1024
1025         Reviewed by Andreas Kling.
1026
1027         Added explicit scavenge support to bmalloc. This isn't a memory win,
1028         since bmalloc's per-thread cache is so small. But it makes testing
1029         simpler.
1030
1031         * bmalloc/Allocator.cpp:
1032         (bmalloc::Allocator::~Allocator):
1033         (bmalloc::Allocator::scavenge):
1034         * bmalloc/Allocator.h:
1035         * bmalloc/Cache.cpp:
1036         (bmalloc::Cache::operator new):
1037         (bmalloc::Cache::operator delete):
1038         (bmalloc::Cache::Cache):
1039         (bmalloc::Cache::scavenge):
1040         * bmalloc/Cache.h:
1041         * bmalloc/Deallocator.cpp:
1042         (bmalloc::Deallocator::~Deallocator):
1043         (bmalloc::Deallocator::scavenge):
1044         * bmalloc/Deallocator.h: Factored existing scavenging code into helper
1045         functions, for reuse.
1046
1047         * bmalloc/Heap.cpp:
1048         (bmalloc::sleep):
1049         (bmalloc::Heap::concurrentScavenge):
1050         (bmalloc::Heap::scavenge):
1051         (bmalloc::Heap::scavengeSmallPages):
1052         (bmalloc::Heap::scavengeMediumPages):
1053         (bmalloc::Heap::scavengeLargeRanges):
1054         * bmalloc/Heap.h: Made scavenge sleep duration a parameter. Forced
1055         scavenging -- in response to a benchmark or a low memory warning --
1056         wants to complete as soon as possible, so its sleep duration is 0.
1057
1058         * bmalloc/bmalloc.h:
1059         (bmalloc::api::scavenge):
1060         * bmalloc/mbmalloc.cpp: Exported the scavenge API for MallocBench's use.
1061
1062 2014-04-14  Geoffrey Garen  <ggaren@apple.com>
1063
1064         Use 4kB pages on Mac
1065         https://bugs.webkit.org/show_bug.cgi?id=131658
1066
1067         Reviewed by Sam Weinig.
1068
1069         This reduces memory use a lot on Membuster:
1070
1071                                                                   base                      patch                                Δ
1072                 Execution Time:
1073                     reddit_memory_warning                         18ms                       17ms                   ^ 1.06x faster
1074                     flickr_memory_warning                         34ms                       36ms                   ! 1.06x slower
1075                     theverge_memory_warning                       39ms                       41ms                   ! 1.05x slower
1076
1077                     <geometric mean>                              29ms                       29ms                   ! 1.02x slower
1078                     <arithmetic mean>                             30ms                       31ms                   ! 1.03x slower
1079                     <harmonic mean>                               27ms                       27ms                    ^ 1.0x faster
1080
1081                 Peak Memory:
1082                     reddit_memory_warning                     16,412kB                   16,436kB                    ! 1.0x bigger
1083                     flickr_memory_warning                     30,120kB                   30,184kB                    ! 1.0x bigger
1084                     theverge_memory_warning                   33,408kB                   33,420kB                    ! 1.0x bigger
1085
1086                     <geometric mean>                          25,466kB                   25,499kB                    ! 1.0x bigger
1087                     <arithmetic mean>                         26,647kB                   26,680kB                    ! 1.0x bigger
1088                     <harmonic mean>                           24,181kB                   24,214kB                    ! 1.0x bigger
1089
1090                 Memory at End:
1091                     reddit_memory_warning                      2,404kB                    1,920kB                  ^ 1.25x smaller
1092                     flickr_memory_warning                      3,764kB                    3,072kB                  ^ 1.23x smaller
1093                     theverge_memory_warning                    3,648kB                    3,132kB                  ^ 1.16x smaller
1094
1095                     <geometric mean>                           3,208kB                    2,644kB                  ^ 1.21x smaller
1096                     <arithmetic mean>                          3,272kB                    2,708kB                  ^ 1.21x smaller
1097                     <harmonic mean>                            3,139kB                    2,574kB                  ^ 1.22x smaller
1098
1099
1100         * bmalloc.xcodeproj/project.pbxproj:
1101         * bmalloc/BPlatform.h: Added.
1102         * bmalloc/VMAllocate.h: Only use 16kB pages on iOS because the page size
1103         is 4kB on Mac.
1104
1105 2014-04-14  Alexey Proskuryakov  <ap@apple.com>
1106
1107         Fixed svn:ignore on bmalloc.xcodeproj, it had erroneous leading spaces.
1108
1109         * bmalloc.xcodeproj: Modified property svn:ignore.
1110
1111 2014-04-13  Geoffrey Garen  <ggaren@apple.com>
1112
1113         Fixed some mbmalloc exports
1114         https://bugs.webkit.org/show_bug.cgi?id=131599
1115
1116         Reviewed by Ryosuke Niwa.
1117
1118         * bmalloc.xcodeproj/project.pbxproj: Made some headers a private part
1119         of the project, so we can call them from API.
1120
1121         * bmalloc/mbmalloc.cpp: Marked the mbmalloc functions with default
1122         visibility, so they show up as exported in the .dylib.
1123
1124 2014-04-09  Geoffrey Garen  <ggaren@apple.com>
1125
1126         Put bmalloc headers in the right place
1127         https://bugs.webkit.org/show_bug.cgi?id=131464
1128
1129         Reviewed by Mark Rowe.
1130
1131         * Configurations/bmalloc.xcconfig: Set PRIVATE_HEADERS_FOLDER_PATH to
1132         specify that we don't just want to dump all of our generically-named
1133         headers into /usr/local/include.
1134
1135 2014-04-08  Geoffrey Garen  <ggaren@apple.com>
1136
1137         Made bmalloc more #include friendly
1138         https://bugs.webkit.org/show_bug.cgi?id=131386
1139
1140         Reviewed by Andreas Kling.
1141
1142         Marked a bunch of headers private so they can be used from client code
1143         that #includes bmalloc.h.
1144
1145         Renamed ASSERT macros to BASSERT. This matches their header, which already
1146         had to be renamed, and fixes conflicts with WTF's ASSERT macros.
1147
1148         * bmalloc.xcodeproj/project.pbxproj:
1149         * bmalloc/Allocator.cpp:
1150         (bmalloc::Allocator::allocateSlowCase):
1151         * bmalloc/AsyncTask.h:
1152         (bmalloc::Function>::runSlowCase):
1153         * bmalloc/BAssert.h:
1154         * bmalloc/BoundaryTag.h:
1155         (bmalloc::BoundaryTag::setSize):
1156         * bmalloc/BoundaryTagInlines.h:
1157         (bmalloc::validate):
1158         (bmalloc::BoundaryTag::init):
1159         (bmalloc::BoundaryTag::deallocate):
1160         (bmalloc::BoundaryTag::splitLarge):
1161         (bmalloc::BoundaryTag::allocate):
1162         * bmalloc/Chunk.h:
1163         * bmalloc/Deallocator.cpp:
1164         (bmalloc::Deallocator::processObjectLog):
1165         (bmalloc::Deallocator::deallocateSlowCase):
1166         * bmalloc/Deallocator.h:
1167         (bmalloc::Deallocator::deallocateFastCase):
1168         * bmalloc/FixedVector.h:
1169         (bmalloc::Capacity>::operator):
1170         (bmalloc::Capacity>::push):
1171         (bmalloc::Capacity>::pop):
1172         (bmalloc::Capacity>::shrink):
1173         * bmalloc/Heap.cpp:
1174         (bmalloc::Heap::allocateLarge):
1175         * bmalloc/LargeChunk.h:
1176         (bmalloc::LargeChunk::get):
1177         (bmalloc::LargeChunk::endTag):
1178         * bmalloc/Line.h:
1179         (bmalloc::Line<Traits>::concurrentRef):
1180         (bmalloc::Line<Traits>::deref):
1181         * bmalloc/MediumAllocator.h:
1182         (bmalloc::MediumAllocator::allocate):
1183         * bmalloc/ObjectType.h:
1184         (bmalloc::isSmall):
1185         * bmalloc/Page.h:
1186         (bmalloc::Page<Traits>::ref):
1187         (bmalloc::Page<Traits>::deref):
1188         * bmalloc/PerThread.h:
1189         (bmalloc::PerThread<T>::getSlowCase):
1190         * bmalloc/SegregatedFreeList.cpp:
1191         (bmalloc::SegregatedFreeList::SegregatedFreeList):
1192         (bmalloc::SegregatedFreeList::insert):
1193         * bmalloc/SmallAllocator.h:
1194         (bmalloc::SmallAllocator::allocate):
1195         (bmalloc::SmallAllocator::refill):
1196         * bmalloc/Syscall.h:
1197         * bmalloc/VMAllocate.h:
1198         (bmalloc::vmValidate):
1199         (bmalloc::vmAllocate):
1200         (bmalloc::vmDeallocatePhysicalPagesSloppy):
1201         * bmalloc/Vector.h:
1202         (bmalloc::Vector<T>::operator):
1203         (bmalloc::Vector<T>::pop):
1204         (bmalloc::Vector<T>::shrink):
1205         * bmalloc/XLargeChunk.h:
1206         (bmalloc::XLargeChunk::range):
1207         (bmalloc::XLargeChunk::size):
1208
1209 2014-04-08  Geoffrey Garen  <ggaren@apple.com>
1210
1211         Removed an unused file.
1212
1213         Unreviewed.
1214
1215         * bmalloc/AsyncTask.cpp: Removed.
1216
1217 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
1218
1219         Build bmalloc on Mac
1220         https://bugs.webkit.org/show_bug.cgi?id=131333
1221
1222         Reviewed by Mark Rowe.
1223
1224         * Makefile: Added. For make clients.
1225
1226         These files are required for building any project in WebKit. I copied
1227         them from WTF:
1228         * Configurations: Added.
1229         * Configurations/Base.xcconfig: Added.
1230         * Configurations/DebugRelease.xcconfig: Added.
1231         * Configurations/bmalloc.xcconfig: Added.
1232         * Configurations/iOS.xcconfig: Added.
1233         * Configurations/mbmalloc.xcconfig: Added.
1234
1235         * bmalloc.xcodeproj/project.pbxproj: I removed per-project-file stuff
1236         from here because everything is in .xcconfig files now.
1237
1238         I had to fix a bunch of minor warnings, since they're enabled in our
1239         .xcconfig files:
1240
1241         * bmalloc/AsyncTask.h:
1242         (bmalloc::Function>::AsyncTask):
1243         * bmalloc/BAssert.h:
1244         * bmalloc/BoundaryTagInlines.h:
1245         (bmalloc::validate):
1246         * bmalloc/Heap.cpp:
1247         (bmalloc::Heap::Heap):
1248         (bmalloc::Heap::allocateLarge):
1249         (bmalloc::Heap::deallocateLarge):
1250         * bmalloc/Mutex.h:
1251         (bmalloc::Mutex::Mutex): Deleted.
1252         * bmalloc/VMAllocate.h:
1253         (bmalloc::vmValidate):
1254         * bmalloc/mbmalloc.cpp:
1255
1256 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
1257
1258         bmalloc: Fixed a leak in the per-thread cache
1259         https://bugs.webkit.org/show_bug.cgi?id=131330
1260
1261         Reviewed by Andreas Kling.
1262
1263         Remember to deallocate our line caches upon thread exit.
1264
1265         * bmalloc/Deallocator.cpp:
1266         (bmalloc::Deallocator::~Deallocator):
1267
1268 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
1269
1270         bmalloc: rolled out the tryLock experiment
1271         https://bugs.webkit.org/show_bug.cgi?id=131328
1272
1273         Reviewed by Andreas Kling.
1274
1275         It wasn't a speedup.
1276
1277         * bmalloc.xcodeproj/project.pbxproj:
1278         * bmalloc/Allocator.cpp:
1279         (bmalloc::Allocator::processSmallAllocatorLog):
1280         (bmalloc::Allocator::processMediumAllocatorLog):
1281         * bmalloc/Deallocator.cpp:
1282         (bmalloc::Deallocator::processObjectLog):
1283         (bmalloc::Deallocator::deallocateSlowCase):
1284         (bmalloc::Deallocator::deallocateSmallLine):
1285         (bmalloc::Deallocator::deallocateMediumLine):
1286         * bmalloc/Deallocator.h:
1287         (bmalloc::Deallocator::deallocateFastCase):
1288         * bmalloc/Heap.h:
1289         (bmalloc::Heap::deallocateSmallLine):
1290         (bmalloc::Heap::deallocateMediumLine):
1291         * bmalloc/Line.h:
1292         (bmalloc::Line<Traits>::deref):
1293         * bmalloc/Page.h:
1294         (bmalloc::Page<Traits>::deref):
1295
1296 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
1297
1298         bmalloc
1299         https://bugs.webkit.org/show_bug.cgi?id=131170
1300
1301         Reviewed by Andreas Kling.
1302
1303         Initial commit.
1304
1305         * bmalloc: Added.
1306         * bmalloc.xcodeproj: Added.
1307         * bmalloc.xcodeproj/project.pbxproj: Added.
1308         * bmalloc/Algorithm.h: Added.
1309         (bmalloc::max):
1310         (bmalloc::min):
1311         (bmalloc::mask):
1312         (bmalloc::test):
1313         (bmalloc::roundUpToMultipleOf):
1314         (bmalloc::roundDownToMultipleOf):
1315         (bmalloc::sizeOf):
1316         (bmalloc::bitCount):
1317         (bmalloc::isPowerOfTwo):
1318         * bmalloc/Allocator.cpp: Added.
1319         (bmalloc::Allocator::Allocator):
1320         (bmalloc::Allocator::~Allocator):
1321         (bmalloc::Allocator::log):
1322         (bmalloc::Allocator::processSmallAllocatorLog):
1323         (bmalloc::Allocator::processMediumAllocatorLog):
1324         (bmalloc::Allocator::allocateLarge):
1325         (bmalloc::Allocator::allocateXLarge):
1326         (bmalloc::Allocator::allocateMedium):
1327         (bmalloc::Allocator::allocateSlowCase):
1328         * bmalloc/Allocator.h: Added.
1329         (bmalloc::Allocator::smallAllocatorFor):
1330         (bmalloc::Allocator::allocateFastCase):
1331         (bmalloc::Allocator::allocate):
1332         * bmalloc/AsyncTask.cpp: Added.
1333         (bmalloc::AsyncTask<Function>::runSlowCase):
1334         (bmalloc::AsyncTask<Function>::pthreadEntryPoint):
1335         (bmalloc::AsyncTask<Function>::entryPoint):
1336         * bmalloc/AsyncTask.h: Added.
1337         (bmalloc::Function>::AsyncTask):
1338         (bmalloc::Function>::join):
1339         (bmalloc::Function>::run):
1340         (bmalloc::Function>::runSlowCase):
1341         (bmalloc::Function>::pthreadEntryPoint):
1342         (bmalloc::Function>::entryPoint):
1343         * bmalloc/BAssert.h: Added.
1344         * bmalloc/BeginTag.h: Added.
1345         (bmalloc::BeginTag::isInFreeList):
1346         * bmalloc/BoundaryTag.h: Added.
1347         (bmalloc::BoundaryTag::isXLarge):
1348         (bmalloc::BoundaryTag::setXLarge):
1349         (bmalloc::BoundaryTag::isFree):
1350         (bmalloc::BoundaryTag::setFree):
1351         (bmalloc::BoundaryTag::isEnd):
1352         (bmalloc::BoundaryTag::setEnd):
1353         (bmalloc::BoundaryTag::hasPhysicalPages):
1354         (bmalloc::BoundaryTag::setHasPhysicalPages):
1355         (bmalloc::BoundaryTag::isNull):
1356         (bmalloc::BoundaryTag::clear):
1357         (bmalloc::BoundaryTag::size):
1358         (bmalloc::BoundaryTag::setSize):
1359         (bmalloc::BoundaryTag::prev):
1360         (bmalloc::BoundaryTag::next):
1361         * bmalloc/BoundaryTagInlines.h: Added.
1362         (bmalloc::validate):
1363         (bmalloc::validatePrev):
1364         (bmalloc::validateNext):
1365         (bmalloc::BoundaryTag::init):
1366         (bmalloc::BoundaryTag::mergeLargeLeft):
1367         (bmalloc::BoundaryTag::mergeLargeRight):
1368         (bmalloc::BoundaryTag::mergeLarge):
1369         (bmalloc::BoundaryTag::deallocate):
1370         (bmalloc::BoundaryTag::splitLarge):
1371         (bmalloc::BoundaryTag::allocate):
1372         * bmalloc/Cache.cpp: Added.
1373         (bmalloc::Cache::operator new):
1374         (bmalloc::Cache::operator delete):
1375         (bmalloc::Cache::Cache):
1376         (bmalloc::Cache::allocateSlowCase):
1377         (bmalloc::Cache::allocateSlowCaseNullCache):
1378         (bmalloc::Cache::deallocateSlowCase):
1379         (bmalloc::Cache::deallocateSlowCaseNullCache):
1380         * bmalloc/Cache.h: Added.
1381         (bmalloc::Cache::allocator):
1382         (bmalloc::Cache::deallocator):
1383         (bmalloc::Cache::allocateFastCase):
1384         (bmalloc::Cache::deallocateFastCase):
1385         (bmalloc::Cache::allocate):
1386         (bmalloc::Cache::deallocate):
1387         * bmalloc/Chunk.h: Added.
1388         (bmalloc::Chunk::begin):
1389         (bmalloc::Chunk::end):
1390         (bmalloc::Chunk::lines):
1391         (bmalloc::Chunk::pages):
1392         * bmalloc/Deallocator.cpp: Added.
1393         (bmalloc::Deallocator::Deallocator):
1394         (bmalloc::Deallocator::~Deallocator):
1395         (bmalloc::Deallocator::deallocateLarge):
1396         (bmalloc::Deallocator::deallocateXLarge):
1397         (bmalloc::Deallocator::processObjectLog):
1398         (bmalloc::Deallocator::deallocateSlowCase):
1399         (bmalloc::Deallocator::deallocateSmallLine):
1400         (bmalloc::Deallocator::allocateSmallLine):
1401         (bmalloc::Deallocator::deallocateMediumLine):
1402         (bmalloc::Deallocator::allocateMediumLine):
1403         * bmalloc/Deallocator.h: Added.
1404         (bmalloc::Deallocator::deallocateFastCase):
1405         (bmalloc::Deallocator::deallocate):
1406         * bmalloc/EndTag.h: Added.
1407         (bmalloc::EndTag::operator=):
1408         * bmalloc/FixedVector.h: Added.
1409         (bmalloc::FixedVector::begin):
1410         (bmalloc::FixedVector::end):
1411         (bmalloc::FixedVector::size):
1412         (bmalloc::FixedVector::capacity):
1413         (bmalloc::FixedVector::clear):
1414         (bmalloc::FixedVector::isEmpty):
1415         (bmalloc::Capacity>::FixedVector):
1416         (bmalloc::Capacity>::operator):
1417         (bmalloc::Capacity>::push):
1418         (bmalloc::Capacity>::pop):
1419         (bmalloc::Capacity>::shrink):
1420         * bmalloc/Heap.cpp: Added.
1421         (bmalloc::sleep):
1422         (bmalloc::Heap::Heap):
1423         (bmalloc::Heap::concurrentScavenge):
1424         (bmalloc::Heap::scavengeSmallPages):
1425         (bmalloc::Heap::scavengeMediumPages):
1426         (bmalloc::Heap::scavengeLargeRanges):
1427         (bmalloc::Heap::allocateSmallLineSlowCase):
1428         (bmalloc::Heap::allocateMediumLineSlowCase):
1429         (bmalloc::Heap::allocateXLarge):
1430         (bmalloc::Heap::deallocateXLarge):
1431         (bmalloc::Heap::allocateLarge):
1432         (bmalloc::Heap::deallocateLarge):
1433         * bmalloc/Heap.h: Added.
1434         (bmalloc::Heap::deallocateSmallLine):
1435         (bmalloc::Heap::allocateSmallLine):
1436         (bmalloc::Heap::deallocateMediumLine):
1437         (bmalloc::Heap::allocateMediumLine):
1438         * bmalloc/Inline.h: Added.
1439         * bmalloc/LargeChunk.h: Added.
1440         (bmalloc::LargeChunk::begin):
1441         (bmalloc::LargeChunk::end):
1442         (bmalloc::LargeChunk::create):
1443         (bmalloc::LargeChunk::get):
1444         (bmalloc::LargeChunk::beginTag):
1445         (bmalloc::LargeChunk::endTag):
1446         * bmalloc/Line.h: Added.
1447         (bmalloc::Line<Traits>::begin):
1448         (bmalloc::Line<Traits>::end):
1449         (bmalloc::Line<Traits>::concurrentRef):
1450         (bmalloc::Line<Traits>::deref):
1451         * bmalloc/MediumAllocator.h: Added.
1452         (bmalloc::MediumAllocator::isNull):
1453         (bmalloc::MediumAllocator::MediumAllocator):
1454         (bmalloc::MediumAllocator::line):
1455         (bmalloc::MediumAllocator::allocate):
1456         (bmalloc::MediumAllocator::derefCount):
1457         (bmalloc::MediumAllocator::refill):
1458         * bmalloc/MediumChunk.h: Added.
1459         * bmalloc/MediumLine.h: Added.
1460         * bmalloc/MediumPage.h: Added.
1461         * bmalloc/MediumTraits.h: Added.
1462         * bmalloc/Mutex.cpp: Added.
1463         (bmalloc::Mutex::lockSlowCase):
1464         * bmalloc/Mutex.h: Added.
1465         (bmalloc::Mutex::Mutex):
1466         (bmalloc::Mutex::try_lock):
1467         (bmalloc::Mutex::lock):
1468         (bmalloc::Mutex::unlock):
1469         * bmalloc/ObjectType.cpp: Added.
1470         (bmalloc::objectType):
1471         * bmalloc/ObjectType.h: Added.
1472         (bmalloc::isSmallOrMedium):
1473         (bmalloc::isSmall):
1474         * bmalloc/Page.h: Added.
1475         (bmalloc::Page<Traits>::ref):
1476         (bmalloc::Page<Traits>::deref):
1477         (bmalloc::Page<Traits>::refCount):
1478         * bmalloc/PerProcess.h: Added.
1479         (bmalloc::PerProcess::mutex):
1480         (bmalloc::PerProcess<T>::getFastCase):
1481         (bmalloc::PerProcess<T>::get):
1482         (bmalloc::PerProcess<T>::getSlowCase):
1483         * bmalloc/PerThread.h: Added.
1484         (bmalloc::PerThreadStorage<Cache>::get):
1485         (bmalloc::PerThreadStorage<Cache>::init):
1486         (bmalloc::PerThreadStorage::get):
1487         (bmalloc::PerThreadStorage::init):
1488         (bmalloc::PerThread<T>::getFastCase):
1489         (bmalloc::PerThread<T>::get):
1490         (bmalloc::PerThread<T>::destructor):
1491         (bmalloc::PerThread<T>::getSlowCase):
1492         * bmalloc/Range.h: Added.
1493         (bmalloc::Range::Range):
1494         (bmalloc::Range::begin):
1495         (bmalloc::Range::end):
1496         (bmalloc::Range::size):
1497         (bmalloc::Range::operator!):
1498         (bmalloc::Range::operator<):
1499         * bmalloc/SegregatedFreeList.cpp: Added.
1500         (bmalloc::SegregatedFreeList::SegregatedFreeList):
1501         (bmalloc::SegregatedFreeList::insert):
1502         (bmalloc::SegregatedFreeList::takeGreedy):
1503         (bmalloc::SegregatedFreeList::take):
1504         * bmalloc/SegregatedFreeList.h: Added.
1505         * bmalloc/Sizes.h: Added.
1506         * bmalloc/SmallAllocator.h: Added.
1507         (bmalloc::SmallAllocator::isNull):
1508         (bmalloc::SmallAllocator::canAllocate):
1509         (bmalloc::SmallAllocator::SmallAllocator):
1510         (bmalloc::SmallAllocator::line):
1511         (bmalloc::SmallAllocator::allocate):
1512         (bmalloc::SmallAllocator::objectCount):
1513         (bmalloc::SmallAllocator::derefCount):
1514         (bmalloc::SmallAllocator::refill):
1515         * bmalloc/SmallChunk.h: Added.
1516         * bmalloc/SmallLine.h: Added.
1517         * bmalloc/SmallPage.h: Added.
1518         * bmalloc/SmallTraits.h: Added.
1519         * bmalloc/Syscall.h: Added.
1520         * bmalloc/VMAllocate.h: Added.
1521         (bmalloc::vmSize):
1522         (bmalloc::vmValidate):
1523         (bmalloc::vmAllocate):
1524         (bmalloc::vmDeallocate):
1525         (bmalloc::vmDeallocatePhysicalPages):
1526         (bmalloc::vmAllocatePhysicalPages):
1527         (bmalloc::vmDeallocatePhysicalPagesSloppy):
1528         (bmalloc::vmAllocatePhysicalPagesSloppy):
1529         * bmalloc/VMHeap.cpp: Added.
1530         (bmalloc::VMHeap::VMHeap):
1531         (bmalloc::VMHeap::allocateSmallChunk):
1532         (bmalloc::VMHeap::allocateMediumChunk):
1533         (bmalloc::VMHeap::allocateLargeChunk):
1534         * bmalloc/VMHeap.h: Added.
1535         (bmalloc::VMHeap::allocateSmallPage):
1536         (bmalloc::VMHeap::allocateMediumPage):
1537         (bmalloc::VMHeap::allocateLargeRange):
1538         (bmalloc::VMHeap::deallocateSmallPage):
1539         (bmalloc::VMHeap::deallocateMediumPage):
1540         (bmalloc::VMHeap::deallocateLargeRange):
1541         * bmalloc/Vector.h: Added.
1542         (bmalloc::Vector::begin):
1543         (bmalloc::Vector::end):
1544         (bmalloc::Vector::size):
1545         (bmalloc::Vector::capacity):
1546         (bmalloc::Vector::last):
1547         (bmalloc::Vector::pop):
1548         (bmalloc::Vector<T>::Vector):
1549         (bmalloc::Vector<T>::~Vector):
1550         (bmalloc::Vector<T>::operator):
1551         (bmalloc::Vector<T>::push):
1552         (bmalloc::Vector<T>::pop):
1553         (bmalloc::Vector<T>::shrink):
1554         (bmalloc::Vector<T>::reallocateBuffer):
1555         (bmalloc::Vector<T>::shrinkCapacity):
1556         (bmalloc::Vector<T>::growCapacity):
1557         * bmalloc/XLargeChunk.h: Added.
1558         (bmalloc::XLargeChunk::get):
1559         (bmalloc::XLargeChunk::begin):
1560         (bmalloc::XLargeChunk::XLargeChunk):
1561         (bmalloc::XLargeChunk::create):
1562         (bmalloc::XLargeChunk::destroy):
1563         (bmalloc::XLargeChunk::range):
1564         (bmalloc::XLargeChunk::size):
1565         * bmalloc/bmalloc.h: Added.
1566         (bmalloc::api::malloc):
1567         (bmalloc::api::free):
1568         (bmalloc::api::realloc):
1569         * bmalloc/mbmalloc.cpp: Added.
1570