All Indic text is rendered as boxes on iOS
[WebKit-https.git] / Source / bmalloc / ChangeLog
1 2014-05-01  Dan Bernstein  <mitz@apple.com>
2
3         Fixed production builds for the iOS Simulator.
4         <rdar://problem/16792221>
5
6         * Configurations/bmalloc.xcconfig: Include INSTALL_PATH_PREFIX in
7         PRIVATE_HEADERS_FOLDER_PATH when installing.
8
9 2014-04-20  Geoffrey Garen  <ggaren@apple.com>
10
11         bmalloc: Segregate pages by objects size
12         https://bugs.webkit.org/show_bug.cgi?id=131909
13
14         Reviewed by Andreas Kling.
15
16         2% reduction in memory-at-end on the Membuster memory_warning benchmarks.
17
18         * bmalloc/Allocator.cpp:
19         (bmalloc::Allocator::allocateSlowCase):
20         * bmalloc/Allocator.h:
21         (bmalloc::Allocator::allocateFastCase):
22         (bmalloc::Allocator::smallAllocatorFor): Use the new shared helper
23         function for size class calculation.
24
25         * bmalloc/Deallocator.cpp:
26         (bmalloc::Deallocator::Deallocator):
27         (bmalloc::Deallocator::scavenge):
28         (bmalloc::Deallocator::deallocateSmallLine):
29         (bmalloc::Deallocator::allocateSmallLine):
30         * bmalloc/Deallocator.h: Keep a cache for every size class, since the
31         cache can't be shared anymore.
32
33         * bmalloc/Heap.cpp:
34         (bmalloc::Heap::allocateSmallLineSlowCase):
35         * bmalloc/Heap.h:
36         (bmalloc::Heap::deallocateSmallLine): Ditto.
37
38         (bmalloc::Heap::allocateSmallLine): Check size class in addition to
39         page refcount when allocating a line because we might have deallocated
40         the page and the recycled it for another size class.
41
42         (bmalloc::Heap::deallocateMediumLine):
43         (bmalloc::Heap::allocateMediumLine):
44         * bmalloc/Line.h:
45         (bmalloc::Line::refCount):
46         * bmalloc/Page.h:
47         (bmalloc::Page::refCount):
48         (bmalloc::Page::smallSizeClass):
49         (bmalloc::Page::setSmallSizeClass):
50         (bmalloc::Page<Traits>::refCount): Deleted.
51         * bmalloc/Sizes.h:
52         (bmalloc::Sizes::smallSizeClassFor): New shared API for computing
53         an index into an array from a size.
54
55 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
56
57         bmalloc: Improved alignment in LargeChunk
58         https://bugs.webkit.org/show_bug.cgi?id=131895
59
60         Reviewed by Andreas Kling.
61
62         * bmalloc/Chunk.h:
63         * bmalloc/LargeChunk.h: Align to vmPageSize just like Chunk does.
64         Technically, the previous alignment was harmless, but I would prefer,
65         dear reader, not to have to explain the interlocking set of
66         circumstances that made it so.
67
68 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
69
70         Rolled out r167502 because it caused a crash on the facebook benchmark.
71
72         Unreviewed.
73
74             bmalloc: Added an XSmall line size
75             https://bugs.webkit.org/show_bug.cgi?id=131851
76
77             Reviewed by Sam Weinig.
78
79 2014-04-19  Geoffrey Garen  <ggaren@apple.com>
80
81         bmalloc: Mutex should be harder to use wrong
82         https://bugs.webkit.org/show_bug.cgi?id=131879
83
84         Reviewed by Andreas Kling.
85
86         Mutex now has a proper constructor, so you can't deadlock by forgetting
87         to initialize it.
88
89         * bmalloc.xcodeproj/project.pbxproj:
90         * bmalloc/Allocator.cpp:
91         (bmalloc::Allocator::processXSmallAllocatorLog):
92         (bmalloc::Allocator::processSmallAllocatorLog):
93         (bmalloc::Allocator::processMediumAllocatorLog):
94         (bmalloc::Allocator::allocateLarge):
95         (bmalloc::Allocator::allocateXLarge): Global replace Mutex => StaticMutex,
96         since the Heap mutex is a static.
97
98         * bmalloc/AsyncTask.h:
99         (bmalloc::Function>::AsyncTask): Use Mutex, since we're not static. No
100         need for explicit initialization anymore.
101
102         * bmalloc/Deallocator.cpp:
103         (bmalloc::Deallocator::scavenge):
104         (bmalloc::Deallocator::deallocateLarge):
105         (bmalloc::Deallocator::deallocateXLarge):
106         (bmalloc::Deallocator::processObjectLog):
107         (bmalloc::Deallocator::deallocateSmallLine):
108         (bmalloc::Deallocator::deallocateXSmallLine):
109         (bmalloc::Deallocator::allocateSmallLine):
110         (bmalloc::Deallocator::allocateXSmallLine):
111         (bmalloc::Deallocator::deallocateMediumLine):
112         (bmalloc::Deallocator::allocateMediumLine):
113         * bmalloc/Deallocator.h:
114         * bmalloc/Heap.cpp:
115         (bmalloc::sleep):
116         (bmalloc::Heap::Heap):
117         (bmalloc::Heap::concurrentScavenge):
118         (bmalloc::Heap::scavenge):
119         (bmalloc::Heap::scavengeSmallPages):
120         (bmalloc::Heap::scavengeXSmallPages):
121         (bmalloc::Heap::scavengeMediumPages):
122         (bmalloc::Heap::scavengeLargeRanges):
123         (bmalloc::Heap::allocateXSmallLineSlowCase):
124         (bmalloc::Heap::allocateSmallLineSlowCase):
125         (bmalloc::Heap::allocateMediumLineSlowCase):
126         (bmalloc::Heap::allocateXLarge):
127         (bmalloc::Heap::deallocateXLarge):
128         (bmalloc::Heap::allocateLarge):
129         (bmalloc::Heap::deallocateLarge):
130         * bmalloc/Heap.h:
131         (bmalloc::Heap::deallocateXSmallLine):
132         (bmalloc::Heap::allocateXSmallLine):
133         (bmalloc::Heap::deallocateSmallLine):
134         (bmalloc::Heap::allocateSmallLine):
135         (bmalloc::Heap::deallocateMediumLine):
136         (bmalloc::Heap::allocateMediumLine):
137         * bmalloc/Line.h:
138         (bmalloc::Line<Traits>::deref):
139         * bmalloc/Mutex.cpp: Removed.
140         * bmalloc/Mutex.h:
141         (bmalloc::Mutex::Mutex):
142         (bmalloc::Mutex::init): Deleted.
143         (bmalloc::Mutex::try_lock): Deleted.
144         (bmalloc::Mutex::lock): Deleted.
145         (bmalloc::Mutex::unlock): Deleted.
146         * bmalloc/Page.h:
147         (bmalloc::Page<Traits>::ref):
148         (bmalloc::Page<Traits>::deref):
149         (bmalloc::Page<Traits>::refCount):
150         * bmalloc/PerProcess.h:
151         (bmalloc::PerProcess::mutex):
152         (bmalloc::PerProcess<T>::getSlowCase):
153         * bmalloc/StaticMutex.cpp: Added.
154         (bmalloc::StaticMutex::lockSlowCase):
155         * bmalloc/StaticMutex.h: Added.
156         (bmalloc::StaticMutex::init):
157         (bmalloc::StaticMutex::try_lock):
158         (bmalloc::StaticMutex::lock):
159         (bmalloc::StaticMutex::unlock):
160         * bmalloc/VMHeap.h:
161         (bmalloc::VMHeap::deallocateXSmallPage):
162         (bmalloc::VMHeap::deallocateSmallPage):
163         (bmalloc::VMHeap::deallocateMediumPage):
164         (bmalloc::VMHeap::deallocateLargeRange):
165         * bmalloc/bmalloc.h:
166         (bmalloc::api::scavenge): Global replace Mutex => StaticMutex,
167         since the Heap mutex is a static.
168
169 2014-04-18  Geoffrey Garen  <ggaren@apple.com>
170
171         bmalloc: AsyncTask should use Mutex instead of std::mutex
172         https://bugs.webkit.org/show_bug.cgi?id=131865
173
174         Reviewed by Gavin Barraclough.
175
176         std::mutex is so slow that it makes parallelizing simple tasks through
177         AsyncTask a net regression. Mutex fixes this.
178
179         * bmalloc/AsyncTask.h:
180         (bmalloc::Function>::AsyncTask):
181         (bmalloc::Function>::join):
182         (bmalloc::Function>::runSlowCase):
183         (bmalloc::Function>::entryPoint):
184         * bmalloc/Mutex.h:
185         (bmalloc::Mutex::init):
186
187 2014-04-18  Geoffrey Garen  <ggaren@apple.com>
188
189         bmalloc: Added an XSmall line size
190         https://bugs.webkit.org/show_bug.cgi?id=131851
191
192         Reviewed by Sam Weinig.
193
194         Reduces malloc footprint on Membuster recordings by 10%.
195
196         This is a throughput regression, but we're still way ahead of TCMalloc.
197         I have some ideas for how to recover the regression -- but I wanted to
198         get this win in first.
199
200         Full set of benchmark results:
201
202                 bmalloc> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks --measure-heap nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
203                                                                                                 
204                                                                nopatch                      patch                                Δ
205                 Peak Memory:
206                     reddit_memory_warning                      7,896kB                    7,532kB                  ^ 1.05x smaller
207                     flickr_memory_warning                     12,968kB                   12,324kB                  ^ 1.05x smaller
208                     theverge_memory_warning                   16,672kB                   15,200kB                   ^ 1.1x smaller
209
210                     <geometric mean>                          11,952kB                   11,216kB                  ^ 1.07x smaller
211                     <arithmetic mean>                         12,512kB                   11,685kB                  ^ 1.07x smaller
212                     <harmonic mean>                           11,375kB                   10,726kB                  ^ 1.06x smaller
213
214                 Memory at End:
215                     reddit_memory_warning                      7,320kB                    6,856kB                  ^ 1.07x smaller
216                     flickr_memory_warning                     10,848kB                    9,692kB                  ^ 1.12x smaller
217                     theverge_memory_warning                   16,380kB                   14,872kB                   ^ 1.1x smaller
218
219                     <geometric mean>                          10,916kB                    9,961kB                   ^ 1.1x smaller
220                     <arithmetic mean>                         11,516kB                   10,473kB                   ^ 1.1x smaller
221                     <harmonic mean>                           10,350kB                    9,485kB                  ^ 1.09x smaller
222
223                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
224                                                                                                 
225                                                    nopatch                patch                         Δ
226                 Execution Time:
227                     churn                            127ms                151ms            ! 1.19x slower
228                     list_allocate                    130ms                164ms            ! 1.26x slower
229                     tree_allocate                    109ms                127ms            ! 1.17x slower
230                     tree_churn                       115ms                120ms            ! 1.04x slower
231                     facebook                         240ms                259ms            ! 1.08x slower
232                     fragment                          91ms                131ms            ! 1.44x slower
233                     fragment_iterate                 105ms                106ms            ! 1.01x slower
234                     message_one                      260ms                259ms             ^ 1.0x faster
235                     message_many                     149ms                154ms            ! 1.03x slower
236                     medium                           194ms                248ms            ! 1.28x slower
237                     big                              157ms                160ms            ! 1.02x slower
238
239                     <geometric mean>                 144ms                163ms            ! 1.13x slower
240                     <arithmetic mean>                152ms                171ms            ! 1.12x slower
241                     <harmonic mean>                  137ms                156ms            ! 1.14x slower
242
243                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks nopatch:~/scratch/Build-nopatch/Release/ patch:~/webkit/WebKitBuild/Release/
244                                                                                                 
245                                                                        nopatch                          patch                                     Δ
246                 Execution Time:
247                     churn                                                126ms                          148ms                        ! 1.17x slower
248                     churn --parallel                                      62ms                           76ms                        ! 1.23x slower
249                     list_allocate                                        130ms                          164ms                        ! 1.26x slower
250                     list_allocate --parallel                             120ms                          175ms                        ! 1.46x slower
251                     tree_allocate                                        111ms                          127ms                        ! 1.14x slower
252                     tree_allocate --parallel                              95ms                          135ms                        ! 1.42x slower
253                     tree_churn                                           115ms                          124ms                        ! 1.08x slower
254                     tree_churn --parallel                                107ms                          126ms                        ! 1.18x slower
255                     facebook                                             240ms                          276ms                        ! 1.15x slower
256                     facebook --parallel                                  802ms                        1,088ms                        ! 1.36x slower
257                     fragment                                              92ms                          130ms                        ! 1.41x slower
258                     fragment --parallel                                   66ms                          124ms                        ! 1.88x slower
259                     fragment_iterate                                     109ms                          127ms                        ! 1.17x slower
260                     fragment_iterate --parallel                           55ms                           64ms                        ! 1.16x slower
261                     message_one                                          260ms                          260ms                                      
262                     message_many                                         170ms                          238ms                         ! 1.4x slower
263                     medium                                               185ms                          250ms                        ! 1.35x slower
264                     medium --parallel                                    210ms                          334ms                        ! 1.59x slower
265                     big                                                  150ms                          169ms                        ! 1.13x slower
266                     big --parallel                                       138ms                          144ms                        ! 1.04x slower
267
268                     <geometric mean>                                     135ms                          170ms                        ! 1.26x slower
269                     <arithmetic mean>                                    167ms                          214ms                        ! 1.28x slower
270                     <harmonic mean>                                      117ms                          148ms                        ! 1.26x slower
271
272                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks TC:~/scratch/Build-TCMalloc/Release/ patch:~/webkit/WebKitBuild/Release/
273
274                                                                     TC                      patch                                Δ
275                 Peak Memory:
276                     reddit_memory_warning                     13,836kB                   13,436kB                  ^ 1.03x smaller
277                     flickr_memory_warning                     24,868kB                   25,188kB                   ! 1.01x bigger
278                     theverge_memory_warning                   24,504kB                   26,636kB                   ! 1.09x bigger
279
280                     <geometric mean>                          20,353kB                   20,812kB                   ! 1.02x bigger
281                     <arithmetic mean>                         21,069kB                   21,753kB                   ! 1.03x bigger
282                     <harmonic mean>                           19,570kB                   19,780kB                   ! 1.01x bigger
283
284                 Memory at End:
285                     reddit_memory_warning                      8,656kB                   10,016kB                   ! 1.16x bigger
286                     flickr_memory_warning                     11,844kB                   13,784kB                   ! 1.16x bigger
287                     theverge_memory_warning                   18,516kB                   22,748kB                   ! 1.23x bigger
288
289                     <geometric mean>                          12,382kB                   14,644kB                   ! 1.18x bigger
290                     <arithmetic mean>                         13,005kB                   15,516kB                   ! 1.19x bigger
291                     <harmonic mean>                           11,813kB                   13,867kB                   ! 1.17x bigger
292
293                 MallocBench> ~/webkit/PerformanceTests/MallocBench/run-malloc-benchmarks TC:~/scratch/Build-TCMalloc/Release/ patch:~/webkit/WebKitBuild/Release/
294                                                                                                 
295                                                         TC                patch                         Δ
296                 Execution Time:
297                     churn                            416ms                148ms            ^ 2.81x faster
298                     list_allocate                    463ms                164ms            ^ 2.82x faster
299                     tree_allocate                    292ms                127ms             ^ 2.3x faster
300                     tree_churn                       157ms                120ms            ^ 1.31x faster
301                     facebook                         327ms                276ms            ^ 1.18x faster
302                     fragment                         335ms                129ms             ^ 2.6x faster
303                     fragment_iterate                 344ms                108ms            ^ 3.19x faster
304                     message_one                      386ms                258ms             ^ 1.5x faster
305                     message_many                     410ms                154ms            ^ 2.66x faster
306                     medium                           391ms                245ms             ^ 1.6x faster
307                     big                              261ms                167ms            ^ 1.56x faster
308
309                     <geometric mean>                 332ms                164ms            ^ 2.02x faster
310                     <arithmetic mean>                344ms                172ms            ^ 1.99x faster
311                     <harmonic mean>                  317ms                157ms            ^ 2.02x faster
312
313         * bmalloc.xcodeproj/project.pbxproj:
314         * bmalloc/Allocator.cpp:
315         (bmalloc::Allocator::Allocator): Don't assume that each allocator's
316         index corresponds with its size. Instead, use the size selection function
317         explicitly. Now that we have XSmall, some small allocator entries are
318         unused.
319
320         (bmalloc::Allocator::scavenge):
321         (bmalloc::Allocator::log):
322         (bmalloc::Allocator::processXSmallAllocatorLog):
323         (bmalloc::Allocator::allocateSlowCase):
324         * bmalloc/Allocator.h:
325         (bmalloc::Allocator::xSmallAllocatorFor):
326         (bmalloc::Allocator::allocateFastCase):
327         * bmalloc/Chunk.h:
328         * bmalloc/Deallocator.cpp:
329         (bmalloc::Deallocator::scavenge):
330         (bmalloc::Deallocator::processObjectLog):
331         (bmalloc::Deallocator::deallocateSlowCase):
332         (bmalloc::Deallocator::deallocateXSmallLine):
333         (bmalloc::Deallocator::allocateXSmallLine):
334         * bmalloc/Deallocator.h:
335         (bmalloc::Deallocator::deallocateFastCase):
336         * bmalloc/Heap.cpp:
337         (bmalloc::Heap::scavenge):
338         (bmalloc::Heap::scavengeXSmallPages):
339         (bmalloc::Heap::allocateXSmallLineSlowCase):
340         * bmalloc/Heap.h:
341         (bmalloc::Heap::deallocateXSmallLine):
342         (bmalloc::Heap::allocateXSmallLine):
343         * bmalloc/LargeChunk.h:
344         (bmalloc::LargeChunk::get):
345         (bmalloc::LargeChunk::endTag):
346         * bmalloc/Line.h:
347         * bmalloc/MediumAllocator.h:
348         (bmalloc::MediumAllocator::allocate):
349         (bmalloc::MediumAllocator::refill):
350         * bmalloc/ObjectType.cpp:
351         (bmalloc::objectType):
352         * bmalloc/ObjectType.h:
353         (bmalloc::isXSmall):
354         (bmalloc::isSmall):
355         (bmalloc::isMedium):
356         (bmalloc::isLarge):
357         (bmalloc::isSmallOrMedium): Deleted.
358         * bmalloc/SegregatedFreeList.h: I boiler-plate copied existing code for
359         handling small objects. There's probably a reasonable way to share this
360         code in the future -- I'll look into that once it's stopped changing.
361
362         * bmalloc/Sizes.h: Tweaked size classes to make Membuster happy. This
363         is the main reason things got slower.
364
365         * bmalloc/SmallAllocator.h:
366         (bmalloc::SmallAllocator::allocate):
367         * bmalloc/SmallTraits.h:
368         * bmalloc/VMHeap.cpp:
369         (bmalloc::VMHeap::allocateXSmallChunk):
370         * bmalloc/VMHeap.h:
371         (bmalloc::VMHeap::allocateXSmallPage):
372         (bmalloc::VMHeap::deallocateXSmallPage):
373         * bmalloc/XSmallAllocator.h: Added.
374         (bmalloc::XSmallAllocator::isNull):
375         (bmalloc::XSmallAllocator::canAllocate):
376         (bmalloc::XSmallAllocator::XSmallAllocator):
377         (bmalloc::XSmallAllocator::line):
378         (bmalloc::XSmallAllocator::allocate):
379         (bmalloc::XSmallAllocator::objectCount):
380         (bmalloc::XSmallAllocator::derefCount):
381         (bmalloc::XSmallAllocator::refill):
382         * bmalloc/XSmallChunk.h: Added.
383         * bmalloc/XSmallLine.h: Added.
384         * bmalloc/XSmallPage.h: Added.
385         * bmalloc/XSmallTraits.h: Added.
386         * bmalloc/bmalloc.h:
387         (bmalloc::api::realloc): Boiler-plate copy, as above.
388
389 2014-04-14  Geoffrey Garen  <ggaren@apple.com>
390
391         MallocBench should scavenge explicitly instead of waiting
392         https://bugs.webkit.org/show_bug.cgi?id=131661
393
394         Reviewed by Andreas Kling.
395
396         Added explicit scavenge support to bmalloc. This isn't a memory win,
397         since bmalloc's per-thread cache is so small. But it makes testing
398         simpler.
399
400         * bmalloc/Allocator.cpp:
401         (bmalloc::Allocator::~Allocator):
402         (bmalloc::Allocator::scavenge):
403         * bmalloc/Allocator.h:
404         * bmalloc/Cache.cpp:
405         (bmalloc::Cache::operator new):
406         (bmalloc::Cache::operator delete):
407         (bmalloc::Cache::Cache):
408         (bmalloc::Cache::scavenge):
409         * bmalloc/Cache.h:
410         * bmalloc/Deallocator.cpp:
411         (bmalloc::Deallocator::~Deallocator):
412         (bmalloc::Deallocator::scavenge):
413         * bmalloc/Deallocator.h: Factored existing scavenging code into helper
414         functions, for reuse.
415
416         * bmalloc/Heap.cpp:
417         (bmalloc::sleep):
418         (bmalloc::Heap::concurrentScavenge):
419         (bmalloc::Heap::scavenge):
420         (bmalloc::Heap::scavengeSmallPages):
421         (bmalloc::Heap::scavengeMediumPages):
422         (bmalloc::Heap::scavengeLargeRanges):
423         * bmalloc/Heap.h: Made scavenge sleep duration a parameter. Forced
424         scavenging -- in response to a benchmark or a low memory warning --
425         wants to complete as soon as possible, so its sleep duration is 0.
426
427         * bmalloc/bmalloc.h:
428         (bmalloc::api::scavenge):
429         * bmalloc/mbmalloc.cpp: Exported the scavenge API for MallocBench's use.
430
431 2014-04-14  Geoffrey Garen  <ggaren@apple.com>
432
433         Use 4kB pages on Mac
434         https://bugs.webkit.org/show_bug.cgi?id=131658
435
436         Reviewed by Sam Weinig.
437
438         This reduces memory use a lot on Membuster:
439
440                                                                   base                      patch                                Δ
441                 Execution Time:
442                     reddit_memory_warning                         18ms                       17ms                   ^ 1.06x faster
443                     flickr_memory_warning                         34ms                       36ms                   ! 1.06x slower
444                     theverge_memory_warning                       39ms                       41ms                   ! 1.05x slower
445
446                     <geometric mean>                              29ms                       29ms                   ! 1.02x slower
447                     <arithmetic mean>                             30ms                       31ms                   ! 1.03x slower
448                     <harmonic mean>                               27ms                       27ms                    ^ 1.0x faster
449
450                 Peak Memory:
451                     reddit_memory_warning                     16,412kB                   16,436kB                    ! 1.0x bigger
452                     flickr_memory_warning                     30,120kB                   30,184kB                    ! 1.0x bigger
453                     theverge_memory_warning                   33,408kB                   33,420kB                    ! 1.0x bigger
454
455                     <geometric mean>                          25,466kB                   25,499kB                    ! 1.0x bigger
456                     <arithmetic mean>                         26,647kB                   26,680kB                    ! 1.0x bigger
457                     <harmonic mean>                           24,181kB                   24,214kB                    ! 1.0x bigger
458
459                 Memory at End:
460                     reddit_memory_warning                      2,404kB                    1,920kB                  ^ 1.25x smaller
461                     flickr_memory_warning                      3,764kB                    3,072kB                  ^ 1.23x smaller
462                     theverge_memory_warning                    3,648kB                    3,132kB                  ^ 1.16x smaller
463
464                     <geometric mean>                           3,208kB                    2,644kB                  ^ 1.21x smaller
465                     <arithmetic mean>                          3,272kB                    2,708kB                  ^ 1.21x smaller
466                     <harmonic mean>                            3,139kB                    2,574kB                  ^ 1.22x smaller
467
468
469         * bmalloc.xcodeproj/project.pbxproj:
470         * bmalloc/BPlatform.h: Added.
471         * bmalloc/VMAllocate.h: Only use 16kB pages on iOS because the page size
472         is 4kB on Mac.
473
474 2014-04-14  Alexey Proskuryakov  <ap@apple.com>
475
476         Fixed svn:ignore on bmalloc.xcodeproj, it had erroneous leading spaces.
477
478         * bmalloc.xcodeproj: Modified property svn:ignore.
479
480 2014-04-13  Geoffrey Garen  <ggaren@apple.com>
481
482         Fixed some mbmalloc exports
483         https://bugs.webkit.org/show_bug.cgi?id=131599
484
485         Reviewed by Ryosuke Niwa.
486
487         * bmalloc.xcodeproj/project.pbxproj: Made some headers a private part
488         of the project, so we can call them from API.
489
490         * bmalloc/mbmalloc.cpp: Marked the mbmalloc functions with default
491         visibility, so they show up as exported in the .dylib.
492
493 2014-04-09  Geoffrey Garen  <ggaren@apple.com>
494
495         Put bmalloc headers in the right place
496         https://bugs.webkit.org/show_bug.cgi?id=131464
497
498         Reviewed by Mark Rowe.
499
500         * Configurations/bmalloc.xcconfig: Set PRIVATE_HEADERS_FOLDER_PATH to
501         specify that we don't just want to dump all of our generically-named
502         headers into /usr/local/include.
503
504 2014-04-08  Geoffrey Garen  <ggaren@apple.com>
505
506         Made bmalloc more #include friendly
507         https://bugs.webkit.org/show_bug.cgi?id=131386
508
509         Reviewed by Andreas Kling.
510
511         Marked a bunch of headers private so they can be used from client code
512         that #includes bmalloc.h.
513
514         Renamed ASSERT macros to BASSERT. This matches their header, which already
515         had to be renamed, and fixes conflicts with WTF's ASSERT macros.
516
517         * bmalloc.xcodeproj/project.pbxproj:
518         * bmalloc/Allocator.cpp:
519         (bmalloc::Allocator::allocateSlowCase):
520         * bmalloc/AsyncTask.h:
521         (bmalloc::Function>::runSlowCase):
522         * bmalloc/BAssert.h:
523         * bmalloc/BoundaryTag.h:
524         (bmalloc::BoundaryTag::setSize):
525         * bmalloc/BoundaryTagInlines.h:
526         (bmalloc::validate):
527         (bmalloc::BoundaryTag::init):
528         (bmalloc::BoundaryTag::deallocate):
529         (bmalloc::BoundaryTag::splitLarge):
530         (bmalloc::BoundaryTag::allocate):
531         * bmalloc/Chunk.h:
532         * bmalloc/Deallocator.cpp:
533         (bmalloc::Deallocator::processObjectLog):
534         (bmalloc::Deallocator::deallocateSlowCase):
535         * bmalloc/Deallocator.h:
536         (bmalloc::Deallocator::deallocateFastCase):
537         * bmalloc/FixedVector.h:
538         (bmalloc::Capacity>::operator):
539         (bmalloc::Capacity>::push):
540         (bmalloc::Capacity>::pop):
541         (bmalloc::Capacity>::shrink):
542         * bmalloc/Heap.cpp:
543         (bmalloc::Heap::allocateLarge):
544         * bmalloc/LargeChunk.h:
545         (bmalloc::LargeChunk::get):
546         (bmalloc::LargeChunk::endTag):
547         * bmalloc/Line.h:
548         (bmalloc::Line<Traits>::concurrentRef):
549         (bmalloc::Line<Traits>::deref):
550         * bmalloc/MediumAllocator.h:
551         (bmalloc::MediumAllocator::allocate):
552         * bmalloc/ObjectType.h:
553         (bmalloc::isSmall):
554         * bmalloc/Page.h:
555         (bmalloc::Page<Traits>::ref):
556         (bmalloc::Page<Traits>::deref):
557         * bmalloc/PerThread.h:
558         (bmalloc::PerThread<T>::getSlowCase):
559         * bmalloc/SegregatedFreeList.cpp:
560         (bmalloc::SegregatedFreeList::SegregatedFreeList):
561         (bmalloc::SegregatedFreeList::insert):
562         * bmalloc/SmallAllocator.h:
563         (bmalloc::SmallAllocator::allocate):
564         (bmalloc::SmallAllocator::refill):
565         * bmalloc/Syscall.h:
566         * bmalloc/VMAllocate.h:
567         (bmalloc::vmValidate):
568         (bmalloc::vmAllocate):
569         (bmalloc::vmDeallocatePhysicalPagesSloppy):
570         * bmalloc/Vector.h:
571         (bmalloc::Vector<T>::operator):
572         (bmalloc::Vector<T>::pop):
573         (bmalloc::Vector<T>::shrink):
574         * bmalloc/XLargeChunk.h:
575         (bmalloc::XLargeChunk::range):
576         (bmalloc::XLargeChunk::size):
577
578 2014-04-08  Geoffrey Garen  <ggaren@apple.com>
579
580         Removed an unused file.
581
582         Unreviewed.
583
584         * bmalloc/AsyncTask.cpp: Removed.
585
586 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
587
588         Build bmalloc on Mac
589         https://bugs.webkit.org/show_bug.cgi?id=131333
590
591         Reviewed by Mark Rowe.
592
593         * Makefile: Added. For make clients.
594
595         These files are required for building any project in WebKit. I copied
596         them from WTF:
597         * Configurations: Added.
598         * Configurations/Base.xcconfig: Added.
599         * Configurations/DebugRelease.xcconfig: Added.
600         * Configurations/bmalloc.xcconfig: Added.
601         * Configurations/iOS.xcconfig: Added.
602         * Configurations/mbmalloc.xcconfig: Added.
603
604         * bmalloc.xcodeproj/project.pbxproj: I removed per-project-file stuff
605         from here because everything is in .xcconfig files now.
606
607         I had to fix a bunch of minor warnings, since they're enabled in our
608         .xcconfig files:
609
610         * bmalloc/AsyncTask.h:
611         (bmalloc::Function>::AsyncTask):
612         * bmalloc/BAssert.h:
613         * bmalloc/BoundaryTagInlines.h:
614         (bmalloc::validate):
615         * bmalloc/Heap.cpp:
616         (bmalloc::Heap::Heap):
617         (bmalloc::Heap::allocateLarge):
618         (bmalloc::Heap::deallocateLarge):
619         * bmalloc/Mutex.h:
620         (bmalloc::Mutex::Mutex): Deleted.
621         * bmalloc/VMAllocate.h:
622         (bmalloc::vmValidate):
623         * bmalloc/mbmalloc.cpp:
624
625 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
626
627         bmalloc: Fixed a leak in the per-thread cache
628         https://bugs.webkit.org/show_bug.cgi?id=131330
629
630         Reviewed by Andreas Kling.
631
632         Remember to deallocate our line caches upon thread exit.
633
634         * bmalloc/Deallocator.cpp:
635         (bmalloc::Deallocator::~Deallocator):
636
637 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
638
639         bmalloc: rolled out the tryLock experiment
640         https://bugs.webkit.org/show_bug.cgi?id=131328
641
642         Reviewed by Andreas Kling.
643
644         It wasn't a speedup.
645
646         * bmalloc.xcodeproj/project.pbxproj:
647         * bmalloc/Allocator.cpp:
648         (bmalloc::Allocator::processSmallAllocatorLog):
649         (bmalloc::Allocator::processMediumAllocatorLog):
650         * bmalloc/Deallocator.cpp:
651         (bmalloc::Deallocator::processObjectLog):
652         (bmalloc::Deallocator::deallocateSlowCase):
653         (bmalloc::Deallocator::deallocateSmallLine):
654         (bmalloc::Deallocator::deallocateMediumLine):
655         * bmalloc/Deallocator.h:
656         (bmalloc::Deallocator::deallocateFastCase):
657         * bmalloc/Heap.h:
658         (bmalloc::Heap::deallocateSmallLine):
659         (bmalloc::Heap::deallocateMediumLine):
660         * bmalloc/Line.h:
661         (bmalloc::Line<Traits>::deref):
662         * bmalloc/Page.h:
663         (bmalloc::Page<Traits>::deref):
664
665 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
666
667         bmalloc
668         https://bugs.webkit.org/show_bug.cgi?id=131170
669
670         Reviewed by Andreas Kling.
671
672         Initial commit.
673
674         * bmalloc: Added.
675         * bmalloc.xcodeproj: Added.
676         * bmalloc.xcodeproj/project.pbxproj: Added.
677         * bmalloc/Algorithm.h: Added.
678         (bmalloc::max):
679         (bmalloc::min):
680         (bmalloc::mask):
681         (bmalloc::test):
682         (bmalloc::roundUpToMultipleOf):
683         (bmalloc::roundDownToMultipleOf):
684         (bmalloc::sizeOf):
685         (bmalloc::bitCount):
686         (bmalloc::isPowerOfTwo):
687         * bmalloc/Allocator.cpp: Added.
688         (bmalloc::Allocator::Allocator):
689         (bmalloc::Allocator::~Allocator):
690         (bmalloc::Allocator::log):
691         (bmalloc::Allocator::processSmallAllocatorLog):
692         (bmalloc::Allocator::processMediumAllocatorLog):
693         (bmalloc::Allocator::allocateLarge):
694         (bmalloc::Allocator::allocateXLarge):
695         (bmalloc::Allocator::allocateMedium):
696         (bmalloc::Allocator::allocateSlowCase):
697         * bmalloc/Allocator.h: Added.
698         (bmalloc::Allocator::smallAllocatorFor):
699         (bmalloc::Allocator::allocateFastCase):
700         (bmalloc::Allocator::allocate):
701         * bmalloc/AsyncTask.cpp: Added.
702         (bmalloc::AsyncTask<Function>::runSlowCase):
703         (bmalloc::AsyncTask<Function>::pthreadEntryPoint):
704         (bmalloc::AsyncTask<Function>::entryPoint):
705         * bmalloc/AsyncTask.h: Added.
706         (bmalloc::Function>::AsyncTask):
707         (bmalloc::Function>::join):
708         (bmalloc::Function>::run):
709         (bmalloc::Function>::runSlowCase):
710         (bmalloc::Function>::pthreadEntryPoint):
711         (bmalloc::Function>::entryPoint):
712         * bmalloc/BAssert.h: Added.
713         * bmalloc/BeginTag.h: Added.
714         (bmalloc::BeginTag::isInFreeList):
715         * bmalloc/BoundaryTag.h: Added.
716         (bmalloc::BoundaryTag::isXLarge):
717         (bmalloc::BoundaryTag::setXLarge):
718         (bmalloc::BoundaryTag::isFree):
719         (bmalloc::BoundaryTag::setFree):
720         (bmalloc::BoundaryTag::isEnd):
721         (bmalloc::BoundaryTag::setEnd):
722         (bmalloc::BoundaryTag::hasPhysicalPages):
723         (bmalloc::BoundaryTag::setHasPhysicalPages):
724         (bmalloc::BoundaryTag::isNull):
725         (bmalloc::BoundaryTag::clear):
726         (bmalloc::BoundaryTag::size):
727         (bmalloc::BoundaryTag::setSize):
728         (bmalloc::BoundaryTag::prev):
729         (bmalloc::BoundaryTag::next):
730         * bmalloc/BoundaryTagInlines.h: Added.
731         (bmalloc::validate):
732         (bmalloc::validatePrev):
733         (bmalloc::validateNext):
734         (bmalloc::BoundaryTag::init):
735         (bmalloc::BoundaryTag::mergeLargeLeft):
736         (bmalloc::BoundaryTag::mergeLargeRight):
737         (bmalloc::BoundaryTag::mergeLarge):
738         (bmalloc::BoundaryTag::deallocate):
739         (bmalloc::BoundaryTag::splitLarge):
740         (bmalloc::BoundaryTag::allocate):
741         * bmalloc/Cache.cpp: Added.
742         (bmalloc::Cache::operator new):
743         (bmalloc::Cache::operator delete):
744         (bmalloc::Cache::Cache):
745         (bmalloc::Cache::allocateSlowCase):
746         (bmalloc::Cache::allocateSlowCaseNullCache):
747         (bmalloc::Cache::deallocateSlowCase):
748         (bmalloc::Cache::deallocateSlowCaseNullCache):
749         * bmalloc/Cache.h: Added.
750         (bmalloc::Cache::allocator):
751         (bmalloc::Cache::deallocator):
752         (bmalloc::Cache::allocateFastCase):
753         (bmalloc::Cache::deallocateFastCase):
754         (bmalloc::Cache::allocate):
755         (bmalloc::Cache::deallocate):
756         * bmalloc/Chunk.h: Added.
757         (bmalloc::Chunk::begin):
758         (bmalloc::Chunk::end):
759         (bmalloc::Chunk::lines):
760         (bmalloc::Chunk::pages):
761         * bmalloc/Deallocator.cpp: Added.
762         (bmalloc::Deallocator::Deallocator):
763         (bmalloc::Deallocator::~Deallocator):
764         (bmalloc::Deallocator::deallocateLarge):
765         (bmalloc::Deallocator::deallocateXLarge):
766         (bmalloc::Deallocator::processObjectLog):
767         (bmalloc::Deallocator::deallocateSlowCase):
768         (bmalloc::Deallocator::deallocateSmallLine):
769         (bmalloc::Deallocator::allocateSmallLine):
770         (bmalloc::Deallocator::deallocateMediumLine):
771         (bmalloc::Deallocator::allocateMediumLine):
772         * bmalloc/Deallocator.h: Added.
773         (bmalloc::Deallocator::deallocateFastCase):
774         (bmalloc::Deallocator::deallocate):
775         * bmalloc/EndTag.h: Added.
776         (bmalloc::EndTag::operator=):
777         * bmalloc/FixedVector.h: Added.
778         (bmalloc::FixedVector::begin):
779         (bmalloc::FixedVector::end):
780         (bmalloc::FixedVector::size):
781         (bmalloc::FixedVector::capacity):
782         (bmalloc::FixedVector::clear):
783         (bmalloc::FixedVector::isEmpty):
784         (bmalloc::Capacity>::FixedVector):
785         (bmalloc::Capacity>::operator):
786         (bmalloc::Capacity>::push):
787         (bmalloc::Capacity>::pop):
788         (bmalloc::Capacity>::shrink):
789         * bmalloc/Heap.cpp: Added.
790         (bmalloc::sleep):
791         (bmalloc::Heap::Heap):
792         (bmalloc::Heap::concurrentScavenge):
793         (bmalloc::Heap::scavengeSmallPages):
794         (bmalloc::Heap::scavengeMediumPages):
795         (bmalloc::Heap::scavengeLargeRanges):
796         (bmalloc::Heap::allocateSmallLineSlowCase):
797         (bmalloc::Heap::allocateMediumLineSlowCase):
798         (bmalloc::Heap::allocateXLarge):
799         (bmalloc::Heap::deallocateXLarge):
800         (bmalloc::Heap::allocateLarge):
801         (bmalloc::Heap::deallocateLarge):
802         * bmalloc/Heap.h: Added.
803         (bmalloc::Heap::deallocateSmallLine):
804         (bmalloc::Heap::allocateSmallLine):
805         (bmalloc::Heap::deallocateMediumLine):
806         (bmalloc::Heap::allocateMediumLine):
807         * bmalloc/Inline.h: Added.
808         * bmalloc/LargeChunk.h: Added.
809         (bmalloc::LargeChunk::begin):
810         (bmalloc::LargeChunk::end):
811         (bmalloc::LargeChunk::create):
812         (bmalloc::LargeChunk::get):
813         (bmalloc::LargeChunk::beginTag):
814         (bmalloc::LargeChunk::endTag):
815         * bmalloc/Line.h: Added.
816         (bmalloc::Line<Traits>::begin):
817         (bmalloc::Line<Traits>::end):
818         (bmalloc::Line<Traits>::concurrentRef):
819         (bmalloc::Line<Traits>::deref):
820         * bmalloc/MediumAllocator.h: Added.
821         (bmalloc::MediumAllocator::isNull):
822         (bmalloc::MediumAllocator::MediumAllocator):
823         (bmalloc::MediumAllocator::line):
824         (bmalloc::MediumAllocator::allocate):
825         (bmalloc::MediumAllocator::derefCount):
826         (bmalloc::MediumAllocator::refill):
827         * bmalloc/MediumChunk.h: Added.
828         * bmalloc/MediumLine.h: Added.
829         * bmalloc/MediumPage.h: Added.
830         * bmalloc/MediumTraits.h: Added.
831         * bmalloc/Mutex.cpp: Added.
832         (bmalloc::Mutex::lockSlowCase):
833         * bmalloc/Mutex.h: Added.
834         (bmalloc::Mutex::Mutex):
835         (bmalloc::Mutex::try_lock):
836         (bmalloc::Mutex::lock):
837         (bmalloc::Mutex::unlock):
838         * bmalloc/ObjectType.cpp: Added.
839         (bmalloc::objectType):
840         * bmalloc/ObjectType.h: Added.
841         (bmalloc::isSmallOrMedium):
842         (bmalloc::isSmall):
843         * bmalloc/Page.h: Added.
844         (bmalloc::Page<Traits>::ref):
845         (bmalloc::Page<Traits>::deref):
846         (bmalloc::Page<Traits>::refCount):
847         * bmalloc/PerProcess.h: Added.
848         (bmalloc::PerProcess::mutex):
849         (bmalloc::PerProcess<T>::getFastCase):
850         (bmalloc::PerProcess<T>::get):
851         (bmalloc::PerProcess<T>::getSlowCase):
852         * bmalloc/PerThread.h: Added.
853         (bmalloc::PerThreadStorage<Cache>::get):
854         (bmalloc::PerThreadStorage<Cache>::init):
855         (bmalloc::PerThreadStorage::get):
856         (bmalloc::PerThreadStorage::init):
857         (bmalloc::PerThread<T>::getFastCase):
858         (bmalloc::PerThread<T>::get):
859         (bmalloc::PerThread<T>::destructor):
860         (bmalloc::PerThread<T>::getSlowCase):
861         * bmalloc/Range.h: Added.
862         (bmalloc::Range::Range):
863         (bmalloc::Range::begin):
864         (bmalloc::Range::end):
865         (bmalloc::Range::size):
866         (bmalloc::Range::operator!):
867         (bmalloc::Range::operator<):
868         * bmalloc/SegregatedFreeList.cpp: Added.
869         (bmalloc::SegregatedFreeList::SegregatedFreeList):
870         (bmalloc::SegregatedFreeList::insert):
871         (bmalloc::SegregatedFreeList::takeGreedy):
872         (bmalloc::SegregatedFreeList::take):
873         * bmalloc/SegregatedFreeList.h: Added.
874         * bmalloc/Sizes.h: Added.
875         * bmalloc/SmallAllocator.h: Added.
876         (bmalloc::SmallAllocator::isNull):
877         (bmalloc::SmallAllocator::canAllocate):
878         (bmalloc::SmallAllocator::SmallAllocator):
879         (bmalloc::SmallAllocator::line):
880         (bmalloc::SmallAllocator::allocate):
881         (bmalloc::SmallAllocator::objectCount):
882         (bmalloc::SmallAllocator::derefCount):
883         (bmalloc::SmallAllocator::refill):
884         * bmalloc/SmallChunk.h: Added.
885         * bmalloc/SmallLine.h: Added.
886         * bmalloc/SmallPage.h: Added.
887         * bmalloc/SmallTraits.h: Added.
888         * bmalloc/Syscall.h: Added.
889         * bmalloc/VMAllocate.h: Added.
890         (bmalloc::vmSize):
891         (bmalloc::vmValidate):
892         (bmalloc::vmAllocate):
893         (bmalloc::vmDeallocate):
894         (bmalloc::vmDeallocatePhysicalPages):
895         (bmalloc::vmAllocatePhysicalPages):
896         (bmalloc::vmDeallocatePhysicalPagesSloppy):
897         (bmalloc::vmAllocatePhysicalPagesSloppy):
898         * bmalloc/VMHeap.cpp: Added.
899         (bmalloc::VMHeap::VMHeap):
900         (bmalloc::VMHeap::allocateSmallChunk):
901         (bmalloc::VMHeap::allocateMediumChunk):
902         (bmalloc::VMHeap::allocateLargeChunk):
903         * bmalloc/VMHeap.h: Added.
904         (bmalloc::VMHeap::allocateSmallPage):
905         (bmalloc::VMHeap::allocateMediumPage):
906         (bmalloc::VMHeap::allocateLargeRange):
907         (bmalloc::VMHeap::deallocateSmallPage):
908         (bmalloc::VMHeap::deallocateMediumPage):
909         (bmalloc::VMHeap::deallocateLargeRange):
910         * bmalloc/Vector.h: Added.
911         (bmalloc::Vector::begin):
912         (bmalloc::Vector::end):
913         (bmalloc::Vector::size):
914         (bmalloc::Vector::capacity):
915         (bmalloc::Vector::last):
916         (bmalloc::Vector::pop):
917         (bmalloc::Vector<T>::Vector):
918         (bmalloc::Vector<T>::~Vector):
919         (bmalloc::Vector<T>::operator):
920         (bmalloc::Vector<T>::push):
921         (bmalloc::Vector<T>::pop):
922         (bmalloc::Vector<T>::shrink):
923         (bmalloc::Vector<T>::reallocateBuffer):
924         (bmalloc::Vector<T>::shrinkCapacity):
925         (bmalloc::Vector<T>::growCapacity):
926         * bmalloc/XLargeChunk.h: Added.
927         (bmalloc::XLargeChunk::get):
928         (bmalloc::XLargeChunk::begin):
929         (bmalloc::XLargeChunk::XLargeChunk):
930         (bmalloc::XLargeChunk::create):
931         (bmalloc::XLargeChunk::destroy):
932         (bmalloc::XLargeChunk::range):
933         (bmalloc::XLargeChunk::size):
934         * bmalloc/bmalloc.h: Added.
935         (bmalloc::api::malloc):
936         (bmalloc::api::free):
937         (bmalloc::api::realloc):
938         * bmalloc/mbmalloc.cpp: Added.
939