aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servoparser/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-03-16 19:13:37 -0700
committerGitHub <noreply@github.com>2017-03-16 19:13:37 -0700
commit9e8e1a47241c6906b4f5777da0d04e3655982fae (patch)
tree76a08f76ae7b97fdbef5e05869d75b52693a110a /components/script/dom/servoparser/mod.rs
parent99f5edbefb69019db0b80688da286a857fd9d6ea (diff)
parent9ff0153ddaef05452cdb2af28a072695dc91ff6d (diff)
downloadservo-9e8e1a47241c6906b4f5777da0d04e3655982fae.tar.gz
servo-9e8e1a47241c6906b4f5777da0d04e3655982fae.zip
Auto merge of #15992 - servo:id-table, r=bholley
Rewrite PropertyDeclaration::id to help the optimizer. If I’m reading the release-mode assembly correctly, before this change `PropertyDeclaration::id` is implemented with a computed jump: ```assembly lea rcx, [rip + .LJTI117_0] movsxd rax, dword ptr [rcx + 4*rax] add rax, rcx jmp rax .LBB117_3: mov dword ptr [rdi], 65536 mov rax, rdi ret .LBB117_2: mov dword ptr [rdi], 0 mov rax, rdi ret .LBB117_4: mov dword ptr [rdi], 131072 mov rax, rdi ret .LBB117_6: mov dword ptr [rdi], 262144 mov rax, rdi ret .LBB117_7: mov dword ptr [rdi], 327680 mov rax, rdi ret ; Four similar lines repeated for each of the few hundred variants... ``` With Rust 1.15 (currently used for geckolib) this doesn’t change significantly. In Nightly 1.17 however, the compiled code uses a lookup table, possibly thanks to https://github.com/rust-lang/rust/pull/39456. ```assembly movq (%rsi), %rax cmpq $171, %rax jne .LBB23_1 addq $8, %rsi movq %rsi, 8(%rdi) movb $1, %al jmp .LBB23_3 .LBB23_1: xorq $128, %rax leaq .Lswitch.table.6(%rip), %rcx movb (%rax,%rcx), %al movb %al, 1(%rdi) xorl %eax, %eax .LBB23_3: movb %al, (%rdi) movq %rdi, %rax retq ``` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15992) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/servoparser/mod.rs')
0 files changed, 0 insertions, 0 deletions