Bug 1598631 - Remove JSOP_LABEL. r=tcampbell

This was a hint for Ion compilation that we no longer need after bug 1595476.

Differential Revision: https://phabricator.services.mozilla.com/D54295

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-11-23 07:24:28 +00:00
Родитель c71a7e9564
Коммит 51910a8901
11 изменённых файлов: 13 добавлений и 69 удалений

Просмотреть файл

@ -1502,7 +1502,6 @@ static bool BytecodeIsEffectful(JSOp op) {
case JSOP_TRY_DESTRUCTURING:
case JSOP_LINENO:
case JSOP_JUMPTARGET:
case JSOP_LABEL:
case JSOP_UNDEFINED:
case JSOP_IFNE:
case JSOP_IFEQ:
@ -1706,6 +1705,7 @@ static bool BytecodeIsEffectful(JSOp op) {
case JSOP_THROWMSG:
case JSOP_FORCEINTERPRETER:
case JSOP_UNUSED71:
case JSOP_UNUSED106:
case JSOP_UNUSED120:
case JSOP_UNUSED149:
case JSOP_LIMIT:

Просмотреть файл

@ -7673,9 +7673,9 @@ MOZ_NEVER_INLINE bool BytecodeEmitter::emitLabeledStatement(
const LabeledStatement* labeledStmt) {
RootedAtom name(cx, labeledStmt->label());
LabelEmitter label(this);
if (!label.emitLabel(name)) {
return false;
}
label.emitLabel(name);
if (!emitTree(labeledStmt->statement())) {
return false;
}

Просмотреть файл

@ -9,43 +9,23 @@
#include "mozilla/Assertions.h" // MOZ_ASSERT
#include "frontend/BytecodeEmitter.h" // BytecodeEmitter
#include "vm/BytecodeUtil.h" // SET_CODE_OFFSET
#include "vm/Opcodes.h" // JSOP_*
using namespace js;
using namespace js::frontend;
bool LabelEmitter::emitLabel(HandleAtom name) {
void LabelEmitter::emitLabel(HandleAtom name) {
MOZ_ASSERT(state_ == State::Start);
// Emit a JSOP_LABEL instruction. The operand is the offset to the statement
// following the labeled statement. The offset is set in emitEnd().
uint32_t index;
if (!bce_->makeAtomIndex(name, &index)) {
return false;
}
if (!bce_->emitN(JSOP_LABEL, 4, &top_)) {
return false;
}
controlInfo_.emplace(bce_, name, bce_->bytecodeSection().offset());
#ifdef DEBUG
state_ = State::Label;
#endif
return true;
}
bool LabelEmitter::emitEnd() {
MOZ_ASSERT(state_ == State::Label);
// Patch the JSOP_LABEL offset.
jsbytecode* labelpc = bce_->bytecodeSection().code(top_);
BytecodeOffsetDiff offset =
bce_->bytecodeSection().lastNonJumpTargetOffset() - top_;
MOZ_ASSERT(*labelpc == JSOP_LABEL);
SET_CODE_OFFSET(labelpc, offset.value());
// Patch the break/continue to this label.
if (!controlInfo_->patchBreaks(bce_)) {
return false;

Просмотреть файл

@ -33,9 +33,6 @@ struct BytecodeEmitter;
class MOZ_STACK_CLASS LabelEmitter {
BytecodeEmitter* bce_;
// The offset of the JSOP_LABEL.
BytecodeOffset top_;
mozilla::Maybe<LabelControl> controlInfo_;
#ifdef DEBUG
@ -60,7 +57,7 @@ class MOZ_STACK_CLASS LabelEmitter {
public:
explicit LabelEmitter(BytecodeEmitter* bce) : bce_(bce) {}
MOZ_MUST_USE bool emitLabel(HandleAtom name);
void emitLabel(HandleAtom name);
MOZ_MUST_USE bool emitEnd();
};

Просмотреть файл

@ -1726,11 +1726,6 @@ bool BaselineCodeGen<Handler>::emit_JSOP_TRY_DESTRUCTURING() {
return true;
}
template <typename Handler>
bool BaselineCodeGen<Handler>::emit_JSOP_LABEL() {
return true;
}
template <typename Handler>
bool BaselineCodeGen<Handler>::emit_JSOP_POP() {
frame.pop();
@ -6927,6 +6922,7 @@ MethodStatus BaselineCompiler::emitBody() {
case JSOP_FORCEINTERPRETER:
// Caller must have checked script->hasForceInterpreterOp().
case JSOP_UNUSED71:
case JSOP_UNUSED106:
case JSOP_UNUSED120:
case JSOP_UNUSED149:
case JSOP_LIMIT:

Просмотреть файл

@ -22,7 +22,6 @@ namespace jit {
#define OPCODE_LIST(_) \
_(JSOP_NOP) \
_(JSOP_NOP_DESTRUCTURING) \
_(JSOP_LABEL) \
_(JSOP_ITERNEXT) \
_(JSOP_POP) \
_(JSOP_POPN) \

Просмотреть файл

@ -1993,7 +1993,6 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
case JSOP_NOP_DESTRUCTURING:
case JSOP_TRY_DESTRUCTURING:
case JSOP_LINENO:
case JSOP_LABEL:
return Ok();
case JSOP_NOP: {
@ -2693,6 +2692,7 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
break;
case JSOP_UNUSED71:
case JSOP_UNUSED106:
case JSOP_UNUSED120:
case JSOP_UNUSED149:
case JSOP_LIMIT:

Просмотреть файл

@ -1432,14 +1432,6 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
break;
}
case JOF_CODE_OFFSET: {
ptrdiff_t off = GET_CODE_OFFSET(pc);
if (!sp->jsprintf(" %u (%+d)", unsigned(loc + int(off)), int(off))) {
return 0;
}
break;
}
case JOF_SCOPE: {
RootedScope scope(cx, script->getScope(GET_UINT32_INDEX(pc)));
UniqueChars bytes;

Просмотреть файл

@ -59,10 +59,9 @@ enum {
JOF_REGEXP = 16, /* uint32_t regexp index */
JOF_DOUBLE = 17, /* inline DoubleValue */
JOF_SCOPE = 18, /* uint32_t scope index */
JOF_CODE_OFFSET = 19, /* int32_t bytecode offset */
JOF_ICINDEX = 20, /* uint32_t IC index */
JOF_LOOPENTRY = 21, /* JSOP_LOOPENTRY, combines JOF_ICINDEX and JOF_UINT8 */
JOF_BIGINT = 22, /* uint32_t index for BigInt value */
JOF_ICINDEX = 19, /* uint32_t IC index */
JOF_LOOPENTRY = 20, /* JSOP_LOOPENTRY, combines JOF_ICINDEX and JOF_UINT8 */
JOF_BIGINT = 21, /* uint32_t index for BigInt value */
JOF_TYPEMASK = 0x001f, /* mask for above immediate types */
JOF_NAME = 1 << 5, /* name operation */
@ -191,14 +190,6 @@ static MOZ_ALWAYS_INLINE void SET_JUMP_OFFSET(jsbytecode* pc, int32_t off) {
SET_INT32(pc, off);
}
static MOZ_ALWAYS_INLINE int32_t GET_CODE_OFFSET(jsbytecode* pc) {
return GET_INT32(pc);
}
static MOZ_ALWAYS_INLINE void SET_CODE_OFFSET(jsbytecode* pc, int32_t off) {
SET_INT32(pc, off);
}
static const unsigned UINT32_INDEX_LEN = 4;
static MOZ_ALWAYS_INLINE uint32_t GET_UINT32_INDEX(const jsbytecode* pc) {

Просмотреть файл

@ -1977,6 +1977,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
CASE(JSOP_NOP_DESTRUCTURING)
CASE(JSOP_TRY_DESTRUCTURING)
CASE(JSOP_UNUSED71)
CASE(JSOP_UNUSED106)
CASE(JSOP_UNUSED120)
CASE(JSOP_UNUSED149)
CASE(JSOP_TRY) {
@ -1991,9 +1992,6 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
ADVANCE_AND_DISPATCH(JSOP_JUMPTARGET_LENGTH);
}
CASE(JSOP_LABEL)
END_CASE(JSOP_LABEL)
CASE(JSOP_LOOPENTRY) {
COUNT_COVERAGE();
// Attempt on-stack replacement into the Baseline Interpreter.

Просмотреть файл

@ -1076,17 +1076,8 @@
*/ \
MACRO(JSOP_STRICTSETPROP_SUPER, 105, "strictsetprop-super", NULL, 5, 3, 1, JOF_ATOM|JOF_PROP|JOF_PROPSET|JOF_DETECTING|JOF_CHECKSTRICT) \
/*
* This opcode precedes every labeled statement. It's a no-op.
*
* 'offset' is the offset to the next instruction after this statement, the
* one 'break LABEL;' would jump to. IonMonkey uses this.
*
* Category: Statements
* Type: Jumps
* Operands: int32_t offset
* Stack: =>
*/ \
MACRO(JSOP_LABEL, 106, "label", NULL, 5, 0, 0, JOF_CODE_OFFSET) \
MACRO(JSOP_UNUSED106, 106, "unused", NULL, 1, 0, 0, JOF_BYTE) \
/*
* Pops the top three values on the stack as 'val', 'obj' and 'receiver',
* and performs 'obj.prop = val', pushing 'val' back onto the stack.