mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 10:59:24 +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.
87 lines
2.7 KiB
Plaintext
87 lines
2.7 KiB
Plaintext
$781e423f super-evaluation-order.js:1:1
|
|
Registers: 9
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = String("read")
|
|
[1] = String("write")
|
|
[2] = String("update")
|
|
[3] = Undefined
|
|
|
|
block0:
|
|
[ 0] GetLexicalEnvironment dst:reg4
|
|
[ 8] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0
|
|
[ 18] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:false
|
|
[ 28] GetGlobal dst:reg6, `Object`
|
|
[ 40] SetLexicalEnvironment environment:reg4
|
|
[ 48] NewClass dst:reg7, super_class:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("read"), element_keys:String("write"), element_keys:String("update")]
|
|
[ 78] InitializeLexicalBinding `A`, src:reg7
|
|
[ 90] GetGlobal dst:reg6, `A`
|
|
[ a8] CallConstruct dst:reg5, callee:reg6, A
|
|
[ c0] GetById dst:reg6, base:reg5, `read`
|
|
[ e0] Call dst:reg7, callee:reg6, this_value:reg5, <object>.read
|
|
[ 100] GetGlobal dst:reg8, `A`
|
|
[ 118] CallConstruct dst:reg5, callee:reg8, A
|
|
[ 130] GetById dst:reg8, base:reg5, `write`
|
|
[ 150] Call dst:reg6, callee:reg8, this_value:reg5, <object>.write
|
|
[ 170] GetGlobal dst:reg5, `A`
|
|
[ 188] CallConstruct dst:reg8, callee:reg5, A
|
|
[ 1a0] GetById dst:reg5, base:reg8, `update`
|
|
[ 1c0] Call dst:reg7, callee:reg5, this_value:reg8, <object>.update
|
|
[ 1e0] End value:reg7
|
|
|
|
|
|
A$3f156142 super-evaluation-order.js:1:1
|
|
Registers: 7
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] CreateVariable `args`, is_immutable:false, is_global:false, is_strict:false
|
|
[ 10] CreateRestParams dst:arg0, rest_index:0
|
|
[ 20] InitializeLexicalBinding `args`, src:arg0
|
|
[ 38] GetBinding dst:reg5, `args`
|
|
[ 50] SuperCallWithArgumentArray dst:reg6, arguments:reg5, is_synthetic:true
|
|
[ 60] Return value:reg6
|
|
|
|
|
|
read$2a1a7339 super-evaluation-order.js:3:9
|
|
Registers: 7
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = String("x")
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg5
|
|
[ 10] GetByIdWithThis dst:reg6, base:reg5, `x`, this_value:this
|
|
[ 30] Return value:reg6
|
|
|
|
|
|
write$5b793bae super-evaluation-order.js:6:20
|
|
Registers: 6
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = String("x")
|
|
[1] = Int32(42)
|
|
[2] = Undefined
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg5
|
|
[ 10] PutByIdWithThis base:reg5, this_value:this, `x`, src:Int32(42), kind:Normal
|
|
[ 30] End value:Undefined
|
|
|
|
|
|
update$8ce50e3d super-evaluation-order.js:9:16
|
|
Registers: 8
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg5
|
|
[ 10] GetByIdWithThis dst:reg6, base:reg5, `x`, this_value:this
|
|
[ 30] PostfixIncrement dst:reg7, src:reg6
|
|
[ 40] PutByIdWithThis base:reg5, this_value:this, `x`, src:reg6, kind:Normal
|
|
[ 60] End value:Undefined
|