mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +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.
63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
$7867793e delete-super-eval-order.js:1:1
|
|
Registers: 10
|
|
Blocks: 4
|
|
Constants:
|
|
[0] = String("m")
|
|
[1] = Undefined
|
|
[2] = String("x")
|
|
|
|
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] SetLexicalEnvironment environment:reg4
|
|
[ 30] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("m")]
|
|
[ 58] InitializeLexicalBinding `A`, src:reg6
|
|
[ 70] Jump target:block3
|
|
|
|
block1:
|
|
[ 78] Catch dst:reg6
|
|
[ 80] SetLexicalEnvironment environment:reg4
|
|
[ 88] Mov2 dst1:reg5, src1:Undefined, dst2:reg7, src2:reg5
|
|
|
|
block2:
|
|
[ a0] End value:reg5
|
|
|
|
block3:
|
|
[ a8] Mov dst:reg6, src:Undefined
|
|
[ b8] GetGlobal dst:reg9, `A`
|
|
[ d0] CallConstruct dst:reg8, callee:reg9, A
|
|
[ e8] GetById dst:reg9, base:reg8, `m`
|
|
[ 108] Call dst:reg5, callee:reg9, this_value:reg8, <object>.m, arguments:[String("x")]
|
|
[ 130] Mov2 dst1:reg6, src1:reg5, dst2:reg5, src2:reg6
|
|
[ 148] End value:reg5
|
|
|
|
Exception handlers:
|
|
[ a8 .. 150] => handler block1
|
|
|
|
|
|
A$811c9dc5
|
|
Registers: 5
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] End value:Undefined
|
|
|
|
|
|
m$0f0a711c delete-super-eval-order.js:6:9
|
|
Registers: 7
|
|
Blocks: 2
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] ResolveThisBinding
|
|
[ 8] ResolveSuperBase dst:reg5
|
|
[ 10] NewReferenceError dst:reg6, Can't delete a property on 'super'
|
|
[ 20] Throw src:reg6
|
|
|
|
block1:
|
|
[ 28] End value:Undefined
|