mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 916612 - rm JSScript::nfixed (r=wingo)
--HG-- extra : rebase_source : 6185ed8b87bf8d9106f2ece0be0c39db4fa8a3eb
This commit is contained in:
parent
65ed60085f
commit
d96baf20ea
@ -464,7 +464,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
if (mode == XDR_ENCODE) {
|
||||
prologLength = script->mainOffset();
|
||||
JS_ASSERT(script->getVersion() != JSVERSION_UNKNOWN);
|
||||
version = (uint32_t)script->getVersion() | (script->nfixed() << 16);
|
||||
version = script->getVersion();
|
||||
lineno = script->lineno();
|
||||
column = script->column();
|
||||
nslots = (uint32_t)script->nslots();
|
||||
@ -553,8 +553,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
return false;
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
/* Note: version is packed into the 32b space with another 16b value. */
|
||||
JSVersion version_ = JSVersion(version & JS_BITMASK(16));
|
||||
JSVersion version_ = JSVersion(version);
|
||||
JS_ASSERT((version_ & VersionFlags::MASK) == unsigned(version_));
|
||||
|
||||
// staticLevel is set below.
|
||||
@ -606,7 +605,6 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
JS_ASSERT(!script->mainOffset());
|
||||
script->mainOffset_ = prologLength;
|
||||
script->setLength(length);
|
||||
script->nfixed_ = uint16_t(version >> 16);
|
||||
script->funLength_ = funLength;
|
||||
|
||||
scriptp.set(script);
|
||||
@ -2018,15 +2016,6 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
|
||||
if (!SaveSharedScriptData(cx, script, ssd, nsrcnotes))
|
||||
return false;
|
||||
|
||||
uint32_t nfixed = bce->sc->isFunctionBox() ? script->bindings.numVars() : 0;
|
||||
JS_ASSERT(nfixed < SLOTNO_LIMIT);
|
||||
script->nfixed_ = uint16_t(nfixed);
|
||||
if (script->nfixed() + bce->maxStackDepth >= JS_BIT(16)) {
|
||||
bce->reportError(nullptr, JSMSG_NEED_DIET, "script");
|
||||
return false;
|
||||
}
|
||||
script->nslots_ = script->nfixed() + bce->maxStackDepth;
|
||||
|
||||
FunctionBox *funbox = bce->sc->isFunctionBox() ? bce->sc->asFunctionBox() : nullptr;
|
||||
|
||||
if (bce->constList.length() != 0)
|
||||
@ -2067,6 +2056,13 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
|
||||
script->setFunction(funbox->function());
|
||||
}
|
||||
|
||||
// The call to nfixed() depends on the above setFunction() call.
|
||||
if (script->nfixed() + bce->maxStackDepth >= JS_BIT(16)) {
|
||||
bce->reportError(nullptr, JSMSG_NEED_DIET, "script");
|
||||
return false;
|
||||
}
|
||||
script->nslots_ = script->nfixed() + bce->maxStackDepth;
|
||||
|
||||
for (unsigned i = 0, n = script->bindings.numArgs(); i < n; ++i) {
|
||||
if (script->formalIsAliased(i)) {
|
||||
script->funHasAnyAliasedFormal_ = true;
|
||||
@ -2527,7 +2523,6 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
|
||||
dst->mainOffset_ = src->mainOffset();
|
||||
dst->natoms_ = src->natoms();
|
||||
dst->funLength_ = src->funLength();
|
||||
dst->nfixed_ = src->nfixed();
|
||||
dst->nTypeSets_ = src->nTypeSets();
|
||||
dst->nslots_ = src->nslots();
|
||||
if (src->argumentsHasVarBinding()) {
|
||||
|
@ -671,14 +671,10 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
|
||||
|
||||
// 16-bit fields.
|
||||
|
||||
uint16_t PADDING16;
|
||||
uint16_t version; /* JS version under which script was compiled */
|
||||
|
||||
uint16_t funLength_; /* ES6 function length */
|
||||
|
||||
uint16_t nfixed_; /* number of slots besides stack operands in
|
||||
slot array */
|
||||
|
||||
uint16_t nTypeSets_; /* number of type sets used in this script for
|
||||
dynamic type monitoring */
|
||||
|
||||
@ -876,7 +872,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
|
||||
|
||||
size_t nfixed() const {
|
||||
js::AutoThreadSafeAccess ts(this);
|
||||
return nfixed_;
|
||||
return function_ ? bindings.numVars() : 0;
|
||||
}
|
||||
|
||||
size_t nslots() const {
|
||||
|
Loading…
Reference in New Issue
Block a user