Commit 6727511
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 cab5a6e commit 6727511
1 file changed
Lines changed: 126 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8359 | 8359 | | |
8360 | 8360 | | |
8361 | 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 | + | |
| 8390 | + | |
| 8391 | + | |
| 8392 | + | |
| 8393 | + | |
| 8394 | + | |
| 8395 | + | |
| 8396 | + | |
| 8397 | + | |
| 8398 | + | |
| 8399 | + | |
| 8400 | + | |
| 8401 | + | |
| 8402 | + | |
| 8403 | + | |
| 8404 | + | |
| 8405 | + | |
| 8406 | + | |
| 8407 | + | |
| 8408 | + | |
| 8409 | + | |
| 8410 | + | |
| 8411 | + | |
| 8412 | + | |
| 8413 | + | |
| 8414 | + | |
| 8415 | + | |
| 8416 | + | |
| 8417 | + | |
| 8418 | + | |
| 8419 | + | |
| 8420 | + | |
| 8421 | + | |
| 8422 | + | |
| 8423 | + | |
| 8424 | + | |
8362 | 8425 | | |
8363 | 8426 | | |
8364 | 8427 | | |
| |||
8382 | 8445 | | |
8383 | 8446 | | |
8384 | 8447 | | |
8385 | | - | |
8386 | | - | |
8387 | | - | |
8388 | | - | |
8389 | | - | |
8390 | 8448 | | |
8391 | 8449 | | |
8392 | 8450 | | |
| |||
8395 | 8453 | | |
8396 | 8454 | | |
8397 | 8455 | | |
8398 | | - | |
8399 | 8456 | | |
8400 | 8457 | | |
8401 | 8458 | | |
| |||
8404 | 8461 | | |
8405 | 8462 | | |
8406 | 8463 | | |
8407 | | - | |
8408 | | - | |
8409 | | - | |
8410 | | - | |
8411 | | - | |
8412 | | - | |
8413 | | - | |
8414 | | - | |
8415 | | - | |
8416 | | - | |
8417 | | - | |
| 8464 | + | |
| 8465 | + | |
8418 | 8466 | | |
| 8467 | + | |
8419 | 8468 | | |
8420 | 8469 | | |
8421 | 8470 | | |
8422 | 8471 | | |
8423 | 8472 | | |
8424 | | - | |
8425 | | - | |
8426 | | - | |
8427 | | - | |
8428 | | - | |
8429 | | - | |
8430 | | - | |
8431 | | - | |
8432 | | - | |
8433 | | - | |
8434 | | - | |
| 8473 | + | |
| 8474 | + | |
8435 | 8475 | | |
| 8476 | + | |
8436 | 8477 | | |
8437 | 8478 | | |
8438 | 8479 | | |
8439 | 8480 | | |
8440 | 8481 | | |
8441 | | - | |
8442 | | - | |
8443 | | - | |
| 8482 | + | |
| 8483 | + | |
8444 | 8484 | | |
8445 | 8485 | | |
8446 | 8486 | | |
8447 | 8487 | | |
| 8488 | + | |
| 8489 | + | |
| 8490 | + | |
| 8491 | + | |
| 8492 | + | |
| 8493 | + | |
| 8494 | + | |
| 8495 | + | |
| 8496 | + | |
| 8497 | + | |
| 8498 | + | |
| 8499 | + | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + | |
| 8515 | + | |
| 8516 | + | |
| 8517 | + | |
| 8518 | + | |
| 8519 | + | |
| 8520 | + | |
| 8521 | + | |
| 8522 | + | |
| 8523 | + | |
| 8524 | + | |
| 8525 | + | |
| 8526 | + | |
| 8527 | + | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
| 8531 | + | |
| 8532 | + | |
| 8533 | + | |
| 8534 | + | |
| 8535 | + | |
| 8536 | + | |
| 8537 | + | |
| 8538 | + | |
| 8539 | + | |
| 8540 | + | |
8448 | 8541 | | |
8449 | 8542 | | |
8450 | 8543 | | |
8451 | | - | |
| 8544 | + | |
8452 | 8545 | | |
8453 | | - | |
| 8546 | + | |
8454 | 8547 | | |
8455 | 8548 | | |
8456 | | - | |
8457 | | - | |
8458 | 8549 | | |
8459 | 8550 | | |
8460 | 8551 | | |
| |||
0 commit comments