author | Jan de Mooij <jdemooij@mozilla.com> |
Wed, 11 Dec 2019 14:06:55 +0000 | |
changeset 507045 | 099b03af31e1e873e46063d4b11232dc20e0752b |
parent 507044 | cad2de45dfa1ca61a3aed2089ed2dcb5c4c30908 |
child 507046 | f2fefbe8b9dbe19350d93ea13997f11c9fe6561a |
push id | 36922 |
push user | ncsoregi@mozilla.com |
push date | Mon, 16 Dec 2019 17:21:47 +0000 |
treeherder | mozilla-central@27d0d6cc2131 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | arai |
bugs | 1601072 |
milestone | 73.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/frontend/BytecodeControlStructures.cpp +++ b/js/src/frontend/BytecodeControlStructures.cpp @@ -92,25 +92,33 @@ bool LoopControl::emitLoopHead(BytecodeE } SetLoopHeadDepthHint(bce->bytecodeSection().code(off), loopDepth_); return true; } bool LoopControl::emitLoopEnd(BytecodeEmitter* bce, JSOp op, JSTryNoteKind tryNoteKind) { - JumpList beq; - if (!bce->emitBackwardJump(op, head_, &beq, &breakTarget_)) { + JumpList jump; + if (!bce->emitJumpNoFallthrough(op, &jump)) { + return false; + } + bce->patchJumpsToTarget(jump, head_); + + // Create a fallthrough for closing iterators, and as a target for break + // statements. + JumpTarget breakTarget; + if (!bce->emitJumpTarget(&breakTarget)) { return false; } if (!patchBreaks(bce)) { return false; } if (!bce->addTryNote(tryNoteKind, bce->bytecodeSection().stackDepth(), - headOffset(), breakTargetOffset())) { + headOffset(), breakTarget.offset)) { return false; } return true; } TryFinallyControl::TryFinallyControl(BytecodeEmitter* bce, StatementKind kind) : NestableControl(bce, kind), emittingSubroutine_(false) { MOZ_ASSERT(is<TryFinallyControl>());
--- a/js/src/frontend/BytecodeControlStructures.h +++ b/js/src/frontend/BytecodeControlStructures.h @@ -104,33 +104,29 @@ class LoopControl : public BreakableCont // # Loop end, backward jump // JSOP_GOTO/JSOP_IFNE head // // breakTarget: // The bytecode offset of JSOP_LOOPHEAD. JumpTarget head_; - // The target of break statement jumps. - JumpTarget breakTarget_; - // Stack depth when this loop was pushed on the control stack. int32_t stackDepth_; // The loop nesting depth. Used as a hint to Ion. uint32_t loopDepth_; public: // Offset of the last continue in the loop. JumpList continues; LoopControl(BytecodeEmitter* bce, StatementKind loopKind); BytecodeOffset headOffset() const { return head_.offset; } - BytecodeOffset breakTargetOffset() const { return breakTarget_.offset; } MOZ_MUST_USE bool emitContinueTarget(BytecodeEmitter* bce); // Emit a jump to break target from the top level of the loop. MOZ_MUST_USE bool emitSpecialBreakForDone(BytecodeEmitter* bce); // `nextPos` is the offset in the source code for the character that // corresponds to the next instruction after JSOP_LOOPHEAD.
--- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -406,32 +406,16 @@ bool BytecodeEmitter::emitJump(JSOp op, JumpTarget fallthrough; if (!emitJumpTarget(&fallthrough)) { return false; } } return true; } -bool BytecodeEmitter::emitBackwardJump(JSOp op, JumpTarget target, - JumpList* jump, - JumpTarget* fallthrough) { - if (!emitJumpNoFallthrough(op, jump)) { - return false; - } - patchJumpsToTarget(*jump, target); - - // Unconditionally create a fallthrough for closing iterators, and as a - // target for break statements. - if (!emitJumpTarget(fallthrough)) { - return false; - } - return true; -} - void BytecodeEmitter::patchJumpsToTarget(JumpList jump, JumpTarget target) { MOZ_ASSERT( !jump.offset.valid() || (0 <= jump.offset.value() && jump.offset <= bytecodeSection().offset())); MOZ_ASSERT(0 <= target.offset.value() && target.offset <= bytecodeSection().offset()); MOZ_ASSERT_IF( jump.offset.valid() &&
--- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -435,18 +435,16 @@ struct MOZ_STACK_CLASS BytecodeEmitter { MOZ_MUST_USE bool emitSetThis(BinaryNode* setThisNode); MOZ_MUST_USE bool emitCheckDerivedClassConstructorReturn(); // Handle jump opcodes and jump targets. MOZ_MUST_USE bool emitJumpTargetOp(JSOp op, BytecodeOffset* off); MOZ_MUST_USE bool emitJumpTarget(JumpTarget* target); MOZ_MUST_USE bool emitJumpNoFallthrough(JSOp op, JumpList* jump); MOZ_MUST_USE bool emitJump(JSOp op, JumpList* jump); - MOZ_MUST_USE bool emitBackwardJump(JSOp op, JumpTarget target, JumpList* jump, - JumpTarget* fallthrough); void patchJumpsToTarget(JumpList jump, JumpTarget target); MOZ_MUST_USE bool emitJumpTargetAndPatch(JumpList jump); MOZ_MUST_USE bool emitCall(JSOp op, uint16_t argc, const mozilla::Maybe<uint32_t>& sourceCoordOffset); MOZ_MUST_USE bool emitCall(JSOp op, uint16_t argc, ParseNode* pn = nullptr); MOZ_MUST_USE bool emitCallIncDec(UnaryNode* incDec);