Closed Bug 1545540 Opened 6 years ago Closed 6 years ago

Add BytecodeOffset type

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Currently an offset in bytecode is held by either JumpTarget or raw ptrdiff_t.
it's better having dedicated type for non-jump target offset.
this also helps bug 1536037 and bug 1464311, given they need to handle jump across BytecodeSections, and there offset is the pair of (BytecodeSection*, ptrdiff_t)

Blocks: 1553958

Previously the initial value of BytecodeSection.lastTarget_ is chosen to make
the following condition true:
lastTargetOffset() + ptrdiff_t(JSOP_JUMPTARGET_LENGTH) == -1

BytecodeOffset class introcuced in part 3 requires the offset value to be
either -1 (invalid) or non-negative, and that rule conflicts with above.

Changed the initial value of BytecodeSection.lastTarget_ to -1 and added
the check for that condition in BytecodeSection::lastOpcodeIsJumpTarget,
so that we don't use negative value in BytecodeOffset.

Depends on D32399

Previously the end of JumpList's link is marked by offset + delta == -1,

BytecodeOffset class introcuced in part 3 requires the operands of - operator
should be valid, and that rule conflicts with above.

Changed the end marker of JumpList to delta == 0, that won't happen in other
case, because that points the same opcode.

Depends on D33052

Attachment #9067198 - Attachment description: Bug 1545540 - Part 1: Add BytecodeOffset/BytecodeOffsetDiff type. r?jorendorff → Bug 1545540 - Part 3: Add BytecodeOffset/BytecodeOffsetDiff type. r?jorendorff
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/9a79b6375011 Part 0: Add comments for include in some frontend files. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/735ff13f705c Part 1: Use BytecodeSection.lastTarget_=-1 to mark last opcode is not jump target. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/7930774e0e96 Part 2: Use delta=0 to mark the end of JumpList. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/4538486aaa02 Part 3: Add BytecodeOffset/BytecodeOffsetDiff type. r=jorendorff
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: