Back out bug 985687, likely cause of js1_8_5/extensions/recursion.js cantankering. r=CLOSED TREE

This commit is contained in:
Jeff Walden 2014-03-20 16:39:30 -07:00
parent 27dda89b58
commit c1673141f3
7 changed files with 31 additions and 51 deletions

View File

@ -1830,7 +1830,7 @@ class AttrDefiner(PropertyDefiner):
return self.generatePrefableArray(
array, name,
' { "%s", %s, %s, %s}',
' { "%s", 0, %s, %s, %s}',
' JS_PS_END',
'JSPropertySpec',
PropertyDefiner.getControllingCondition, specData, doIdArrays)

View File

@ -2693,6 +2693,10 @@ Parser<FullParseHandler>::bindLet(BindData<FullParseHandler> *data,
Rooted<StaticBlockObject *> blockObj(cx, data->let.blockObj);
unsigned index = blockObj->numVariables();
if (index >= StaticBlockObject::LOCAL_INDEX_LIMIT) {
parser->report(ParseError, false, pn, data->let.overflow);
return false;
}
/*
* Assign block-local index to pn->pn_cookie right away, encoding it as an

View File

@ -2395,6 +2395,7 @@ struct JSPropertySpec {
};
const char *name;
int8_t tinyid;
uint8_t flags;
union {
JSPropertyOpWrapper propertyOp;
@ -2448,26 +2449,26 @@ CheckIsCharacterLiteral(const char (&arr)[N]);
* JSNatives.
*/
#define JS_PSG(name, getter, flags) \
{name, \
{name, 0, \
uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | JSPROP_SHARED | JSPROP_NATIVE_ACCESSORS), \
JSOP_WRAPPER(JS_CAST_NATIVE_TO(getter, JSPropertyOp)), \
JSOP_NULLWRAPPER}
#define JS_PSGS(name, getter, setter, flags) \
{name, \
{name, 0, \
uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | JSPROP_SHARED | JSPROP_NATIVE_ACCESSORS), \
JSOP_WRAPPER(JS_CAST_NATIVE_TO(getter, JSPropertyOp)), \
JSOP_WRAPPER(JS_CAST_NATIVE_TO(setter, JSStrictPropertyOp))}
#define JS_SELF_HOSTED_GET(name, getterName, flags) \
{name, \
{name, 0, \
uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | JSPROP_SHARED | JSPROP_GETTER), \
{ nullptr, JS_CAST_STRING_TO(getterName, const JSJitInfo *) }, \
JSOP_NULLWRAPPER }
#define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) \
{name, \
{name, 0, \
uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER), \
{ nullptr, JS_CAST_STRING_TO(getterName, const JSJitInfo *) }, \
{ nullptr, JS_CAST_STRING_TO(setterName, const JSJitInfo *) } }
#define JS_PS_END { nullptr, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER }
#define JS_PS_END {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER }
/*
* To define a native function, set call to a JSNativeWrapper. To define a

View File

@ -5159,7 +5159,7 @@ static const JSJitInfo doFoo_methodinfo = {
};
static const JSPropertySpec dom_props[] = {
{"x",
{"x", 0,
JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS,
{ { (JSPropertyOp)dom_genericGetter, &dom_x_getterinfo } },
{ { (JSStrictPropertyOp)dom_genericSetter, &dom_x_setterinfo } }

View File

@ -1,39 +0,0 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 999999;
var summary =
"Allow defining more than 2**16 let-variables in a single scope";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
print("Creating binding string...");
var bindings = [];
var codeStr = "let ";
for (var i = 0; i < Math.pow(2, 20); i++)
bindings.push("x" + i + " = " + i);
var codeStr = "let " + bindings.join(", ") + ";";
print("Binding string created, testing with global eval...");
eval(codeStr);
print("Testing with Function...");
Function(codeStr)();
print("Testing inside a function...");
eval("function q() { " + codeStr + " }; q();");
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");

View File

@ -684,6 +684,7 @@ StaticBlockObject::addVar(ExclusiveContext *cx, Handle<StaticBlockObject*> block
unsigned index, bool *redeclared)
{
JS_ASSERT(JSID_IS_ATOM(id));
JS_ASSERT(index < LOCAL_INDEX_LIMIT);
*redeclared = false;
@ -754,19 +755,19 @@ js::XDRStaticBlockObject(XDRState<mode> *xdr, HandleObject enclosingScope,
if (!xdr->codeUint32(&offset))
return false;
/*
* XDR the block object's properties. We know that there are 'count'
* properties to XDR, stored as id/aliased pairs. (The empty string as
* id indicates an int id.)
*/
if (mode == XDR_DECODE) {
obj->setLocalOffset(offset);
/*
* XDR the block object's properties. We know that there are 'count'
* properties to XDR, stored as id/shortid pairs.
*/
for (unsigned i = 0; i < count; i++) {
RootedAtom atom(cx);
if (!XDRAtom(xdr, &atom))
return false;
/* The empty string indicates an int id. */
RootedId id(cx, atom != cx->runtime()->emptyString
? AtomToId(atom)
: INT_TO_JSID(i));
@ -792,6 +793,10 @@ js::XDRStaticBlockObject(XDRState<mode> *xdr, HandleObject enclosingScope,
for (Shape::Range<NoGC> r(obj->lastProperty()); !r.empty(); r.popFront())
shapes[obj->shapeToIndex(r.front())] = &r.front();
/*
* XDR the block object's properties. We know that there are 'count'
* properties to XDR, stored as id/shortid pairs.
*/
RootedShape shape(cx);
RootedId propid(cx);
RootedAtom atom(cx);
@ -803,6 +808,7 @@ js::XDRStaticBlockObject(XDRState<mode> *xdr, HandleObject enclosingScope,
propid = shape->propid();
JS_ASSERT(JSID_IS_ATOM(propid) || JSID_IS_INT(propid));
/* The empty string indicates an int id. */
atom = JSID_IS_ATOM(propid)
? JSID_TO_ATOM(propid)
: cx->runtime()->emptyString;

View File

@ -532,6 +532,14 @@ class StaticBlockObject : public BlockObject
return reinterpret_cast<frontend::Definition *>(v.toPrivate());
}
/*
* While ScopeCoordinate can generally reference up to 2^24 slots, block objects have an
* additional limitation that all slot indices must be storable as uint16_t short-ids in the
* associated Shape. If we could remove the block dependencies on shape->shortid, we could
* remove INDEX_LIMIT.
*/
static const unsigned LOCAL_INDEX_LIMIT = JS_BIT(16);
static Shape *addVar(ExclusiveContext *cx, Handle<StaticBlockObject*> block, HandleId id,
unsigned index, bool *redeclared);
};