mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 788099 - Remove BytecodeEmitter::constMap. r=luke.
--HG-- extra : rebase_source : eb1d3c9744641f34d31216b1eacf96f61f31f413
This commit is contained in:
parent
1148c744d4
commit
87e07fd1fd
@ -117,7 +117,6 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter *parent, Parser *parser, Shared
|
||||
ntrynotes(0), lastTryNode(NULL),
|
||||
arrayCompDepth(0),
|
||||
emitLevel(0),
|
||||
constMap(sc->context),
|
||||
constList(sc->context),
|
||||
typesetCount(0),
|
||||
hasSingletons(false),
|
||||
@ -134,7 +133,7 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter *parent, Parser *parser, Shared
|
||||
bool
|
||||
BytecodeEmitter::init()
|
||||
{
|
||||
return constMap.init() && atomIndices.ensureMap(sc->context);
|
||||
return atomIndices.ensureMap(sc->context);
|
||||
}
|
||||
|
||||
BytecodeEmitter::~BytecodeEmitter()
|
||||
@ -736,17 +735,6 @@ PopStatementBCE(JSContext *cx, BytecodeEmitter *bce)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
frontend::DefineCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom *atom, ParseNode *pn)
|
||||
{
|
||||
/* XXX just do numbers for now */
|
||||
if (pn->isKind(PNK_NUMBER)) {
|
||||
if (!bce->constMap.put(atom, NumberValue(pn->pn_dval)))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EmitIndex32(JSContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce)
|
||||
{
|
||||
@ -3395,11 +3383,6 @@ EmitVariables(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption
|
||||
if (!EmitIndex32(cx, bindOp, atomIndex, bce))
|
||||
return false;
|
||||
}
|
||||
if (pn->isOp(JSOP_DEFCONST) &&
|
||||
!DefineCompileTimeConstant(cx, bce, pn2->pn_atom, pn3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool oldEmittingForInit = bce->emittingForInit;
|
||||
bce->emittingForInit = false;
|
||||
|
@ -99,9 +99,6 @@ struct BytecodeEmitter
|
||||
|
||||
unsigned emitLevel; /* js::frontend::EmitTree recursion level */
|
||||
|
||||
typedef HashMap<JSAtom *, Value> ConstMap;
|
||||
ConstMap constMap; /* compile time constants */
|
||||
|
||||
GCConstList constList; /* constants to be included with the script */
|
||||
|
||||
CGObjectList objectList; /* list of emitted objects */
|
||||
@ -209,21 +206,6 @@ Emit3(JSContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1, jsbytecode o
|
||||
ptrdiff_t
|
||||
EmitN(JSContext *cx, BytecodeEmitter *bce, JSOp op, size_t extra);
|
||||
|
||||
/*
|
||||
* Define and lookup a primitive jsval associated with the const named by atom.
|
||||
* DefineCompileTimeConstant analyzes the constant-folded initializer at pn
|
||||
* and saves the const's value in bce->constList, if it can be used at compile
|
||||
* time. It returns true unless an error occurred.
|
||||
*
|
||||
* If the initializer's value could not be saved, DefineCompileTimeConstant
|
||||
* calls will return the undefined value. DefineCompileTimeConstant tries
|
||||
* to find a const value memorized for atom, returning true with *vp set to a
|
||||
* value other than undefined if the constant was found, true with *vp set to
|
||||
* JSVAL_VOID if not found, and false on error.
|
||||
*/
|
||||
bool
|
||||
DefineCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom *atom, ParseNode *pn);
|
||||
|
||||
/*
|
||||
* Emit code into bce for the tree rooted at pn.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user