Bug 216056 - [bmalloc] Remove code duplication from small bump ranges.
Summary: [bmalloc] Remove code duplication from small bump ranges.
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
Keywords: InRadar
Depends on:
Reported: 2020-09-01 15:37 PDT by Basuke Suzuki
Modified: 2020-09-08 15:38 PDT (History)
4 users (show)

See Also:

PATCH (827 bytes, patch)
2020-09-02 20:54 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH (8.95 KB, patch)
2020-09-02 20:57 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
Fix debug build (8.26 KB, patch)
2020-09-03 10:35 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
Refactoring (9.26 KB, patch)
2020-09-03 14:48 PDT, Basuke Suzuki
ysuzuki: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2020-09-01 15:37:14 PDT
Both byMetadata and byObject share same logic and can be refactored.
Comment 1 Basuke Suzuki 2020-09-02 20:54:29 PDT
Created attachment 407860 [details]
Comment 2 Basuke Suzuki 2020-09-02 20:57:17 PDT
Created attachment 407861 [details]
Comment 3 Basuke Suzuki 2020-09-03 10:35:03 PDT
Created attachment 407890 [details]
Fix debug build
Comment 4 Basuke Suzuki 2020-09-03 14:48:05 PDT
Created attachment 407916 [details]
Comment 5 Yusuke Suzuki 2020-09-04 12:51:40 PDT
Comment on attachment 407916 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=407916&action=review

Can you run MallocBench to ensure that this does not affect on the performance? Because this code is super critical path in bmalloc.

> Source/bmalloc/bmalloc/Heap.cpp:372
> +inline void allocateSmallBumpRangesInline(

Let's put BINLINE since this is super critical path which we should ensure that this is always inlined regardless of compiler's decision.

> Source/bmalloc/bmalloc/Heap.cpp:385
> +            lineCache[page->sizeClass()].push(page);

Let's pass sizeClass and use it.

> Source/bmalloc/bmalloc/Heap.cpp:403
> +    auto sizeClass = page->sizeClass();

Let's use passed sizeClass.

> Source/bmalloc/bmalloc/Heap.h:172
> +        allocateSmallBumpRangesByMetadata(lock, page, allocator, rangeCache, lineCache);
> +    else
> +        allocateSmallBumpRangesByObject(lock, page, allocator, rangeCache, lineCache);

Let's just pass `sizeClass` too.
Comment 6 Radar WebKit Bug Importer 2020-09-08 15:38:16 PDT