Commit 38de045
committed
servo: Merge #15992 - Rewrite PropertyDeclaration::id to help the optimizer (from servo:id-table); r=bholley
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 rust-lang/rust#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
```
Source-Repo: https://github.com/servo/servo
Source-Revision: 9e8e1a47241c6906b4f5777da0d04e3655982fae
UltraBlame original commit: af90f70b05df8c81f440b222728ae48c2e2bf5f81 parent a998d9c commit 38de045
1 file changed
Lines changed: 126 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8208 | 8208 | | |
8209 | 8209 | | |
8210 | 8210 | | |
| 8211 | + | |
| 8212 | + | |
| 8213 | + | |
| 8214 | + | |
| 8215 | + | |
| 8216 | + | |
| 8217 | + | |
| 8218 | + | |
| 8219 | + | |
| 8220 | + | |
| 8221 | + | |
| 8222 | + | |
| 8223 | + | |
| 8224 | + | |
| 8225 | + | |
| 8226 | + | |
| 8227 | + | |
| 8228 | + | |
| 8229 | + | |
| 8230 | + | |
| 8231 | + | |
| 8232 | + | |
| 8233 | + | |
| 8234 | + | |
| 8235 | + | |
| 8236 | + | |
| 8237 | + | |
| 8238 | + | |
| 8239 | + | |
| 8240 | + | |
| 8241 | + | |
| 8242 | + | |
| 8243 | + | |
| 8244 | + | |
| 8245 | + | |
| 8246 | + | |
| 8247 | + | |
| 8248 | + | |
| 8249 | + | |
| 8250 | + | |
| 8251 | + | |
| 8252 | + | |
| 8253 | + | |
| 8254 | + | |
| 8255 | + | |
| 8256 | + | |
| 8257 | + | |
| 8258 | + | |
| 8259 | + | |
| 8260 | + | |
| 8261 | + | |
| 8262 | + | |
| 8263 | + | |
| 8264 | + | |
| 8265 | + | |
| 8266 | + | |
| 8267 | + | |
| 8268 | + | |
| 8269 | + | |
| 8270 | + | |
| 8271 | + | |
| 8272 | + | |
| 8273 | + | |
8211 | 8274 | | |
8212 | 8275 | | |
8213 | 8276 | | |
| |||
8231 | 8294 | | |
8232 | 8295 | | |
8233 | 8296 | | |
8234 | | - | |
8235 | | - | |
8236 | | - | |
8237 | | - | |
8238 | | - | |
8239 | 8297 | | |
8240 | 8298 | | |
8241 | 8299 | | |
| |||
8244 | 8302 | | |
8245 | 8303 | | |
8246 | 8304 | | |
8247 | | - | |
8248 | 8305 | | |
8249 | 8306 | | |
8250 | 8307 | | |
| |||
8253 | 8310 | | |
8254 | 8311 | | |
8255 | 8312 | | |
8256 | | - | |
8257 | | - | |
8258 | | - | |
8259 | | - | |
8260 | | - | |
8261 | | - | |
8262 | | - | |
8263 | | - | |
8264 | | - | |
8265 | | - | |
8266 | | - | |
| 8313 | + | |
| 8314 | + | |
8267 | 8315 | | |
| 8316 | + | |
8268 | 8317 | | |
8269 | 8318 | | |
8270 | 8319 | | |
8271 | 8320 | | |
8272 | 8321 | | |
8273 | | - | |
8274 | | - | |
8275 | | - | |
8276 | | - | |
8277 | | - | |
8278 | | - | |
8279 | | - | |
8280 | | - | |
8281 | | - | |
8282 | | - | |
8283 | | - | |
| 8322 | + | |
| 8323 | + | |
8284 | 8324 | | |
| 8325 | + | |
8285 | 8326 | | |
8286 | 8327 | | |
8287 | 8328 | | |
8288 | 8329 | | |
8289 | 8330 | | |
8290 | | - | |
8291 | | - | |
8292 | | - | |
| 8331 | + | |
| 8332 | + | |
8293 | 8333 | | |
8294 | 8334 | | |
8295 | 8335 | | |
8296 | 8336 | | |
| 8337 | + | |
| 8338 | + | |
| 8339 | + | |
| 8340 | + | |
| 8341 | + | |
| 8342 | + | |
| 8343 | + | |
| 8344 | + | |
| 8345 | + | |
| 8346 | + | |
| 8347 | + | |
| 8348 | + | |
| 8349 | + | |
| 8350 | + | |
| 8351 | + | |
| 8352 | + | |
| 8353 | + | |
| 8354 | + | |
| 8355 | + | |
| 8356 | + | |
| 8357 | + | |
| 8358 | + | |
| 8359 | + | |
| 8360 | + | |
| 8361 | + | |
| 8362 | + | |
| 8363 | + | |
| 8364 | + | |
| 8365 | + | |
| 8366 | + | |
| 8367 | + | |
| 8368 | + | |
| 8369 | + | |
| 8370 | + | |
| 8371 | + | |
| 8372 | + | |
| 8373 | + | |
| 8374 | + | |
| 8375 | + | |
| 8376 | + | |
| 8377 | + | |
| 8378 | + | |
| 8379 | + | |
| 8380 | + | |
| 8381 | + | |
| 8382 | + | |
| 8383 | + | |
| 8384 | + | |
| 8385 | + | |
| 8386 | + | |
| 8387 | + | |
| 8388 | + | |
| 8389 | + | |
8297 | 8390 | | |
8298 | 8391 | | |
8299 | 8392 | | |
8300 | | - | |
| 8393 | + | |
8301 | 8394 | | |
8302 | | - | |
| 8395 | + | |
8303 | 8396 | | |
8304 | 8397 | | |
8305 | | - | |
8306 | | - | |
8307 | 8398 | | |
8308 | 8399 | | |
8309 | 8400 | | |
| |||
0 commit comments