Closed Bug 1913413 Opened 3 months ago Closed 3 months ago

Move code from architecture-specific CodeGenerator into common CodeGenerator

Categories

(Core :: JavaScript Engine: JIT, task)

task

Tracking

()

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(26 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

MacroAssembler now provides enough abstractions that we can move more code from architecture-specific CodeGenerator into the common CodeGenerator.

Doesn't change generated code, but let's us share more code across all target
architectures.

Notes:

  • If isNextBlock(lir->ifTrue()->lir()) is true, then jumpToBlock(lir->ifTrue())
    is a no-op, so it's not necessary to check isNextBlock and we can instead
    directly call jumpToBlock.
  • branchTest32(cond, input, input) is handled by ARM targets to instead emit
    branch32(cond, input, Imm32(0)).

Also updated visitTestBIAndBranch to stay in-sync.

Some target architectures allow the right-hand side to be an Address, which
needs to be special-cased, because cmp{32,Ptr}Set only supports Address as
the left-hand side operand.

Similar to the previous two parts, share more code across targets.

Use branchTestNull to share the same code across all targets.

Move the NaN handling code into a separate method.

Some branch64 methods were already calling into their branchPtr
counterparts. Do this consistently to avoid duplicating code.

Instead directly call either low or hi.

Support additional condition codes for part 13.

Drive-by change:

  • Move jump(fail) for ARM32/x86 to the end to avoid duplicate code.

Share visitCompareI64AndBranch across all target architectures.

Drive-by change:

  • Move const for getInt64Operand to the correct position, because returning
    a const value isn't really useful.

All architectures expect for ARM64 used useInt64OrConstant, whereas ARM64 used
useInt64RegisterOrConstant. The previous part ensures that Address operands are
correctly handled on all platforms, so useInt64OrConstant is now also supported
for ARM64 and we can move the lowering back into the shared code.

And extend the existing branchTest64 on x86 and ARM32 to handle the case when
temp is an invalid register or lhs != rhs.

Using branchTest64 from the previous part, it's now possible to use a single
definition of visitTestI64AndBranch.

lowerForBitAndAndBranch is exactly the same across all targets, so there's
no reason to duplicate this code.

Drive-by change:

  • Rename some variable to be consistent with other code in visitTest.

Requires adding LBitAnd64AndBranch to cleanly handle 32- and 64-bit targets.

All callers use Register64 outputs, so it's easier to pass Register64 to
the MacroAssembler.

Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/0d102f00d0d7 Part 1: Move visitTestIAndBranch into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/8f9328e21fa7 Part 2: Move visitCompare into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/bd7b76800a95 Part 3: Move visitCompareAndBranch into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/00221f811b82 Part 4: Remove unused testZeroEmitBranch method. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/ef6def483963 Part 5: Replace testNullEmitBranch with branchTestNull. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/09a7c6105499 Part 6: Replace testUndefinedEmitBranch with branchTestUndefined. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/5dfd87ed05b4 Part 7: Replace testObjectEmitBranch with branchTestObject. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/2bac091fec61 Part 8: Add definition for emitBranch(DoubleCondition). r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/9cb172f866f5 Part 9: Consistently use branchPtr for branch64 methods on ARM64. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/667435a5c4f7 Part 10: Remove Imm64::{first,second}Half. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/4ca179b8636f Part 11: Support additional condition codes for branch64. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/93bfcf8e8706 Part 12: Add IsRegister64 and ToAddress for LInt64Allocation. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/f0fbaabaa131 Part 13: Move visitCompareI64AndBranch into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/4f8dd358e534 Part 14: Move lowering for LCompareI64AndBranch into shared code. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/c5923db1a7d7 Part 15: Remove unused `template` argument from branch methods. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/517a6a9add34 Part 16: Add branchTestPtr with ImmWord operand. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/190893e0c9c2 Part 17: Add branchTest64 with an immediate operand. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/7c69fd0c5de7 Part 18: Move visitTestI64AndBranch into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/6b57333f3d76 Part 19: Remove lowerForBitAndAndBranch. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/e50e1cfff284 Part 20: Move visitBitAndAndBranch into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/4ff89086adc6 Part 21: Use {Low,High}Word in more places. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/a7ce2906337d Part 22: Move visit{Double,Float32,Value} into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/4d4c4c4e791d Part 23: Support Register64 operands in cmp64Set. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/6ae14ffaa8c4 Part 24: Move visitCompareI64 into shared CodeGenerator. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/cf3241eb6da8 Part 25: Write c{lt}z64 result into Register64. r=spidermonkey-reviewers,iain https://hg.mozilla.org/integration/autoland/rev/e812df518f63 Part 26: Move visit{Clz,Ctz,Popcnt}{I,I64} into shared CodeGenerator. r=spidermonkey-reviewers,iain
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch
Blocks: sm-jits
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: