mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 17:37:33 +02:00
Generator::allocate_register used to scan the free pool to find the lowest-numbered register and then Vec::remove it, making every allocation O(n) in the size of the pool. When loading https://x.com/ on my Linux machine, we spent ~800ms in this function alone! This logic only existed to match the C++ register allocation ordering while transitioning from C++ to Rust in the LibJS compiler, so now we can simply get rid of it and make it instant. :^) So drop the "always hand out the lowest-numbered free register" policy and use the pool as a plain LIFO stack. Pushing and popping the back of the Vec are both O(1), and peak register usage is unchanged since the policy only affects which specific register gets reused, not how aggressively.
78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
$bc802664 super-method-call-order.js:1:1
|
|
Registers: 9
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] NewObject dst:reg5
|
|
[ 10] NewFunction dst:reg6, shared_function_data_index:0 (m), home_object:reg5
|
|
[ 28] InitObjectLiteralProperty object:reg5, `m`, src:reg6, shape_cache_index:0, property_slot:0
|
|
[ 40] CacheObjectShape object:reg5
|
|
[ 50] SetGlobal `proto`, src:reg5
|
|
[ 68] NewObject dst:reg5
|
|
[ 78] GetGlobal dst:reg6, `proto`
|
|
[ 90] PutById base:reg5, `__proto__`, src:reg6, kind:Prototype
|
|
[ b8] NewFunction dst:reg6, shared_function_data_index:1 (test), home_object:reg5
|
|
[ d0] PutById base:reg5, `test`, src:reg6, kind:Own
|
|
[ f8] NewFunction dst:reg6, shared_function_data_index:2 (get x), home_object:reg5
|
|
[ 110] PutById base:reg5, `x`, src:reg6, kind:Getter
|
|
[ 138] NewFunction dst:reg6, shared_function_data_index:3 (test2), home_object:reg5
|
|
[ 150] PutById base:reg5, `test2`, src:reg6, kind:Own
|
|
[ 178] SetGlobal `obj`, src:reg5
|
|
[ 190] GetGlobal dst:reg6, `obj`
|
|
[ 1a8] GetById dst:reg7, base:reg6, `test` (obj.test)
|
|
[ 1c8] Call dst:reg5, callee:reg7, this_value:reg6, obj.test
|
|
[ 1e8] GetGlobal dst:reg7, `obj`
|
|
[ 200] GetById dst:reg6, base:reg7, `x` (obj.x)
|
|
[ 220] GetGlobal dst:reg7, `obj`
|
|
[ 238] GetById dst:reg8, base:reg7, `test2` (obj.test2)
|
|
[ 258] Call dst:reg5, callee:reg8, this_value:reg7, obj.test2
|
|
[ 278] End value:reg5
|
|
|
|
|
|
test$6b58e3e5 super-method-call-order.js:5:9
|
|
Registers: 8
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg6
|
|
[ 10] GetByIdWithThis dst:reg7, base:reg6, `m`, this_value:this
|
|
[ 30] Call dst:reg5, callee:reg7, this_value:this, <object>.m
|
|
[ 50] Return value:reg5
|
|
|
|
|
|
m$811c9dc5
|
|
Registers: 5
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] End value:Undefined
|
|
|
|
|
|
get x$6b58e3e5 super-method-call-order.js:8:9
|
|
Registers: 8
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg6
|
|
[ 10] GetByIdWithThis dst:reg7, base:reg6, `m`, this_value:this
|
|
[ 30] Call dst:reg5, callee:reg7, this_value:this, <object>.m
|
|
[ 50] Return value:reg5
|
|
|
|
|
|
test2$d17f9e3d super-method-call-order.js:11:9
|
|
Registers: 8
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = String("m")
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg6
|
|
[ 10] GetByIdWithThis dst:reg7, base:reg6, `m`, this_value:this
|
|
[ 30] Call dst:reg5, callee:reg7, this_value:this, <object>['m']
|
|
[ 50] Return value:reg5
|