Bug 1228340: Get rid of the js_ prefix for CodeSpec, CodeName, NumCodeSpecs; r=jorendorff

--HG--
extra : rebase_source : 15581237242211fb1b29743f909d9c04669c6b2c
This commit is contained in:
Benjamin Bouvier 2015-11-26 15:51:26 +01:00
parent 2e76d6b88a
commit 4db8c7ff5e
28 changed files with 117 additions and 117 deletions

View File

@ -306,7 +306,7 @@ BytecodeEmitter::emitN(JSOp op, size_t extra, ptrdiff_t* 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 (js_CodeSpec[op].nuses >= 0)
if (CodeSpec[op].nuses >= 0)
updateDepth(off);
if (offset)
@ -520,7 +520,7 @@ BytecodeEmitter::emitLoopEntry(ParseNode* nextpn)
void
BytecodeEmitter::checkTypeSet(JSOp op)
{
if (js_CodeSpec[op].format & JOF_TYPESET) {
if (CodeSpec[op].format & JOF_TYPESET) {
if (typesetCount < UINT16_MAX)
typesetCount++;
}
@ -997,7 +997,7 @@ BytecodeEmitter::emitIndex32(JSOp op, uint32_t index)
MOZ_ASSERT(checkStrictOrSloppy(op));
const size_t len = 1 + UINT32_INDEX_LEN;
MOZ_ASSERT(len == size_t(js_CodeSpec[op].length));
MOZ_ASSERT(len == size_t(CodeSpec[op].length));
ptrdiff_t offset;
if (!emitCheck(len, &offset))
@ -1016,7 +1016,7 @@ BytecodeEmitter::emitIndexOp(JSOp op, uint32_t index)
{
MOZ_ASSERT(checkStrictOrSloppy(op));
const size_t len = js_CodeSpec[op].length;
const size_t len = CodeSpec[op].length;
MOZ_ASSERT(len >= 1 + UINT32_INDEX_LEN);
ptrdiff_t offset;
@ -1141,7 +1141,7 @@ BytecodeEmitter::emitScopeCoordOp(JSOp op, ScopeCoordinate sc)
MOZ_ASSERT(JOF_OPTYPE(op) == JOF_SCOPECOORD);
unsigned n = SCOPECOORD_HOPS_LEN + SCOPECOORD_SLOT_LEN;
MOZ_ASSERT(int(n) + 1 /* op */ == js_CodeSpec[op].length);
MOZ_ASSERT(int(n) + 1 /* op */ == CodeSpec[op].length);
ptrdiff_t off;
if (!emitN(op, n, &off))
@ -2742,7 +2742,7 @@ BytecodeEmitter::emitPropIncDec(ParseNode* pn)
bool
BytecodeEmitter::emitNameIncDec(ParseNode* pn)
{
const JSCodeSpec* cs = &js_CodeSpec[pn->pn_kid->getOp()];
const JSCodeSpec* cs = &CodeSpec[pn->pn_kid->getOp()];
bool global = (cs->format & JOF_GNAME);
bool post;

View File

@ -839,7 +839,7 @@ class FullParseHandler
node->setOp(node->isOp(JSOP_GETLOCAL) ? JSOP_SETLOCAL : JSOP_SETNAME);
}
void maybeDespecializeSet(ParseNode* node) {
if (!(js_CodeSpec[node->getOp()].format & JOF_SET))
if (!(CodeSpec[node->getOp()].format & JOF_SET))
node->setOp(JSOP_SETNAME);
}

View File

@ -615,7 +615,7 @@ ParseNode::appendOrCreateList(ParseNodeKind kind, JSOp op, ParseNode* left, Pars
//
if (left->isKind(kind) &&
left->isOp(op) &&
(js_CodeSpec[op].format & JOF_LEFTASSOC ||
(CodeSpec[op].format & JOF_LEFTASSOC ||
(kind == PNK_POW && !left->pn_parens)))
{
ListNode* list = &left->as<ListNode>();

View File

@ -1664,7 +1664,7 @@ ParseNode::test(unsigned flag) const
inline void
ParseNode::markAsAssigned()
{
MOZ_ASSERT(js_CodeSpec[pn_op].format & JOF_NAME);
MOZ_ASSERT(CodeSpec[pn_op].format & JOF_NAME);
if (isUsed())
pn_lexdef->pn_dflags |= PND_ASSIGNED;
pn_dflags |= PND_ASSIGNED;

View File

@ -263,7 +263,7 @@ ParseContext<FullParseHandler>::define(TokenStream& ts,
switch (kind) {
case Definition::ARG:
MOZ_ASSERT(sc->isFunctionBox());
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETARG : JSOP_GETARG);
dn->setOp((CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETARG : JSOP_GETARG);
dn->pn_blockid = bodyid;
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_scopecoord.setSlot(ts, args_.length()))
@ -294,7 +294,7 @@ ParseContext<FullParseHandler>::define(TokenStream& ts,
// and non-deoptimized (e.g., inside a with scope) vars live in frame
// or CallObject slots.
if (!sc->isGlobalContext() && !dn->isDeoptimized()) {
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETLOCAL : JSOP_GETLOCAL);
dn->setOp((CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETLOCAL : JSOP_GETLOCAL);
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_scopecoord.setSlot(ts, vars_.length() - 1))
return false;
@ -1452,7 +1452,7 @@ Parser<FullParseHandler>::makeDefIntoUse(Definition* dn, ParseNode* pn, HandleAt
MOZ_ASSERT(dn->isKind(PNK_NAME));
MOZ_ASSERT(dn->isArity(PN_NAME));
MOZ_ASSERT(dn->pn_atom == atom);
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_GETNAME);
dn->setOp((CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_GETNAME);
dn->setDefn(false);
dn->setUsed(true);
dn->pn_lexdef = (Definition*) pn;

View File

@ -989,7 +989,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
#ifdef JS_JITSPEW
JitSpew(JitSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%" PRIuSIZE,
resumeAfter ? "after" : "at", (int) pcOff, js_CodeName[op],
resumeAfter ? "after" : "at", (int) pcOff, CodeName[op],
PCToLineNumber(script, pc), script->filename(), script->lineno());
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
BailoutKindString(bailoutKind));
@ -1007,7 +1007,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
// then the bailed out state should be in a position to enter
// into the ICTypeMonitor chain for the op.
bool enterMonitorChain = false;
if (resumeAfter && (js_CodeSpec[op].format & JOF_TYPESET)) {
if (resumeAfter && (CodeSpec[op].format & JOF_TYPESET)) {
// Not every monitored op has a monitored fallback stub, e.g.
// JSOP_NEWOBJECT, which always returns the same type for a
// particular script/pc location.
@ -1154,7 +1154,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
JS_snprintf(buf, len, "%s %s %s on line %u of %s:%" PRIuSIZE,
BailoutKindString(bailoutKind),
resumeAfter ? "after" : "at",
js_CodeName[op],
CodeName[op],
PCToLineNumber(script, pc),
filename,
script->lineno());

View File

@ -923,7 +923,7 @@ BaselineCompiler::emitBody()
while (true) {
JSOp op = JSOp(*pc);
JitSpew(JitSpew_BaselineOp, "Compiling op @ %d: %s",
int(script->pcToOffset(pc)), js_CodeName[op]);
int(script->pcToOffset(pc)), CodeName[op]);
BytecodeInfo* info = analysis_.maybeInfo(pc);
@ -979,7 +979,7 @@ BaselineCompiler::emitBody()
switch (op) {
default:
JitSpew(JitSpew_BaselineAbort, "Unhandled op: %s", js_CodeName[op]);
JitSpew(JitSpew_BaselineAbort, "Unhandled op: %s", CodeName[op]);
return Method_CantCompile;
#define EMIT_OP(OP) \

View File

@ -321,7 +321,7 @@ SpewPatchBaselineFrame(uint8_t* oldReturnAddress, uint8_t* newReturnAddress,
JitSpew(JitSpew_BaselineDebugModeOSR,
"Patch return %p -> %p on BaselineJS frame (%s:%d) from %s at %s",
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
ICEntryKindToString(frameKind), js_CodeName[(JSOp)*pc]);
ICEntryKindToString(frameKind), CodeName[(JSOp)*pc]);
}
static void
@ -331,7 +331,7 @@ SpewPatchBaselineFrameFromExceptionHandler(uint8_t* oldReturnAddress, uint8_t* n
JitSpew(JitSpew_BaselineDebugModeOSR,
"Patch return %p -> %p on BaselineJS frame (%s:%d) from exception handler at %s",
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
js_CodeName[(JSOp)*pc]);
CodeName[(JSOp)*pc]);
}
static void

View File

@ -1749,7 +1749,7 @@ DoGetElemFallback(JSContext* cx, BaselineFrame* frame, ICGetElem_Fallback* stub_
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(frame->script());
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "GetElem(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "GetElem(%s)", CodeName[op]);
MOZ_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM);
@ -2727,7 +2727,7 @@ DoSetElemFallback(JSContext* cx, BaselineFrame* frame, ICSetElem_Fallback* stub_
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "SetElem(%s)", js_CodeName[JSOp(*pc)]);
FallbackICSpew(cx, stub, "SetElem(%s)", CodeName[JSOp(*pc)]);
MOZ_ASSERT(op == JSOP_SETELEM ||
op == JSOP_STRICTSETELEM ||
@ -4156,7 +4156,7 @@ DoGetNameFallback(JSContext* cx, BaselineFrame* frame, ICGetName_Fallback* stub_
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(script);
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
FallbackICSpew(cx, stub, "GetName(%s)", js_CodeName[JSOp(*pc)]);
FallbackICSpew(cx, stub, "GetName(%s)", CodeName[JSOp(*pc)]);
MOZ_ASSERT(op == JSOP_GETNAME || op == JSOP_GETGNAME);
@ -4315,7 +4315,7 @@ DoBindNameFallback(JSContext* cx, BaselineFrame* frame, ICBindName_Fallback* stu
{
jsbytecode* pc = stub->icEntry()->pc(frame->script());
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
FallbackICSpew(cx, stub, "BindName(%s)", js_CodeName[JSOp(*pc)]);
FallbackICSpew(cx, stub, "BindName(%s)", CodeName[JSOp(*pc)]);
MOZ_ASSERT(op == JSOP_BINDNAME || op == JSOP_BINDGNAME);
@ -4363,7 +4363,7 @@ DoGetIntrinsicFallback(JSContext* cx, BaselineFrame* frame, ICGetIntrinsic_Fallb
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(script);
mozilla::DebugOnly<JSOp> op = JSOp(*pc);
FallbackICSpew(cx, stub, "GetIntrinsic(%s)", js_CodeName[JSOp(*pc)]);
FallbackICSpew(cx, stub, "GetIntrinsic(%s)", CodeName[JSOp(*pc)]);
MOZ_ASSERT(op == JSOP_GETINTRINSIC);
@ -4690,7 +4690,7 @@ DoSetPropFallback(JSContext* cx, BaselineFrame* frame, ICSetProp_Fallback* stub_
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "SetProp(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "SetProp(%s)", CodeName[op]);
MOZ_ASSERT(op == JSOP_SETPROP ||
op == JSOP_STRICTSETPROP ||
@ -6083,7 +6083,7 @@ DoCallFallback(JSContext* cx, BaselineFrame* frame, ICCall_Fallback* stub_, uint
RootedScript script(cx, frame->script());
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "Call(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "Call(%s)", CodeName[op]);
MOZ_ASSERT(argc == GET_ARGC(pc));
bool constructing = (op == JSOP_NEW);
@ -6189,7 +6189,7 @@ DoSpreadCallFallback(JSContext* cx, BaselineFrame* frame, ICCall_Fallback* stub_
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
bool constructing = (op == JSOP_SPREADNEW);
FallbackICSpew(cx, stub, "SpreadCall(%s)", js_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);

View File

@ -68,7 +68,7 @@ BytecodeAnalysis::init(TempAllocator& alloc, GSNCache& gsn)
unsigned offset = script_->pcToOffset(pc);
JitSpew(JitSpew_BaselineOp, "Analyzing op @ %d (end=%d): %s",
int(script_->pcToOffset(pc)), int(script_->length()), js_CodeName[op]);
int(script_->pcToOffset(pc)), int(script_->length()), CodeName[op]);
// If this bytecode info has not yet been initialized, it's not reachable.
if (!infos_[offset].initialized)

View File

@ -242,7 +242,7 @@ IonBuilder::spew(const char* message)
static inline int32_t
GetJumpOffset(jsbytecode* pc)
{
MOZ_ASSERT(js_CodeSpec[JSOp(*pc)].type() == JOF_JUMP);
MOZ_ASSERT(CodeSpec[JSOp(*pc)].type() == JOF_JUMP);
return GET_JUMP_OFFSET(pc);
}
@ -639,7 +639,7 @@ IonBuilder::analyzeNewLoopTypes(MBasicBlock* entry, jsbytecode* start, jsbytecod
if (*last == JSOP_POS)
last = earlier;
if (js_CodeSpec[*last].format & JOF_TYPESET) {
if (CodeSpec[*last].format & JOF_TYPESET) {
TemporaryTypeSet* typeSet = bytecodeTypes(last);
if (!typeSet->empty()) {
MIRType type = typeSet->getKnownMIRType();
@ -1565,7 +1565,7 @@ IonBuilder::traverseBytecode()
}
#endif
pc += js_CodeSpec[op].length;
pc += CodeSpec[op].length;
current->updateTrackedSite(bytecodeSite(pc));
}
@ -2114,7 +2114,7 @@ IonBuilder::inspectOpcode(JSOp op)
// thing anyways.
trackActionableAbort("Unsupported bytecode");
#ifdef DEBUG
return abort("Unsupported opcode: %s", js_CodeName[op]);
return abort("Unsupported opcode: %s", CodeName[op]);
#else
return abort("Unsupported opcode: %d", op);
#endif
@ -2925,7 +2925,7 @@ IonBuilder::processBreak(JSOp op, jssrcnote* sn)
MOZ_ASSERT(found);
setCurrent(nullptr);
pc += js_CodeSpec[op].length;
pc += CodeSpec[op].length;
return processControlEnd();
}
@ -2962,7 +2962,7 @@ IonBuilder::processContinue(JSOp op)
state.loop.continues = new(alloc()) DeferredEdge(current, state.loop.continues);
setCurrent(nullptr);
pc += js_CodeSpec[op].length;
pc += CodeSpec[op].length;
return processControlEnd();
}
@ -3001,7 +3001,7 @@ IonBuilder::processSwitchBreak(JSOp op)
*breaks = new(alloc()) DeferredEdge(current, *breaks);
setCurrent(nullptr);
pc += js_CodeSpec[op].length;
pc += CodeSpec[op].length;
return processControlEnd();
}
@ -4249,7 +4249,7 @@ IonBuilder::jsop_andor(JSOp op)
{
MOZ_ASSERT(op == JSOP_AND || op == JSOP_OR);
jsbytecode* rhsStart = pc + js_CodeSpec[op].length;
jsbytecode* rhsStart = pc + CodeSpec[op].length;
jsbytecode* joinStart = pc + GetJumpOffset(pc);
MOZ_ASSERT(joinStart > pc);
@ -4311,7 +4311,7 @@ bool
IonBuilder::jsop_ifeq(JSOp op)
{
// IFEQ always has a forward offset.
jsbytecode* trueStart = pc + js_CodeSpec[op].length;
jsbytecode* trueStart = pc + CodeSpec[op].length;
jsbytecode* falseStart = pc + GetJumpOffset(pc);
MOZ_ASSERT(falseStart > pc);

View File

@ -2704,7 +2704,7 @@ JitFrameIterator::dumpBaseline() const
baselineScriptAndPc(script.address(), &pc);
fprintf(stderr, " script = %p, pc = %p (offset %u)\n", (void*)script, pc, uint32_t(script->pcToOffset(pc)));
fprintf(stderr, " current op: %s\n", js_CodeName[*pc]);
fprintf(stderr, " current op: %s\n", CodeName[*pc]);
fprintf(stderr, " actual args: %d\n", numActualArgs());
@ -2748,7 +2748,7 @@ InlineFrameIterator::dump() const
script()->filename(), script()->lineno());
fprintf(stderr, " script = %p, pc = %p\n", (void*) script(), pc());
fprintf(stderr, " current op: %s\n", js_CodeName[*pc()]);
fprintf(stderr, " current op: %s\n", CodeName[*pc()]);
if (!more()) {
numActualArgs();

View File

@ -1392,7 +1392,7 @@ JitcodeRegionEntry::WriteRun(CompactBufferWriter& writer,
jsbytecode* pc = entry[i].tree->script()->offsetToPC(curBc);
#ifdef JS_JITSPEW
JSOp op = JSOp(*pc);
JitSpewCont(JitSpew_Profiling, "%s ", js_CodeName[op]);
JitSpewCont(JitSpew_Profiling, "%s ", CodeName[op]);
#endif
curBc += GetBytecodeLength(pc);
}

View File

@ -1090,7 +1090,7 @@ void
MCompare::printOpcode(GenericPrinter& out) const
{
MDefinition::printOpcode(out);
out.printf(" %s", js_CodeName[jsop()]);
out.printf(" %s", CodeName[jsop()]);
}
void

View File

@ -928,7 +928,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "BinaryArith(%s,%d,%d)", js_CodeName[op],
FallbackICSpew(cx, stub, "BinaryArith(%s,%d,%d)", CodeName[op],
int(lhs.isDouble() ? JSVAL_TYPE_DOUBLE : lhs.extractNonDoubleType()),
int(rhs.isDouble() ? JSVAL_TYPE_DOUBLE : rhs.extractNonDoubleType()));
@ -1024,7 +1024,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
// Handle string concat.
if (op == JSOP_ADD) {
if (lhs.isString() && rhs.isString()) {
JitSpew(JitSpew_BaselineIC, " Generating %s(String, String) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(String, String) stub", CodeName[op]);
MOZ_ASSERT(ret.isString());
ICBinaryArith_StringConcat::Compiler compiler(cx, engine);
ICStub* strcatStub = compiler.getStub(compiler.getStubSpace(script));
@ -1035,7 +1035,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
}
if ((lhs.isString() && rhs.isObject()) || (lhs.isObject() && rhs.isString())) {
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", CodeName[op],
lhs.isString() ? "String" : "Object",
lhs.isString() ? "Object" : "String");
MOZ_ASSERT(ret.isString());
@ -1053,7 +1053,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
(op == JSOP_ADD || op == JSOP_SUB || op == JSOP_BITOR || op == JSOP_BITAND ||
op == JSOP_BITXOR))
{
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", CodeName[op],
lhs.isBoolean() ? "Boolean" : "Int32", rhs.isBoolean() ? "Boolean" : "Int32");
ICBinaryArith_BooleanWithInt32::Compiler compiler(cx, op, engine,
lhs.isBoolean(), rhs.isBoolean());
@ -1084,7 +1084,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
case JSOP_MOD: {
// Unlink int32 stubs, it's faster to always use the double stub.
stub->unlinkStubsWithKind(cx, ICStub::BinaryArith_Int32);
JitSpew(JitSpew_BaselineIC, " Generating %s(Double, Double) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Double, Double) stub", CodeName[op]);
ICBinaryArith_Double::Compiler compiler(cx, op, engine);
ICStub* doubleStub = compiler.getStub(compiler.getStubSpace(script));
@ -1102,7 +1102,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
bool allowDouble = ret.isDouble();
if (allowDouble)
stub->unlinkStubsWithKind(cx, ICStub::BinaryArith_Int32);
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32, Int32%s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32, Int32%s) stub", CodeName[op],
allowDouble ? " => Double" : "");
ICBinaryArith_Int32::Compiler compilerInt32(cx, op, engine, allowDouble);
ICStub* int32Stub = compilerInt32.getStub(compilerInt32.getStubSpace(script));
@ -1120,7 +1120,7 @@ DoBinaryArithFallback(JSContext* cx, BaselineFrame* frame, ICBinaryArith_Fallbac
case JSOP_BITOR:
case JSOP_BITXOR:
case JSOP_BITAND: {
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", CodeName[op],
lhs.isDouble() ? "Double" : "Int32",
lhs.isDouble() ? "Int32" : "Double");
ICBinaryArith_DoubleWithInt32::Compiler compiler(cx, op, engine, lhs.isDouble());
@ -1486,7 +1486,7 @@ DoUnaryArithFallback(JSContext* cx, BaselineFrame* frame, ICUnaryArith_Fallback*
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "UnaryArith(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "UnaryArith(%s)", CodeName[op]);
switch (op) {
case JSOP_BITNOT: {
@ -1517,7 +1517,7 @@ DoUnaryArithFallback(JSContext* cx, BaselineFrame* frame, ICUnaryArith_Fallback*
}
if (val.isInt32() && res.isInt32()) {
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32 => Int32) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32 => Int32) stub", CodeName[op]);
ICUnaryArith_Int32::Compiler compiler(cx, op, engine);
ICStub* int32Stub = compiler.getStub(compiler.getStubSpace(script));
if (!int32Stub)
@ -1527,7 +1527,7 @@ DoUnaryArithFallback(JSContext* cx, BaselineFrame* frame, ICUnaryArith_Fallback*
}
if (val.isNumber() && res.isNumber() && cx->runtime()->jitSupportsFloatingPoint) {
JitSpew(JitSpew_BaselineIC, " Generating %s(Number => Number) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Number => Number) stub", CodeName[op]);
// Unlink int32 stubs, the double stub handles both cases and TI specializes for both.
stub->unlinkStubsWithKind(cx, ICStub::UnaryArith_Int32);
@ -1623,7 +1623,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "Compare(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "Compare(%s)", CodeName[op]);
// Case operations in a CONDSWITCH are performing strict equality.
if (op == JSOP_CASE)
@ -1689,7 +1689,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
// Try to generate new stubs.
if (lhs.isInt32() && rhs.isInt32()) {
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32, Int32) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Int32, Int32) stub", CodeName[op]);
ICCompare_Int32::Compiler compiler(cx, op, engine);
ICStub* int32Stub = compiler.getStub(compiler.getStubSpace(script));
if (!int32Stub)
@ -1703,7 +1703,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
return true;
if (lhs.isNumber() && rhs.isNumber()) {
JitSpew(JitSpew_BaselineIC, " Generating %s(Number, Number) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Number, Number) stub", CodeName[op]);
// Unlink int32 stubs, it's faster to always use the double stub.
stub->unlinkStubsWithKind(cx, ICStub::Compare_Int32);
@ -1720,7 +1720,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
if ((lhs.isNumber() && rhs.isUndefined()) ||
(lhs.isUndefined() && rhs.isNumber()))
{
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", CodeName[op],
rhs.isUndefined() ? "Number" : "Undefined",
rhs.isUndefined() ? "Undefined" : "Number");
ICCompare_NumberWithUndefined::Compiler compiler(cx, op, engine, lhs.isUndefined());
@ -1733,7 +1733,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
}
if (lhs.isBoolean() && rhs.isBoolean()) {
JitSpew(JitSpew_BaselineIC, " Generating %s(Boolean, Boolean) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Boolean, Boolean) stub", CodeName[op]);
ICCompare_Boolean::Compiler compiler(cx, op, engine);
ICStub* booleanStub = compiler.getStub(compiler.getStubSpace(script));
if (!booleanStub)
@ -1744,7 +1744,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
}
if ((lhs.isBoolean() && rhs.isInt32()) || (lhs.isInt32() && rhs.isBoolean())) {
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op],
JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", CodeName[op],
rhs.isInt32() ? "Boolean" : "Int32",
rhs.isInt32() ? "Int32" : "Boolean");
ICCompare_Int32WithBoolean::Compiler compiler(cx, op, engine, lhs.isInt32());
@ -1758,7 +1758,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
if (IsEqualityOp(op)) {
if (lhs.isString() && rhs.isString() && !stub->hasStub(ICStub::Compare_String)) {
JitSpew(JitSpew_BaselineIC, " Generating %s(String, String) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(String, String) stub", CodeName[op]);
ICCompare_String::Compiler compiler(cx, op, engine);
ICStub* stringStub = compiler.getStub(compiler.getStubSpace(script));
if (!stringStub)
@ -1770,7 +1770,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
if (lhs.isObject() && rhs.isObject()) {
MOZ_ASSERT(!stub->hasStub(ICStub::Compare_Object));
JitSpew(JitSpew_BaselineIC, " Generating %s(Object, Object) stub", js_CodeName[op]);
JitSpew(JitSpew_BaselineIC, " Generating %s(Object, Object) stub", CodeName[op]);
ICCompare_Object::Compiler compiler(cx, op, engine);
ICStub* objectStub = compiler.getStub(compiler.getStubSpace(script));
if (!objectStub)
@ -1785,7 +1785,7 @@ DoCompareFallback(JSContext* cx, BaselineFrame* frame, ICCompare_Fallback* stub_
!stub->hasStub(ICStub::Compare_ObjectWithUndefined))
{
JitSpew(JitSpew_BaselineIC, " Generating %s(Obj/Null/Undef, Obj/Null/Undef) stub",
js_CodeName[op]);
CodeName[op]);
bool lhsIsUndefined = lhs.isNull() || lhs.isUndefined();
bool compareWithNull = lhs.isNull() || rhs.isNull();
ICCompare_ObjectWithUndefined::Compiler compiler(cx, op, engine,
@ -2968,7 +2968,7 @@ DoGetPropFallback(JSContext* cx, BaselineFrame* frame, ICGetProp_Fallback* stub_
jsbytecode* pc = stub->icEntry()->pc(script);
JSOp op = JSOp(*pc);
FallbackICSpew(cx, stub, "GetProp(%s)", js_CodeName[op]);
FallbackICSpew(cx, stub, "GetProp(%s)", CodeName[op]);
MOZ_ASSERT(op == JSOP_GETPROP || op == JSOP_CALLPROP || op == JSOP_LENGTH || op == JSOP_GETXPROP);

View File

@ -552,7 +552,7 @@ SnapshotReader::spewBailingFrom() const
if (JitSpewEnabled(JitSpew_IonBailouts)) {
JitSpewHeader(JitSpew_IonBailouts);
Fprinter& out = JitSpewPrinter();
out.printf(" bailing from bytecode: %s, MIR: ", js_CodeName[pcOpcode_]);
out.printf(" bailing from bytecode: %s, MIR: ", CodeName[pcOpcode_]);
MDefinition::PrintOpcodeName(out, MDefinition::Opcode(mirOpcode_));
out.printf(" [%u], LIR: ", mirId_);
LInstruction::printName(out, LInstruction::Opcode(lirOpcode_));

View File

@ -308,7 +308,7 @@ CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx)
nativeDelta,
ref.pc - script->code(),
pcDelta,
js_CodeName[JSOp(*ref.pc)],
CodeName[JSOp(*ref.pc)],
script->filename(), script->lineno());
for (tree = tree->caller(); tree; tree = tree->caller()) {

View File

@ -2165,7 +2165,7 @@ class LCompare : public LInstructionHelper<1, 2, 0>
return mir_->toCompare();
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
};
@ -2211,7 +2211,7 @@ class LCompareAndBranch : public LControlInstructionHelper<2, 2, 0>
return cmpMir_;
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
};
@ -2751,7 +2751,7 @@ class LBitOpI : public LInstructionHelper<1, 2, 0>
const char* extraName() const {
if (bitop() == JSOP_URSH && mir_->toUrsh()->bailoutsDisabled())
return "ursh:BailoutsDisabled";
return js_CodeName[op_];
return CodeName[op_];
}
JSOp bitop() const {
@ -2776,7 +2776,7 @@ class LBitOpV : public LCallInstructionHelper<1, 2 * BOX_PIECES, 0>
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
static const size_t LhsInput = 0;
@ -2805,7 +2805,7 @@ class LShiftI : public LBinaryMath<0>
}
const char* extraName() const {
return js_CodeName[op_];
return CodeName[op_];
}
};
@ -3219,7 +3219,7 @@ class LMathD : public LBinaryMath<0>
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
};
@ -3240,7 +3240,7 @@ class LMathF: public LBinaryMath<0>
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
};
@ -3279,7 +3279,7 @@ class LBinaryV : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 0>
}
const char* extraName() const {
return js_CodeName[jsop_];
return CodeName[jsop_];
}
static const size_t LhsInput = 0;

View File

@ -3478,7 +3478,7 @@ js::DumpInterpreterFrame(JSContext* cx, InterpreterFrame* start)
if (jsbytecode* pc = i.pc()) {
fprintf(stderr, " pc = %p\n", pc);
fprintf(stderr, " current op: %s\n", js_CodeName[*pc]);
fprintf(stderr, " current op: %s\n", CodeName[*pc]);
MaybeDumpObject("staticScope", i.script()->getStaticBlockScope(pc));
}
if (i.isNonEvalFunctionFrame())

View File

@ -61,13 +61,13 @@ using js::frontend::IsIdentifier;
*/
JS_STATIC_ASSERT(sizeof(uint32_t) * JS_BITS_PER_BYTE >= INDEX_LIMIT_LOG2 + 1);
const JSCodeSpec js_CodeSpec[] = {
const JSCodeSpec js::CodeSpec[] = {
#define MAKE_CODESPEC(op,val,name,token,length,nuses,ndefs,format) {length,nuses,ndefs,format},
FOR_EACH_OPCODE(MAKE_CODESPEC)
#undef MAKE_CODESPEC
};
const unsigned js_NumCodeSpecs = JS_ARRAY_LENGTH(js_CodeSpec);
const unsigned js::NumCodeSpecs = JS_ARRAY_LENGTH(CodeSpec);
/*
* Each element of the array is either a source literal associated with JS
@ -83,7 +83,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::CodeName[] = {
#define OPNAME(op, val, name, ...) name,
FOR_EACH_OPCODE(OPNAME)
#undef OPNAME
@ -97,7 +97,7 @@ size_t
js::GetVariableBytecodeLength(jsbytecode* pc)
{
JSOp op = JSOp(*pc);
MOZ_ASSERT(js_CodeSpec[op].length == -1);
MOZ_ASSERT(CodeSpec[op].length == -1);
switch (op) {
case JSOP_TABLESWITCH: {
/* Structure: default-jump case-low case-high case1-jump ... */
@ -117,11 +117,11 @@ unsigned
js::StackUses(JSScript* script, jsbytecode* pc)
{
JSOp op = (JSOp) *pc;
const JSCodeSpec& cs = js_CodeSpec[op];
const JSCodeSpec& cs = CodeSpec[op];
if (cs.nuses >= 0)
return cs.nuses;
MOZ_ASSERT(js_CodeSpec[op].nuses == -1);
MOZ_ASSERT(CodeSpec[op].nuses == -1);
switch (op) {
case JSOP_POPN:
return GET_UINT16(pc);
@ -140,7 +140,7 @@ unsigned
js::StackDefs(JSScript* script, jsbytecode* pc)
{
JSOp op = (JSOp) *pc;
const JSCodeSpec& cs = js_CodeSpec[op];
const JSCodeSpec& cs = CodeSpec[op];
MOZ_ASSERT(cs.ndefs >= 0);
return cs.ndefs;
}
@ -820,12 +820,12 @@ js::Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
return 0;
}
const JSCodeSpec* cs = &js_CodeSpec[op];
const JSCodeSpec* cs = &CodeSpec[op];
ptrdiff_t len = (ptrdiff_t) cs->length;
Sprint(sp, "%05u:", loc);
if (lines)
Sprint(sp, "%4u", PCToLineNumber(script, pc));
Sprint(sp, " %s", js_CodeName[op]);
Sprint(sp, " %s", CodeName[op]);
switch (JOF_TYPE(cs->format)) {
case JOF_BYTE:
@ -1062,7 +1062,7 @@ ExpressionDecompiler::decompilePC(jsbytecode* pc)
if (const char* token = CodeToken[op]) {
// Handle simple cases of binary and unary operators.
switch (js_CodeSpec[op].nuses) {
switch (CodeSpec[op].nuses) {
case 2: {
jssrcnote* sn = GetSrcNote(cx, script, pc);
if (!sn || SN_TYPE(sn) != SRC_ASSIGNOP)
@ -1804,7 +1804,7 @@ GetPCCountJSON(JSContext* cx, const ScriptAndCounts& sac, StringBuffer& buf)
NumberValueToStringBuffer(cx, Int32Value(scanner.getLine()), buf);
{
const char* name = js_CodeName[op];
const char* name = CodeName[op];
AppendJSONProperty(buf, "name");
buf.append('\"');
buf.append(name, strlen(name));

View File

@ -380,18 +380,6 @@ struct JSCodeSpec {
uint32_t type() const { return JOF_TYPE(format); }
};
extern const JSCodeSpec js_CodeSpec[];
extern const unsigned js_NumCodeSpecs;
extern const char * const js_CodeName[];
/* Shorthand for type from opcode. */
static inline uint32_t
JOF_OPTYPE(JSOp op)
{
return JOF_TYPE(js_CodeSpec[op].format);
}
/* Silence unreferenced formal parameter warnings */
#ifdef _MSC_VER
#pragma warning(push)
@ -400,10 +388,22 @@ JOF_OPTYPE(JSOp op)
namespace js {
extern const JSCodeSpec CodeSpec[];
extern const unsigned NumCodeSpecs;
extern const char * const CodeName[];
/* Shorthand for type from opcode. */
static inline uint32_t
JOF_OPTYPE(JSOp op)
{
return JOF_TYPE(CodeSpec[op].format);
}
static inline bool
IsJumpOpcode(JSOp op)
{
uint32_t type = JOF_TYPE(js_CodeSpec[op].format);
uint32_t type = JOF_TYPE(CodeSpec[op].format);
/*
* LABEL opcodes have type JOF_JUMP but are no-ops, don't treat them as
@ -579,7 +579,7 @@ GetDecomposeLength(jsbytecode* pc, size_t len)
* The last byte of a DECOMPOSE op stores the decomposed length. This is a
* constant: perhaps we should just hardcode values instead?
*/
MOZ_ASSERT(size_t(js_CodeSpec[*pc].length) == len);
MOZ_ASSERT(size_t(CodeSpec[*pc].length) == len);
return (unsigned) pc[len - 1];
}
@ -589,8 +589,8 @@ GetBytecodeLength(jsbytecode* pc)
JSOp op = (JSOp)*pc;
MOZ_ASSERT(op < JSOP_LIMIT);
if (js_CodeSpec[op].length != -1)
return js_CodeSpec[op].length;
if (CodeSpec[op].length != -1)
return CodeSpec[op].length;
return GetVariableBytecodeLength(pc);
}
@ -673,7 +673,7 @@ IsAliasedVarOp(JSOp op)
inline bool
IsGlobalOp(JSOp op)
{
return js_CodeSpec[op].format & JOF_GNAME;
return CodeSpec[op].format & JOF_GNAME;
}
inline bool
@ -685,14 +685,14 @@ IsEqualityOp(JSOp op)
inline bool
IsCheckStrictOp(JSOp op)
{
return js_CodeSpec[op].format & JOF_CHECKSTRICT;
return CodeSpec[op].format & JOF_CHECKSTRICT;
}
#ifdef DEBUG
inline bool
IsCheckSloppyOp(JSOp op)
{
return js_CodeSpec[op].format & JOF_CHECKSLOPPY;
return CodeSpec[op].format & JOF_CHECKSLOPPY;
}
#endif
@ -754,7 +754,7 @@ IsSetElemPC(jsbytecode* pc)
inline bool
IsCallPC(jsbytecode* pc)
{
return js_CodeSpec[*pc].format & JOF_INVOKE;
return CodeSpec[*pc].format & JOF_INVOKE;
}
inline bool

View File

@ -46,9 +46,9 @@ GetUseCount(JSScript* script, unsigned offset)
if (JSOp(*pc) == JSOP_PICK)
return pc[1] + 1;
if (js_CodeSpec[*pc].nuses == -1)
if (CodeSpec[*pc].nuses == -1)
return StackUses(script, pc);
return js_CodeSpec[*pc].nuses;
return CodeSpec[*pc].nuses;
}
static inline JSOp

View File

@ -5,7 +5,7 @@
//-----------------------------------------------------------------------------
var BUGNUMBER = 426827;
var summary = 'Do not assert: !(js_CodeSpec[op2].format & JOF_DEL)';
var summary = 'Do not assert: !(CodeSpec[op2].format & JOF_DEL)';
var actual = '';
var expect = '';

View File

@ -5040,7 +5040,7 @@ class FlowGraphSummary {
if (FlowsIntoNext(prevOp))
addEdge(prevLineno, prevColumn, r.frontOffset());
if (js_CodeSpec[op].type() == JOF_JUMP) {
if (CodeSpec[op].type() == JOF_JUMP) {
addEdge(lineno, column, r.frontOffset() + GET_JUMP_OFFSET(r.frontPC()));
} else if (op == JSOP_TABLESWITCH) {
jsbytecode* pc = r.frontPC();

View File

@ -1764,7 +1764,7 @@ CASE(JSOP_UNUSED223)
CASE(JSOP_CONDSWITCH)
CASE(JSOP_TRY)
{
MOZ_ASSERT(js_CodeSpec[*REGS.pc].length == 1);
MOZ_ASSERT(CodeSpec[*REGS.pc].length == 1);
ADVANCE_AND_DISPATCH(1);
}
@ -1892,7 +1892,7 @@ CASE(JSOP_RETRVAL)
jit_return:
MOZ_ASSERT(js_CodeSpec[*REGS.pc].format & JOF_INVOKE);
MOZ_ASSERT(CodeSpec[*REGS.pc].format & JOF_INVOKE);
/* Resume execution in the calling frame. */
if (MOZ_LIKELY(interpReturnOK)) {
@ -1958,7 +1958,7 @@ END_CASE(JSOP_AND)
#define TRY_BRANCH_AFTER_COND(cond,spdec) \
JS_BEGIN_MACRO \
MOZ_ASSERT(js_CodeSpec[*REGS.pc].length == 1); \
MOZ_ASSERT(CodeSpec[*REGS.pc].length == 1); \
unsigned diff_ = (unsigned) GET_UINT8(REGS.pc) - (unsigned) JSOP_IFEQ; \
if (diff_ <= 1) { \
REGS.sp -= (spdec); \

View File

@ -1738,7 +1738,7 @@ Detecting(JSContext* cx, JSScript* script, jsbytecode* pc)
// General case: a branch or equality op follows the access.
JSOp op = JSOp(*pc);
if (js_CodeSpec[op].format & JOF_DETECTING)
if (CodeSpec[op].format & JOF_DETECTING)
return true;
jsbytecode* endpc = script->codeEnd();
@ -1756,7 +1756,7 @@ Detecting(JSContext* cx, JSScript* script, jsbytecode* pc)
// Special case #2: don't warn about (obj.prop == undefined).
JSAtom* atom = script->getAtom(GET_UINT32_INDEX(pc));
if (atom == cx->names().undefined &&
(pc += js_CodeSpec[op].length) < endpc) {
(pc += CodeSpec[op].length) < endpc) {
op = JSOp(*pc);
return op == JSOP_EQ || op == JSOP_NE || op == JSOP_STRICTEQ || op == JSOP_STRICTNE;
}
@ -1836,7 +1836,7 @@ GetNonexistentProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
return true;
// Do not warn about tests like (obj[prop] == undefined).
pc += js_CodeSpec[*pc].length;
pc += CodeSpec[*pc].length;
if (Detecting(cx, script, pc))
return true;

View File

@ -503,7 +503,7 @@ template <typename TYPESET>
TypeScript::BytecodeTypes(JSScript* script, jsbytecode* pc, uint32_t* bytecodeMap,
uint32_t* hint, TYPESET* typeArray)
{
MOZ_ASSERT(js_CodeSpec[*pc].format & JOF_TYPESET);
MOZ_ASSERT(CodeSpec[*pc].format & JOF_TYPESET);
uint32_t offset = script->pcToOffset(pc);
// See if this pc is the next typeset opcode after the last one looked up.

View File

@ -3212,7 +3212,7 @@ js::FillBytecodeTypeMap(JSScript* script, uint32_t* bytecodeMap)
uint32_t added = 0;
for (jsbytecode* pc = script->code(); pc < script->codeEnd(); pc += GetBytecodeLength(pc)) {
JSOp op = JSOp(*pc);
if (js_CodeSpec[op].format & JOF_TYPESET) {
if (CodeSpec[op].format & JOF_TYPESET) {
bytecodeMap[added++] = script->pcToOffset(pc);
if (added == script->nTypeSets())
break;
@ -3239,7 +3239,7 @@ void
js::TypeMonitorResult(JSContext* cx, JSScript* script, jsbytecode* pc, const js::Value& rval)
{
/* Allow the non-TYPESET scenario to simplify stubs used in compound opcodes. */
if (!(js_CodeSpec[*pc].format & JOF_TYPESET))
if (!(CodeSpec[*pc].format & JOF_TYPESET))
return;
if (!script->hasBaselineScript())
@ -4468,7 +4468,7 @@ TypeScript::printTypes(JSContext* cx, HandleScript script) const
fprintf(stderr, "%s", sprinter.string());
}
if (js_CodeSpec[*pc].format & JOF_TYPESET) {
if (CodeSpec[*pc].format & JOF_TYPESET) {
StackTypeSet* types = TypeScript::BytecodeTypes(script, pc);
fprintf(stderr, " typeset %u:", unsigned(types - typeArray()));
types->print();