mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1608089 - Part 1: Add explicit casts between JSOp and uint8_t. r=jandem.
Later we will turn JSOp into an enum class that requires these casts. In places where we are overwriting a previously written bytecode, this casts to jsbytecode rather than uint8_t, following the prevailing style. Differential Revision: https://phabricator.services.mozilla.com/D59359 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
55782f1de7
commit
87338c7f13
@ -1806,7 +1806,7 @@ Completion Completion::fromJSFramePop(JSContext* cx, AbstractFramePtr frame,
|
||||
// possibility, so it's fine to call genObj->isClosed().
|
||||
Rooted<AbstractGeneratorObject*> generatorObj(
|
||||
cx, GetGeneratorObjectForFrame(cx, frame));
|
||||
switch (*pc) {
|
||||
switch (JSOp(*pc)) {
|
||||
case JSOP_INITIALYIELD:
|
||||
MOZ_ASSERT(!generatorObj->isClosed());
|
||||
return Completion(InitialYield(generatorObj));
|
||||
@ -2120,7 +2120,7 @@ ResumeMode Debugger::fireEnterFrame(JSContext* cx, MutableHandleValue vp) {
|
||||
|
||||
#if DEBUG
|
||||
// Assert that the hook won't be able to re-enter the generator.
|
||||
if (iter.hasScript() && *iter.pc() == JSOP_AFTERYIELD) {
|
||||
if (iter.hasScript() && JSOp(*iter.pc()) == JSOP_AFTERYIELD) {
|
||||
auto* genObj = GetGeneratorObjectForFrame(cx, iter.abstractFramePtr());
|
||||
MOZ_ASSERT(genObj->isRunning());
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ bool BytecodeEmitter::emitN(JSOp op, size_t extra, BytecodeOffset* offset) {
|
||||
* Don't updateDepth if op's use-count comes from the immediate
|
||||
* operand yet to be stored in the extra bytes after op.
|
||||
*/
|
||||
if (CodeSpec[op].nuses >= 0) {
|
||||
if (CodeSpec(op).nuses >= 0) {
|
||||
bytecodeSection().updateDepth(off);
|
||||
}
|
||||
|
||||
@ -1654,7 +1654,7 @@ bool BytecodeEmitter::emitNewInit() {
|
||||
}
|
||||
|
||||
jsbytecode* code = bytecodeSection().code(offset);
|
||||
code[0] = JSOP_NEWINIT;
|
||||
code[0] = jsbytecode(JSOP_NEWINIT);
|
||||
code[1] = 0;
|
||||
code[2] = 0;
|
||||
code[3] = 0;
|
||||
@ -5878,7 +5878,7 @@ bool BytecodeEmitter::emitReturn(UnaryNode* returnNode) {
|
||||
return false;
|
||||
}
|
||||
} else if (isDerivedClassConstructor) {
|
||||
MOZ_ASSERT(bytecodeSection().code()[top.value()] == JSOP_SETRVAL);
|
||||
MOZ_ASSERT(JSOp(bytecodeSection().code()[top.value()]) == JSOP_SETRVAL);
|
||||
if (!emitReturnRval()) {
|
||||
return false;
|
||||
}
|
||||
@ -5887,7 +5887,7 @@ bool BytecodeEmitter::emitReturn(UnaryNode* returnNode) {
|
||||
// If we are instrumenting, make sure we use RETRVAL and add any
|
||||
// instrumentation for the frame exit.
|
||||
instrumentationKinds) {
|
||||
bytecodeSection().code()[top.value()] = JSOP_SETRVAL;
|
||||
bytecodeSection().code()[top.value()] = jsbytecode(JSOP_SETRVAL);
|
||||
if (!emitReturnRval()) {
|
||||
return false;
|
||||
}
|
||||
@ -8475,8 +8475,8 @@ bool BytecodeEmitter::replaceNewInitWithNewObject(JSObject* obj,
|
||||
|
||||
jsbytecode* code = bytecodeSection().code(offset);
|
||||
|
||||
MOZ_ASSERT(code[0] == JSOP_NEWINIT);
|
||||
code[0] = JSOP_NEWOBJECT;
|
||||
MOZ_ASSERT(JSOp(code[0]) == JSOP_NEWINIT);
|
||||
code[0] = jsbytecode(JSOP_NEWOBJECT);
|
||||
SET_UINT32(code, index);
|
||||
|
||||
return true;
|
||||
|
@ -72,7 +72,7 @@ bool TryEmitter::emitTryEnd() {
|
||||
// Patch the JSOP_TRY offset.
|
||||
jsbytecode* trypc = bce_->bytecodeSection().code(tryOpOffset_);
|
||||
BytecodeOffsetDiff offset = bce_->bytecodeSection().offset() - tryOpOffset_;
|
||||
MOZ_ASSERT(*trypc == JSOP_TRY);
|
||||
MOZ_ASSERT(JSOp(*trypc) == JSOP_TRY);
|
||||
SET_CODE_OFFSET(trypc, offset.value());
|
||||
|
||||
// Emit jump over catch and/or finally.
|
||||
|
@ -52,7 +52,7 @@ FRAGMENT(Interpreter, Regs) {
|
||||
JS::Value slot1;
|
||||
JS::Value slot2;
|
||||
} fakeFrame;
|
||||
uint8_t fakeOpcode = JSOP_TRUE;
|
||||
uint8_t fakeOpcode = uint8_t(JSOP_TRUE);
|
||||
|
||||
js::InterpreterRegs regs;
|
||||
js::GDBTestInitInterpreterRegs(regs, &fakeFrame.frame, &fakeFrame.slot2,
|
||||
|
@ -1082,7 +1082,7 @@ static bool InitFromBailout(JSContext* cx, size_t frameNo, HandleFunction fun,
|
||||
#ifdef JS_JITSPEW
|
||||
JitSpew(JitSpew_BaselineBailouts,
|
||||
" Resuming %s pc offset %d (op %s) (line %d) of %s:%u:%u",
|
||||
resumeAfter ? "after" : "at", (int)pcOff, CodeName[op],
|
||||
resumeAfter ? "after" : "at", (int)pcOff, CodeName(op),
|
||||
PCToLineNumber(script, pc), script->filename(), script->lineno(),
|
||||
script->column());
|
||||
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
|
||||
@ -1141,7 +1141,7 @@ static bool InitFromBailout(JSContext* cx, size_t frameNo, HandleFunction fun,
|
||||
}
|
||||
snprintf(buf.get(), len, "%s %s %s on line %u of %s:%u",
|
||||
BailoutKindString(bailoutKind), resumeAfter ? "after" : "at",
|
||||
CodeName[op], PCToLineNumber(script, pc), filename,
|
||||
CodeName(op), PCToLineNumber(script, pc), filename,
|
||||
script->lineno());
|
||||
cx->runtime()->geckoProfiler().markEvent(buf.get());
|
||||
}
|
||||
|
@ -6810,7 +6810,7 @@ MethodStatus BaselineCompiler::emitBody() {
|
||||
while (true) {
|
||||
JSOp op = JSOp(*handler.pc());
|
||||
JitSpew(JitSpew_BaselineOp, "Compiling op @ %d: %s",
|
||||
int(script->pcToOffset(handler.pc())), CodeName[op]);
|
||||
int(script->pcToOffset(handler.pc())), CodeName(op));
|
||||
|
||||
BytecodeInfo* info = handler.analysis().maybeInfo(handler.pc());
|
||||
|
||||
@ -6981,7 +6981,7 @@ bool BaselineInterpreterGenerator::emitInterpreterLoop() {
|
||||
Label opLabels[JSOP_LIMIT];
|
||||
#define EMIT_OP(OP, ...) \
|
||||
{ \
|
||||
masm.bind(&opLabels[OP]); \
|
||||
masm.bind(&opLabels[uint8_t(OP)]); \
|
||||
handler.setCurrentOp(OP); \
|
||||
if (!this->emit_##OP()) { \
|
||||
return false; \
|
||||
|
@ -207,7 +207,7 @@ static void SpewPatchBaselineFrame(const uint8_t* oldReturnAddress,
|
||||
"Patch return %p -> %p on BaselineJS frame (%s:%u:%u) from %s at %s",
|
||||
oldReturnAddress, newReturnAddress, script->filename(),
|
||||
script->lineno(), script->column(),
|
||||
RetAddrEntryKindToString(frameKind), CodeName[(JSOp)*pc]);
|
||||
RetAddrEntryKindToString(frameKind), CodeName(JSOp(*pc)));
|
||||
}
|
||||
|
||||
static void PatchBaselineFramesForDebugMode(
|
||||
|
@ -1826,7 +1826,7 @@ bool DoGetElemFallback(JSContext* cx, BaselineFrame* frame,
|
||||
jsbytecode* pc = stub->icEntry()->pc(frame->script());
|
||||
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "GetElem(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "GetElem(%s)", CodeName(op));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM);
|
||||
|
||||
@ -1892,7 +1892,7 @@ bool DoGetElemSuperFallback(JSContext* cx, BaselineFrame* frame,
|
||||
jsbytecode* pc = stub->icEntry()->pc(frame->script());
|
||||
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "GetElemSuper(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "GetElemSuper(%s)", CodeName(op));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_GETELEM_SUPER);
|
||||
|
||||
@ -2034,7 +2034,7 @@ bool DoSetElemFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript outerScript(cx, script);
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "SetElem(%s)", CodeName[JSOp(*pc)]);
|
||||
FallbackICSpew(cx, stub, "SetElem(%s)", CodeName(JSOp(*pc)));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_SETELEM || op == JSOP_STRICTSETELEM ||
|
||||
op == JSOP_INITELEM || op == JSOP_INITHIDDENELEM ||
|
||||
@ -2318,7 +2318,7 @@ bool DoGetNameFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "GetName(%s)", CodeName[JSOp(*pc)]);
|
||||
FallbackICSpew(cx, stub, "GetName(%s)", CodeName(JSOp(*pc)));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_GETNAME || op == JSOP_GETGNAME);
|
||||
|
||||
@ -2368,7 +2368,7 @@ bool DoBindNameFallback(JSContext* cx, BaselineFrame* frame,
|
||||
|
||||
jsbytecode* pc = stub->icEntry()->pc(frame->script());
|
||||
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "BindName(%s)", CodeName[JSOp(*pc)]);
|
||||
FallbackICSpew(cx, stub, "BindName(%s)", CodeName(JSOp(*pc)));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_BINDNAME || op == JSOP_BINDGNAME);
|
||||
|
||||
@ -2413,7 +2413,7 @@ bool DoGetIntrinsicFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "GetIntrinsic(%s)", CodeName[JSOp(*pc)]);
|
||||
FallbackICSpew(cx, stub, "GetIntrinsic(%s)", CodeName(JSOp(*pc)));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_GETINTRINSIC);
|
||||
|
||||
@ -2489,7 +2489,7 @@ bool DoGetPropFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "GetProp(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "GetProp(%s)", CodeName(op));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_GETPROP || op == JSOP_CALLPROP || op == JSOP_LENGTH ||
|
||||
op == JSOP_GETBOUNDNAME);
|
||||
@ -2514,7 +2514,7 @@ bool DoGetPropSuperFallback(JSContext* cx, BaselineFrame* frame,
|
||||
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
FallbackICSpew(cx, stub, "GetPropSuper(%s)", CodeName[JSOp(*pc)]);
|
||||
FallbackICSpew(cx, stub, "GetPropSuper(%s)", CodeName(JSOp(*pc)));
|
||||
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_GETPROP_SUPER);
|
||||
|
||||
@ -2617,7 +2617,7 @@ bool DoSetPropFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "SetProp(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "SetProp(%s)", CodeName(op));
|
||||
|
||||
MOZ_ASSERT(op == JSOP_SETPROP || op == JSOP_STRICTSETPROP ||
|
||||
op == JSOP_SETNAME || op == JSOP_STRICTSETNAME ||
|
||||
@ -2819,7 +2819,7 @@ bool DoCallFallback(JSContext* cx, BaselineFrame* frame, ICCall_Fallback* stub,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "Call(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "Call(%s)", CodeName(op));
|
||||
|
||||
MOZ_ASSERT(argc == GET_ARGC(pc));
|
||||
bool constructing = (op == JSOP_NEW || op == JSOP_SUPERCALL);
|
||||
@ -2962,7 +2962,7 @@ bool DoSpreadCallFallback(JSContext* cx, BaselineFrame* frame,
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
bool constructing = (op == JSOP_SPREADNEW || op == JSOP_SPREADSUPERCALL);
|
||||
FallbackICSpew(cx, stub, "SpreadCall(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "SpreadCall(%s)", CodeName(op));
|
||||
|
||||
// Ensure vp array is rooted - we may GC in here.
|
||||
AutoArrayRooter vpRoot(cx, 3 + constructing, vp);
|
||||
@ -3400,7 +3400,7 @@ bool DoUnaryArithFallback(JSContext* cx, BaselineFrame* frame,
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(cx, stub, "UnaryArith(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "UnaryArith(%s)", CodeName(op));
|
||||
|
||||
// The unary operations take a copied val because the original value is needed
|
||||
// below.
|
||||
@ -3476,7 +3476,7 @@ bool DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame,
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
FallbackICSpew(
|
||||
cx, stub, "CacheIRBinaryArith(%s,%d,%d)", CodeName[op],
|
||||
cx, stub, "CacheIRBinaryArith(%s,%d,%d)", CodeName(op),
|
||||
int(lhs.isDouble() ? JSVAL_TYPE_DOUBLE : lhs.extractNonDoubleType()),
|
||||
int(rhs.isDouble() ? JSVAL_TYPE_DOUBLE : rhs.extractNonDoubleType()));
|
||||
|
||||
@ -3601,7 +3601,7 @@ bool DoCompareFallback(JSContext* cx, BaselineFrame* frame,
|
||||
jsbytecode* pc = stub->icEntry()->pc(script);
|
||||
JSOp op = JSOp(*pc);
|
||||
|
||||
FallbackICSpew(cx, stub, "Compare(%s)", CodeName[op]);
|
||||
FallbackICSpew(cx, stub, "Compare(%s)", CodeName(op));
|
||||
|
||||
// Don't pass lhs/rhs directly, we need the original values when
|
||||
// generating stubs.
|
||||
|
@ -749,7 +749,7 @@ ObjectGroup* BaselineInspector::getTemplateObjectGroup(jsbytecode* pc) {
|
||||
}
|
||||
|
||||
JSFunction* BaselineInspector::getSingleCallee(jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_NEW);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_NEW);
|
||||
|
||||
const ICEntry& entry = icEntryFromPC(pc);
|
||||
ICStub* stub = entry.firstStub();
|
||||
@ -1571,7 +1571,7 @@ MIRType BaselineInspector::expectedPropertyAccessInputType(jsbytecode* pc) {
|
||||
bool BaselineInspector::instanceOfData(jsbytecode* pc, Shape** shape,
|
||||
uint32_t* slot,
|
||||
JSObject** prototypeObject) {
|
||||
MOZ_ASSERT(*pc == JSOP_INSTANCEOF);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INSTANCEOF);
|
||||
|
||||
const ICEntry& entry = icEntryFromPC(pc);
|
||||
ICStub* firstStub = entry.firstStub();
|
||||
|
@ -410,7 +410,7 @@ bool jit::BaselineCompileFromBaselineInterpreter(JSContext* cx,
|
||||
|
||||
RootedScript script(cx, frame->script());
|
||||
jsbytecode* pc = frame->interpreterPC();
|
||||
MOZ_ASSERT(pc == script->code() || *pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(pc == script->code() || JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
|
||||
MethodStatus status = CanEnterBaselineJIT(cx, script,
|
||||
/* osrSourceFrame = */ frame);
|
||||
@ -424,7 +424,7 @@ bool jit::BaselineCompileFromBaselineInterpreter(JSContext* cx,
|
||||
return true;
|
||||
|
||||
case Method_Compiled: {
|
||||
if (*pc == JSOP_LOOPHEAD) {
|
||||
if (JSOp(*pc) == JSOP_LOOPHEAD) {
|
||||
MOZ_ASSERT(pc > script->code(),
|
||||
"Prologue vs OSR cases must not be ambiguous");
|
||||
BaselineScript* baselineScript = script->baselineScript();
|
||||
|
@ -52,7 +52,7 @@ bool BytecodeAnalysis::init(TempAllocator& alloc) {
|
||||
uint32_t offset = it.bytecodeToOffset(script_);
|
||||
|
||||
JitSpew(JitSpew_BaselineOp, "Analyzing op @ %u (end=%u): %s",
|
||||
unsigned(offset), unsigned(script_->length()), CodeName[op]);
|
||||
unsigned(offset), unsigned(script_->length()), CodeName(op));
|
||||
|
||||
// If this bytecode info has not yet been initialized, it's not reachable.
|
||||
if (!infos_[offset].initialized) {
|
||||
|
@ -514,7 +514,7 @@ static bool IsCacheableNoProperty(JSContext* cx, JSObject* obj,
|
||||
// If we're doing a name lookup, we have to throw a ReferenceError. If
|
||||
// extra warnings are enabled, we may have to report a warning.
|
||||
// Note that Ion does not generate idempotent caches for JSOP_GETBOUNDNAME.
|
||||
if ((pc && *pc == JSOP_GETBOUNDNAME) ||
|
||||
if ((pc && JSOp(*pc) == JSOP_GETBOUNDNAME) ||
|
||||
cx->realm()->behaviors().extraWarnings(cx)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2023,91 +2023,87 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
|
||||
writeOperandId(rhs);
|
||||
}
|
||||
|
||||
void compareStringResult(uint32_t op, StringOperandId lhs,
|
||||
StringOperandId rhs) {
|
||||
void compareStringResult(JSOp op, StringOperandId lhs, StringOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareStringResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareObjectResult(uint32_t op, ObjOperandId lhs, ObjOperandId rhs) {
|
||||
void compareObjectResult(JSOp op, ObjOperandId lhs, ObjOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareObjectResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareObjectUndefinedNullResult(uint32_t op, ObjOperandId object) {
|
||||
void compareObjectUndefinedNullResult(JSOp op, ObjOperandId object) {
|
||||
writeOpWithOperandId(CacheOp::CompareObjectUndefinedNullResult, object);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareSymbolResult(uint32_t op, SymbolOperandId lhs,
|
||||
SymbolOperandId rhs) {
|
||||
void compareSymbolResult(JSOp op, SymbolOperandId lhs, SymbolOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareSymbolResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareInt32Result(uint32_t op, Int32OperandId lhs, Int32OperandId rhs) {
|
||||
void compareInt32Result(JSOp op, Int32OperandId lhs, Int32OperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareInt32Result, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareDoubleResult(uint32_t op, NumberOperandId lhs,
|
||||
NumberOperandId rhs) {
|
||||
void compareDoubleResult(JSOp op, NumberOperandId lhs, NumberOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareDoubleResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareBigIntResult(uint32_t op, BigIntOperandId lhs,
|
||||
BigIntOperandId rhs) {
|
||||
void compareBigIntResult(JSOp op, BigIntOperandId lhs, BigIntOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareBigIntResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareBigIntInt32Result(uint32_t op, BigIntOperandId lhs,
|
||||
void compareBigIntInt32Result(JSOp op, BigIntOperandId lhs,
|
||||
Int32OperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareBigIntInt32Result, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareInt32BigIntResult(uint32_t op, Int32OperandId lhs,
|
||||
void compareInt32BigIntResult(JSOp op, Int32OperandId lhs,
|
||||
BigIntOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareInt32BigIntResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareBigIntNumberResult(uint32_t op, BigIntOperandId lhs,
|
||||
void compareBigIntNumberResult(JSOp op, BigIntOperandId lhs,
|
||||
NumberOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareBigIntNumberResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareNumberBigIntResult(uint32_t op, NumberOperandId lhs,
|
||||
void compareNumberBigIntResult(JSOp op, NumberOperandId lhs,
|
||||
BigIntOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareNumberBigIntResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareBigIntStringResult(uint32_t op, BigIntOperandId lhs,
|
||||
void compareBigIntStringResult(JSOp op, BigIntOperandId lhs,
|
||||
StringOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareBigIntStringResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void compareStringBigIntResult(uint32_t op, StringOperandId lhs,
|
||||
void compareStringBigIntResult(JSOp op, StringOperandId lhs,
|
||||
BigIntOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareStringBigIntResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
buffer_.writeByte(uint8_t(op));
|
||||
}
|
||||
|
||||
void callPrintString(const char* str) {
|
||||
|
@ -189,7 +189,7 @@ void CacheIRSpewer::opcodeProperty(const char* name, const JSOp op) {
|
||||
JSONPrinter& j = json_.ref();
|
||||
|
||||
j.beginStringProperty(name);
|
||||
output_.put(CodeName[op]);
|
||||
output_.put(CodeName(op));
|
||||
j.endStringProperty();
|
||||
}
|
||||
|
||||
|
@ -6178,7 +6178,7 @@ static void DumpTrackedSite(const BytecodeSite* site) {
|
||||
unsigned column = 0;
|
||||
unsigned lineNumber = PCToLineNumber(site->script(), site->pc(), &column);
|
||||
JitSpew(JitSpew_OptimizationTracking, "Types for %s at %s:%u:%u",
|
||||
CodeName[JSOp(*site->pc())], site->script()->filename(), lineNumber,
|
||||
CodeName(JSOp(*site->pc())), site->script()->filename(), lineNumber,
|
||||
column);
|
||||
#endif
|
||||
}
|
||||
@ -11106,7 +11106,7 @@ void CodeGenerator::visitCallGetElement(LCallGetElement* lir) {
|
||||
pushArg(ToValue(lir, LCallGetElement::RhsInput));
|
||||
pushArg(ToValue(lir, LCallGetElement::LhsInput));
|
||||
|
||||
JSOp op = JSOp(*lir->mir()->resumePoint()->pc());
|
||||
uint8_t op = *lir->mir()->resumePoint()->pc();
|
||||
pushArg(Imm32(op));
|
||||
|
||||
using Fn =
|
||||
|
@ -1124,7 +1124,7 @@ static void EliminateTriviallyDeadResumePointOperands(MIRGraph& graph,
|
||||
MResumePoint* rp) {
|
||||
// If we will pop the top of the stack immediately after resuming,
|
||||
// then don't preserve the top value in the resume point.
|
||||
if (rp->mode() != MResumePoint::ResumeAt || *rp->pc() != JSOP_POP) {
|
||||
if (rp->mode() != MResumePoint::ResumeAt || JSOp(*rp->pc()) != JSOP_POP) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4742,7 +4742,7 @@ static bool ArgumentsUseCanBeLazy(JSContext* cx, JSScript* script,
|
||||
bool* argumentsContentsObserved) {
|
||||
// We can read the frame's arguments directly for f.apply(x, arguments).
|
||||
if (ins->isCall()) {
|
||||
if (*ins->toCall()->resumePoint()->pc() == JSOP_FUNAPPLY &&
|
||||
if (JSOp(*ins->toCall()->resumePoint()->pc()) == JSOP_FUNAPPLY &&
|
||||
ins->toCall()->numActualArgs() == 2 &&
|
||||
index == MCall::IndexOfArgument(1)) {
|
||||
*argumentsContentsObserved = true;
|
||||
|
@ -1756,7 +1756,7 @@ AbortReasonOr<Ok> IonBuilder::startTraversingBlock(MBasicBlock* block) {
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok> IonBuilder::jsop_goto(bool* restarted) {
|
||||
MOZ_ASSERT(*pc == JSOP_GOTO);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_GOTO);
|
||||
|
||||
if (IsBackedgePC(pc)) {
|
||||
return visitBackEdge(restarted);
|
||||
@ -1801,7 +1801,7 @@ AbortReasonOr<Ok> IonBuilder::jsop_loophead() {
|
||||
// ...
|
||||
// IFNE/GOTO to LOOPHEAD
|
||||
|
||||
MOZ_ASSERT(*pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
|
||||
if (hasTerminatedBlock()) {
|
||||
// The whole loop is unreachable.
|
||||
@ -2101,7 +2101,7 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
|
||||
// SET* opcodes. Place a resume point afterwards to avoid capturing
|
||||
// the dead value in later snapshots, except in places where that
|
||||
// resume point is obviously unnecessary.
|
||||
if (pc[JSOP_POP_LENGTH] == JSOP_POP) {
|
||||
if (JSOp(pc[JSOP_POP_LENGTH]) == JSOP_POP) {
|
||||
return Ok();
|
||||
}
|
||||
if (def->isConstant()) {
|
||||
@ -2180,8 +2180,8 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
|
||||
case JSOP_CALLITER:
|
||||
case JSOP_NEW:
|
||||
MOZ_TRY(jsop_call(GET_ARGC(pc),
|
||||
(JSOp)*pc == JSOP_NEW || (JSOp)*pc == JSOP_SUPERCALL,
|
||||
(JSOp)*pc == JSOP_CALL_IGNORES_RV));
|
||||
JSOp(*pc) == JSOP_NEW || JSOp(*pc) == JSOP_SUPERCALL,
|
||||
JSOp(*pc) == JSOP_CALL_IGNORES_RV));
|
||||
if (op == JSOP_CALLITER) {
|
||||
if (!outermostBuilder()->iterators_.append(current->peek(-1))) {
|
||||
return abort(AbortReason::Alloc);
|
||||
@ -2581,7 +2581,7 @@ AbortReasonOr<Ok> IonBuilder::inspectOpcode(JSOp op, bool* restarted) {
|
||||
// thing anyways.
|
||||
trackActionableAbort("Unsupported bytecode");
|
||||
#ifdef DEBUG
|
||||
return abort(AbortReason::Disable, "Unsupported opcode: %s", CodeName[op]);
|
||||
return abort(AbortReason::Disable, "Unsupported opcode: %s", CodeName(op));
|
||||
#else
|
||||
return abort(AbortReason::Disable, "Unsupported opcode: %d", op);
|
||||
#endif
|
||||
@ -6199,7 +6199,7 @@ AbortReasonOr<Ok> IonBuilder::jsop_call(uint32_t argc, bool constructing,
|
||||
if (observed->empty()) {
|
||||
if (BytecodeFlowsToBitop(pc)) {
|
||||
observed->addType(TypeSet::Int32Type(), alloc_->lifoAlloc());
|
||||
} else if (*GetNextPc(pc) == JSOP_POS) {
|
||||
} else if (JSOp(*GetNextPc(pc)) == JSOP_POS) {
|
||||
// Note: this is lame, overspecialized on the code patterns used
|
||||
// by asm.js and should be replaced by a more general mechanism.
|
||||
// See bug 870847.
|
||||
@ -7281,7 +7281,7 @@ AbortReasonOr<Ok> IonBuilder::jsop_newobject() {
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok> IonBuilder::jsop_initelem() {
|
||||
MOZ_ASSERT(*pc == JSOP_INITELEM || *pc == JSOP_INITHIDDENELEM);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITELEM || JSOp(*pc) == JSOP_INITHIDDENELEM);
|
||||
|
||||
MDefinition* value = current->pop();
|
||||
MDefinition* id = current->pop();
|
||||
@ -7289,7 +7289,7 @@ AbortReasonOr<Ok> IonBuilder::jsop_initelem() {
|
||||
|
||||
bool emitted = false;
|
||||
|
||||
if (!forceInlineCaches() && *pc == JSOP_INITELEM) {
|
||||
if (!forceInlineCaches() && JSOp(*pc) == JSOP_INITELEM) {
|
||||
MOZ_TRY(initOrSetElemTryDense(&emitted, obj, id, value,
|
||||
/* writeHole = */ true));
|
||||
if (emitted) {
|
||||
@ -7323,7 +7323,8 @@ AbortReasonOr<Ok> IonBuilder::jsop_initelem_inc() {
|
||||
AbortReasonOr<Ok> IonBuilder::initArrayElement(MDefinition* obj,
|
||||
MDefinition* id,
|
||||
MDefinition* value) {
|
||||
MOZ_ASSERT(*pc == JSOP_INITELEM_ARRAY || *pc == JSOP_INITELEM_INC);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITELEM_ARRAY ||
|
||||
JSOp(*pc) == JSOP_INITELEM_INC);
|
||||
|
||||
bool emitted = false;
|
||||
|
||||
@ -7357,7 +7358,8 @@ AbortReasonOr<Ok> IonBuilder::initArrayElemTryFastPath(bool* emitted,
|
||||
MDefinition* id,
|
||||
MDefinition* value) {
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
MOZ_ASSERT(*pc == JSOP_INITELEM_ARRAY || *pc == JSOP_INITELEM_INC);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITELEM_ARRAY ||
|
||||
JSOp(*pc) == JSOP_INITELEM_INC);
|
||||
|
||||
// Make sure that arrays have the type being written to them by the
|
||||
// intializer, and that arrays are marked as non-packed when writing holes
|
||||
@ -7979,7 +7981,7 @@ static bool ObjectHasExtraOwnProperty(CompileRealm* realm,
|
||||
}
|
||||
|
||||
void IonBuilder::insertRecompileCheck(jsbytecode* pc) {
|
||||
MOZ_ASSERT(pc == script()->code() || *pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(pc == script()->code() || JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
|
||||
// No need for recompile checks if this is the highest optimization level or
|
||||
// if we're performing an analysis instead of compilation.
|
||||
@ -7994,7 +7996,7 @@ void IonBuilder::insertRecompileCheck(jsbytecode* pc) {
|
||||
// works.
|
||||
|
||||
MRecompileCheck::RecompileCheckType type;
|
||||
if (*pc == JSOP_LOOPHEAD) {
|
||||
if (JSOp(*pc) == JSOP_LOOPHEAD) {
|
||||
type = MRecompileCheck::RecompileCheckType::OptimizationLevelOSR;
|
||||
} else if (this != outermostBuilder()) {
|
||||
type = MRecompileCheck::RecompileCheckType::OptimizationLevelInlined;
|
||||
@ -11212,7 +11214,7 @@ MDefinition* IonBuilder::maybeUnboxForPropertyAccess(MDefinition* def) {
|
||||
// If we have better type information to unbox the first copy going into
|
||||
// the CALLPROP operation, we can replace the duplicated copy on the
|
||||
// stack as well.
|
||||
if (*pc == JSOP_CALLPROP || *pc == JSOP_CALLELEM) {
|
||||
if (JSOp(*pc) == JSOP_CALLPROP || JSOp(*pc) == JSOP_CALLELEM) {
|
||||
uint32_t idx = current->stackDepth() - 1;
|
||||
MOZ_ASSERT(current->getSlot(idx) == def);
|
||||
current->setSlot(idx, unbox);
|
||||
@ -11381,7 +11383,7 @@ AbortReasonOr<Ok> IonBuilder::improveThisTypesForCall() {
|
||||
// at this point we can remove null and undefined from obj's TypeSet, to
|
||||
// improve type information for the call that will follow.
|
||||
|
||||
MOZ_ASSERT(*pc == JSOP_CALLPROP || *pc == JSOP_CALLELEM);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_CALLPROP || JSOp(*pc) == JSOP_CALLELEM);
|
||||
|
||||
// Ensure |this| has types {object, null/undefined}. For simplicity don't
|
||||
// optimize if the callee is a Phi (this can happen in rare cases after
|
||||
@ -12225,7 +12227,7 @@ AbortReasonOr<Ok> IonBuilder::getPropAddCache(MDefinition* obj,
|
||||
}
|
||||
load->setResultType(rvalType);
|
||||
|
||||
if (*pc != JSOP_CALLPROP || !IsNullOrUndefined(obj->type())) {
|
||||
if (JSOp(*pc) != JSOP_CALLPROP || !IsNullOrUndefined(obj->type())) {
|
||||
// Due to inlining, it's possible the observed TypeSet is non-empty,
|
||||
// even though we know |obj| is null/undefined and the MCallGetProperty
|
||||
// will throw. Don't push a TypeBarrier in this case, to avoid
|
||||
|
@ -322,7 +322,7 @@ bool IonSetPropertyIC::update(JSContext* cx, HandleScript outerScript,
|
||||
|
||||
jsbytecode* pc = ic->pc();
|
||||
if (ic->kind() == CacheKind::SetElem) {
|
||||
if (*pc == JSOP_INITELEM_INC || *pc == JSOP_INITELEM_ARRAY) {
|
||||
if (JSOp(*pc) == JSOP_INITELEM_INC || JSOp(*pc) == JSOP_INITELEM_ARRAY) {
|
||||
if (!InitArrayElemOperation(cx, pc, obj, idVal.toInt32(), rhs)) {
|
||||
return false;
|
||||
}
|
||||
@ -339,7 +339,7 @@ bool IonSetPropertyIC::update(JSContext* cx, HandleScript outerScript,
|
||||
} else {
|
||||
MOZ_ASSERT(ic->kind() == CacheKind::SetProp);
|
||||
|
||||
if (*pc == JSOP_INITGLEXICAL) {
|
||||
if (JSOp(*pc) == JSOP_INITGLEXICAL) {
|
||||
RootedScript script(cx, ic->script());
|
||||
MOZ_ASSERT(!script->hasNonSyntacticScope());
|
||||
InitGlobalLexicalOperation(cx, &cx->global()->lexicalEnvironment(),
|
||||
@ -421,7 +421,7 @@ bool IonGetNameIC::update(JSContext* cx, HandleScript outerScript,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*GetNextPc(pc) == JSOP_TYPEOF) {
|
||||
if (JSOp(*GetNextPc(pc)) == JSOP_TYPEOF) {
|
||||
if (!FetchName<GetNameMode::TypeOf>(cx, obj, holder, name, prop, res)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -122,10 +122,10 @@ uint32_t OptimizationInfo::compilerWarmUpThreshold(JSScript* script,
|
||||
|
||||
uint32_t OptimizationInfo::recompileWarmUpThreshold(JSScript* script,
|
||||
jsbytecode* pc) const {
|
||||
MOZ_ASSERT(pc == script->code() || *pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(pc == script->code() || JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
|
||||
uint32_t threshold = compilerWarmUpThreshold(script, pc);
|
||||
if (*pc != JSOP_LOOPHEAD || JitOptions.eagerIonCompilation()) {
|
||||
if (JSOp(*pc) != JSOP_LOOPHEAD || JitOptions.eagerIonCompilation()) {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void JSJitFrameIter::dumpBaseline() const {
|
||||
|
||||
fprintf(stderr, " script = %p, pc = %p (offset %u)\n", (void*)script, pc,
|
||||
uint32_t(script->pcToOffset(pc)));
|
||||
fprintf(stderr, " current op: %s\n", CodeName[*pc]);
|
||||
fprintf(stderr, " current op: %s\n", CodeName(JSOp(*pc)));
|
||||
|
||||
fprintf(stderr, " actual args: %d\n", numActualArgs());
|
||||
|
||||
|
@ -2252,7 +2252,7 @@ void InlineFrameIterator::dump() const {
|
||||
script()->lineno());
|
||||
|
||||
fprintf(stderr, " script = %p, pc = %p\n", (void*)script(), pc());
|
||||
fprintf(stderr, " current op: %s\n", CodeName[*pc()]);
|
||||
fprintf(stderr, " current op: %s\n", CodeName(JSOp(*pc())));
|
||||
|
||||
if (!more()) {
|
||||
numActualArgs();
|
||||
|
@ -702,7 +702,7 @@ void jit::JitSpewBaselineICStats(JSScript* script, const char* dumpReason) {
|
||||
unsigned int line = PCToLineNumber(script, pc, &column);
|
||||
|
||||
spew->beginObject();
|
||||
spew->property("op", CodeName[*pc]);
|
||||
spew->property("op", CodeName(JSOp(*pc)));
|
||||
spew->property("pc", pcOffset);
|
||||
spew->property("line", line);
|
||||
spew->property("column", column);
|
||||
|
@ -1293,7 +1293,7 @@ bool JitcodeRegionEntry::WriteRun(CompactBufferWriter& writer,
|
||||
jsbytecode* pc = entry[i].tree->script()->offsetToPC(curBc);
|
||||
#ifdef JS_JITSPEW
|
||||
JSOp op = JSOp(*pc);
|
||||
JitSpewCont(JitSpew_Profiling, "%s ", CodeName[op]);
|
||||
JitSpewCont(JitSpew_Profiling, "%s ", CodeName(op));
|
||||
#endif
|
||||
curBc += GetBytecodeLength(pc);
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ void MControlInstruction::printOpcode(GenericPrinter& out) const {
|
||||
|
||||
void MCompare::printOpcode(GenericPrinter& out) const {
|
||||
MDefinition::printOpcode(out);
|
||||
out.printf(" %s", CodeName[jsop()]);
|
||||
out.printf(" %s", CodeName(jsop()));
|
||||
}
|
||||
|
||||
void MConstantElements::printOpcode(GenericPrinter& out) const {
|
||||
|
@ -466,7 +466,7 @@ void SnapshotReader::spewBailingFrom() const {
|
||||
if (JitSpewEnabled(JitSpew_IonBailouts)) {
|
||||
JitSpewHeader(JitSpew_IonBailouts);
|
||||
Fprinter& out = JitSpewPrinter();
|
||||
out.printf(" bailing from bytecode: %s, MIR: ", CodeName[pcOpcode_]);
|
||||
out.printf(" bailing from bytecode: %s, MIR: ", CodeName(JSOp(pcOpcode_)));
|
||||
MDefinition::PrintOpcodeName(out, MDefinition::Opcode(mirOpcode_));
|
||||
out.printf(" [%u], LIR: ", mirId_);
|
||||
LInstruction::printName(out, LInstruction::Opcode(lirOpcode_));
|
||||
|
@ -899,7 +899,7 @@ JSObject* CreateGenerator(JSContext* cx, BaselineFrame* frame) {
|
||||
|
||||
bool NormalSuspend(JSContext* cx, HandleObject obj, BaselineFrame* frame,
|
||||
uint32_t frameSize, jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_YIELD || *pc == JSOP_AWAIT);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_YIELD || JSOp(*pc) == JSOP_AWAIT);
|
||||
|
||||
uint32_t numValueSlots = frame->numValueSlots(frameSize);
|
||||
|
||||
@ -929,7 +929,7 @@ bool NormalSuspend(JSContext* cx, HandleObject obj, BaselineFrame* frame,
|
||||
}
|
||||
|
||||
bool FinalSuspend(JSContext* cx, HandleObject obj, jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_FINALYIELDRVAL);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_FINALYIELDRVAL);
|
||||
AbstractGeneratorObject::finalSuspend(obj);
|
||||
return true;
|
||||
}
|
||||
@ -1067,7 +1067,7 @@ bool HandleDebugTrap(JSContext* cx, BaselineFrame* frame, uint8_t* retAddr) {
|
||||
DebugAPI::hasBreakpointsAt(script, pc));
|
||||
}
|
||||
|
||||
if (*pc == JSOP_AFTERYIELD) {
|
||||
if (JSOp(*pc) == JSOP_AFTERYIELD) {
|
||||
// JSOP_AFTERYIELD will set the frame's debuggee flag and call the
|
||||
// onEnterFrame handler, but if we set a breakpoint there we have to do
|
||||
// it now.
|
||||
|
@ -315,7 +315,7 @@ void CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx) {
|
||||
JitSpewStart(
|
||||
JitSpew_Profiling, " %08zx [+%-6d] => %-6ld [%-4d] {%-10s} (%s:%u:%u",
|
||||
ref.nativeOffset.offset(), nativeDelta, (long)(ref.pc - script->code()),
|
||||
pcDelta, CodeName[JSOp(*ref.pc)], script->filename(), script->lineno(),
|
||||
pcDelta, CodeName(JSOp(*ref.pc)), script->filename(), script->lineno(),
|
||||
script->column());
|
||||
|
||||
for (tree = tree->caller(); tree; tree = tree->caller()) {
|
||||
|
@ -1510,7 +1510,7 @@ class LCompare : public LInstructionHelper<1, 2, 0> {
|
||||
const LAllocation* left() { return getOperand(0); }
|
||||
const LAllocation* right() { return getOperand(1); }
|
||||
MCompare* mir() { return mir_->toCompare(); }
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
class LCompareI64 : public LInstructionHelper<1, 2 * INT64_PIECES, 0> {
|
||||
@ -1531,7 +1531,7 @@ class LCompareI64 : public LInstructionHelper<1, 2 * INT64_PIECES, 0> {
|
||||
|
||||
JSOp jsop() const { return jsop_; }
|
||||
MCompare* mir() { return mir_->toCompare(); }
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
class LCompareI64AndBranch
|
||||
@ -1561,7 +1561,7 @@ class LCompareI64AndBranch
|
||||
MBasicBlock* ifFalse() const { return getSuccessor(1); }
|
||||
MTest* mir() const { return mir_->toTest(); }
|
||||
MCompare* cmpMir() const { return cmpMir_; }
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
// Compares two integral values of the same JS type, either integer or object.
|
||||
@ -1589,7 +1589,7 @@ class LCompareAndBranch : public LControlInstructionHelper<2, 2, 0> {
|
||||
const LAllocation* right() { return getOperand(1); }
|
||||
MTest* mir() const { return mir_->toTest(); }
|
||||
MCompare* cmpMir() const { return cmpMir_; }
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
class LCompareD : public LInstructionHelper<1, 2, 0> {
|
||||
@ -2089,7 +2089,7 @@ class LBitOpI : public LInstructionHelper<1, 2, 0> {
|
||||
if (bitop() == JSOP_URSH && mir_->toUrsh()->bailoutsDisabled()) {
|
||||
return "ursh:BailoutsDisabled";
|
||||
}
|
||||
return CodeName[op_];
|
||||
return CodeName(op_);
|
||||
}
|
||||
|
||||
JSOp bitop() const { return op_; }
|
||||
@ -2106,7 +2106,7 @@ class LBitOpI64 : public LInstructionHelper<INT64_PIECES, 2 * INT64_PIECES, 0> {
|
||||
|
||||
explicit LBitOpI64(JSOp op) : LInstructionHelper(classOpcode), op_(op) {}
|
||||
|
||||
const char* extraName() const { return CodeName[op_]; }
|
||||
const char* extraName() const { return CodeName(op_); }
|
||||
|
||||
JSOp bitop() const { return op_; }
|
||||
};
|
||||
@ -2125,7 +2125,7 @@ class LShiftI : public LBinaryMath<0> {
|
||||
|
||||
MInstruction* mir() { return mir_->toInstruction(); }
|
||||
|
||||
const char* extraName() const { return CodeName[op_]; }
|
||||
const char* extraName() const { return CodeName(op_); }
|
||||
};
|
||||
|
||||
class LShiftI64 : public LInstructionHelper<INT64_PIECES, INT64_PIECES + 1, 0> {
|
||||
@ -2143,7 +2143,7 @@ class LShiftI64 : public LInstructionHelper<INT64_PIECES, INT64_PIECES + 1, 0> {
|
||||
|
||||
MInstruction* mir() { return mir_->toInstruction(); }
|
||||
|
||||
const char* extraName() const { return CodeName[op_]; }
|
||||
const char* extraName() const { return CodeName(op_); }
|
||||
};
|
||||
|
||||
// Sign extension
|
||||
@ -2674,7 +2674,7 @@ class LMathD : public LBinaryMath<0> {
|
||||
|
||||
JSOp jsop() const { return jsop_; }
|
||||
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
// Performs an add, sub, mul, or div on two double values.
|
||||
@ -2688,7 +2688,7 @@ class LMathF : public LBinaryMath<0> {
|
||||
|
||||
JSOp jsop() const { return jsop_; }
|
||||
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
};
|
||||
|
||||
class LModD : public LBinaryMath<1> {
|
||||
@ -2721,7 +2721,7 @@ class LBinaryV : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 0> {
|
||||
|
||||
JSOp jsop() const { return jsop_; }
|
||||
|
||||
const char* extraName() const { return CodeName[jsop_]; }
|
||||
const char* extraName() const { return CodeName(jsop_); }
|
||||
|
||||
static const size_t LhsInput = 0;
|
||||
static const size_t RhsInput = BOX_PIECES;
|
||||
|
@ -65,7 +65,7 @@ using js::frontend::IsIdentifier;
|
||||
*/
|
||||
JS_STATIC_ASSERT(sizeof(uint32_t) * CHAR_BIT >= INDEX_LIMIT_LOG2 + 1);
|
||||
|
||||
const JSCodeSpec js::CodeSpec[] = {
|
||||
const JSCodeSpec js::CodeSpecTable[] = {
|
||||
#define MAKE_CODESPEC(op, name, token, length, nuses, ndefs, format) \
|
||||
{length, nuses, ndefs, format},
|
||||
FOR_EACH_OPCODE(MAKE_CODESPEC)
|
||||
@ -86,7 +86,7 @@ static const char* const CodeToken[] = {
|
||||
* Array of JS bytecode names used by PC count JSON, DEBUG-only Disassemble
|
||||
* and JIT debug spew.
|
||||
*/
|
||||
const char* const js::CodeName[] = {
|
||||
const char* const js::CodeNameTable[] = {
|
||||
#define OPNAME(op, name, ...) name,
|
||||
FOR_EACH_OPCODE(OPNAME)
|
||||
#undef OPNAME
|
||||
@ -1291,7 +1291,7 @@ static bool DumpJumpOrigins(HandleScript script, jsbytecode* pc,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!sp->jsprintf("from %s @ %05u", CodeName[*pc],
|
||||
if (!sp->jsprintf("from %s @ %05u", CodeName(JSOp(*pc)),
|
||||
unsigned(script->pcToOffset(pc)))) {
|
||||
return false;
|
||||
}
|
||||
@ -1376,17 +1376,17 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
return true;
|
||||
};
|
||||
|
||||
JSOp op = (JSOp)*pc;
|
||||
if (op >= JSOP_LIMIT) {
|
||||
if (*pc >= uint8_t(JSOP_LIMIT)) {
|
||||
char numBuf1[12], numBuf2[12];
|
||||
SprintfLiteral(numBuf1, "%d", op);
|
||||
SprintfLiteral(numBuf2, "%d", JSOP_LIMIT);
|
||||
SprintfLiteral(numBuf1, "%d", int(*pc));
|
||||
SprintfLiteral(numBuf2, "%d", int(uint8_t(JSOP_LIMIT)));
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
|
||||
return 0;
|
||||
}
|
||||
const JSCodeSpec* cs = &CodeSpec[op];
|
||||
const unsigned len = cs->length;
|
||||
JSOp op = JSOp(*pc);
|
||||
const JSCodeSpec& cs = CodeSpec(op);
|
||||
const unsigned len = cs.length;
|
||||
if (!sp->jsprintf("%05u:", loc)) {
|
||||
return 0;
|
||||
}
|
||||
@ -1395,12 +1395,12 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!sp->jsprintf(" %s", CodeName[op])) {
|
||||
if (!sp->jsprintf(" %s", CodeName(op))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
switch (JOF_TYPE(cs->format)) {
|
||||
switch (JOF_TYPE(cs.format)) {
|
||||
case JOF_BYTE:
|
||||
break;
|
||||
|
||||
@ -1621,7 +1621,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
|
||||
default: {
|
||||
char numBuf[12];
|
||||
SprintfLiteral(numBuf, "%x", cs->format);
|
||||
SprintfLiteral(numBuf, "%x", cs.format);
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_UNKNOWN_FORMAT, numBuf);
|
||||
return 0;
|
||||
@ -1727,12 +1727,12 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) {
|
||||
|
||||
JSOp op = (JSOp)*pc;
|
||||
|
||||
if (const char* token = CodeToken[op]) {
|
||||
if (const char* token = CodeToken[uint8_t(op)]) {
|
||||
MOZ_ASSERT(defIndex == 0);
|
||||
MOZ_ASSERT(CodeSpec[op].ndefs == 1);
|
||||
MOZ_ASSERT(CodeSpec(op).ndefs == 1);
|
||||
|
||||
// Handle simple cases of binary and unary operators.
|
||||
switch (CodeSpec[op].nuses) {
|
||||
switch (CodeSpec(op).nuses) {
|
||||
case 2: {
|
||||
jssrcnote* sn = GetSrcNote(cx, script, pc);
|
||||
if (!sn || SN_TYPE(sn) != SRC_ASSIGNOP) {
|
||||
@ -2750,7 +2750,7 @@ static bool GetPCCountJSON(JSContext* cx, const ScriptAndCounts& sac,
|
||||
|
||||
json.property("id", offset);
|
||||
json.property("line", range.frontLineNumber());
|
||||
json.property("name", CodeName[op]);
|
||||
json.property("name", CodeName(op));
|
||||
|
||||
{
|
||||
ExpressionDecompiler ed(cx, script, parser);
|
||||
@ -3034,7 +3034,7 @@ bool js::GetSuccessorBytecodes(JSScript* script, jsbytecode* pc,
|
||||
}
|
||||
}
|
||||
|
||||
if (CodeSpec[op].type() == JOF_JUMP) {
|
||||
if (CodeSpec(op).type() == JOF_JUMP) {
|
||||
if (!successors.append(pc + GET_JUMP_OFFSET(pc))) {
|
||||
return false;
|
||||
}
|
||||
|
@ -264,12 +264,12 @@ static inline void SET_ICINDEX(jsbytecode* pc, uint32_t icIndex) {
|
||||
}
|
||||
|
||||
static inline unsigned LoopHeadDepthHint(jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
return GET_UINT8(pc + 4);
|
||||
}
|
||||
|
||||
static inline void SetLoopHeadDepthHint(jsbytecode* pc, unsigned loopDepth) {
|
||||
MOZ_ASSERT(*pc == JSOP_LOOPHEAD);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPHEAD);
|
||||
uint8_t data = std::min(loopDepth, unsigned(UINT8_MAX));
|
||||
SET_UINT8(pc + 4, data);
|
||||
}
|
||||
@ -293,7 +293,8 @@ static inline void SetClassConstructorOperands(jsbytecode* pc,
|
||||
uint32_t atomIndex,
|
||||
uint32_t sourceStart,
|
||||
uint32_t sourceEnd) {
|
||||
MOZ_ASSERT(*pc == JSOP_CLASSCONSTRUCTOR || *pc == JSOP_DERIVEDCONSTRUCTOR);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_CLASSCONSTRUCTOR ||
|
||||
JSOp(*pc) == JSOP_DERIVEDCONSTRUCTOR);
|
||||
SET_UINT32(pc, atomIndex);
|
||||
SET_UINT32(pc + 4, sourceStart);
|
||||
SET_UINT32(pc + 8, sourceEnd);
|
||||
@ -303,7 +304,8 @@ static inline void GetClassConstructorOperands(jsbytecode* pc,
|
||||
uint32_t* atomIndex,
|
||||
uint32_t* sourceStart,
|
||||
uint32_t* sourceEnd) {
|
||||
MOZ_ASSERT(*pc == JSOP_CLASSCONSTRUCTOR || *pc == JSOP_DERIVEDCONSTRUCTOR);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_CLASSCONSTRUCTOR ||
|
||||
JSOp(*pc) == JSOP_DERIVEDCONSTRUCTOR);
|
||||
*atomIndex = GET_UINT32(pc);
|
||||
*sourceStart = GET_UINT32(pc + 4);
|
||||
*sourceEnd = GET_UINT32(pc + 8);
|
||||
@ -355,13 +357,20 @@ struct JSCodeSpec {
|
||||
|
||||
namespace js {
|
||||
|
||||
extern const JSCodeSpec CodeSpec[];
|
||||
extern const char* const CodeName[];
|
||||
extern const JSCodeSpec CodeSpecTable[];
|
||||
|
||||
inline const JSCodeSpec& CodeSpec(JSOp op) {
|
||||
return CodeSpecTable[uint8_t(op)];
|
||||
}
|
||||
|
||||
extern const char* const CodeNameTable[];
|
||||
|
||||
inline const char* CodeName(JSOp op) { return CodeNameTable[uint8_t(op)]; }
|
||||
|
||||
/* Shorthand for type from opcode. */
|
||||
|
||||
static inline uint32_t JOF_OPTYPE(JSOp op) {
|
||||
return JOF_TYPE(CodeSpec[op].format);
|
||||
return JOF_TYPE(CodeSpec(op).format);
|
||||
}
|
||||
|
||||
static inline bool IsJumpOpcode(JSOp op) { return JOF_OPTYPE(op) == JOF_JUMP; }
|
||||
@ -398,7 +407,7 @@ static inline bool BytecodeIsJumpTarget(JSOp op) {
|
||||
|
||||
MOZ_ALWAYS_INLINE unsigned StackUses(jsbytecode* pc) {
|
||||
JSOp op = JSOp(*pc);
|
||||
int nuses = CodeSpec[op].nuses;
|
||||
int nuses = CodeSpec(op).nuses;
|
||||
if (nuses >= 0) {
|
||||
return nuses;
|
||||
}
|
||||
@ -421,7 +430,7 @@ MOZ_ALWAYS_INLINE unsigned StackUses(jsbytecode* pc) {
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE unsigned StackDefs(jsbytecode* pc) {
|
||||
int ndefs = CodeSpec[*pc].ndefs;
|
||||
int ndefs = CodeSpec(JSOp(*pc)).ndefs;
|
||||
MOZ_ASSERT(ndefs >= 0);
|
||||
return ndefs;
|
||||
}
|
||||
@ -473,8 +482,8 @@ JSString* DecompileArgument(JSContext* cx, int formalIndex, HandleValue v);
|
||||
|
||||
static inline unsigned GetOpLength(JSOp op) {
|
||||
MOZ_ASSERT(op < JSOP_LIMIT);
|
||||
MOZ_ASSERT(CodeSpec[op].length > 0);
|
||||
return CodeSpec[op].length;
|
||||
MOZ_ASSERT(CodeSpec(op).length > 0);
|
||||
return CodeSpec(op).length;
|
||||
}
|
||||
|
||||
static inline unsigned GetBytecodeLength(jsbytecode* pc) {
|
||||
@ -490,29 +499,29 @@ static inline bool BytecodeIsPopped(jsbytecode* pc) {
|
||||
static inline bool BytecodeFlowsToBitop(jsbytecode* pc) {
|
||||
// Look for simple bytecode for integer conversions like (x | 0) or (x & -1).
|
||||
jsbytecode* next = pc + GetBytecodeLength(pc);
|
||||
if (*next == JSOP_BITOR || *next == JSOP_BITAND) {
|
||||
if (JSOp(*next) == JSOP_BITOR || JSOp(*next) == JSOP_BITAND) {
|
||||
return true;
|
||||
}
|
||||
if (*next == JSOP_INT8 && GET_INT8(next) == -1) {
|
||||
if (JSOp(*next) == JSOP_INT8 && GET_INT8(next) == -1) {
|
||||
next += GetBytecodeLength(next);
|
||||
if (*next == JSOP_BITAND) {
|
||||
if (JSOp(*next) == JSOP_BITAND) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (*next == JSOP_ONE) {
|
||||
if (JSOp(*next) == JSOP_ONE) {
|
||||
next += GetBytecodeLength(next);
|
||||
if (*next == JSOP_NEG) {
|
||||
if (JSOp(*next) == JSOP_NEG) {
|
||||
next += GetBytecodeLength(next);
|
||||
if (*next == JSOP_BITAND) {
|
||||
if (JSOp(*next) == JSOP_BITAND) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (*next == JSOP_ZERO) {
|
||||
if (JSOp(*next) == JSOP_ZERO) {
|
||||
next += GetBytecodeLength(next);
|
||||
if (*next == JSOP_BITOR) {
|
||||
if (JSOp(*next) == JSOP_BITOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -545,14 +554,14 @@ inline bool IsLocalOp(JSOp op) { return JOF_OPTYPE(op) == JOF_LOCAL; }
|
||||
|
||||
inline bool IsAliasedVarOp(JSOp op) { return JOF_OPTYPE(op) == JOF_ENVCOORD; }
|
||||
|
||||
inline bool IsGlobalOp(JSOp op) { return CodeSpec[op].format & JOF_GNAME; }
|
||||
inline bool IsGlobalOp(JSOp op) { return CodeSpec(op).format & JOF_GNAME; }
|
||||
|
||||
inline bool IsPropertySetOp(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_PROPSET;
|
||||
return CodeSpec(op).format & JOF_PROPSET;
|
||||
}
|
||||
|
||||
inline bool IsPropertyInitOp(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_PROPINIT;
|
||||
return CodeSpec(op).format & JOF_PROPINIT;
|
||||
}
|
||||
|
||||
inline bool IsLooseEqualityOp(JSOp op) {
|
||||
@ -572,16 +581,16 @@ inline bool IsRelationalOp(JSOp op) {
|
||||
}
|
||||
|
||||
inline bool IsCheckStrictOp(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_CHECKSTRICT;
|
||||
return CodeSpec(op).format & JOF_CHECKSTRICT;
|
||||
}
|
||||
|
||||
inline bool IsDetecting(JSOp op) { return CodeSpec[op].format & JOF_DETECTING; }
|
||||
inline bool IsDetecting(JSOp op) { return CodeSpec(op).format & JOF_DETECTING; }
|
||||
|
||||
inline bool IsNameOp(JSOp op) { return CodeSpec[op].format & JOF_NAME; }
|
||||
inline bool IsNameOp(JSOp op) { return CodeSpec(op).format & JOF_NAME; }
|
||||
|
||||
#ifdef DEBUG
|
||||
inline bool IsCheckSloppyOp(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_CHECKSLOPPY;
|
||||
return CodeSpec(op).format & JOF_CHECKSLOPPY;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -626,10 +635,10 @@ inline bool IsSetElemOp(JSOp op) {
|
||||
inline bool IsSetElemPC(const jsbytecode* pc) { return IsSetElemOp(JSOp(*pc)); }
|
||||
|
||||
inline bool IsElemPC(const jsbytecode* pc) {
|
||||
return CodeSpec[*pc].format & JOF_ELEM;
|
||||
return CodeSpec(JSOp(*pc)).format & JOF_ELEM;
|
||||
}
|
||||
|
||||
inline bool IsInvokeOp(JSOp op) { return CodeSpec[op].format & JOF_INVOKE; }
|
||||
inline bool IsInvokeOp(JSOp op) { return CodeSpec(op).format & JOF_INVOKE; }
|
||||
|
||||
inline bool IsInvokePC(jsbytecode* pc) { return IsInvokeOp(JSOp(*pc)); }
|
||||
|
||||
@ -639,13 +648,13 @@ inline bool IsStrictEvalPC(jsbytecode* pc) {
|
||||
}
|
||||
|
||||
inline bool IsConstructOp(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_CONSTRUCT;
|
||||
return CodeSpec(op).format & JOF_CONSTRUCT;
|
||||
}
|
||||
inline bool IsConstructPC(const jsbytecode* pc) {
|
||||
return IsConstructOp(JSOp(*pc));
|
||||
}
|
||||
|
||||
inline bool IsSpreadOp(JSOp op) { return CodeSpec[op].format & JOF_SPREAD; }
|
||||
inline bool IsSpreadOp(JSOp op) { return CodeSpec(op).format & JOF_SPREAD; }
|
||||
|
||||
inline bool IsSpreadPC(const jsbytecode* pc) { return IsSpreadOp(JSOp(*pc)); }
|
||||
|
||||
@ -668,10 +677,10 @@ static inline int32_t GetBytecodeInteger(jsbytecode* pc) {
|
||||
}
|
||||
}
|
||||
|
||||
inline bool BytecodeOpHasIC(JSOp op) { return CodeSpec[op].format & JOF_IC; }
|
||||
inline bool BytecodeOpHasIC(JSOp op) { return CodeSpec(op).format & JOF_IC; }
|
||||
|
||||
inline bool BytecodeOpHasTypeSet(JSOp op) {
|
||||
return CodeSpec[op].format & JOF_TYPESET;
|
||||
return CodeSpec(op).format & JOF_TYPESET;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3391,7 +3391,7 @@ static bool GetThisValueForDebuggerEnvironmentIterMaybeOptimizedOut(
|
||||
if (script->functionHasThisBinding()) {
|
||||
for (jsbytecode* it = script->code(); it < script->codeEnd();
|
||||
it = GetNextPc(it)) {
|
||||
if (*it == JSOP_FUNCTIONTHIS) {
|
||||
if (JSOp(*it) == JSOP_FUNCTIONTHIS) {
|
||||
// The next op after JSOP_FUNCTIONTHIS always sets it.
|
||||
executedInitThisOp = pc > GetNextPc(it);
|
||||
break;
|
||||
|
@ -62,13 +62,13 @@ void AbstractGeneratorObject::trace(JSTracer* trc) {
|
||||
bool AbstractGeneratorObject::suspend(JSContext* cx, HandleObject obj,
|
||||
AbstractFramePtr frame, jsbytecode* pc,
|
||||
Value* vp, unsigned nvalues) {
|
||||
MOZ_ASSERT(*pc == JSOP_INITIALYIELD || *pc == JSOP_YIELD ||
|
||||
*pc == JSOP_AWAIT);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITIALYIELD || JSOp(*pc) == JSOP_YIELD ||
|
||||
JSOp(*pc) == JSOP_AWAIT);
|
||||
|
||||
auto genObj = obj.as<AbstractGeneratorObject>();
|
||||
MOZ_ASSERT(!genObj->hasExpressionStack() || genObj->isExpressionStackEmpty());
|
||||
MOZ_ASSERT_IF(*pc == JSOP_AWAIT, genObj->callee().isAsync());
|
||||
MOZ_ASSERT_IF(*pc == JSOP_YIELD, genObj->callee().isGenerator());
|
||||
MOZ_ASSERT_IF(JSOp(*pc) == JSOP_AWAIT, genObj->callee().isAsync());
|
||||
MOZ_ASSERT_IF(JSOp(*pc) == JSOP_YIELD, genObj->callee().isGenerator());
|
||||
|
||||
ArrayObject* stack = nullptr;
|
||||
if (nvalues > 0) {
|
||||
@ -358,7 +358,7 @@ bool AbstractGeneratorObject::isAfterYieldOrAwait(JSOp op) {
|
||||
JSScript* script = callee().nonLazyScript();
|
||||
jsbytecode* code = script->code();
|
||||
uint32_t nextOffset = script->resumeOffsets()[resumeIndex()];
|
||||
if (code[nextOffset] != JSOP_AFTERYIELD) {
|
||||
if (JSOp(code[nextOffset]) != JSOP_AFTERYIELD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -368,10 +368,11 @@ bool AbstractGeneratorObject::isAfterYieldOrAwait(JSOp op) {
|
||||
"JSOP_YIELD and JSOP_AWAIT must have the same length");
|
||||
|
||||
uint32_t offset = nextOffset - JSOP_YIELD_LENGTH;
|
||||
MOZ_ASSERT(code[offset] == JSOP_INITIALYIELD || code[offset] == JSOP_YIELD ||
|
||||
code[offset] == JSOP_AWAIT);
|
||||
JSOp prevOp = JSOp(code[offset]);
|
||||
MOZ_ASSERT(prevOp == JSOP_INITIALYIELD || prevOp == JSOP_YIELD ||
|
||||
prevOp == JSOP_AWAIT);
|
||||
|
||||
return code[offset] == op;
|
||||
return prevOp == op;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -125,8 +125,8 @@ class AbstractGeneratorObject : public NativeObject {
|
||||
setFixedSlot(RESUME_INDEX_SLOT, Int32Value(RESUME_INDEX_RUNNING));
|
||||
}
|
||||
void setResumeIndex(jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_INITIALYIELD || *pc == JSOP_YIELD ||
|
||||
*pc == JSOP_AWAIT);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITIALYIELD || JSOp(*pc) == JSOP_YIELD ||
|
||||
JSOp(*pc) == JSOP_AWAIT);
|
||||
|
||||
MOZ_ASSERT_IF(JSOp(*pc) == JSOP_INITIALYIELD,
|
||||
getFixedSlot(RESUME_INDEX_SLOT).isUndefined());
|
||||
@ -217,7 +217,7 @@ inline GeneratorResumeKind IntToResumeKind(int32_t value) {
|
||||
}
|
||||
|
||||
inline GeneratorResumeKind ResumeKindFromPC(jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_RESUMEKIND);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_RESUMEKIND);
|
||||
return IntToResumeKind(GET_UINT8(pc));
|
||||
}
|
||||
|
||||
|
@ -306,15 +306,16 @@ inline void SetAliasedVarOperation(JSContext* cx, JSScript* script,
|
||||
|
||||
inline bool SetNameOperation(JSContext* cx, JSScript* script, jsbytecode* pc,
|
||||
HandleObject env, HandleValue val) {
|
||||
MOZ_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_STRICTSETNAME ||
|
||||
*pc == JSOP_SETGNAME || *pc == JSOP_STRICTSETGNAME);
|
||||
MOZ_ASSERT_IF((*pc == JSOP_SETGNAME || *pc == JSOP_STRICTSETGNAME) &&
|
||||
!script->hasNonSyntacticScope(),
|
||||
env == cx->global() ||
|
||||
env == &cx->global()->lexicalEnvironment() ||
|
||||
env->is<RuntimeLexicalErrorObject>());
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_SETNAME || JSOp(*pc) == JSOP_STRICTSETNAME ||
|
||||
JSOp(*pc) == JSOP_SETGNAME || JSOp(*pc) == JSOP_STRICTSETGNAME);
|
||||
MOZ_ASSERT_IF(
|
||||
(JSOp(*pc) == JSOP_SETGNAME || JSOp(*pc) == JSOP_STRICTSETGNAME) &&
|
||||
!script->hasNonSyntacticScope(),
|
||||
env == cx->global() || env == &cx->global()->lexicalEnvironment() ||
|
||||
env->is<RuntimeLexicalErrorObject>());
|
||||
|
||||
bool strict = *pc == JSOP_STRICTSETNAME || *pc == JSOP_STRICTSETGNAME;
|
||||
bool strict =
|
||||
JSOp(*pc) == JSOP_STRICTSETNAME || JSOp(*pc) == JSOP_STRICTSETGNAME;
|
||||
RootedPropertyName name(cx, script->getName(pc));
|
||||
|
||||
// In strict mode, assigning to an undeclared global variable is an
|
||||
@ -346,7 +347,7 @@ inline void InitGlobalLexicalOperation(JSContext* cx,
|
||||
HandleValue value) {
|
||||
MOZ_ASSERT_IF(!script->hasNonSyntacticScope(),
|
||||
lexicalEnvArg == &cx->global()->lexicalEnvironment());
|
||||
MOZ_ASSERT(*pc == JSOP_INITGLEXICAL);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_INITGLEXICAL);
|
||||
Rooted<LexicalEnvironmentObject*> lexicalEnv(cx, lexicalEnvArg);
|
||||
RootedShape shape(cx, lexicalEnv->lookup(cx, script->getName(pc)));
|
||||
MOZ_ASSERT(shape);
|
||||
@ -667,7 +668,7 @@ static MOZ_ALWAYS_INLINE bool InitArrayElemOperation(JSContext* cx,
|
||||
static inline ArrayObject* ProcessCallSiteObjOperation(JSContext* cx,
|
||||
HandleScript script,
|
||||
jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_CALLSITEOBJ);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_CALLSITEOBJ);
|
||||
|
||||
RootedArrayObject cso(cx, &script->getObject(pc)->as<ArrayObject>());
|
||||
|
||||
|
@ -1090,10 +1090,10 @@ jsbytecode* js::UnwindEnvironmentToTryPc(JSScript* script,
|
||||
jsbytecode* pc = script->offsetToPC(tn->start);
|
||||
if (tn->kind == JSTRY_CATCH || tn->kind == JSTRY_FINALLY) {
|
||||
pc -= JSOP_TRY_LENGTH;
|
||||
MOZ_ASSERT(*pc == JSOP_TRY);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_TRY);
|
||||
} else if (tn->kind == JSTRY_DESTRUCTURING) {
|
||||
pc -= JSOP_TRY_DESTRUCTURING_LENGTH;
|
||||
MOZ_ASSERT(*pc == JSOP_TRY_DESTRUCTURING);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_TRY_DESTRUCTURING);
|
||||
}
|
||||
return pc;
|
||||
}
|
||||
@ -1340,7 +1340,7 @@ JS_STATIC_ASSERT(JSOP_SETNAME_LENGTH == JSOP_SETPROP_LENGTH);
|
||||
|
||||
/* See TRY_BRANCH_AFTER_COND. */
|
||||
JS_STATIC_ASSERT(JSOP_IFNE_LENGTH == JSOP_IFEQ_LENGTH);
|
||||
JS_STATIC_ASSERT(JSOP_IFNE == JSOP_IFEQ + 1);
|
||||
JS_STATIC_ASSERT(uint8_t(JSOP_IFNE) == uint8_t(JSOP_IFEQ) + 1);
|
||||
|
||||
/*
|
||||
* Compute the implicit |this| value used by a call expression with an
|
||||
@ -2080,7 +2080,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
||||
// first |await| expression in an async function.
|
||||
MOZ_ASSERT(
|
||||
REGS.stackDepth() == 0 ||
|
||||
(*REGS.pc == JSOP_AWAIT && !REGS.fp()->isResumedGenerator()));
|
||||
(JSOp(*REGS.pc) == JSOP_AWAIT && !REGS.fp()->isResumedGenerator()));
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
@ -2890,7 +2890,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
||||
FETCH_ELEMENT_ID(-2, id);
|
||||
HandleValue value = REGS.stackHandleAt(-1);
|
||||
if (!SetObjectElementOperation(cx, obj, id, value, receiver,
|
||||
*REGS.pc == JSOP_STRICTSETELEM)) {
|
||||
JSOp(*REGS.pc) == JSOP_STRICTSETELEM)) {
|
||||
goto error;
|
||||
}
|
||||
REGS.sp[-3] = value;
|
||||
@ -3011,9 +3011,9 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
||||
cx->geckoProfiler().updatePC(cx, script, REGS.pc);
|
||||
}
|
||||
|
||||
MaybeConstruct construct =
|
||||
MaybeConstruct(*REGS.pc == JSOP_NEW || *REGS.pc == JSOP_SUPERCALL);
|
||||
bool ignoresReturnValue = *REGS.pc == JSOP_CALL_IGNORES_RV;
|
||||
MaybeConstruct construct = MaybeConstruct(
|
||||
JSOp(*REGS.pc) == JSOP_NEW || JSOp(*REGS.pc) == JSOP_SUPERCALL);
|
||||
bool ignoresReturnValue = JSOp(*REGS.pc) == JSOP_CALL_IGNORES_RV;
|
||||
unsigned argStackSlots = GET_ARGC(REGS.pc) + construct;
|
||||
|
||||
MOZ_ASSERT(REGS.stackDepth() >= 2u + GET_ARGC(REGS.pc));
|
||||
@ -3035,7 +3035,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (*REGS.pc == JSOP_CALLITER && args.calleev().isPrimitive()) {
|
||||
if (JSOp(*REGS.pc) == JSOP_CALLITER && args.calleev().isPrimitive()) {
|
||||
MOZ_ASSERT(args.length() == 0, "thisv must be on top of the stack");
|
||||
ReportValueError(cx, JSMSG_NOT_ITERABLE, -1, args.thisv(), nullptr);
|
||||
goto error;
|
||||
@ -3480,7 +3480,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
||||
* the method JIT, and a GETLOCAL followed by POP is not considered to be
|
||||
* a use of the variable.
|
||||
*/
|
||||
if (REGS.pc[JSOP_GETLOCAL_LENGTH] != JSOP_POP) {
|
||||
if (JSOp(REGS.pc[JSOP_GETLOCAL_LENGTH]) != JSOP_POP) {
|
||||
cx->debugOnlyCheck(REGS.sp[-1]);
|
||||
}
|
||||
}
|
||||
@ -4549,10 +4549,10 @@ bool js::DefVarOperation(JSContext* cx, HandleObject envChain,
|
||||
|
||||
bool js::DefLexicalOperation(JSContext* cx, HandleObject envChain,
|
||||
HandleScript script, jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_DEFLET || *pc == JSOP_DEFCONST);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_DEFLET || JSOp(*pc) == JSOP_DEFCONST);
|
||||
|
||||
unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT;
|
||||
if (*pc == JSOP_DEFCONST) {
|
||||
if (JSOp(*pc) == JSOP_DEFCONST) {
|
||||
attrs |= JSPROP_READONLY;
|
||||
}
|
||||
|
||||
@ -4672,7 +4672,7 @@ bool js::DefFunOperation(JSContext* cx, HandleScript script,
|
||||
JSObject* js::SingletonObjectLiteralOperation(JSContext* cx,
|
||||
HandleScript script,
|
||||
jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_OBJECT);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_OBJECT);
|
||||
|
||||
RootedObject obj(cx, script->getObject(pc));
|
||||
if (cx->realm()->creationOptions().cloneSingletons()) {
|
||||
@ -4690,7 +4690,7 @@ JSObject* js::ImportMetaOperation(JSContext* cx, HandleScript script) {
|
||||
}
|
||||
|
||||
JSObject* js::BuiltinProtoOperation(JSContext* cx, jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_BUILTINPROTO);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_BUILTINPROTO);
|
||||
MOZ_ASSERT(GET_UINT8(pc) < JSProto_LIMIT);
|
||||
|
||||
JSProtoKey key = static_cast<JSProtoKey>(GET_UINT8(pc));
|
||||
@ -5092,8 +5092,8 @@ JSObject* js::NewObjectOperation(JSContext* cx, HandleScript script,
|
||||
NewObjectKind newKind /* = GenericObject */) {
|
||||
MOZ_ASSERT(newKind != SingletonObject);
|
||||
bool withTemplate =
|
||||
(*pc == JSOP_NEWOBJECT || *pc == JSOP_NEWOBJECT_WITHGROUP);
|
||||
bool withTemplateGroup = (*pc == JSOP_NEWOBJECT_WITHGROUP);
|
||||
(JSOp(*pc) == JSOP_NEWOBJECT || JSOp(*pc) == JSOP_NEWOBJECT_WITHGROUP);
|
||||
bool withTemplateGroup = (JSOp(*pc) == JSOP_NEWOBJECT_WITHGROUP);
|
||||
|
||||
RootedObjectGroup group(cx);
|
||||
RootedPlainObject baseObject(cx);
|
||||
@ -5140,7 +5140,7 @@ JSObject* js::NewObjectOperation(JSContext* cx, HandleScript script,
|
||||
if (withTemplate) {
|
||||
obj = CopyInitializerObject(cx, baseObject, newKind);
|
||||
} else {
|
||||
MOZ_ASSERT(*pc == JSOP_NEWINIT);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_NEWINIT);
|
||||
obj = NewBuiltinClassInstance<PlainObject>(cx, newKind);
|
||||
}
|
||||
|
||||
@ -5204,7 +5204,7 @@ JSObject* js::CreateThisWithTemplate(JSContext* cx,
|
||||
JSObject* js::NewArrayOperation(JSContext* cx, HandleScript script,
|
||||
jsbytecode* pc, uint32_t length,
|
||||
NewObjectKind newKind /* = GenericObject */) {
|
||||
MOZ_ASSERT(*pc == JSOP_NEWARRAY);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_NEWARRAY);
|
||||
MOZ_ASSERT(newKind != SingletonObject);
|
||||
|
||||
RootedObjectGroup group(cx);
|
||||
@ -5262,7 +5262,7 @@ JSObject* js::NewArrayOperationWithTemplate(JSContext* cx,
|
||||
ArrayObject* js::NewArrayCopyOnWriteOperation(JSContext* cx,
|
||||
HandleScript script,
|
||||
jsbytecode* pc) {
|
||||
MOZ_ASSERT(*pc == JSOP_NEWARRAY_COPYONWRITE);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_NEWARRAY_COPYONWRITE);
|
||||
|
||||
RootedArrayObject baseobj(
|
||||
cx, ObjectGroup::getOrFixupCopyOnWriteObject(cx, script, pc));
|
||||
|
@ -3842,7 +3842,7 @@ JS_FRIEND_API void js::DumpInterpreterFrame(JSContext* cx,
|
||||
|
||||
if (jsbytecode* pc = i.pc()) {
|
||||
out.printf(" pc = %p\n", pc);
|
||||
out.printf(" current op: %s\n", CodeName[*pc]);
|
||||
out.printf(" current op: %s\n", CodeName(JSOp(*pc)));
|
||||
MaybeDumpScope(i.script()->lookupScope(pc), out);
|
||||
}
|
||||
if (i.isFunctionFrame()) {
|
||||
|
@ -4854,7 +4854,7 @@ void js::DescribeScriptedCallerForDirectEval(JSContext* cx, HandleScript script,
|
||||
(JSOp(*pc) == JSOP_SPREADEVAL || JSOp(*pc) == JSOP_STRICTSPREADEVAL);
|
||||
jsbytecode* nextpc =
|
||||
pc + (isSpread ? JSOP_SPREADEVAL_LENGTH : JSOP_EVAL_LENGTH);
|
||||
MOZ_ASSERT(*nextpc == JSOP_LINENO);
|
||||
MOZ_ASSERT(JSOp(*nextpc) == JSOP_LINENO);
|
||||
|
||||
*file = script->filename();
|
||||
*linenop = GET_UINT32(nextpc);
|
||||
@ -5446,11 +5446,11 @@ void js::SetFrameArgumentsObject(JSContext* cx, AbstractFramePtr frame,
|
||||
* is assigned to.
|
||||
*/
|
||||
jsbytecode* pc = script->code();
|
||||
while (*pc != JSOP_ARGUMENTS) {
|
||||
while (JSOp(*pc) != JSOP_ARGUMENTS) {
|
||||
pc += GetBytecodeLength(pc);
|
||||
}
|
||||
pc += JSOP_ARGUMENTS_LENGTH;
|
||||
MOZ_ASSERT(*pc == JSOP_SETALIASEDVAR);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_SETALIASEDVAR);
|
||||
|
||||
// Note that here and below, it is insufficient to only check for
|
||||
// JS_OPTIMIZED_ARGUMENTS, as Ion could have optimized out the
|
||||
|
@ -2724,7 +2724,7 @@ class JSScript : public js::BaseScript {
|
||||
|
||||
jsbytecode* lastPC() const {
|
||||
jsbytecode* pc = codeEnd() - js::JSOP_RETRVAL_LENGTH;
|
||||
MOZ_ASSERT(*pc == JSOP_RETRVAL);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_RETRVAL);
|
||||
return pc;
|
||||
}
|
||||
|
||||
@ -3099,7 +3099,7 @@ class JSScript : public js::BaseScript {
|
||||
|
||||
uint32_t tableSwitchCaseOffset(jsbytecode* pc, uint32_t caseIndex) const {
|
||||
MOZ_ASSERT(containsPC(pc));
|
||||
MOZ_ASSERT(*pc == JSOP_TABLESWITCH);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_TABLESWITCH);
|
||||
uint32_t firstResumeIndex = GET_RESUMEINDEX(pc + 3 * JUMP_OFFSET_LEN);
|
||||
return resumeOffsets()[firstResumeIndex + caseIndex];
|
||||
}
|
||||
|
@ -2453,7 +2453,7 @@ static bool GetNonexistentProperty(JSContext* cx, HandleId id,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (*pc != JSOP_GETPROP && *pc != JSOP_GETELEM) {
|
||||
if (JSOp(*pc) != JSOP_GETPROP && JSOp(*pc) != JSOP_GETELEM) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3419,9 +3419,9 @@ void JitScript::MonitorMagicValueBytecodeType(JSContext* cx, JSScript* script,
|
||||
// GETALIASEDVAR can return the magic TDZ value.
|
||||
MOZ_ASSERT(rval.whyMagic() == JS_UNINITIALIZED_LEXICAL);
|
||||
MOZ_ASSERT(script->function() || script->isForEval());
|
||||
MOZ_ASSERT(*GetNextPc(pc) == JSOP_CHECKTHIS ||
|
||||
*GetNextPc(pc) == JSOP_CHECKTHISREINIT ||
|
||||
*GetNextPc(pc) == JSOP_CHECKRETURN);
|
||||
MOZ_ASSERT(JSOp(*GetNextPc(pc)) == JSOP_CHECKTHIS ||
|
||||
JSOp(*GetNextPc(pc)) == JSOP_CHECKTHISREINIT ||
|
||||
JSOp(*GetNextPc(pc)) == JSOP_CHECKRETURN);
|
||||
|
||||
MonitorBytecodeType(cx, script, pc, TypeSet::UnknownType());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user