mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 790349 - Convert all fooAtom uses to simply foo. r=jorendorff
--HG-- extra : rebase_source : b0b255d242dbb8cef2df3c758bec82e88699ecdd
This commit is contained in:
parent
d6e3e21556
commit
6f6a379cab
@ -847,8 +847,8 @@ ParallelArrayObject::initClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
JSProtoKey key = JSProto_ParallelArray;
|
JSProtoKey key = JSProto_ParallelArray;
|
||||||
Rooted<PropertyName*> name(cx, cx->runtime->atomState.ParallelArrayAtom);
|
RootedFunction ctor(cx);
|
||||||
RootedFunction ctor(cx, global->createConstructor(cx, construct, name, 0));
|
ctor = global->createConstructor(cx, construct, cx->names().ParallelArray, 0);
|
||||||
if (!ctor ||
|
if (!ctor ||
|
||||||
!LinkConstructorAndPrototype(cx, ctor, proto) ||
|
!LinkConstructorAndPrototype(cx, ctor, proto) ||
|
||||||
!DefinePropertiesAndBrand(cx, proto, NULL, methods) ||
|
!DefinePropertiesAndBrand(cx, proto, NULL, methods) ||
|
||||||
@ -858,8 +858,8 @@ ParallelArrayObject::initClass(JSContext *cx, JSObject *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define the length and shape properties.
|
// Define the length and shape properties.
|
||||||
RootedId lengthId(cx, AtomToId(cx->runtime->atomState.lengthAtom));
|
RootedId lengthId(cx, AtomToId(cx->names().length));
|
||||||
RootedId shapeId(cx, AtomToId(cx->runtime->atomState.shapeAtom));
|
RootedId shapeId(cx, AtomToId(cx->names().shape));
|
||||||
unsigned flags = JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_GETTER;
|
unsigned flags = JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_GETTER;
|
||||||
|
|
||||||
JSObject *scriptedLength = js_NewFunction(cx, NULL, NonGenericMethod<lengthGetter>,
|
JSObject *scriptedLength = js_NewFunction(cx, NULL, NonGenericMethod<lengthGetter>,
|
||||||
@ -1533,7 +1533,7 @@ ParallelArrayObject::toStringBufferImpl(JSContext *cx, IndexInfo &iv, bool useLo
|
|||||||
if (!robj)
|
if (!robj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.toLocaleStringAtom);
|
id = NameToId(cx->names().toLocaleString);
|
||||||
if (!robj->callMethod(cx, id, 0, NULL, &localeElem) ||
|
if (!robj->callMethod(cx, id, 0, NULL, &localeElem) ||
|
||||||
!ValueToStringBuffer(cx, localeElem, sb))
|
!ValueToStringBuffer(cx, localeElem, sb))
|
||||||
{
|
{
|
||||||
@ -1611,7 +1611,7 @@ ParallelArrayObject::lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
|||||||
if (js_IdIsIndex(id, &i))
|
if (js_IdIsIndex(id, &i))
|
||||||
return lookupElement(cx, obj, i, objp, propp);
|
return lookupElement(cx, obj, i, objp, propp);
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
MarkNonNativePropertyFound(obj, propp);
|
MarkNonNativePropertyFound(obj, propp);
|
||||||
objp.set(obj);
|
objp.set(obj);
|
||||||
return true;
|
return true;
|
||||||
@ -1718,7 +1718,7 @@ JSBool
|
|||||||
ParallelArrayObject::getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
|
ParallelArrayObject::getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
|
||||||
HandlePropertyName name, MutableHandleValue vp)
|
HandlePropertyName name, MutableHandleValue vp)
|
||||||
{
|
{
|
||||||
if (name == cx->runtime->atomState.lengthAtom) {
|
if (name == cx->names().length) {
|
||||||
vp.setNumber(as(obj)->outermostDimension());
|
vp.setNumber(as(obj)->outermostDimension());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1789,7 +1789,7 @@ JSBool
|
|||||||
ParallelArrayObject::getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id,
|
ParallelArrayObject::getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id,
|
||||||
unsigned *attrsp)
|
unsigned *attrsp)
|
||||||
{
|
{
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
if (JSID_IS_ATOM(id, cx->names().length))
|
||||||
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
||||||
else
|
else
|
||||||
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_ENUMERATE;
|
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_ENUMERATE;
|
||||||
@ -1801,7 +1801,7 @@ JSBool
|
|||||||
ParallelArrayObject::getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
ParallelArrayObject::getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||||
unsigned *attrsp)
|
unsigned *attrsp)
|
||||||
{
|
{
|
||||||
if (name == cx->runtime->atomState.lengthAtom)
|
if (name == cx->names().length)
|
||||||
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1892,7 +1892,7 @@ ParallelArrayObject::enumerate(JSContext *cx, HandleObject obj, unsigned flags,
|
|||||||
{
|
{
|
||||||
RootedParallelArrayObject source(cx, as(obj));
|
RootedParallelArrayObject source(cx, as(obj));
|
||||||
|
|
||||||
if (flags & JSITER_HIDDEN && !props->append(NameToId(cx->runtime->atomState.lengthAtom)))
|
if (flags & JSITER_HIDDEN && !props->append(NameToId(cx->names().length)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// ParallelArray objects have no holes.
|
// ParallelArray objects have no holes.
|
||||||
|
@ -37,16 +37,14 @@ class RegExpMatchBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool setIndex(int index) {
|
bool setIndex(int index) {
|
||||||
Rooted<PropertyName*> name(cx, cx->runtime->atomState.indexAtom);
|
|
||||||
RootedValue value(cx, Int32Value(index));
|
RootedValue value(cx, Int32Value(index));
|
||||||
return setProperty(name, value);
|
return setProperty(cx->names().index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setInput(JSString *str) {
|
bool setInput(JSString *str) {
|
||||||
JS_ASSERT(str);
|
JS_ASSERT(str);
|
||||||
Rooted<PropertyName*> name(cx, cx->runtime->atomState.inputAtom);
|
|
||||||
RootedValue value(cx, StringValue(str));
|
RootedValue value(cx, StringValue(str));
|
||||||
return setProperty(name, value);
|
return setProperty(cx->names().input, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -244,7 +242,7 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args)
|
|||||||
* to executing RegExpObject::getSource on the unwrapped object.
|
* to executing RegExpObject::getSource on the unwrapped object.
|
||||||
*/
|
*/
|
||||||
RootedValue v(cx);
|
RootedValue v(cx);
|
||||||
if (!JSObject::getProperty(cx, sourceObj, sourceObj, cx->runtime->atomState.sourceAtom, &v))
|
if (!JSObject::getProperty(cx, sourceObj, sourceObj, cx->names().source, &v))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Rooted<JSAtom*> sourceAtom(cx, &v.toString()->asAtom());
|
Rooted<JSAtom*> sourceAtom(cx, &v.toString()->asAtom());
|
||||||
@ -493,8 +491,8 @@ js_InitRegExpClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
proto->setPrivate(NULL);
|
proto->setPrivate(NULL);
|
||||||
|
|
||||||
|
HandlePropertyName empty = cx->names().empty;
|
||||||
RegExpObjectBuilder builder(cx, &proto->asRegExp());
|
RegExpObjectBuilder builder(cx, &proto->asRegExp());
|
||||||
Rooted<JSAtom*> empty(cx, cx->runtime->emptyString);
|
|
||||||
if (!builder.build(empty, RegExpFlag(0)))
|
if (!builder.build(empty, RegExpFlag(0)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -502,7 +500,7 @@ js_InitRegExpClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, regexp_construct, cx->runtime->atomState.RegExpAtom, 2);
|
ctor = global->createConstructor(cx, regexp_construct, cx->names().RegExp, 2);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
|
|||||||
|
|
||||||
// It's an error to use |arguments| in a function that has a rest parameter.
|
// It's an error to use |arguments| in a function that has a rest parameter.
|
||||||
if (callerFrame && callerFrame->isFunctionFrame() && callerFrame->fun()->hasRest()) {
|
if (callerFrame && callerFrame->isFunctionFrame() && callerFrame->fun()->hasRest()) {
|
||||||
PropertyName *arguments = cx->runtime->atomState.argumentsAtom;
|
HandlePropertyName arguments = cx->names().arguments;
|
||||||
for (AtomDefnRange r = pc.lexdeps->all(); !r.empty(); r.popFront()) {
|
for (AtomDefnRange r = pc.lexdeps->all(); !r.empty(); r.popFront()) {
|
||||||
if (r.front().key() == arguments) {
|
if (r.front().key() == arguments) {
|
||||||
parser.reportError(NULL, JSMSG_ARGUMENTS_AND_REST);
|
parser.reportError(NULL, JSMSG_ARGUMENTS_AND_REST);
|
||||||
|
@ -772,7 +772,7 @@ EmitAtomOp(JSContext *cx, JSAtom *atom, JSOp op, BytecodeEmitter *bce)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
|
JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
|
||||||
|
|
||||||
if (op == JSOP_GETPROP && atom == cx->runtime->atomState.lengthAtom) {
|
if (op == JSOP_GETPROP && atom == cx->names().length) {
|
||||||
/* Specialize length accesses for the interpreter. */
|
/* Specialize length accesses for the interpreter. */
|
||||||
op = JSOP_LENGTH;
|
op = JSOP_LENGTH;
|
||||||
}
|
}
|
||||||
@ -2626,7 +2626,7 @@ frontend::EmitFunctionScript(JSContext *cx, BytecodeEmitter *bce, ParseNode *bod
|
|||||||
if (bce->script->varIsAliased(varIndex)) {
|
if (bce->script->varIsAliased(varIndex)) {
|
||||||
ScopeCoordinate sc;
|
ScopeCoordinate sc;
|
||||||
sc.hops = 0;
|
sc.hops = 0;
|
||||||
sc.slot = AliasedNameToSlot(bce->script, cx->runtime->atomState.argumentsAtom);
|
sc.slot = AliasedNameToSlot(bce->script, cx->names().arguments);
|
||||||
if (!EmitAliasedVarOp(cx, JSOP_SETALIASEDVAR, sc, bce))
|
if (!EmitAliasedVarOp(cx, JSOP_SETALIASEDVAR, sc, bce))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -3553,7 +3553,7 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
|
|||||||
case PNK_DOT: {
|
case PNK_DOT: {
|
||||||
if (Emit1(cx, bce, JSOP_DUP) < 0)
|
if (Emit1(cx, bce, JSOP_DUP) < 0)
|
||||||
return false;
|
return false;
|
||||||
bool isLength = (lhs->pn_atom == cx->runtime->atomState.lengthAtom);
|
bool isLength = (lhs->pn_atom == cx->names().length);
|
||||||
if (!EmitIndex32(cx, isLength ? JSOP_LENGTH : JSOP_GETPROP, atomIndex, bce))
|
if (!EmitIndex32(cx, isLength ? JSOP_LENGTH : JSOP_GETPROP, atomIndex, bce))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
@ -3776,7 +3776,7 @@ ParseNode::getConstantValue(JSContext *cx, bool strictChecks, Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(pnid->isKind(PNK_NAME) || pnid->isKind(PNK_STRING));
|
JS_ASSERT(pnid->isKind(PNK_NAME) || pnid->isKind(PNK_STRING));
|
||||||
JS_ASSERT(pnid->pn_atom != cx->runtime->atomState.protoAtom);
|
JS_ASSERT(pnid->pn_atom != cx->names().proto);
|
||||||
RootedId id(cx, AtomToId(pnid->pn_atom));
|
RootedId id(cx, AtomToId(pnid->pn_atom));
|
||||||
if (!DefineNativeProperty(cx, obj, id, value, NULL, NULL,
|
if (!DefineNativeProperty(cx, obj, id, value, NULL, NULL,
|
||||||
JSPROP_ENUMERATE, 0, 0)) {
|
JSPROP_ENUMERATE, 0, 0)) {
|
||||||
@ -4356,9 +4356,9 @@ EmitXMLTag(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
|
|
||||||
{
|
{
|
||||||
jsatomid index;
|
jsatomid index;
|
||||||
JSAtom *tagAtom = (pn->isKind(PNK_XMLETAGO))
|
HandlePropertyName tagAtom = (pn->isKind(PNK_XMLETAGO))
|
||||||
? cx->runtime->atomState.etagoAtom
|
? cx->names().etago
|
||||||
: cx->runtime->atomState.stagoAtom;
|
: cx->names().stago;
|
||||||
if (!bce->makeAtomIndex(tagAtom, &index))
|
if (!bce->makeAtomIndex(tagAtom, &index))
|
||||||
return false;
|
return false;
|
||||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||||
@ -4390,8 +4390,9 @@ EmitXMLTag(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
|
|
||||||
{
|
{
|
||||||
jsatomid index;
|
jsatomid index;
|
||||||
JSAtom *tmp = (pn->isKind(PNK_XMLPTAGC)) ? cx->runtime->atomState.ptagcAtom
|
HandlePropertyName tmp = pn->isKind(PNK_XMLPTAGC)
|
||||||
: cx->runtime->atomState.tagcAtom;
|
? cx->names().ptagc
|
||||||
|
: cx->names().tagc;
|
||||||
if (!bce->makeAtomIndex(tmp, &index))
|
if (!bce->makeAtomIndex(tmp, &index))
|
||||||
return false;
|
return false;
|
||||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||||
@ -5351,7 +5352,7 @@ EmitCallOrNew(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
|
|||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case PNK_INTRINSICNAME:
|
case PNK_INTRINSICNAME:
|
||||||
if (pn2->name() == cx->runtime->atomState._CallFunctionAtom)
|
if (pn2->name() == cx->names()._CallFunction)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Special-casing of %_CallFunction to emit bytecode that directly
|
* Special-casing of %_CallFunction to emit bytecode that directly
|
||||||
@ -5800,7 +5801,7 @@ EmitObject(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
* Disable NEWOBJECT on initializers that set __proto__, which has
|
* Disable NEWOBJECT on initializers that set __proto__, which has
|
||||||
* a non-standard setter on objects.
|
* a non-standard setter on objects.
|
||||||
*/
|
*/
|
||||||
if (pn3->pn_atom == cx->runtime->atomState.protoAtom)
|
if (pn3->pn_atom == cx->names().proto)
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
op = JSOP_INITPROP;
|
op = JSOP_INITPROP;
|
||||||
|
|
||||||
@ -6545,9 +6546,8 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
if (pn->pn_xflags & PNX_XMLROOT) {
|
if (pn->pn_xflags & PNX_XMLROOT) {
|
||||||
if (pn->pn_count == 0) {
|
if (pn->pn_count == 0) {
|
||||||
JS_ASSERT(pn->isKind(PNK_XMLLIST));
|
JS_ASSERT(pn->isKind(PNK_XMLLIST));
|
||||||
JSAtom *atom = cx->runtime->atomState.emptyAtom;
|
|
||||||
jsatomid index;
|
jsatomid index;
|
||||||
if (!bce->makeAtomIndex(atom, &index))
|
if (!bce->makeAtomIndex(cx->names().empty, &index))
|
||||||
return false;
|
return false;
|
||||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||||
return false;
|
return false;
|
||||||
|
@ -201,9 +201,9 @@ FoldXMLConstants(JSContext *cx, ParseNode *pn, Parser *parser)
|
|||||||
RootedString str(cx);
|
RootedString str(cx);
|
||||||
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
||||||
if (kind == PNK_XMLETAGO)
|
if (kind == PNK_XMLETAGO)
|
||||||
accum = cx->runtime->atomState.etagoAtom;
|
accum = cx->names().etago;
|
||||||
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLPTAGC)
|
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLPTAGC)
|
||||||
accum = cx->runtime->atomState.stagoAtom;
|
accum = cx->names().stago;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -307,9 +307,9 @@ FoldXMLConstants(JSContext *cx, ParseNode *pn, Parser *parser)
|
|||||||
str = NULL;
|
str = NULL;
|
||||||
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
||||||
if (kind == PNK_XMLPTAGC)
|
if (kind == PNK_XMLPTAGC)
|
||||||
str = cx->runtime->atomState.ptagcAtom;
|
str = cx->names().ptagc;
|
||||||
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLETAGO)
|
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLETAGO)
|
||||||
str = cx->runtime->atomState.tagcAtom;
|
str = cx->names().tagc;
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
accum = js_ConcatStrings(cx, accum, str);
|
accum = js_ConcatStrings(cx, accum, str);
|
||||||
|
@ -174,7 +174,7 @@ ParseContext::define(JSContext *cx, PropertyName *name, ParseNode *pn, Definitio
|
|||||||
return false;
|
return false;
|
||||||
if (!args_.append(dn))
|
if (!args_.append(dn))
|
||||||
return false;
|
return false;
|
||||||
if (name == cx->runtime->atomState.emptyAtom)
|
if (name == cx->names().empty)
|
||||||
break;
|
break;
|
||||||
if (!decls_.addUnique(name, dn))
|
if (!decls_.addUnique(name, dn))
|
||||||
return false;
|
return false;
|
||||||
@ -696,8 +696,7 @@ CheckStrictAssignment(JSContext *cx, Parser *parser, ParseNode *lhs)
|
|||||||
{
|
{
|
||||||
if (parser->pc->sc->needStrictChecks() && lhs->isKind(PNK_NAME)) {
|
if (parser->pc->sc->needStrictChecks() && lhs->isKind(PNK_NAME)) {
|
||||||
JSAtom *atom = lhs->pn_atom;
|
JSAtom *atom = lhs->pn_atom;
|
||||||
JSAtomState *atomState = &cx->runtime->atomState;
|
if (atom == cx->names().eval || atom == cx->names().arguments) {
|
||||||
if (atom == atomState->evalAtom || atom == atomState->argumentsAtom) {
|
|
||||||
JSAutoByteString name;
|
JSAutoByteString name;
|
||||||
if (!js_AtomToPrintableString(cx, atom, &name) ||
|
if (!js_AtomToPrintableString(cx, atom, &name) ||
|
||||||
!parser->reportStrictModeError(lhs, JSMSG_DEPRECATED_ASSIGN, name.ptr()))
|
!parser->reportStrictModeError(lhs, JSMSG_DEPRECATED_ASSIGN, name.ptr()))
|
||||||
@ -721,9 +720,8 @@ CheckStrictBinding(JSContext *cx, Parser *parser, HandlePropertyName name, Parse
|
|||||||
if (!parser->pc->sc->needStrictChecks())
|
if (!parser->pc->sc->needStrictChecks())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
JSAtomState *atomState = &cx->runtime->atomState;
|
if (name == cx->names().eval ||
|
||||||
if (name == atomState->evalAtom ||
|
name == cx->names().arguments ||
|
||||||
name == atomState->argumentsAtom ||
|
|
||||||
FindKeyword(name->charsZ(), name->length()))
|
FindKeyword(name->charsZ(), name->length()))
|
||||||
{
|
{
|
||||||
JSAutoByteString bytes;
|
JSAutoByteString bytes;
|
||||||
@ -790,7 +788,7 @@ Parser::functionBody(FunctionBodyType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Time to implement the odd semantics of 'arguments'. */
|
/* Time to implement the odd semantics of 'arguments'. */
|
||||||
Rooted<PropertyName*> arguments(context, context->runtime->atomState.argumentsAtom);
|
Handle<PropertyName*> arguments = context->names().arguments;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Non-top-level functions use JSOP_DEFFUN which is a dynamic scope
|
* Non-top-level functions use JSOP_DEFFUN which is a dynamic scope
|
||||||
@ -1425,7 +1423,7 @@ Parser::functionArguments(ParseNode **listp, ParseNode* funcpn, bool &hasRest)
|
|||||||
* anonymous positional parameter into the destructuring
|
* anonymous positional parameter into the destructuring
|
||||||
* left-hand-side expression and accumulate it in list.
|
* left-hand-side expression and accumulate it in list.
|
||||||
*/
|
*/
|
||||||
PropertyName *name = context->runtime->atomState.emptyAtom;
|
HandlePropertyName name = context->names().empty;
|
||||||
ParseNode *rhs = NameNode::create(PNK_NAME, name, this, this->pc);
|
ParseNode *rhs = NameNode::create(PNK_NAME, name, this, this->pc);
|
||||||
if (!rhs)
|
if (!rhs)
|
||||||
return false;
|
return false;
|
||||||
@ -1912,7 +1910,7 @@ Parser::processDirectives(ParseNode *stmts)
|
|||||||
tokenStream.matchToken(TOK_SEMI);
|
tokenStream.matchToken(TOK_SEMI);
|
||||||
if (isDirective) {
|
if (isDirective) {
|
||||||
// It's a directive. Is it one we know?
|
// It's a directive. Is it one we know?
|
||||||
if (atom == context->runtime->atomState.useStrictAtom && !gotStrictMode) {
|
if (atom == context->names().useStrict && !gotStrictMode) {
|
||||||
pc->sc->setExplicitUseStrict();
|
pc->sc->setExplicitUseStrict();
|
||||||
if (!setStrictMode(true))
|
if (!setStrictMode(true))
|
||||||
return false;
|
return false;
|
||||||
@ -2953,7 +2951,7 @@ Parser::matchInOrOf(bool *isForOfp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tokenStream.matchToken(TOK_NAME)) {
|
if (tokenStream.matchToken(TOK_NAME)) {
|
||||||
if (tokenStream.currentToken().name() == context->runtime->atomState.ofAtom) {
|
if (tokenStream.currentToken().name() == context->names().of) {
|
||||||
*isForOfp = true;
|
*isForOfp = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2978,7 +2976,7 @@ Parser::forStatement()
|
|||||||
pn->setOp(JSOP_ITER);
|
pn->setOp(JSOP_ITER);
|
||||||
pn->pn_iflags = 0;
|
pn->pn_iflags = 0;
|
||||||
if (tokenStream.matchToken(TOK_NAME)) {
|
if (tokenStream.matchToken(TOK_NAME)) {
|
||||||
if (tokenStream.currentToken().name() == context->runtime->atomState.eachAtom)
|
if (tokenStream.currentToken().name() == context->names().each)
|
||||||
pn->pn_iflags = JSITER_FOREACH;
|
pn->pn_iflags = JSITER_FOREACH;
|
||||||
else
|
else
|
||||||
tokenStream.ungetToken();
|
tokenStream.ungetToken();
|
||||||
@ -5161,7 +5159,7 @@ Parser::comprehensionTail(ParseNode *kid, unsigned blockid, bool isGenexp,
|
|||||||
pn2->setOp(JSOP_ITER);
|
pn2->setOp(JSOP_ITER);
|
||||||
pn2->pn_iflags = JSITER_ENUMERATE;
|
pn2->pn_iflags = JSITER_ENUMERATE;
|
||||||
if (tokenStream.matchToken(TOK_NAME)) {
|
if (tokenStream.matchToken(TOK_NAME)) {
|
||||||
if (tokenStream.currentToken().name() == context->runtime->atomState.eachAtom)
|
if (tokenStream.currentToken().name() == context->names().each)
|
||||||
pn2->pn_iflags |= JSITER_FOREACH;
|
pn2->pn_iflags |= JSITER_FOREACH;
|
||||||
else
|
else
|
||||||
tokenStream.ungetToken();
|
tokenStream.ungetToken();
|
||||||
@ -5392,8 +5390,7 @@ Parser::generatorExpr(ParseNode *kid)
|
|||||||
genfn->pn_pos.begin = body->pn_pos.begin = kid->pn_pos.begin;
|
genfn->pn_pos.begin = body->pn_pos.begin = kid->pn_pos.begin;
|
||||||
genfn->pn_pos.end = body->pn_pos.end = tokenStream.currentToken().pos.end;
|
genfn->pn_pos.end = body->pn_pos.end = tokenStream.currentToken().pos.end;
|
||||||
|
|
||||||
JSAtom *arguments = context->runtime->atomState.argumentsAtom;
|
if (AtomDefnPtr p = genpc.lexdeps->lookup(context->names().arguments)) {
|
||||||
if (AtomDefnPtr p = genpc.lexdeps->lookup(arguments)) {
|
|
||||||
Definition *dn = p.value();
|
Definition *dn = p.value();
|
||||||
ParseNode *errorNode = dn->dn_uses ? dn->dn_uses : body;
|
ParseNode *errorNode = dn->dn_uses ? dn->dn_uses : body;
|
||||||
reportError(errorNode, JSMSG_BAD_GENEXP_BODY, js_arguments_str);
|
reportError(errorNode, JSMSG_BAD_GENEXP_BODY, js_arguments_str);
|
||||||
@ -5695,7 +5692,7 @@ Parser::memberExpr(bool allowCallSyntax)
|
|||||||
nextMember->setOp(JSOP_CALL);
|
nextMember->setOp(JSOP_CALL);
|
||||||
|
|
||||||
if (lhs->isOp(JSOP_NAME)) {
|
if (lhs->isOp(JSOP_NAME)) {
|
||||||
if (lhs->pn_atom == context->runtime->atomState.evalAtom) {
|
if (lhs->pn_atom == context->names().eval) {
|
||||||
/* Select JSOP_EVAL and flag pc as heavyweight. */
|
/* Select JSOP_EVAL and flag pc as heavyweight. */
|
||||||
nextMember->setOp(JSOP_EVAL);
|
nextMember->setOp(JSOP_EVAL);
|
||||||
pc->sc->setBindingsAccessedDynamically();
|
pc->sc->setBindingsAccessedDynamically();
|
||||||
@ -5709,9 +5706,9 @@ Parser::memberExpr(bool allowCallSyntax)
|
|||||||
}
|
}
|
||||||
} else if (lhs->isOp(JSOP_GETPROP)) {
|
} else if (lhs->isOp(JSOP_GETPROP)) {
|
||||||
/* Select JSOP_FUNAPPLY given foo.apply(...). */
|
/* Select JSOP_FUNAPPLY given foo.apply(...). */
|
||||||
if (lhs->pn_atom == context->runtime->atomState.applyAtom)
|
if (lhs->pn_atom == context->names().apply)
|
||||||
nextMember->setOp(JSOP_FUNAPPLY);
|
nextMember->setOp(JSOP_FUNAPPLY);
|
||||||
else if (lhs->pn_atom == context->runtime->atomState.callAtom)
|
else if (lhs->pn_atom == context->names().call)
|
||||||
nextMember->setOp(JSOP_FUNCALL);
|
nextMember->setOp(JSOP_FUNCALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5830,7 +5827,7 @@ Parser::propertySelector()
|
|||||||
if (!selector)
|
if (!selector)
|
||||||
return NULL;
|
return NULL;
|
||||||
selector->setOp(JSOP_ANYNAME);
|
selector->setOp(JSOP_ANYNAME);
|
||||||
selector->pn_atom = context->runtime->atomState.starAtom;
|
selector->pn_atom = context->names().star;
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(tokenStream.isCurrentTokenType(TOK_NAME));
|
JS_ASSERT(tokenStream.isCurrentTokenType(TOK_NAME));
|
||||||
selector = NullaryNode::create(PNK_NAME, this);
|
selector = NullaryNode::create(PNK_NAME, this);
|
||||||
@ -5866,7 +5863,7 @@ Parser::qualifiedSuffix(ParseNode *pn)
|
|||||||
pn2->setOp(JSOP_QNAMECONST);
|
pn2->setOp(JSOP_QNAMECONST);
|
||||||
pn2->pn_pos.begin = pn->pn_pos.begin;
|
pn2->pn_pos.begin = pn->pn_pos.begin;
|
||||||
pn2->pn_atom = (tt == TOK_STAR)
|
pn2->pn_atom = (tt == TOK_STAR)
|
||||||
? context->runtime->atomState.starAtom
|
? context->names().star
|
||||||
: tokenStream.currentToken().name();
|
: tokenStream.currentToken().name();
|
||||||
pn2->pn_expr = pn;
|
pn2->pn_expr = pn;
|
||||||
pn2->pn_cookie.makeFree();
|
pn2->pn_cookie.makeFree();
|
||||||
@ -6465,7 +6462,7 @@ Parser::intrinsicName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertyName *name = tokenStream.currentToken().name();
|
PropertyName *name = tokenStream.currentToken().name();
|
||||||
if (!(name == context->runtime->atomState._CallFunctionAtom ||
|
if (!(name == context->names()._CallFunction ||
|
||||||
context->global()->hasIntrinsicFunction(context, name)))
|
context->global()->hasIntrinsicFunction(context, name)))
|
||||||
{
|
{
|
||||||
reportError(NULL, JSMSG_INTRINSIC_NOT_DEFINED, JS_EncodeString(context, name));
|
reportError(NULL, JSMSG_INTRINSIC_NOT_DEFINED, JS_EncodeString(context, name));
|
||||||
@ -6720,9 +6717,9 @@ Parser::primaryExpr(TokenKind tt, bool afterDoubleDot)
|
|||||||
case TOK_NAME:
|
case TOK_NAME:
|
||||||
{
|
{
|
||||||
atom = tokenStream.currentToken().name();
|
atom = tokenStream.currentToken().name();
|
||||||
if (atom == context->runtime->atomState.getAtom) {
|
if (atom == context->names().get) {
|
||||||
op = JSOP_GETTER;
|
op = JSOP_GETTER;
|
||||||
} else if (atom == context->runtime->atomState.setAtom) {
|
} else if (atom == context->names().set) {
|
||||||
op = JSOP_SETTER;
|
op = JSOP_SETTER;
|
||||||
} else {
|
} else {
|
||||||
pn3 = NullaryNode::create(PNK_NAME, this);
|
pn3 = NullaryNode::create(PNK_NAME, this);
|
||||||
@ -6821,7 +6818,7 @@ Parser::primaryExpr(TokenKind tt, bool afterDoubleDot)
|
|||||||
* so that we can later assume singleton objects delegate to
|
* so that we can later assume singleton objects delegate to
|
||||||
* the default Object.prototype.
|
* the default Object.prototype.
|
||||||
*/
|
*/
|
||||||
if (!pnval->isConstant() || atom == context->runtime->atomState.protoAtom)
|
if (!pnval->isConstant() || atom == context->names().proto)
|
||||||
pn->pn_xflags |= PNX_NONCONST;
|
pn->pn_xflags |= PNX_NONCONST;
|
||||||
}
|
}
|
||||||
#if JS_HAS_DESTRUCTURING_SHORTHAND
|
#if JS_HAS_DESTRUCTURING_SHORTHAND
|
||||||
|
@ -1041,7 +1041,7 @@ TokenStream::getXMLMarkup(TokenKind *ttp, Token **tpp)
|
|||||||
|
|
||||||
JSAtom *data;
|
JSAtom *data;
|
||||||
if (contentIndex < 0) {
|
if (contentIndex < 0) {
|
||||||
data = cx->runtime->atomState.emptyAtom;
|
data = cx->names().empty;
|
||||||
} else {
|
} else {
|
||||||
data = AtomizeChars(cx, tokenbuf.begin() + contentIndex,
|
data = AtomizeChars(cx, tokenbuf.begin() + contentIndex,
|
||||||
tokenbuf.length() - contentIndex);
|
tokenbuf.length() - contentIndex);
|
||||||
|
@ -3168,7 +3168,7 @@ CodeGenerator::visitOutOfLineCacheGetProperty(OutOfLineCache *ool)
|
|||||||
switch (ins->op()) {
|
switch (ins->op()) {
|
||||||
case LInstruction::LOp_InstanceOfO:
|
case LInstruction::LOp_InstanceOfO:
|
||||||
case LInstruction::LOp_InstanceOfV:
|
case LInstruction::LOp_InstanceOfV:
|
||||||
name = gen->compartment->rt->atomState.classPrototypeAtom;
|
name = gen->compartment->rt->atomState.classPrototype;
|
||||||
objReg = ToRegister(ins->getTemp(1));
|
objReg = ToRegister(ins->getTemp(1));
|
||||||
output = TypedOrValueRegister(MIRType_Object, ToAnyRegister(ins->getDef(0)));
|
output = TypedOrValueRegister(MIRType_Object, ToAnyRegister(ins->getDef(0)));
|
||||||
break;
|
break;
|
||||||
@ -3475,29 +3475,29 @@ CodeGenerator::visitTypeOfV(LTypeOfV *lir)
|
|||||||
|
|
||||||
Label notNumber;
|
Label notNumber;
|
||||||
masm.branchTestNumber(Assembler::NotEqual, tag, ¬Number);
|
masm.branchTestNumber(Assembler::NotEqual, tag, ¬Number);
|
||||||
masm.movePtr(ImmGCPtr(rt->atomState.numberAtom), output);
|
masm.movePtr(ImmGCPtr(rt->atomState.number), output);
|
||||||
masm.jump(&done);
|
masm.jump(&done);
|
||||||
masm.bind(¬Number);
|
masm.bind(¬Number);
|
||||||
|
|
||||||
Label notUndefined;
|
Label notUndefined;
|
||||||
masm.branchTestUndefined(Assembler::NotEqual, tag, ¬Undefined);
|
masm.branchTestUndefined(Assembler::NotEqual, tag, ¬Undefined);
|
||||||
masm.movePtr(ImmGCPtr(rt->atomState.undefinedAtom), output);
|
masm.movePtr(ImmGCPtr(rt->atomState.undefined), output);
|
||||||
masm.jump(&done);
|
masm.jump(&done);
|
||||||
masm.bind(¬Undefined);
|
masm.bind(¬Undefined);
|
||||||
|
|
||||||
Label notNull;
|
Label notNull;
|
||||||
masm.branchTestNull(Assembler::NotEqual, tag, ¬Null);
|
masm.branchTestNull(Assembler::NotEqual, tag, ¬Null);
|
||||||
masm.movePtr(ImmGCPtr(rt->atomState.objectAtom), output);
|
masm.movePtr(ImmGCPtr(rt->atomState.object), output);
|
||||||
masm.jump(&done);
|
masm.jump(&done);
|
||||||
masm.bind(¬Null);
|
masm.bind(¬Null);
|
||||||
|
|
||||||
Label notBoolean;
|
Label notBoolean;
|
||||||
masm.branchTestBoolean(Assembler::NotEqual, tag, ¬Boolean);
|
masm.branchTestBoolean(Assembler::NotEqual, tag, ¬Boolean);
|
||||||
masm.movePtr(ImmGCPtr(rt->atomState.booleanAtom), output);
|
masm.movePtr(ImmGCPtr(rt->atomState.boolean), output);
|
||||||
masm.jump(&done);
|
masm.jump(&done);
|
||||||
masm.bind(¬Boolean);
|
masm.bind(¬Boolean);
|
||||||
|
|
||||||
masm.movePtr(ImmGCPtr(rt->atomState.stringAtom), output);
|
masm.movePtr(ImmGCPtr(rt->atomState.string), output);
|
||||||
|
|
||||||
masm.bind(&done);
|
masm.bind(&done);
|
||||||
masm.bind(ool->rejoin());
|
masm.bind(ool->rejoin());
|
||||||
|
@ -3465,8 +3465,7 @@ IonBuilder::createThisScripted(MDefinition *callee)
|
|||||||
// This instruction MUST be idempotent: since it does not correspond to an
|
// This instruction MUST be idempotent: since it does not correspond to an
|
||||||
// explicit operation in the bytecode, we cannot use resumeAfter(). But
|
// explicit operation in the bytecode, we cannot use resumeAfter(). But
|
||||||
// calling GetProperty can trigger a GC, and thus invalidation.
|
// calling GetProperty can trigger a GC, and thus invalidation.
|
||||||
RootedPropertyName name(cx, cx->runtime->atomState.classPrototypeAtom);
|
MCallGetProperty *getProto = MCallGetProperty::New(callee, cx->names().classPrototype);
|
||||||
MCallGetProperty *getProto = MCallGetProperty::New(callee, name);
|
|
||||||
|
|
||||||
// Getters may not override |prototype| fetching, so this is repeatable.
|
// Getters may not override |prototype| fetching, so this is repeatable.
|
||||||
getProto->markUneffectful();
|
getProto->markUneffectful();
|
||||||
@ -3486,7 +3485,7 @@ IonBuilder::getSingletonPrototype(JSFunction *target)
|
|||||||
if (target->getType(cx)->unknownProperties())
|
if (target->getType(cx)->unknownProperties())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
jsid protoid = AtomToId(cx->runtime->atomState.classPrototypeAtom);
|
jsid protoid = NameToId(cx->names().classPrototype);
|
||||||
types::HeapTypeSet *protoTypes = target->getType(cx)->getProperty(cx, protoid, false);
|
types::HeapTypeSet *protoTypes = target->getType(cx)->getProperty(cx, protoid, false);
|
||||||
if (!protoTypes)
|
if (!protoTypes)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3679,7 +3678,7 @@ GetBuiltinRegExpTest(JSContext *cx, JSScript *script, JSFunction **result)
|
|||||||
// to avoid calling a getter.
|
// to avoid calling a getter.
|
||||||
RootedShape shape(cx);
|
RootedShape shape(cx);
|
||||||
RootedObject holder(cx);
|
RootedObject holder(cx);
|
||||||
if (!JSObject::lookupProperty(cx, proto, cx->runtime->atomState.testAtom, &holder, &shape))
|
if (!JSObject::lookupProperty(cx, proto, cx->names().test, &holder, &shape))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (proto != holder || !shape || !shape->hasDefaultGetter() || !shape->hasSlot())
|
if (proto != holder || !shape || !shape->hasDefaultGetter() || !shape->hasSlot())
|
||||||
@ -4612,11 +4611,11 @@ bool
|
|||||||
IonBuilder::jsop_getgname(HandlePropertyName name)
|
IonBuilder::jsop_getgname(HandlePropertyName name)
|
||||||
{
|
{
|
||||||
// Optimize undefined, NaN, and Infinity.
|
// Optimize undefined, NaN, and Infinity.
|
||||||
if (name == cx->runtime->atomState.undefinedAtom)
|
if (name == cx->names().undefined)
|
||||||
return pushConstant(UndefinedValue());
|
return pushConstant(UndefinedValue());
|
||||||
if (name == cx->runtime->atomState.NaNAtom)
|
if (name == cx->names().NaN)
|
||||||
return pushConstant(cx->runtime->NaNValue);
|
return pushConstant(cx->runtime->NaNValue);
|
||||||
if (name == cx->runtime->atomState.InfinityAtom)
|
if (name == cx->names().Infinity)
|
||||||
return pushConstant(cx->runtime->positiveInfinityValue);
|
return pushConstant(cx->runtime->positiveInfinityValue);
|
||||||
|
|
||||||
RootedObject globalObj(cx, &script->global());
|
RootedObject globalObj(cx, &script->global());
|
||||||
|
@ -131,7 +131,7 @@ InitProp(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue v
|
|||||||
RootedValue rval(cx, value);
|
RootedValue rval(cx, value);
|
||||||
RootedId id(cx, NameToId(name));
|
RootedId id(cx, NameToId(name));
|
||||||
|
|
||||||
if (name == cx->runtime->atomState.protoAtom)
|
if (name == cx->names().proto)
|
||||||
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false);
|
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false);
|
||||||
return !!DefineNativeProperty(cx, obj, id, rval, NULL, NULL, JSPROP_ENUMERATE, 0, 0, 0);
|
return !!DefineNativeProperty(cx, obj, id, rval, NULL, NULL, JSPROP_ENUMERATE, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1805,7 +1805,7 @@ typedef struct JSStdName {
|
|||||||
Class *clasp;
|
Class *clasp;
|
||||||
} JSStdName;
|
} JSStdName;
|
||||||
|
|
||||||
static PropertyName *
|
static Handle<PropertyName*>
|
||||||
StdNameToPropertyName(JSContext *cx, JSStdName *stdn)
|
StdNameToPropertyName(JSContext *cx, JSStdName *stdn)
|
||||||
{
|
{
|
||||||
return OFFSET_TO_NAME(cx->runtime, stdn->atomOffset);
|
return OFFSET_TO_NAME(cx->runtime, stdn->atomOffset);
|
||||||
@ -1955,7 +1955,7 @@ JS_ResolveStandardClass(JSContext *cx, JSObject *objArg, jsid id, JSBool *resolv
|
|||||||
idstr = JSID_TO_STRING(id);
|
idstr = JSID_TO_STRING(id);
|
||||||
|
|
||||||
/* Check whether we're resolving 'undefined', and define it if so. */
|
/* Check whether we're resolving 'undefined', and define it if so. */
|
||||||
atom = rt->atomState.undefinedAtom;
|
atom = rt->atomState.undefined;
|
||||||
if (idstr == atom) {
|
if (idstr == atom) {
|
||||||
*resolved = true;
|
*resolved = true;
|
||||||
RootedValue undefinedValue(cx, UndefinedValue());
|
RootedValue undefinedValue(cx, UndefinedValue());
|
||||||
@ -2048,7 +2048,7 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *objArg)
|
|||||||
* Check whether we need to bind 'undefined' and define it if so.
|
* Check whether we need to bind 'undefined' and define it if so.
|
||||||
* Since ES5 15.1.1.3 undefined can't be deleted.
|
* Since ES5 15.1.1.3 undefined can't be deleted.
|
||||||
*/
|
*/
|
||||||
RootedPropertyName undefinedName(cx, cx->runtime->atomState.undefinedAtom);
|
HandlePropertyName undefinedName = cx->names().undefined;
|
||||||
RootedValue undefinedValue(cx, UndefinedValue());
|
RootedValue undefinedValue(cx, UndefinedValue());
|
||||||
if (!obj->nativeContains(cx, undefinedName) &&
|
if (!obj->nativeContains(cx, undefinedName) &&
|
||||||
!JSObject::defineProperty(cx, obj, undefinedName, undefinedValue,
|
!JSObject::defineProperty(cx, obj, undefinedName, undefinedValue,
|
||||||
@ -2157,12 +2157,12 @@ JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *objArg, JSIdArray *
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether 'undefined' has been resolved and enumerate it if so. */
|
/* Check whether 'undefined' has been resolved and enumerate it if so. */
|
||||||
Rooted<PropertyName*> name(cx, rt->atomState.undefinedAtom);
|
ida = EnumerateIfResolved(cx, obj, cx->names().undefined, ida, &i, &found);
|
||||||
ida = EnumerateIfResolved(cx, obj, name, ida, &i, &found);
|
|
||||||
if (!ida)
|
if (!ida)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Enumerate only classes that *have* been resolved. */
|
/* Enumerate only classes that *have* been resolved. */
|
||||||
|
Rooted<PropertyName*> name(cx);
|
||||||
for (j = 0; standard_class_atoms[j].init; j++) {
|
for (j = 0; standard_class_atoms[j].init; j++) {
|
||||||
name = OFFSET_TO_NAME(rt, standard_class_atoms[j].atomOffset);
|
name = OFFSET_TO_NAME(rt, standard_class_atoms[j].atomOffset);
|
||||||
ida = EnumerateIfResolved(cx, obj, name, ida, &i, &found);
|
ida = EnumerateIfResolved(cx, obj, name, ida, &i, &found);
|
||||||
@ -3373,7 +3373,7 @@ JS_GetConstructor(JSContext *cx, JSObject *protoArg)
|
|||||||
{
|
{
|
||||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||||
|
|
||||||
if (!JSObject::getProperty(cx, proto, proto, cx->runtime->atomState.constructorAtom, &cval))
|
if (!JSObject::getProperty(cx, proto, proto, cx->names().constructor, &cval))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!IsFunctionObject(cval)) {
|
if (!IsFunctionObject(cval)) {
|
||||||
@ -6392,8 +6392,8 @@ JS_Stringify(JSContext *cx, jsval *vp, JSObject *replacerArg, jsval space,
|
|||||||
return false;
|
return false;
|
||||||
*vp = value;
|
*vp = value;
|
||||||
if (sb.empty()) {
|
if (sb.empty()) {
|
||||||
JSAtom *nullAtom = cx->runtime->atomState.nullAtom;
|
HandlePropertyName null = cx->names().null;
|
||||||
return callback(nullAtom->chars(), nullAtom->length(), data);
|
return callback(null->chars(), null->length(), data);
|
||||||
}
|
}
|
||||||
return callback(sb.begin(), sb.length(), data);
|
return callback(sb.begin(), sb.length(), data);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ GetLengthProperty(JSContext *cx, HandleObject obj, uint32_t *lengthp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RootedValue value(cx);
|
RootedValue value(cx);
|
||||||
if (!JSObject::getProperty(cx, obj, obj, cx->runtime->atomState.lengthAtom, &value))
|
if (!JSObject::getProperty(cx, obj, obj, cx->names().length, &value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (value.isInt32()) {
|
if (value.isInt32()) {
|
||||||
@ -491,7 +491,7 @@ js::SetLengthProperty(JSContext *cx, HandleObject obj, double length)
|
|||||||
RootedValue v(cx, NumberValue(length));
|
RootedValue v(cx, NumberValue(length));
|
||||||
|
|
||||||
/* We don't support read-only array length yet. */
|
/* We don't support read-only array length yet. */
|
||||||
return JSObject::setProperty(cx, obj, obj, cx->runtime->atomState.lengthAtom, &v, false);
|
return JSObject::setProperty(cx, obj, obj, cx->names().length, &v, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -518,7 +518,7 @@ static JSBool
|
|||||||
array_length_setter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp)
|
array_length_setter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp)
|
||||||
{
|
{
|
||||||
if (!obj->isArray()) {
|
if (!obj->isArray()) {
|
||||||
return JSObject::defineProperty(cx, obj, cx->runtime->atomState.lengthAtom, vp,
|
return JSObject::defineProperty(cx, obj, cx->names().length, vp,
|
||||||
NULL, NULL, JSPROP_ENUMERATE);
|
NULL, NULL, JSPROP_ENUMERATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ IsDenseArrayId(JSContext *cx, JSObject *obj, jsid id)
|
|||||||
JS_ASSERT(obj->isDenseArray());
|
JS_ASSERT(obj->isDenseArray());
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
return JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom) ||
|
return JSID_IS_ATOM(id, cx->names().length) ||
|
||||||
(js_IdIsIndex(id, &i) && IsDenseArrayIndex(obj, i));
|
(js_IdIsIndex(id, &i) && IsDenseArrayIndex(obj, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ js_GetDenseArrayElementValue(JSContext *cx, HandleObject obj, jsid id, Value *vp
|
|||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
if (!js_IdIsIndex(id, &i)) {
|
if (!js_IdIsIndex(id, &i)) {
|
||||||
JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom));
|
JS_ASSERT(JSID_IS_ATOM(id, cx->names().length));
|
||||||
vp->setNumber(obj->getArrayLength());
|
vp->setNumber(obj->getArrayLength());
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
@ -706,7 +706,7 @@ static JSBool
|
|||||||
array_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name,
|
array_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name,
|
||||||
MutableHandleValue vp)
|
MutableHandleValue vp)
|
||||||
{
|
{
|
||||||
if (name == cx->runtime->atomState.lengthAtom) {
|
if (name == cx->names().length) {
|
||||||
vp.setNumber(obj->getArrayLength());
|
vp.setNumber(obj->getArrayLength());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ static JSBool
|
|||||||
array_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
array_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||||
MutableHandleValue vp, JSBool strict)
|
MutableHandleValue vp, JSBool strict)
|
||||||
{
|
{
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
if (JSID_IS_ATOM(id, cx->names().length))
|
||||||
return array_length_setter(cx, obj, id, strict, vp);
|
return array_length_setter(cx, obj, id, strict, vp);
|
||||||
|
|
||||||
if (!obj->isDenseArray())
|
if (!obj->isDenseArray())
|
||||||
@ -922,7 +922,7 @@ static JSBool
|
|||||||
array_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
|
array_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
|
||||||
JSPropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
JSPropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||||
{
|
{
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
if (JSID_IS_ATOM(id, cx->names().length))
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
|
||||||
if (!obj->isDenseArray())
|
if (!obj->isDenseArray())
|
||||||
@ -1015,7 +1015,7 @@ array_defineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, Handle
|
|||||||
static JSBool
|
static JSBool
|
||||||
array_getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
|
array_getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
|
||||||
{
|
{
|
||||||
*attrsp = JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)
|
*attrsp = JSID_IS_ATOM(id, cx->names().length)
|
||||||
? JSPROP_PERMANENT : JSPROP_ENUMERATE;
|
? JSPROP_PERMANENT : JSPROP_ENUMERATE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1023,7 +1023,7 @@ array_getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigne
|
|||||||
static JSBool
|
static JSBool
|
||||||
array_getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name, unsigned *attrsp)
|
array_getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name, unsigned *attrsp)
|
||||||
{
|
{
|
||||||
*attrsp = (name == cx->runtime->atomState.lengthAtom)
|
*attrsp = (name == cx->names().length)
|
||||||
? JSPROP_PERMANENT
|
? JSPROP_PERMANENT
|
||||||
: JSPROP_ENUMERATE;
|
: JSPROP_ENUMERATE;
|
||||||
return true;
|
return true;
|
||||||
@ -1078,7 +1078,7 @@ array_deleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
|||||||
if (!obj->isDenseArray())
|
if (!obj->isDenseArray())
|
||||||
return baseops::DeleteProperty(cx, obj, name, rval, strict);
|
return baseops::DeleteProperty(cx, obj, name, rval, strict);
|
||||||
|
|
||||||
if (name == cx->runtime->atomState.lengthAtom) {
|
if (name == cx->names().length) {
|
||||||
rval.setBoolean(false);
|
rval.setBoolean(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1241,7 +1241,7 @@ AddLengthProperty(JSContext *cx, HandleObject obj)
|
|||||||
* as accesses to 'length' will use the elements header.
|
* as accesses to 'length' will use the elements header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RootedId lengthId(cx, NameToId(cx->runtime->atomState.lengthAtom));
|
RootedId lengthId(cx, NameToId(cx->names().length));
|
||||||
JS_ASSERT(!obj->nativeLookup(cx, lengthId));
|
JS_ASSERT(!obj->nativeLookup(cx, lengthId));
|
||||||
|
|
||||||
if (!obj->allocateSlowArrayElements(cx))
|
if (!obj->allocateSlowArrayElements(cx))
|
||||||
@ -1459,7 +1459,7 @@ array_join_sub(JSContext *cx, CallArgs &args, bool locale)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (detector.foundCycle()) {
|
if (detector.foundCycle()) {
|
||||||
args.rval().setString(cx->runtime->atomState.emptyAtom);
|
args.rval().setString(cx->names().empty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1540,7 +1540,7 @@ array_join_sub(JSContext *cx, CallArgs &args, bool locale)
|
|||||||
JSObject *robj = ToObject(cx, elt);
|
JSObject *robj = ToObject(cx, elt);
|
||||||
if (!robj)
|
if (!robj)
|
||||||
return false;
|
return false;
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.toLocaleStringAtom));
|
RootedId id(cx, NameToId(cx->names().toLocaleString));
|
||||||
if (!robj->callMethod(cx, id, 0, NULL, &elt))
|
if (!robj->callMethod(cx, id, 0, NULL, &elt))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1576,7 +1576,7 @@ array_toString(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
RootedValue join(cx, args.calleev());
|
RootedValue join(cx, args.calleev());
|
||||||
if (!JSObject::getProperty(cx, obj, obj, cx->runtime->atomState.joinAtom, &join))
|
if (!JSObject::getProperty(cx, obj, obj, cx->names().join, &join))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!js_IsCallable(join)) {
|
if (!js_IsCallable(join)) {
|
||||||
@ -3552,7 +3552,7 @@ js_InitArrayClass(JSContext *cx, JSObject *obj)
|
|||||||
arrayProto->setArrayLength(cx, 0);
|
arrayProto->setArrayLength(cx, 0);
|
||||||
|
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, js_Array, cx->runtime->atomState.ArrayAtom, 1);
|
ctor = global->createConstructor(cx, js_Array, cx->names().Array, 1);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -156,11 +156,11 @@ inline Handle<PropertyName*>
|
|||||||
TypeName(JSType type, JSRuntime *rt)
|
TypeName(JSType type, JSRuntime *rt)
|
||||||
{
|
{
|
||||||
JS_ASSERT(type < JSTYPE_LIMIT);
|
JS_ASSERT(type < JSTYPE_LIMIT);
|
||||||
JS_STATIC_ASSERT(offsetof(JSAtomState, undefinedAtom) +
|
JS_STATIC_ASSERT(offsetof(JSAtomState, undefined) +
|
||||||
JSTYPE_LIMIT * sizeof(FixedHeapPtr<PropertyName>) <=
|
JSTYPE_LIMIT * sizeof(FixedHeapPtr<PropertyName>) <=
|
||||||
sizeof(JSAtomState));
|
sizeof(JSAtomState));
|
||||||
JS_STATIC_ASSERT(JSTYPE_VOID == 0);
|
JS_STATIC_ASSERT(JSTYPE_VOID == 0);
|
||||||
return (&rt->atomState.undefinedAtom)[type];
|
return (&rt->atomState.undefined)[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Handle<PropertyName*>
|
inline Handle<PropertyName*>
|
||||||
@ -173,11 +173,11 @@ inline Handle<PropertyName*>
|
|||||||
ClassName(JSProtoKey key, JSContext *cx)
|
ClassName(JSProtoKey key, JSContext *cx)
|
||||||
{
|
{
|
||||||
JS_ASSERT(key < JSProto_LIMIT);
|
JS_ASSERT(key < JSProto_LIMIT);
|
||||||
JS_STATIC_ASSERT(offsetof(JSAtomState, NullAtom) +
|
JS_STATIC_ASSERT(offsetof(JSAtomState, Null) +
|
||||||
JSProto_LIMIT * sizeof(FixedHeapPtr<PropertyName>) <=
|
JSProto_LIMIT * sizeof(FixedHeapPtr<PropertyName>) <=
|
||||||
sizeof(JSAtomState));
|
sizeof(JSAtomState));
|
||||||
JS_STATIC_ASSERT(JSProto_Null == 0);
|
JS_STATIC_ASSERT(JSProto_Null == 0);
|
||||||
return (&cx->runtime->atomState.NullAtom)[key];
|
return (&cx->runtime->atomState.Null)[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
@ -154,8 +154,7 @@ js_InitBooleanClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
booleanProto->setFixedSlot(BooleanObject::PRIMITIVE_VALUE_SLOT, BooleanValue(false));
|
booleanProto->setFixedSlot(BooleanObject::PRIMITIVE_VALUE_SLOT, BooleanValue(false));
|
||||||
|
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx, global->createConstructor(cx, Boolean, cx->names().Boolean, 1));
|
||||||
ctor = global->createConstructor(cx, Boolean, cx->runtime->atomState.BooleanAtom, 1);
|
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -165,7 +164,7 @@ js_InitBooleanClass(JSContext *cx, JSObject *obj)
|
|||||||
if (!DefinePropertiesAndBrand(cx, booleanProto, NULL, boolean_methods))
|
if (!DefinePropertiesAndBrand(cx, booleanProto, NULL, boolean_methods))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Rooted<PropertyName*> valueOfName(cx, cx->runtime->atomState.valueOfAtom);
|
Handle<PropertyName*> valueOfName = cx->names().valueOf;
|
||||||
Rooted<JSFunction*> valueOf(cx,
|
Rooted<JSFunction*> valueOf(cx,
|
||||||
js_NewFunction(cx, NULL, bool_valueOf, 0, 0, global, valueOfName));
|
js_NewFunction(cx, NULL, bool_valueOf, 0, 0, global, valueOfName));
|
||||||
if (!valueOf)
|
if (!valueOf)
|
||||||
|
@ -382,25 +382,15 @@ struct RuntimeSizes;
|
|||||||
/* Various built-in or commonly-used names pinned on first context. */
|
/* Various built-in or commonly-used names pinned on first context. */
|
||||||
struct JSAtomState
|
struct JSAtomState
|
||||||
{
|
{
|
||||||
#define PROPERTYNAME_FIELD(idpart, id, text) \
|
#define PROPERTYNAME_FIELD(idpart, id, text) js::FixedHeapPtr<js::PropertyName> id;
|
||||||
union { \
|
|
||||||
js::FixedHeapPtr<js::PropertyName> idpart##Atom; \
|
|
||||||
js::FixedHeapPtr<js::PropertyName> id; \
|
|
||||||
};
|
|
||||||
FOR_EACH_COMMON_PROPERTYNAME(PROPERTYNAME_FIELD)
|
FOR_EACH_COMMON_PROPERTYNAME(PROPERTYNAME_FIELD)
|
||||||
#undef PROPERTYNAME_FIELD
|
#undef PROPERTYNAME_FIELD
|
||||||
#define PROPERTYNAME_FIELD(name, code, init) \
|
#define PROPERTYNAME_FIELD(name, code, init) js::FixedHeapPtr<js::PropertyName> name;
|
||||||
union { \
|
|
||||||
js::FixedHeapPtr<js::PropertyName> name##Atom; \
|
|
||||||
js::FixedHeapPtr<js::PropertyName> name; \
|
|
||||||
};
|
|
||||||
JS_FOR_EACH_PROTOTYPE(PROPERTYNAME_FIELD)
|
JS_FOR_EACH_PROTOTYPE(PROPERTYNAME_FIELD)
|
||||||
#undef PROPERTYNAME_FIELD
|
#undef PROPERTYNAME_FIELD
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ATOM(name) (cx->names().name)
|
#define NAME_OFFSET(name) offsetof(JSAtomState, name)
|
||||||
|
|
||||||
#define NAME_OFFSET(name) offsetof(JSAtomState, name##Atom)
|
|
||||||
#define OFFSET_TO_NAME(rt,off) (*(js::FixedHeapPtr<js::PropertyName>*)((char*)&(rt)->atomState + (off)))
|
#define OFFSET_TO_NAME(rt,off) (*(js::FixedHeapPtr<js::PropertyName>*)((char*)&(rt)->atomState + (off)))
|
||||||
|
|
||||||
struct JSRuntime : js::RuntimeFriendFields
|
struct JSRuntime : js::RuntimeFriendFields
|
||||||
|
@ -2609,7 +2609,7 @@ date_toJSON(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
|
|
||||||
/* Step 4. */
|
/* Step 4. */
|
||||||
RootedValue toISO(cx);
|
RootedValue toISO(cx);
|
||||||
if (!JSObject::getProperty(cx, obj, obj, cx->runtime->atomState.toISOStringAtom, &toISO))
|
if (!JSObject::getProperty(cx, obj, obj, cx->names().toISOString, &toISO))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Step 5. */
|
/* Step 5. */
|
||||||
@ -3161,7 +3161,7 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
|
|||||||
SetDateToNaN(cx, dateProto);
|
SetDateToNaN(cx, dateProto);
|
||||||
|
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, js_Date, cx->runtime->atomState.DateAtom, MAXARGS);
|
ctor = global->createConstructor(cx, js_Date, cx->names().Date, MAXARGS);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -3179,8 +3179,8 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
|
|||||||
if (!JS_DefineFunctions(cx, dateProto, date_methods))
|
if (!JS_DefineFunctions(cx, dateProto, date_methods))
|
||||||
return NULL;
|
return NULL;
|
||||||
RootedValue toUTCStringFun(cx);
|
RootedValue toUTCStringFun(cx);
|
||||||
RootedId toUTCStringId(cx, NameToId(cx->runtime->atomState.toUTCStringAtom));
|
RootedId toUTCStringId(cx, NameToId(cx->names().toUTCString));
|
||||||
RootedId toGMTStringId(cx, NameToId(cx->runtime->atomState.toGMTStringAtom));
|
RootedId toGMTStringId(cx, NameToId(cx->names().toGMTString));
|
||||||
if (!baseops::GetProperty(cx, dateProto, toUTCStringId, &toUTCStringFun) ||
|
if (!baseops::GetProperty(cx, dateProto, toUTCStringId, &toUTCStringFun) ||
|
||||||
!baseops::DefineGeneric(cx, dateProto, toGMTStringId, toUTCStringFun,
|
!baseops::DefineGeneric(cx, dateProto, toGMTStringId, toUTCStringFun,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub, 0))
|
JS_PropertyStub, JS_StrictPropertyStub, 0))
|
||||||
|
@ -39,7 +39,7 @@ JS_FRIEND_API(JSString *)
|
|||||||
JS_GetAnonymousString(JSRuntime *rt)
|
JS_GetAnonymousString(JSRuntime *rt)
|
||||||
{
|
{
|
||||||
JS_ASSERT(rt->hasContexts());
|
JS_ASSERT(rt->hasContexts());
|
||||||
return rt->atomState.anonymousAtom;
|
return rt->atomState.anonymous;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(JSObject *)
|
JS_FRIEND_API(JSObject *)
|
||||||
|
@ -108,7 +108,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu
|
|||||||
|
|
||||||
StackFrame *fp = iter.fp();
|
StackFrame *fp = iter.fp();
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.argumentsAtom)) {
|
if (JSID_IS_ATOM(id, cx->names().arguments)) {
|
||||||
if (fun->hasRest()) {
|
if (fun->hasRest()) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_FUNCTION_ARGUMENTS_AND_REST);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_FUNCTION_ARGUMENTS_AND_REST);
|
||||||
return false;
|
return false;
|
||||||
@ -141,7 +141,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu
|
|||||||
if (iter.isScript() && iter.isIon())
|
if (iter.isScript() && iter.isIon())
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.callerAtom) && fp && fp->prev()) {
|
if (JSID_IS_ATOM(id, cx->names().caller) && fp && fp->prev()) {
|
||||||
/*
|
/*
|
||||||
* If the frame was called from within an inlined frame, mark the
|
* If the frame was called from within an inlined frame, mark the
|
||||||
* innermost function as uninlineable to expand its frame and allow us
|
* innermost function as uninlineable to expand its frame and allow us
|
||||||
@ -158,7 +158,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.callerAtom)) {
|
if (JSID_IS_ATOM(id, cx->names().caller)) {
|
||||||
++iter;
|
++iter;
|
||||||
if (iter.done() || !iter.isFunctionFrame()) {
|
if (iter.done() || !iter.isFunctionFrame()) {
|
||||||
JS_ASSERT(vp.isNull());
|
JS_ASSERT(vp.isNull());
|
||||||
@ -205,16 +205,16 @@ fun_enumerate(JSContext *cx, HandleObject obj)
|
|||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
if (!obj->isBoundFunction()) {
|
if (!obj->isBoundFunction()) {
|
||||||
id = NameToId(cx->runtime->atomState.classPrototypeAtom);
|
id = NameToId(cx->names().classPrototype);
|
||||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.lengthAtom);
|
id = NameToId(cx->names().length);
|
||||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.nameAtom);
|
id = NameToId(cx->names().name);
|
||||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -264,10 +264,10 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj)
|
|||||||
*/
|
*/
|
||||||
RootedValue protoVal(cx, ObjectValue(*proto));
|
RootedValue protoVal(cx, ObjectValue(*proto));
|
||||||
RootedValue objVal(cx, ObjectValue(*obj));
|
RootedValue objVal(cx, ObjectValue(*obj));
|
||||||
if (!JSObject::defineProperty(cx, obj, cx->runtime->atomState.classPrototypeAtom,
|
if (!JSObject::defineProperty(cx, obj, cx->names().classPrototype,
|
||||||
protoVal, JS_PropertyStub, JS_StrictPropertyStub,
|
protoVal, JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT) ||
|
JSPROP_PERMANENT) ||
|
||||||
!JSObject::defineProperty(cx, proto, cx->runtime->atomState.constructorAtom,
|
!JSObject::defineProperty(cx, proto, cx->names().constructor,
|
||||||
objVal, JS_PropertyStub, JS_StrictPropertyStub, 0))
|
objVal, JS_PropertyStub, JS_StrictPropertyStub, 0))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -285,7 +285,7 @@ fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
|||||||
|
|
||||||
RootedFunction fun(cx, obj->toFunction());
|
RootedFunction fun(cx, obj->toFunction());
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.classPrototypeAtom)) {
|
if (JSID_IS_ATOM(id, cx->names().classPrototype)) {
|
||||||
/*
|
/*
|
||||||
* Built-in functions do not have a .prototype property per ECMA-262,
|
* Built-in functions do not have a .prototype property per ECMA-262,
|
||||||
* or (Object.prototype, Function.prototype, etc.) have that property
|
* or (Object.prototype, Function.prototype, etc.) have that property
|
||||||
@ -307,12 +307,11 @@ fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom) ||
|
if (JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().name)) {
|
||||||
JSID_IS_ATOM(id, cx->runtime->atomState.nameAtom)) {
|
|
||||||
JS_ASSERT(!IsInternalFunctionObject(obj));
|
JS_ASSERT(!IsInternalFunctionObject(obj));
|
||||||
|
|
||||||
RootedValue v(cx);
|
RootedValue v(cx);
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
if (JSID_IS_ATOM(id, cx->names().length))
|
||||||
v.setInt32(fun->nargs - fun->hasRest());
|
v.setInt32(fun->nargs - fun->hasRest());
|
||||||
else
|
else
|
||||||
v.setString(fun->atom() == NULL ? cx->runtime->emptyString : fun->atom());
|
v.setString(fun->atom() == NULL ? cx->runtime->emptyString : fun->atom());
|
||||||
@ -480,7 +479,7 @@ fun_hasInstance(JSContext *cx, HandleObject objArg, MutableHandleValue v, JSBool
|
|||||||
}
|
}
|
||||||
|
|
||||||
RootedValue pval(cx);
|
RootedValue pval(cx);
|
||||||
if (!JSObject::getProperty(cx, obj, obj, cx->runtime->atomState.classPrototypeAtom, &pval))
|
if (!JSObject::getProperty(cx, obj, obj, cx->names().classPrototype, &pval))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
if (pval.isPrimitive()) {
|
if (pval.isPrimitive()) {
|
||||||
@ -1386,7 +1385,7 @@ Function(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
* and so would a call to f from another top-level's script or function.
|
* and so would a call to f from another top-level's script or function.
|
||||||
*/
|
*/
|
||||||
RootedFunction fun(cx, js_NewFunction(cx, NULL, NULL, 0, JSFUN_LAMBDA | JSFUN_INTERPRETED,
|
RootedFunction fun(cx, js_NewFunction(cx, NULL, NULL, 0, JSFUN_LAMBDA | JSFUN_INTERPRETED,
|
||||||
global, cx->runtime->atomState.anonymousAtom));
|
global, cx->names().anonymous));
|
||||||
if (!fun)
|
if (!fun)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -54,44 +54,44 @@ using namespace js::analyze;
|
|||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_prototype(JSContext *cx) {
|
id_prototype(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.classPrototypeAtom);
|
return NameToId(cx->names().classPrototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_arguments(JSContext *cx) {
|
id_arguments(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.argumentsAtom);
|
return NameToId(cx->names().arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_length(JSContext *cx) {
|
id_length(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.lengthAtom);
|
return NameToId(cx->names().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id___proto__(JSContext *cx) {
|
id___proto__(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.protoAtom);
|
return NameToId(cx->names().proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_constructor(JSContext *cx) {
|
id_constructor(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.constructorAtom);
|
return NameToId(cx->names().constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_caller(JSContext *cx) {
|
id_caller(JSContext *cx) {
|
||||||
return NameToId(cx->runtime->atomState.callerAtom);
|
return NameToId(cx->names().caller);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_toString(JSContext *cx)
|
id_toString(JSContext *cx)
|
||||||
{
|
{
|
||||||
return NameToId(cx->runtime->atomState.toStringAtom);
|
return NameToId(cx->names().toString);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline jsid
|
static inline jsid
|
||||||
id_toSource(JSContext *cx)
|
id_toSource(JSContext *cx)
|
||||||
{
|
{
|
||||||
return NameToId(cx->runtime->atomState.toSourceAtom);
|
return NameToId(cx->names().toSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -3738,11 +3738,11 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
|
|||||||
* the method JIT will bypass this, and we need to add the types
|
* the method JIT will bypass this, and we need to add the types
|
||||||
* directly.
|
* directly.
|
||||||
*/
|
*/
|
||||||
if (id == NameToId(cx->runtime->atomState.undefinedAtom))
|
if (id == NameToId(cx->names().undefined))
|
||||||
seen->addType(cx, Type::UndefinedType());
|
seen->addType(cx, Type::UndefinedType());
|
||||||
if (id == NameToId(cx->runtime->atomState.NaNAtom))
|
if (id == NameToId(cx->names().NaN))
|
||||||
seen->addType(cx, Type::DoubleType());
|
seen->addType(cx, Type::DoubleType());
|
||||||
if (id == NameToId(cx->runtime->atomState.InfinityAtom))
|
if (id == NameToId(cx->names().Infinity))
|
||||||
seen->addType(cx, Type::DoubleType());
|
seen->addType(cx, Type::DoubleType());
|
||||||
|
|
||||||
TypeObject *global = script->global().getType(cx);
|
TypeObject *global = script->global().getType(cx);
|
||||||
|
@ -172,7 +172,7 @@ js::OnUnknownMethod(JSContext *cx, HandleObject obj, Value idval_, MutableHandle
|
|||||||
{
|
{
|
||||||
RootedValue idval(cx, idval_);
|
RootedValue idval(cx, idval_);
|
||||||
|
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.noSuchMethodAtom));
|
RootedId id(cx, NameToId(cx->names().noSuchMethod));
|
||||||
RootedValue value(cx);
|
RootedValue value(cx);
|
||||||
if (!GetMethod(cx, obj, id, 0, &value))
|
if (!GetMethod(cx, obj, id, 0, &value))
|
||||||
return false;
|
return false;
|
||||||
@ -3163,7 +3163,7 @@ BEGIN_CASE(JSOP_INITPROP)
|
|||||||
RootedId &id = rootId0;
|
RootedId &id = rootId0;
|
||||||
id = NameToId(name);
|
id = NameToId(name);
|
||||||
|
|
||||||
if (JS_UNLIKELY(name == cx->runtime->atomState.protoAtom)
|
if (JS_UNLIKELY(name == cx->names().proto)
|
||||||
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strictModeCode)
|
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strictModeCode)
|
||||||
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
||||||
JSPROP_ENUMERATE, 0, 0, 0)) {
|
JSPROP_ENUMERATE, 0, 0, 0)) {
|
||||||
@ -3981,7 +3981,7 @@ js::Throw(JSContext *cx, HandleValue v)
|
|||||||
bool
|
bool
|
||||||
js::GetProperty(JSContext *cx, HandleValue v, PropertyName *name, MutableHandleValue vp)
|
js::GetProperty(JSContext *cx, HandleValue v, PropertyName *name, MutableHandleValue vp)
|
||||||
{
|
{
|
||||||
if (name == cx->runtime->atomState.lengthAtom) {
|
if (name == cx->names().length) {
|
||||||
// Fast path for strings, arrays and arguments.
|
// Fast path for strings, arrays and arguments.
|
||||||
if (GetLengthProperty(v, vp))
|
if (GetLengthProperty(v, vp))
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,7 +104,7 @@ Enumerate(JSContext *cx, JSObject *obj, JSObject *pobj, jsid id,
|
|||||||
* the built-in prototypes). So exclude __proto__ if the object where the
|
* the built-in prototypes). So exclude __proto__ if the object where the
|
||||||
* property was found has no [[Prototype]] and might be |Object.prototype|.
|
* property was found has no [[Prototype]] and might be |Object.prototype|.
|
||||||
*/
|
*/
|
||||||
if (JS_UNLIKELY(!pobj->getProto() && JSID_IS_ATOM(id, cx->runtime->atomState.protoAtom)))
|
if (JS_UNLIKELY(!pobj->getProto() && JSID_IS_ATOM(id, cx->names().proto)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!(flags & JSITER_OWNONLY) || pobj->isProxy() || pobj->getOps()->enumerate) {
|
if (!(flags & JSITER_OWNONLY) || pobj->isProxy() || pobj->getOps()->enumerate) {
|
||||||
@ -157,10 +157,8 @@ static bool
|
|||||||
EnumerateDenseArrayProperties(JSContext *cx, JSObject *obj, JSObject *pobj, unsigned flags,
|
EnumerateDenseArrayProperties(JSContext *cx, JSObject *obj, JSObject *pobj, unsigned flags,
|
||||||
IdSet &ht, AutoIdVector *props)
|
IdSet &ht, AutoIdVector *props)
|
||||||
{
|
{
|
||||||
if (!Enumerate(cx, obj, pobj, NameToId(cx->runtime->atomState.lengthAtom), false,
|
if (!Enumerate(cx, obj, pobj, NameToId(cx->names().length), false, flags, ht, props))
|
||||||
flags, ht, props)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (pobj->getArrayLength() > 0) {
|
if (pobj->getArrayLength() > 0) {
|
||||||
size_t initlen = pobj->getDenseArrayInitializedLength();
|
size_t initlen = pobj->getDenseArrayInitializedLength();
|
||||||
@ -355,7 +353,7 @@ GetCustomIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandle
|
|||||||
JS_CHECK_RECURSION(cx, return false);
|
JS_CHECK_RECURSION(cx, return false);
|
||||||
|
|
||||||
/* Check whether we have a valid __iterator__ method. */
|
/* Check whether we have a valid __iterator__ method. */
|
||||||
RootedPropertyName name(cx, cx->runtime->atomState.iteratorIntrinsicAtom);
|
HandlePropertyName name = cx->names().iteratorIntrinsic;
|
||||||
if (!GetMethod(cx, obj, name, 0, vp))
|
if (!GetMethod(cx, obj, name, 0, vp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -584,7 +582,7 @@ GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleValue
|
|||||||
if (flags == JSITER_FOR_OF) {
|
if (flags == JSITER_FOR_OF) {
|
||||||
// for-of loop. The iterator is simply |obj.iterator()|.
|
// for-of loop. The iterator is simply |obj.iterator()|.
|
||||||
RootedValue method(cx);
|
RootedValue method(cx);
|
||||||
if (!JSObject::getProperty(cx, obj, obj, cx->runtime->atomState.iteratorAtom, &method))
|
if (!JSObject::getProperty(cx, obj, obj, cx->names().iterator, &method))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Throw if obj.iterator isn't callable. js::Invoke is about to check
|
// Throw if obj.iterator isn't callable. js::Invoke is about to check
|
||||||
@ -1243,7 +1241,7 @@ js_IteratorMore(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
/* Call the iterator object's .next method. */
|
/* Call the iterator object's .next method. */
|
||||||
if (!GetMethod(cx, iterobj, cx->runtime->atomState.nextAtom, 0, rval))
|
if (!GetMethod(cx, iterobj, cx->names().next, 0, rval))
|
||||||
return false;
|
return false;
|
||||||
if (!Invoke(cx, ObjectValue(*iterobj), rval, 0, NULL, rval.address())) {
|
if (!Invoke(cx, ObjectValue(*iterobj), rval, 0, NULL, rval.address())) {
|
||||||
/* Check for StopIteration. */
|
/* Check for StopIteration. */
|
||||||
@ -1778,7 +1776,7 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle<GlobalObject *> global)
|
|||||||
iteratorProto->asPropertyIterator().setNativeIterator(ni);
|
iteratorProto->asPropertyIterator().setNativeIterator(ni);
|
||||||
|
|
||||||
Rooted<JSFunction*> ctor(cx);
|
Rooted<JSFunction*> ctor(cx);
|
||||||
ctor = global->createConstructor(cx, IteratorConstructor, cx->runtime->atomState.IteratorAtom, 2);
|
ctor = global->createConstructor(cx, IteratorConstructor, cx->names().Iterator, 2);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return false;
|
return false;
|
||||||
if (!LinkConstructorAndPrototype(cx, ctor, iteratorProto))
|
if (!LinkConstructorAndPrototype(cx, ctor, iteratorProto))
|
||||||
|
@ -656,7 +656,7 @@ js::math_tan(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
static JSBool
|
static JSBool
|
||||||
math_toSource(JSContext *cx, unsigned argc, Value *vp)
|
math_toSource(JSContext *cx, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
vp->setString(cx->runtime->atomState.MathAtom);
|
vp->setString(cx->names().Math);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1137,7 +1137,7 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
|
|||||||
numberProto->asNumber().setPrimitiveValue(0);
|
numberProto->asNumber().setPrimitiveValue(0);
|
||||||
|
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, Number, cx->runtime->atomState.NumberAtom, 1);
|
ctor = global->createConstructor(cx, Number, cx->names().Number, 1);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1161,10 +1161,10 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
|
|||||||
RootedValue valueInfinity(cx, cx->runtime->positiveInfinityValue);
|
RootedValue valueInfinity(cx, cx->runtime->positiveInfinityValue);
|
||||||
|
|
||||||
/* ES5 15.1.1.1, 15.1.1.2 */
|
/* ES5 15.1.1.1, 15.1.1.2 */
|
||||||
if (!DefineNativeProperty(cx, global, cx->runtime->atomState.NaNAtom, valueNaN,
|
if (!DefineNativeProperty(cx, global, cx->names().NaN, valueNaN,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub,
|
JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0) ||
|
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0) ||
|
||||||
!DefineNativeProperty(cx, global, cx->runtime->atomState.InfinityAtom, valueInfinity,
|
!DefineNativeProperty(cx, global, cx->names().Infinity, valueInfinity,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub,
|
JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0))
|
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0))
|
||||||
{
|
{
|
||||||
|
@ -162,13 +162,13 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
if (attrs & JSPROP_GETTER) {
|
if (attrs & JSPROP_GETTER) {
|
||||||
doGet = false;
|
doGet = false;
|
||||||
val[valcnt] = shape->getterValue();
|
val[valcnt] = shape->getterValue();
|
||||||
gsop[valcnt] = cx->runtime->atomState.getAtom;
|
gsop[valcnt] = cx->names().get;
|
||||||
valcnt++;
|
valcnt++;
|
||||||
}
|
}
|
||||||
if (attrs & JSPROP_SETTER) {
|
if (attrs & JSPROP_SETTER) {
|
||||||
doGet = false;
|
doGet = false;
|
||||||
val[valcnt] = shape->setterValue();
|
val[valcnt] = shape->setterValue();
|
||||||
gsop[valcnt] = cx->runtime->atomState.setAtom;
|
gsop[valcnt] = cx->names().set;
|
||||||
valcnt++;
|
valcnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,13 +341,13 @@ obj_toString(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
|
|
||||||
/* Step 1. */
|
/* Step 1. */
|
||||||
if (args.thisv().isUndefined()) {
|
if (args.thisv().isUndefined()) {
|
||||||
args.rval().setString(cx->runtime->atomState.objectUndefinedAtom);
|
args.rval().setString(cx->names().objectUndefined);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 2. */
|
/* Step 2. */
|
||||||
if (args.thisv().isNull()) {
|
if (args.thisv().isNull()) {
|
||||||
args.rval().setString(cx->runtime->atomState.objectNullAtom);
|
args.rval().setString(cx->names().objectNull);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ obj_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Steps 2-4. */
|
/* Steps 2-4. */
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.toStringAtom));
|
RootedId id(cx, NameToId(cx->names().toString));
|
||||||
return obj->callMethod(cx, id, 0, NULL, args.rval());
|
return obj->callMethod(cx, id, 0, NULL, args.rval());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,19 +643,19 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
if (!descObj)
|
if (!descObj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
JSAtomState &state = cx->runtime->atomState;
|
JSAtomState &names = cx->names();
|
||||||
RootedValue trueVal(cx, BooleanValue(true));
|
RootedValue trueVal(cx, BooleanValue(true));
|
||||||
|
|
||||||
/* enumerable: true */
|
/* enumerable: true */
|
||||||
if (!JSObject::defineProperty(cx, descObj, state.enumerableAtom, trueVal))
|
if (!JSObject::defineProperty(cx, descObj, names.enumerable, trueVal))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* configurable: true */
|
/* configurable: true */
|
||||||
if (!JSObject::defineProperty(cx, descObj, state.configurableAtom, trueVal))
|
if (!JSObject::defineProperty(cx, descObj, names.configurable, trueVal))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* enumerable: true */
|
/* enumerable: true */
|
||||||
PropertyName *acc = (Type == Getter) ? state.getAtom : state.setAtom;
|
PropertyName *acc = (Type == Getter) ? names.get : names.set;
|
||||||
RootedValue accessorVal(cx, args[1]);
|
RootedValue accessorVal(cx, args[1]);
|
||||||
if (!JSObject::defineProperty(cx, descObj, acc, accessorVal))
|
if (!JSObject::defineProperty(cx, descObj, acc, accessorVal))
|
||||||
return false;
|
return false;
|
||||||
@ -857,22 +857,22 @@ PropDesc::makeObject(JSContext *cx)
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const JSAtomState &atomState = cx->runtime->atomState;
|
const JSAtomState &names = cx->names();
|
||||||
RootedValue configurableVal(cx, BooleanValue((attrs & JSPROP_PERMANENT) == 0));
|
RootedValue configurableVal(cx, BooleanValue((attrs & JSPROP_PERMANENT) == 0));
|
||||||
RootedValue enumerableVal(cx, BooleanValue((attrs & JSPROP_ENUMERATE) != 0));
|
RootedValue enumerableVal(cx, BooleanValue((attrs & JSPROP_ENUMERATE) != 0));
|
||||||
RootedValue writableVal(cx, BooleanValue((attrs & JSPROP_READONLY) == 0));
|
RootedValue writableVal(cx, BooleanValue((attrs & JSPROP_READONLY) == 0));
|
||||||
if ((hasConfigurable() &&
|
if ((hasConfigurable() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.configurableAtom, configurableVal)) ||
|
!JSObject::defineProperty(cx, obj, names.configurable, configurableVal)) ||
|
||||||
(hasEnumerable() &&
|
(hasEnumerable() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.enumerableAtom, enumerableVal)) ||
|
!JSObject::defineProperty(cx, obj, names.enumerable, enumerableVal)) ||
|
||||||
(hasGet() &&
|
(hasGet() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.getAtom, getterValue())) ||
|
!JSObject::defineProperty(cx, obj, names.get, getterValue())) ||
|
||||||
(hasSet() &&
|
(hasSet() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.setAtom, setterValue())) ||
|
!JSObject::defineProperty(cx, obj, names.set, setterValue())) ||
|
||||||
(hasValue() &&
|
(hasValue() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.valueAtom, value())) ||
|
!JSObject::defineProperty(cx, obj, names.value, value())) ||
|
||||||
(hasWritable() &&
|
(hasWritable() &&
|
||||||
!JSObject::defineProperty(cx, obj, atomState.writableAtom, writableVal)))
|
!JSObject::defineProperty(cx, obj, names.writable, writableVal)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1051,7 +1051,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
RootedId id(cx);
|
RootedId id(cx);
|
||||||
|
|
||||||
/* 8.10.5 step 3 */
|
/* 8.10.5 step 3 */
|
||||||
id = NameToId(cx->runtime->atomState.enumerableAtom);
|
id = NameToId(cx->names().enumerable);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1061,7 +1061,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 8.10.5 step 4 */
|
/* 8.10.5 step 4 */
|
||||||
id = NameToId(cx->runtime->atomState.configurableAtom);
|
id = NameToId(cx->names().configurable);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1071,7 +1071,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 8.10.5 step 5 */
|
/* 8.10.5 step 5 */
|
||||||
id = NameToId(cx->runtime->atomState.valueAtom);
|
id = NameToId(cx->names().value);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1080,7 +1080,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 8.10.6 step 6 */
|
/* 8.10.6 step 6 */
|
||||||
id = NameToId(cx->runtime->atomState.writableAtom);
|
id = NameToId(cx->names().writable);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1090,7 +1090,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 8.10.7 step 7 */
|
/* 8.10.7 step 7 */
|
||||||
id = NameToId(cx->runtime->atomState.getAtom);
|
id = NameToId(cx->names().get);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1103,7 +1103,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 8.10.7 step 8 */
|
/* 8.10.7 step 8 */
|
||||||
id = NameToId(cx->runtime->atomState.setAtom);
|
id = NameToId(cx->names().set);
|
||||||
if (!HasProperty(cx, desc, id, &v, &found))
|
if (!HasProperty(cx, desc, id, &v, &found))
|
||||||
return false;
|
return false;
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1565,7 +1565,7 @@ DefinePropertyOnArray(JSContext *cx, HandleObject obj, HandleId id, const PropDe
|
|||||||
|
|
||||||
uint32_t oldLen = obj->getArrayLength();
|
uint32_t oldLen = obj->getArrayLength();
|
||||||
|
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
/*
|
/*
|
||||||
* Our optimization of storage of the length property of arrays makes
|
* Our optimization of storage of the length property of arrays makes
|
||||||
* it very difficult to properly implement defining the property. For
|
* it very difficult to properly implement defining the property. For
|
||||||
@ -2313,7 +2313,7 @@ JSObject*
|
|||||||
js_CreateThis(JSContext *cx, Class *newclasp, HandleObject callee)
|
js_CreateThis(JSContext *cx, Class *newclasp, HandleObject callee)
|
||||||
{
|
{
|
||||||
RootedValue protov(cx);
|
RootedValue protov(cx);
|
||||||
if (!JSObject::getProperty(cx, callee, callee, cx->runtime->atomState.classPrototypeAtom, &protov))
|
if (!JSObject::getProperty(cx, callee, callee, cx->names().classPrototype, &protov))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
JSObject *proto = protov.isObjectOrNull() ? protov.toObjectOrNull() : NULL;
|
JSObject *proto = protov.isObjectOrNull() ? protov.toObjectOrNull() : NULL;
|
||||||
@ -2367,7 +2367,7 @@ JSObject *
|
|||||||
js_CreateThisForFunction(JSContext *cx, HandleObject callee, bool newType)
|
js_CreateThisForFunction(JSContext *cx, HandleObject callee, bool newType)
|
||||||
{
|
{
|
||||||
RootedValue protov(cx);
|
RootedValue protov(cx);
|
||||||
if (!JSObject::getProperty(cx, callee, callee, cx->runtime->atomState.classPrototypeAtom, &protov))
|
if (!JSObject::getProperty(cx, callee, callee, cx->names().classPrototype, &protov))
|
||||||
return NULL;
|
return NULL;
|
||||||
JSObject *proto;
|
JSObject *proto;
|
||||||
if (protov.isObject())
|
if (protov.isObject())
|
||||||
@ -2434,7 +2434,7 @@ Detecting(JSContext *cx, jsbytecode *pc)
|
|||||||
* global binding...because, really?
|
* global binding...because, really?
|
||||||
*/
|
*/
|
||||||
atom = script->getAtom(GET_UINT32_INDEX(pc));
|
atom = script->getAtom(GET_UINT32_INDEX(pc));
|
||||||
if (atom == cx->runtime->atomState.undefinedAtom &&
|
if (atom == cx->names().undefined &&
|
||||||
(pc += js_CodeSpec[op].length) < endpc) {
|
(pc += js_CodeSpec[op].length) < endpc) {
|
||||||
op = JSOp(*pc);
|
op = JSOp(*pc);
|
||||||
return op == JSOP_EQ || op == JSOP_NE || op == JSOP_STRICTEQ || op == JSOP_STRICTNE;
|
return op == JSOP_EQ || op == JSOP_NE || op == JSOP_STRICTEQ || op == JSOP_STRICTNE;
|
||||||
@ -4323,7 +4323,7 @@ js_GetPropertyHelperInline(JSContext *cx, HandleObject obj, HandleObject receive
|
|||||||
* XXX do not warn about missing __iterator__ as the function
|
* XXX do not warn about missing __iterator__ as the function
|
||||||
* may be called from JS_GetMethodById. See bug 355145.
|
* may be called from JS_GetMethodById. See bug 355145.
|
||||||
*/
|
*/
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.iteratorIntrinsicAtom))
|
if (JSID_IS_ATOM(id, cx->names().iteratorIntrinsic))
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
|
||||||
/* Do not warn about tests like (obj[prop] == undefined). */
|
/* Do not warn about tests like (obj[prop] == undefined). */
|
||||||
@ -4855,7 +4855,7 @@ DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
|
|||||||
|
|
||||||
Class *clasp = obj->getClass();
|
Class *clasp = obj->getClass();
|
||||||
if (hint == JSTYPE_STRING) {
|
if (hint == JSTYPE_STRING) {
|
||||||
id = NameToId(cx->runtime->atomState.toStringAtom);
|
id = NameToId(cx->names().toString);
|
||||||
|
|
||||||
/* Optimize (new String(...)).toString(). */
|
/* Optimize (new String(...)).toString(). */
|
||||||
if (clasp == &StringClass) {
|
if (clasp == &StringClass) {
|
||||||
@ -4870,7 +4870,7 @@ DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
|
|||||||
if (vp.isPrimitive())
|
if (vp.isPrimitive())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.valueOfAtom);
|
id = NameToId(cx->names().valueOf);
|
||||||
if (!MaybeCallMethod(cx, obj, id, vp))
|
if (!MaybeCallMethod(cx, obj, id, vp))
|
||||||
return false;
|
return false;
|
||||||
if (vp.isPrimitive())
|
if (vp.isPrimitive())
|
||||||
@ -4879,7 +4879,7 @@ DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
|
|||||||
|
|
||||||
/* Optimize new String(...).valueOf(). */
|
/* Optimize new String(...).valueOf(). */
|
||||||
if (clasp == &StringClass) {
|
if (clasp == &StringClass) {
|
||||||
id = NameToId(cx->runtime->atomState.valueOfAtom);
|
id = NameToId(cx->names().valueOf);
|
||||||
if (ClassMethodIsNative(cx, obj, &StringClass, id, js_str_toString)) {
|
if (ClassMethodIsNative(cx, obj, &StringClass, id, js_str_toString)) {
|
||||||
vp.setString(obj->asString().unbox());
|
vp.setString(obj->asString().unbox());
|
||||||
return true;
|
return true;
|
||||||
@ -4888,20 +4888,20 @@ DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
|
|||||||
|
|
||||||
/* Optimize new Number(...).valueOf(). */
|
/* Optimize new Number(...).valueOf(). */
|
||||||
if (clasp == &NumberClass) {
|
if (clasp == &NumberClass) {
|
||||||
id = NameToId(cx->runtime->atomState.valueOfAtom);
|
id = NameToId(cx->names().valueOf);
|
||||||
if (ClassMethodIsNative(cx, obj, &NumberClass, id, js_num_valueOf)) {
|
if (ClassMethodIsNative(cx, obj, &NumberClass, id, js_num_valueOf)) {
|
||||||
vp.setNumber(obj->asNumber().unbox());
|
vp.setNumber(obj->asNumber().unbox());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.valueOfAtom);
|
id = NameToId(cx->names().valueOf);
|
||||||
if (!MaybeCallMethod(cx, obj, id, vp))
|
if (!MaybeCallMethod(cx, obj, id, vp))
|
||||||
return false;
|
return false;
|
||||||
if (vp.isPrimitive())
|
if (vp.isPrimitive())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
id = NameToId(cx->runtime->atomState.toStringAtom);
|
id = NameToId(cx->names().toString);
|
||||||
if (!MaybeCallMethod(cx, obj, id, vp))
|
if (!MaybeCallMethod(cx, obj, id, vp))
|
||||||
return false;
|
return false;
|
||||||
if (vp.isPrimitive())
|
if (vp.isPrimitive())
|
||||||
@ -5062,7 +5062,7 @@ js_GetClassPrototype(JSContext *cx, JSProtoKey protoKey, MutableHandleObject pro
|
|||||||
|
|
||||||
if (IsFunctionObject(v)) {
|
if (IsFunctionObject(v)) {
|
||||||
RootedObject ctor(cx, &v.get().toObject());
|
RootedObject ctor(cx, &v.get().toObject());
|
||||||
if (!JSObject::getProperty(cx, ctor, ctor, cx->runtime->atomState.classPrototypeAtom, &v))
|
if (!JSObject::getProperty(cx, ctor, ctor, cx->names().classPrototype, &v))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ JSObject::setArrayLength(JSContext *cx, uint32_t length)
|
|||||||
js::types::MarkTypeObjectFlags(cx, this,
|
js::types::MarkTypeObjectFlags(cx, this,
|
||||||
js::types::OBJECT_FLAG_NON_PACKED_ARRAY |
|
js::types::OBJECT_FLAG_NON_PACKED_ARRAY |
|
||||||
js::types::OBJECT_FLAG_NON_DENSE_ARRAY);
|
js::types::OBJECT_FLAG_NON_DENSE_ARRAY);
|
||||||
jsid lengthId = js::NameToId(cx->runtime->atomState.lengthAtom);
|
jsid lengthId = js::NameToId(cx->names().length);
|
||||||
js::types::AddTypePropertyId(cx, this, lengthId,
|
js::types::AddTypePropertyId(cx, this, lengthId,
|
||||||
js::types::Type::DoubleType());
|
js::types::Type::DoubleType());
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ js_json_parse(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
if (!linear)
|
if (!linear)
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
linear = cx->runtime->atomState.undefinedAtom;
|
linear = cx->names().undefined;
|
||||||
}
|
}
|
||||||
JS::Anchor<JSString *> anchor(linear);
|
JS::Anchor<JSString *> anchor(linear);
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ PreprocessValue(JSContext *cx, HandleObject holder, KeyType key, MutableHandleVa
|
|||||||
/* Step 2. */
|
/* Step 2. */
|
||||||
if (vp.get().isObject()) {
|
if (vp.get().isObject()) {
|
||||||
RootedValue toJSON(cx);
|
RootedValue toJSON(cx);
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.toJSONAtom));
|
RootedId id(cx, NameToId(cx->names().toJSON));
|
||||||
Rooted<JSObject*> obj(cx, &vp.get().toObject());
|
Rooted<JSObject*> obj(cx, &vp.get().toObject());
|
||||||
if (!GetMethod(cx, obj, id, 0, &toJSON))
|
if (!GetMethod(cx, obj, id, 0, &toJSON))
|
||||||
return false;
|
return false;
|
||||||
@ -725,7 +725,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Step 10. */
|
/* Step 10. */
|
||||||
RootedId emptyId(cx, NameToId(cx->runtime->atomState.emptyAtom));
|
RootedId emptyId(cx, NameToId(cx->names().empty));
|
||||||
if (!DefineNativeProperty(cx, wrapper, emptyId, vp, JS_PropertyStub, JS_StrictPropertyStub,
|
if (!DefineNativeProperty(cx, wrapper, emptyId, vp, JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_ENUMERATE, 0, 0))
|
JSPROP_ENUMERATE, 0, 0))
|
||||||
{
|
{
|
||||||
@ -856,10 +856,10 @@ Revive(JSContext *cx, HandleValue reviver, MutableHandleValue vp)
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!JSObject::defineProperty(cx, obj, cx->runtime->atomState.emptyAtom, vp))
|
if (!JSObject::defineProperty(cx, obj, cx->names().empty, vp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Rooted<jsid> id(cx, NameToId(cx->runtime->atomState.emptyAtom));
|
Rooted<jsid> id(cx, NameToId(cx->names().empty));
|
||||||
return Walk(cx, obj, id, reviver, vp);
|
return Walk(cx, obj, id, reviver, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -887,7 +887,7 @@ ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleVa
|
|||||||
static JSBool
|
static JSBool
|
||||||
json_toSource(JSContext *cx, unsigned argc, Value *vp)
|
json_toSource(JSContext *cx, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
vp->setString(cx->runtime->atomState.JSONAtom);
|
vp->setString(cx->names().JSON);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -429,7 +429,7 @@ ToDisassemblySource(JSContext *cx, jsval v, JSAutoByteString *bytes)
|
|||||||
while (!r.empty()) {
|
while (!r.empty()) {
|
||||||
Rooted<Shape*> shape(cx, &r.front());
|
Rooted<Shape*> shape(cx, &r.front());
|
||||||
JSAtom *atom = JSID_IS_INT(shape->propid())
|
JSAtom *atom = JSID_IS_INT(shape->propid())
|
||||||
? cx->runtime->atomState.emptyAtom
|
? cx->names().empty
|
||||||
: JSID_TO_ATOM(shape->propid());
|
: JSID_TO_ATOM(shape->propid());
|
||||||
|
|
||||||
JSAutoByteString bytes;
|
JSAutoByteString bytes;
|
||||||
@ -2342,7 +2342,7 @@ GetBlockNames(JSContext *cx, StaticBlockObject &blockObj, AtomVector *atoms)
|
|||||||
--i;
|
--i;
|
||||||
LOCAL_ASSERT((unsigned)shape.shortid() == i);
|
LOCAL_ASSERT((unsigned)shape.shortid() == i);
|
||||||
(*atoms)[i] = JSID_IS_INT(shape.propid())
|
(*atoms)[i] = JSID_IS_INT(shape.propid())
|
||||||
? cx->runtime->atomState.emptyAtom
|
? cx->names().empty
|
||||||
: JSID_TO_ATOM(shape.propid());
|
: JSID_TO_ATOM(shape.propid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3467,7 +3467,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
|||||||
if (ss->sprinter.put(rhs + DestructuredStringLength) < 0)
|
if (ss->sprinter.put(rhs + DestructuredStringLength) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(atoms[i] != cx->runtime->atomState.emptyAtom);
|
JS_ASSERT(atoms[i] != cx->names().empty);
|
||||||
if (!QuoteString(&ss->sprinter, atoms[i], 0))
|
if (!QuoteString(&ss->sprinter, atoms[i], 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (*rhs) {
|
if (*rhs) {
|
||||||
@ -5960,7 +5960,7 @@ ExpressionDecompiler::decompilePC(jsbytecode *pc)
|
|||||||
case JSOP_LENGTH:
|
case JSOP_LENGTH:
|
||||||
case JSOP_GETPROP:
|
case JSOP_GETPROP:
|
||||||
case JSOP_CALLPROP: {
|
case JSOP_CALLPROP: {
|
||||||
JSAtom *prop = (op == JSOP_LENGTH) ? cx->runtime->atomState.lengthAtom : loadAtom(pc);
|
JSAtom *prop = (op == JSOP_LENGTH) ? cx->names().length : loadAtom(pc);
|
||||||
if (!decompilePC(pcstack[-1]))
|
if (!decompilePC(pcstack[-1]))
|
||||||
return false;
|
return false;
|
||||||
if (IsIdentifier(prop))
|
if (IsIdentifier(prop))
|
||||||
|
@ -17,12 +17,12 @@ static inline PropertyName *
|
|||||||
GetNameFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op)
|
GetNameFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op)
|
||||||
{
|
{
|
||||||
if (op == JSOP_LENGTH)
|
if (op == JSOP_LENGTH)
|
||||||
return cx->runtime->atomState.lengthAtom;
|
return cx->names().length;
|
||||||
|
|
||||||
// The method JIT's implementation of instanceof contains an internal lookup
|
// The method JIT's implementation of instanceof contains an internal lookup
|
||||||
// of the prototype property.
|
// of the prototype property.
|
||||||
if (op == JSOP_INSTANCEOF)
|
if (op == JSOP_INSTANCEOF)
|
||||||
return cx->runtime->atomState.classPrototypeAtom;
|
return cx->names().classPrototype;
|
||||||
|
|
||||||
PropertyName *name;
|
PropertyName *name;
|
||||||
GET_NAME_FROM_BYTECODE(script, pc, 0, name);
|
GET_NAME_FROM_BYTECODE(script, pc, 0, name);
|
||||||
|
@ -638,12 +638,12 @@ static bool
|
|||||||
GetDerivedTrap(JSContext *cx, HandleObject handler, HandlePropertyName name,
|
GetDerivedTrap(JSContext *cx, HandleObject handler, HandlePropertyName name,
|
||||||
MutableHandleValue fvalp)
|
MutableHandleValue fvalp)
|
||||||
{
|
{
|
||||||
JS_ASSERT(name == ATOM(has) ||
|
JS_ASSERT(name == cx->names().has ||
|
||||||
name == ATOM(hasOwn) ||
|
name == cx->names().hasOwn ||
|
||||||
name == ATOM(get) ||
|
name == cx->names().get ||
|
||||||
name == ATOM(set) ||
|
name == cx->names().set ||
|
||||||
name == ATOM(keys) ||
|
name == cx->names().keys ||
|
||||||
name == ATOM(iterate));
|
name == cx->names().iterate);
|
||||||
|
|
||||||
return JSObject::getProperty(cx, handler, handler, name, fvalp);
|
return JSObject::getProperty(cx, handler, handler, name, fvalp);
|
||||||
}
|
}
|
||||||
@ -816,10 +816,10 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *pro
|
|||||||
RootedObject proxy(cx, proxy_);
|
RootedObject proxy(cx, proxy_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(getPropertyDescriptor), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().getPropertyDescriptor, &fval) &&
|
||||||
Trap1(cx, handler, fval, id, value.address()) &&
|
Trap1(cx, handler, fval, id, value.address()) &&
|
||||||
((value.get().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
((value.get().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
||||||
(ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), value) &&
|
(ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().getPropertyDescriptor, value) &&
|
||||||
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
|
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,10 +831,10 @@ ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *
|
|||||||
RootedObject proxy(cx, proxy_);
|
RootedObject proxy(cx, proxy_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyDescriptor), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().getOwnPropertyDescriptor, &fval) &&
|
||||||
Trap1(cx, handler, fval, id, value.address()) &&
|
Trap1(cx, handler, fval, id, value.address()) &&
|
||||||
((value.get().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
((value.get().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
||||||
(ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), value) &&
|
(ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().getPropertyDescriptor, value) &&
|
||||||
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
|
ParsePropertyDescriptorObject(cx, proxy, value, desc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +845,7 @@ ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, JSObject *proxy, jsi
|
|||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
RootedId id(cx, id_);
|
RootedId id(cx, id_);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(defineProperty), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().defineProperty, &fval) &&
|
||||||
NewPropertyDescriptorObject(cx, desc, value.address()) &&
|
NewPropertyDescriptorObject(cx, desc, value.address()) &&
|
||||||
Trap2(cx, handler, fval, id, value, value.address());
|
Trap2(cx, handler, fval, id, value, value.address());
|
||||||
}
|
}
|
||||||
@ -856,7 +856,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, JSObject *proxy
|
|||||||
{
|
{
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyNames), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().getOwnPropertyNames, &fval) &&
|
||||||
Trap(cx, handler, fval, 0, NULL, value.address()) &&
|
Trap(cx, handler, fval, 0, NULL, value.address()) &&
|
||||||
ArrayToIdVector(cx, value, props);
|
ArrayToIdVector(cx, value, props);
|
||||||
}
|
}
|
||||||
@ -867,7 +867,7 @@ ScriptedIndirectProxyHandler::delete_(JSContext *cx, JSObject *proxy, jsid id_,
|
|||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedId id(cx, id_);
|
RootedId id(cx, id_);
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(delete_), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().delete_, &fval) &&
|
||||||
Trap1(cx, handler, fval, id, value.address()) &&
|
Trap1(cx, handler, fval, id, value.address()) &&
|
||||||
ValueToBool(cx, value, bp);
|
ValueToBool(cx, value, bp);
|
||||||
}
|
}
|
||||||
@ -877,7 +877,7 @@ ScriptedIndirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy, AutoIdVe
|
|||||||
{
|
{
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(enumerate), &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().enumerate, &fval) &&
|
||||||
Trap(cx, handler, fval, 0, NULL, value.address()) &&
|
Trap(cx, handler, fval, 0, NULL, value.address()) &&
|
||||||
ArrayToIdVector(cx, value, props);
|
ArrayToIdVector(cx, value, props);
|
||||||
}
|
}
|
||||||
@ -889,7 +889,7 @@ ScriptedIndirectProxyHandler::has(JSContext *cx, JSObject *proxy_, jsid id_, boo
|
|||||||
RootedId id(cx, id_);
|
RootedId id(cx, id_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(has), &fval))
|
if (!GetDerivedTrap(cx, handler, cx->names().has, &fval))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(fval))
|
if (!js_IsCallable(fval))
|
||||||
return BaseProxyHandler::has(cx, proxy, id, bp);
|
return BaseProxyHandler::has(cx, proxy, id, bp);
|
||||||
@ -904,7 +904,7 @@ ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, JSObject *proxy_, jsid id_,
|
|||||||
RootedId id(cx, id_);
|
RootedId id(cx, id_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(hasOwn), &fval))
|
if (!GetDerivedTrap(cx, handler, cx->names().hasOwn, &fval))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(fval))
|
if (!js_IsCallable(fval))
|
||||||
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
|
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
|
||||||
@ -926,7 +926,7 @@ ScriptedIndirectProxyHandler::get(JSContext *cx, JSObject *proxy_, JSObject *rec
|
|||||||
Value argv[] = { ObjectOrNullValue(receiver), value };
|
Value argv[] = { ObjectOrNullValue(receiver), value };
|
||||||
AutoValueArray ava(cx, argv, 2);
|
AutoValueArray ava(cx, argv, 2);
|
||||||
RootedValue fval(cx);
|
RootedValue fval(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(get), &fval))
|
if (!GetDerivedTrap(cx, handler, cx->names().get, &fval))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(fval))
|
if (!js_IsCallable(fval))
|
||||||
return BaseProxyHandler::get(cx, proxy, receiver, id, vp);
|
return BaseProxyHandler::get(cx, proxy, receiver, id, vp);
|
||||||
@ -947,7 +947,7 @@ ScriptedIndirectProxyHandler::set(JSContext *cx, JSObject *proxy_, JSObject *rec
|
|||||||
Value argv[] = { ObjectOrNullValue(receiver), value, *vp };
|
Value argv[] = { ObjectOrNullValue(receiver), value, *vp };
|
||||||
AutoValueArray ava(cx, argv, 3);
|
AutoValueArray ava(cx, argv, 3);
|
||||||
RootedValue fval(cx);
|
RootedValue fval(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(set), &fval))
|
if (!GetDerivedTrap(cx, handler, cx->names().set, &fval))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(fval))
|
if (!js_IsCallable(fval))
|
||||||
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
|
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
|
||||||
@ -960,7 +960,7 @@ ScriptedIndirectProxyHandler::keys(JSContext *cx, JSObject *proxy_, AutoIdVector
|
|||||||
RootedObject proxy(cx, proxy_);
|
RootedObject proxy(cx, proxy_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue value(cx);
|
RootedValue value(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(keys), &value))
|
if (!GetDerivedTrap(cx, handler, cx->names().keys, &value))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(value))
|
if (!js_IsCallable(value))
|
||||||
return BaseProxyHandler::keys(cx, proxy, props);
|
return BaseProxyHandler::keys(cx, proxy, props);
|
||||||
@ -974,12 +974,12 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, JSObject *proxy_, unsigned
|
|||||||
RootedObject proxy(cx, proxy_);
|
RootedObject proxy(cx, proxy_);
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(cx, proxy));
|
||||||
RootedValue value(cx);
|
RootedValue value(cx);
|
||||||
if (!GetDerivedTrap(cx, handler, ATOM(iterate), &value))
|
if (!GetDerivedTrap(cx, handler, cx->names().iterate, &value))
|
||||||
return false;
|
return false;
|
||||||
if (!js_IsCallable(value))
|
if (!js_IsCallable(value))
|
||||||
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
|
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
|
||||||
return Trap(cx, handler, value, 0, NULL, vp) &&
|
return Trap(cx, handler, value, 0, NULL, vp) &&
|
||||||
ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(iterate), *vp);
|
ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().iterate, *vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1121,9 +1121,9 @@ NormalizePropertyDescriptor(JSContext *cx, MutableHandleValue vp, bool complete
|
|||||||
if (JSID_IS_ATOM(id)) {
|
if (JSID_IS_ATOM(id)) {
|
||||||
JSAtom *atom = JSID_TO_ATOM(id);
|
JSAtom *atom = JSID_TO_ATOM(id);
|
||||||
const JSAtomState &atomState = cx->runtime->atomState;
|
const JSAtomState &atomState = cx->runtime->atomState;
|
||||||
if (atom == atomState.valueAtom || atom == atomState.writableAtom ||
|
if (atom == atomState.value || atom == atomState.writable ||
|
||||||
atom == atomState.getAtom || atom == atomState.setAtom ||
|
atom == atomState.get || atom == atomState.set ||
|
||||||
atom == atomState.enumerableAtom || atom == atomState.configurableAtom)
|
atom == atomState.enumerable || atom == atomState.configurable)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1306,7 +1306,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(getOwnPropertyDescriptor), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().getOwnPropertyDescriptor, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -1408,7 +1408,7 @@ TrapDefineOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHan
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(defineProperty), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().defineProperty, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -1667,7 +1667,7 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, JSObject *proxy_,
|
|||||||
|
|
||||||
// step c
|
// step c
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(getOwnPropertyNames), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().getOwnPropertyNames, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step d
|
// step d
|
||||||
@ -1684,13 +1684,13 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, JSObject *proxy_,
|
|||||||
|
|
||||||
// step f
|
// step f
|
||||||
if (trapResult.isPrimitive()) {
|
if (trapResult.isPrimitive()) {
|
||||||
ReportInvalidTrapResult(cx, proxy, ATOM(getOwnPropertyNames));
|
ReportInvalidTrapResult(cx, proxy, cx->names().getOwnPropertyNames);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// steps g to n are shared
|
// steps g to n are shared
|
||||||
return ArrayToIdVector(cx, proxy, target, trapResult, props, JSITER_OWNONLY | JSITER_HIDDEN,
|
return ArrayToIdVector(cx, proxy, target, trapResult, props, JSITER_OWNONLY | JSITER_HIDDEN,
|
||||||
ATOM(getOwnPropertyNames));
|
cx->names().getOwnPropertyNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proxy.[[Delete]](P, Throw)
|
// Proxy.[[Delete]](P, Throw)
|
||||||
@ -1708,7 +1708,7 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, JSObject *proxy_, jsid id_, b
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(deleteProperty), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().deleteProperty, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -1762,7 +1762,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy_, AutoIdVec
|
|||||||
|
|
||||||
// step c
|
// step c
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(enumerate), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().enumerate, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step d
|
// step d
|
||||||
@ -1780,7 +1780,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy_, AutoIdVec
|
|||||||
// step f
|
// step f
|
||||||
if (trapResult.isPrimitive()) {
|
if (trapResult.isPrimitive()) {
|
||||||
JSAutoByteString bytes;
|
JSAutoByteString bytes;
|
||||||
if (!js_AtomToPrintableString(cx, ATOM(enumerate), &bytes))
|
if (!js_AtomToPrintableString(cx, cx->names().enumerate, &bytes))
|
||||||
return false;
|
return false;
|
||||||
RootedValue v(cx, ObjectOrNullValue(proxy));
|
RootedValue v(cx, ObjectOrNullValue(proxy));
|
||||||
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_SEARCH_STACK,
|
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_SEARCH_STACK,
|
||||||
@ -1790,7 +1790,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy_, AutoIdVec
|
|||||||
|
|
||||||
// steps g-m are shared
|
// steps g-m are shared
|
||||||
// FIXME: the trap should return an iterator object, see bug 783826
|
// FIXME: the trap should return an iterator object, see bug 783826
|
||||||
return ArrayToIdVector(cx, proxy, target, trapResult, props, 0, ATOM(enumerate));
|
return ArrayToIdVector(cx, proxy, target, trapResult, props, 0, cx->names().enumerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proxy.[[HasProperty]](P)
|
// Proxy.[[HasProperty]](P)
|
||||||
@ -1808,7 +1808,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, JSObject *proxy_, jsid id_, bool
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(has), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().has, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -1871,7 +1871,7 @@ ScriptedDirectProxyHandler::hasOwn(JSContext *cx, JSObject *proxy_, jsid id_, bo
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(hasOwn), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().hasOwn, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -1944,7 +1944,7 @@ ScriptedDirectProxyHandler::get(JSContext *cx, JSObject *proxy_, JSObject *recei
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(get), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().get, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -2017,7 +2017,7 @@ ScriptedDirectProxyHandler::set(JSContext *cx, JSObject *proxy_, JSObject *recei
|
|||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(set), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().set, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
@ -2087,7 +2087,7 @@ ScriptedDirectProxyHandler::keys(JSContext *cx, JSObject *proxy_, AutoIdVector &
|
|||||||
|
|
||||||
// step c
|
// step c
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(keys), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().keys, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step d
|
// step d
|
||||||
@ -2105,7 +2105,7 @@ ScriptedDirectProxyHandler::keys(JSContext *cx, JSObject *proxy_, AutoIdVector &
|
|||||||
// step f
|
// step f
|
||||||
if (trapResult.isPrimitive()) {
|
if (trapResult.isPrimitive()) {
|
||||||
JSAutoByteString bytes;
|
JSAutoByteString bytes;
|
||||||
if (!js_AtomToPrintableString(cx, ATOM(keys), &bytes))
|
if (!js_AtomToPrintableString(cx, cx->names().keys, &bytes))
|
||||||
return false;
|
return false;
|
||||||
RootedValue v(cx, ObjectOrNullValue(proxy));
|
RootedValue v(cx, ObjectOrNullValue(proxy));
|
||||||
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK,
|
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK,
|
||||||
@ -2114,7 +2114,7 @@ ScriptedDirectProxyHandler::keys(JSContext *cx, JSObject *proxy_, AutoIdVector &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// steps g-n are shared
|
// steps g-n are shared
|
||||||
return ArrayToIdVector(cx, proxy, target, trapResult, props, JSITER_OWNONLY, ATOM(keys));
|
return ArrayToIdVector(cx, proxy, target, trapResult, props, JSITER_OWNONLY, cx->names().keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -2147,7 +2147,7 @@ ScriptedDirectProxyHandler::call(JSContext *cx, JSObject *proxy_, unsigned argc,
|
|||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(apply), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().apply, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 5
|
// step 5
|
||||||
@ -2188,7 +2188,7 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, JSObject *proxy_, unsigned
|
|||||||
|
|
||||||
// step 4
|
// step 4
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, ATOM(construct), &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().construct, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 5
|
// step 5
|
||||||
|
@ -1696,7 +1696,7 @@ class ASTSerializer
|
|||||||
DebugOnly<uint32_t> lineno;
|
DebugOnly<uint32_t> lineno;
|
||||||
|
|
||||||
RawValue unrootedAtomContents(RawAtom atom) {
|
RawValue unrootedAtomContents(RawAtom atom) {
|
||||||
return StringValue(atom ? atom : cx->runtime->atomState.emptyAtom);
|
return StringValue(atom ? atom : cx->names().empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryOperator binop(ParseNodeKind kind, JSOp op);
|
BinaryOperator binop(ParseNodeKind kind, JSOp op);
|
||||||
@ -3418,7 +3418,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
|||||||
RootedValue prop(cx);
|
RootedValue prop(cx);
|
||||||
|
|
||||||
/* config.loc */
|
/* config.loc */
|
||||||
RootedId locId(cx, NameToId(cx->runtime->atomState.locAtom));
|
RootedId locId(cx, NameToId(cx->names().loc));
|
||||||
RootedValue trueVal(cx, BooleanValue(true));
|
RootedValue trueVal(cx, BooleanValue(true));
|
||||||
if (!baseops::GetPropertyDefault(cx, config, locId, trueVal, &prop))
|
if (!baseops::GetPropertyDefault(cx, config, locId, trueVal, &prop))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -3427,7 +3427,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
|||||||
|
|
||||||
if (loc) {
|
if (loc) {
|
||||||
/* config.source */
|
/* config.source */
|
||||||
RootedId sourceId(cx, NameToId(cx->runtime->atomState.sourceAtom));
|
RootedId sourceId(cx, NameToId(cx->names().source));
|
||||||
RootedValue nullVal(cx, NullValue());
|
RootedValue nullVal(cx, NullValue());
|
||||||
if (!baseops::GetPropertyDefault(cx, config, sourceId, nullVal, &prop))
|
if (!baseops::GetPropertyDefault(cx, config, sourceId, nullVal, &prop))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -3449,7 +3449,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* config.line */
|
/* config.line */
|
||||||
RootedId lineId(cx, NameToId(cx->runtime->atomState.lineAtom));
|
RootedId lineId(cx, NameToId(cx->names().line));
|
||||||
RootedValue oneValue(cx, Int32Value(1));
|
RootedValue oneValue(cx, Int32Value(1));
|
||||||
if (!baseops::GetPropertyDefault(cx, config, lineId, oneValue, &prop) ||
|
if (!baseops::GetPropertyDefault(cx, config, lineId, oneValue, &prop) ||
|
||||||
!ToUint32(cx, prop, &lineno)) {
|
!ToUint32(cx, prop, &lineno)) {
|
||||||
@ -3458,7 +3458,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* config.builder */
|
/* config.builder */
|
||||||
RootedId builderId(cx, NameToId(cx->runtime->atomState.builderAtom));
|
RootedId builderId(cx, NameToId(cx->names().builder));
|
||||||
RootedValue nullVal(cx, NullValue());
|
RootedValue nullVal(cx, NullValue());
|
||||||
if (!baseops::GetPropertyDefault(cx, config, builderId, nullVal, &prop))
|
if (!baseops::GetPropertyDefault(cx, config, builderId, nullVal, &prop))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -53,7 +53,7 @@ using namespace js::frontend;
|
|||||||
unsigned
|
unsigned
|
||||||
Bindings::argumentsVarIndex(JSContext *cx) const
|
Bindings::argumentsVarIndex(JSContext *cx) const
|
||||||
{
|
{
|
||||||
PropertyName *arguments = cx->runtime->atomState.argumentsAtom;
|
HandlePropertyName arguments = cx->names().arguments;
|
||||||
BindingIter bi(*this);
|
BindingIter bi(*this);
|
||||||
while (bi->name() != arguments)
|
while (bi->name() != arguments)
|
||||||
bi++;
|
bi++;
|
||||||
|
@ -66,7 +66,7 @@ static JSLinearString *
|
|||||||
ArgToRootedString(JSContext *cx, CallArgs &args, unsigned argno)
|
ArgToRootedString(JSContext *cx, CallArgs &args, unsigned argno)
|
||||||
{
|
{
|
||||||
if (argno >= args.length())
|
if (argno >= args.length())
|
||||||
return cx->runtime->atomState.undefinedAtom;
|
return cx->names().undefined;
|
||||||
|
|
||||||
Value &arg = args[argno];
|
Value &arg = args[argno];
|
||||||
JSString *str = ToString(cx, arg);
|
JSString *str = ToString(cx, arg);
|
||||||
@ -439,7 +439,7 @@ ThisToStringForStringProto(JSContext *cx, CallReceiver call)
|
|||||||
if (call.thisv().isObject()) {
|
if (call.thisv().isObject()) {
|
||||||
RootedObject obj(cx, &call.thisv().toObject());
|
RootedObject obj(cx, &call.thisv().toObject());
|
||||||
if (obj->isString()) {
|
if (obj->isString()) {
|
||||||
Rooted<jsid> id(cx, NameToId(cx->runtime->atomState.toStringAtom));
|
Rooted<jsid> id(cx, NameToId(cx->names().toString));
|
||||||
if (ClassMethodIsNative(cx, obj, &StringClass, id, js_str_toString)) {
|
if (ClassMethodIsNative(cx, obj, &StringClass, id, js_str_toString)) {
|
||||||
JSString *str = obj->asString().unbox();
|
JSString *str = obj->asString().unbox();
|
||||||
call.setThis(StringValue(str));
|
call.setThis(StringValue(str));
|
||||||
@ -1727,8 +1727,8 @@ BuildFlatMatchArray(JSContext *cx, HandleString textstr, const FlatMatch &fm, Ca
|
|||||||
RootedValue textVal(cx, StringValue(textstr));
|
RootedValue textVal(cx, StringValue(textstr));
|
||||||
|
|
||||||
if (!JSObject::defineElement(cx, obj, 0, patternVal) ||
|
if (!JSObject::defineElement(cx, obj, 0, patternVal) ||
|
||||||
!JSObject::defineProperty(cx, obj, cx->runtime->atomState.indexAtom, matchVal) ||
|
!JSObject::defineProperty(cx, obj, cx->names().index, matchVal) ||
|
||||||
!JSObject::defineProperty(cx, obj, cx->runtime->atomState.inputAtom, textVal))
|
!JSObject::defineProperty(cx, obj, cx->names().input, textVal))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3220,7 +3220,7 @@ StringObject::assignInitialShape(JSContext *cx)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(nativeEmpty());
|
JS_ASSERT(nativeEmpty());
|
||||||
|
|
||||||
return addDataProperty(cx, NameToId(cx->runtime->atomState.lengthAtom),
|
return addDataProperty(cx, NameToId(cx->names().length),
|
||||||
LENGTH_SLOT, JSPROP_PERMANENT | JSPROP_READONLY);
|
LENGTH_SLOT, JSPROP_PERMANENT | JSPROP_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3238,7 +3238,7 @@ js_InitStringClass(JSContext *cx, JSObject *obj)
|
|||||||
|
|
||||||
/* Now create the String function. */
|
/* Now create the String function. */
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, js_String, cx->runtime->atomState.StringAtom, 1);
|
ctor = global->createConstructor(cx, js_String, cx->names().String, 1);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -3423,9 +3423,9 @@ js::ToStringSlow(JSContext *cx, const Value &arg)
|
|||||||
} else if (v.isBoolean()) {
|
} else if (v.isBoolean()) {
|
||||||
str = js_BooleanToString(cx, v.toBoolean());
|
str = js_BooleanToString(cx, v.toBoolean());
|
||||||
} else if (v.isNull()) {
|
} else if (v.isNull()) {
|
||||||
str = cx->runtime->atomState.nullAtom;
|
str = cx->names().null;
|
||||||
} else {
|
} else {
|
||||||
str = cx->runtime->atomState.undefinedAtom;
|
str = cx->names().undefined;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -3436,7 +3436,7 @@ js_ValueToSource(JSContext *cx, const Value &v)
|
|||||||
JS_CHECK_RECURSION(cx, return NULL);
|
JS_CHECK_RECURSION(cx, return NULL);
|
||||||
|
|
||||||
if (v.isUndefined())
|
if (v.isUndefined())
|
||||||
return cx->runtime->atomState.void0Atom;
|
return cx->names().void0;
|
||||||
if (v.isString())
|
if (v.isString())
|
||||||
return js_QuoteString(cx, v.toString(), '"');
|
return js_QuoteString(cx, v.toString(), '"');
|
||||||
if (v.isPrimitive()) {
|
if (v.isPrimitive()) {
|
||||||
@ -3452,7 +3452,7 @@ js_ValueToSource(JSContext *cx, const Value &v)
|
|||||||
|
|
||||||
Value rval = NullValue();
|
Value rval = NullValue();
|
||||||
RootedValue fval(cx);
|
RootedValue fval(cx);
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.toSourceAtom));
|
RootedId id(cx, NameToId(cx->names().toSource));
|
||||||
Rooted<JSObject*> obj(cx, &v.toObject());
|
Rooted<JSObject*> obj(cx, &v.toObject());
|
||||||
if (!GetMethod(cx, obj, id, 0, &fval))
|
if (!GetMethod(cx, obj, id, 0, &fval))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1596,16 +1596,16 @@ class TypedArrayTemplate
|
|||||||
static
|
static
|
||||||
bool defineGetters(JSContext *cx, HandleObject proto)
|
bool defineGetters(JSContext *cx, HandleObject proto)
|
||||||
{
|
{
|
||||||
if (!DefineGetter<lengthValue>(cx, cx->runtime->atomState.lengthAtom, proto))
|
if (!DefineGetter<lengthValue>(cx, cx->names().length, proto))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!DefineGetter<bufferValue>(cx, cx->runtime->atomState.bufferAtom, proto))
|
if (!DefineGetter<bufferValue>(cx, cx->names().buffer, proto))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!DefineGetter<byteLengthValue>(cx, cx->runtime->atomState.byteLengthAtom, proto))
|
if (!DefineGetter<byteLengthValue>(cx, cx->names().byteLength, proto))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!DefineGetter<byteOffsetValue>(cx, cx->runtime->atomState.byteOffsetAtom, proto))
|
if (!DefineGetter<byteOffsetValue>(cx, cx->names().byteOffset, proto))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3215,11 +3215,11 @@ InitTypedArrayClass(JSContext *cx)
|
|||||||
RootedValue bytesValue(cx, Int32Value(ArrayType::BYTES_PER_ELEMENT));
|
RootedValue bytesValue(cx, Int32Value(ArrayType::BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
if (!JSObject::defineProperty(cx, ctor,
|
if (!JSObject::defineProperty(cx, ctor,
|
||||||
cx->runtime->atomState.BYTES_PER_ELEMENTAtom, bytesValue,
|
cx->names().BYTES_PER_ELEMENT, bytesValue,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub,
|
JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY) ||
|
JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||||
!JSObject::defineProperty(cx, proto,
|
!JSObject::defineProperty(cx, proto,
|
||||||
cx->runtime->atomState.BYTES_PER_ELEMENTAtom, bytesValue,
|
cx->names().BYTES_PER_ELEMENT, bytesValue,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub,
|
JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY))
|
JSPROP_PERMANENT | JSPROP_READONLY))
|
||||||
{
|
{
|
||||||
@ -3291,14 +3291,14 @@ InitArrayBufferClass(JSContext *cx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RootedFunction ctor(cx, global->createConstructor(cx, ArrayBufferObject::class_constructor,
|
RootedFunction ctor(cx, global->createConstructor(cx, ArrayBufferObject::class_constructor,
|
||||||
cx->runtime->atomState.ArrayBufferAtom, 1));
|
cx->names().ArrayBuffer, 1));
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!LinkConstructorAndPrototype(cx, ctor, arrayBufferProto))
|
if (!LinkConstructorAndPrototype(cx, ctor, arrayBufferProto))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RootedId byteLengthId(cx, NameToId(cx->runtime->atomState.byteLengthAtom));
|
RootedId byteLengthId(cx, NameToId(cx->names().byteLength));
|
||||||
unsigned flags = JSPROP_SHARED | JSPROP_GETTER | JSPROP_PERMANENT;
|
unsigned flags = JSPROP_SHARED | JSPROP_GETTER | JSPROP_PERMANENT;
|
||||||
JSObject *getter = js_NewFunction(cx, NULL, ArrayBufferObject::byteLengthGetter, 0, 0, global, NULL);
|
JSObject *getter = js_NewFunction(cx, NULL, ArrayBufferObject::byteLengthGetter, 0, 0, global, NULL);
|
||||||
if (!getter)
|
if (!getter)
|
||||||
@ -3420,20 +3420,20 @@ DataViewObject::initClass(JSContext *cx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RootedFunction ctor(cx, global->createConstructor(cx, DataViewObject::class_constructor,
|
RootedFunction ctor(cx, global->createConstructor(cx, DataViewObject::class_constructor,
|
||||||
cx->runtime->atomState.DataViewAtom, 3));
|
cx->names().DataView, 3));
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!defineGetter<bufferValue>(cx, cx->runtime->atomState.bufferAtom, proto))
|
if (!defineGetter<bufferValue>(cx, cx->names().buffer, proto))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!defineGetter<byteLengthValue>(cx, cx->runtime->atomState.byteLengthAtom, proto))
|
if (!defineGetter<byteLengthValue>(cx, cx->names().byteLength, proto))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!defineGetter<byteOffsetValue>(cx, cx->runtime->atomState.byteOffsetAtom, proto))
|
if (!defineGetter<byteOffsetValue>(cx, cx->names().byteOffset, proto))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!JS_DefineFunctions(cx, proto, DataViewObject::jsfuncs))
|
if (!JS_DefineFunctions(cx, proto, DataViewObject::jsfuncs))
|
||||||
|
@ -373,7 +373,7 @@ js_InitWeakMapClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RootedFunction ctor(cx, global->createConstructor(cx, WeakMap_construct,
|
RootedFunction ctor(cx, global->createConstructor(cx, WeakMap_construct,
|
||||||
cx->runtime->atomState.WeakMapAtom, 0));
|
cx->names().WeakMap, 0));
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -354,12 +354,12 @@ ConvertQNameToString(JSContext *cx, JSObject *obj)
|
|||||||
RootedString str(cx);
|
RootedString str(cx);
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
/* No uri means wildcard qualifier. */
|
/* No uri means wildcard qualifier. */
|
||||||
str = cx->runtime->atomState.starQualifierAtom;
|
str = cx->names().starQualifier;
|
||||||
} else if (uri->empty()) {
|
} else if (uri->empty()) {
|
||||||
/* Empty string for uri means localName is in no namespace. */
|
/* Empty string for uri means localName is in no namespace. */
|
||||||
str = cx->runtime->emptyString;
|
str = cx->runtime->emptyString;
|
||||||
} else {
|
} else {
|
||||||
RootedString qualstr(cx, cx->runtime->atomState.qualifierAtom);
|
RootedString qualstr(cx, cx->names().qualifier);
|
||||||
str = js_ConcatStrings(cx, uri, qualstr);
|
str = js_ConcatStrings(cx, uri, qualstr);
|
||||||
if (!str)
|
if (!str)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -737,7 +737,7 @@ QNameHelper(JSContext *cx, int argc, jsval *argv, jsval *rval)
|
|||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
name = cx->runtime->emptyString;
|
name = cx->runtime->emptyString;
|
||||||
} else if (argc < 0) {
|
} else if (argc < 0) {
|
||||||
name = cx->runtime->atomState.undefinedAtom;
|
name = cx->names().undefined;
|
||||||
} else {
|
} else {
|
||||||
name = ToAtom(cx, nameval);
|
name = ToAtom(cx, nameval);
|
||||||
if (!name)
|
if (!name)
|
||||||
@ -2805,7 +2805,7 @@ ToAttributeName(JSContext *cx, jsval v)
|
|||||||
name = qn->getQNameLocalName();
|
name = qn->getQNameLocalName();
|
||||||
} else {
|
} else {
|
||||||
if (clasp == &AnyNameClass) {
|
if (clasp == &AnyNameClass) {
|
||||||
name = cx->runtime->atomState.starAtom;
|
name = cx->names().star;
|
||||||
} else {
|
} else {
|
||||||
name = ToAtom(cx, v);
|
name = ToAtom(cx, v);
|
||||||
if (!name)
|
if (!name)
|
||||||
@ -2833,7 +2833,7 @@ namespace js {
|
|||||||
bool
|
bool
|
||||||
GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx)
|
GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx)
|
||||||
{
|
{
|
||||||
JSAtom *atom = cx->runtime->atomState.functionNamespaceURIAtom;
|
JSAtom *atom = cx->names().functionNamespaceURI;
|
||||||
JSLinearString *uri = qn->getNameURI();
|
JSLinearString *uri = qn->getNameURI();
|
||||||
if (uri && (uri == atom || EqualStrings(uri, atom))) {
|
if (uri && (uri == atom || EqualStrings(uri, atom))) {
|
||||||
*namep = qn->getQNameLocalName();
|
*namep = qn->getQNameLocalName();
|
||||||
@ -2879,7 +2879,7 @@ ToXMLName(JSContext *cx, jsval v, jsid *funidp)
|
|||||||
if (clasp == &AttributeNameClass || clasp == &QNameClass)
|
if (clasp == &AttributeNameClass || clasp == &QNameClass)
|
||||||
goto out;
|
goto out;
|
||||||
if (clasp == &AnyNameClass) {
|
if (clasp == &AnyNameClass) {
|
||||||
name = cx->runtime->atomState.starAtom;
|
name = cx->names().star;
|
||||||
goto construct;
|
goto construct;
|
||||||
}
|
}
|
||||||
name = ToStringSlow(cx, v);
|
name = ToStringSlow(cx, v);
|
||||||
@ -4160,7 +4160,7 @@ PutProperty(JSContext *cx, HandleObject obj_, HandleId id_, JSBool strict, Mutab
|
|||||||
kidobj = js_GetXMLObject(cx, kid);
|
kidobj = js_GetXMLObject(cx, kid);
|
||||||
if (!kidobj)
|
if (!kidobj)
|
||||||
goto bad;
|
goto bad;
|
||||||
id = NameToId(cx->runtime->atomState.starAtom);
|
id = NameToId(cx->names().star);
|
||||||
ok = PutProperty(cx, kidobj, id, strict, vp);
|
ok = PutProperty(cx, kidobj, id, strict, vp);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
goto out;
|
goto out;
|
||||||
@ -4258,7 +4258,7 @@ PutProperty(JSContext *cx, HandleObject obj_, HandleId id_, JSBool strict, Mutab
|
|||||||
if (!left)
|
if (!left)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
RootedString space(cx, cx->runtime->atomState.spaceAtom);
|
RootedString space(cx, cx->names().space);
|
||||||
for (i = 1; i < n; i++) {
|
for (i = 1; i < n; i++) {
|
||||||
left = js_ConcatStrings(cx, left, space);
|
left = js_ConcatStrings(cx, left, space);
|
||||||
if (!left)
|
if (!left)
|
||||||
@ -5505,7 +5505,7 @@ xml_attribute(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
static JSBool
|
static JSBool
|
||||||
xml_attributes(JSContext *cx, unsigned argc, jsval *vp)
|
xml_attributes(JSContext *cx, unsigned argc, jsval *vp)
|
||||||
{
|
{
|
||||||
jsval name = STRING_TO_JSVAL(cx->runtime->atomState.starAtom);
|
jsval name = STRING_TO_JSVAL(cx->names().star);
|
||||||
JSObject *qn = ToAttributeName(cx, name);
|
JSObject *qn = ToAttributeName(cx, name);
|
||||||
if (!qn)
|
if (!qn)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -5674,7 +5674,7 @@ xml_children(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
RootedObject obj(cx, ToObject(cx, HandleValue::fromMarkedLocation(&vp[1])));
|
RootedObject obj(cx, ToObject(cx, HandleValue::fromMarkedLocation(&vp[1])));
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
RootedId name(cx, NameToId(cx->runtime->atomState.starAtom));
|
RootedId name(cx, NameToId(cx->names().star));
|
||||||
return GetProperty(cx, obj, name, MutableHandleValue::fromMarkedLocation(vp));
|
return GetProperty(cx, obj, name, MutableHandleValue::fromMarkedLocation(vp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5788,7 +5788,7 @@ xml_descendants(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
JSXML *list;
|
JSXML *list;
|
||||||
|
|
||||||
XML_METHOD_PROLOG;
|
XML_METHOD_PROLOG;
|
||||||
name = argc == 0 ? STRING_TO_JSVAL(cx->runtime->atomState.starAtom) : vp[2];
|
name = argc == 0 ? STRING_TO_JSVAL(cx->names().star) : vp[2];
|
||||||
list = Descendants(cx, xml, name);
|
list = Descendants(cx, xml, name);
|
||||||
if (!list)
|
if (!list)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -5860,7 +5860,7 @@ xml_elements(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
|
|
||||||
XML_METHOD_PROLOG;
|
XML_METHOD_PROLOG;
|
||||||
|
|
||||||
name = (argc == 0) ? STRING_TO_JSVAL(cx->runtime->atomState.starAtom) : vp[2];
|
name = (argc == 0) ? STRING_TO_JSVAL(cx->names().star) : vp[2];
|
||||||
nameqn = ToXMLName(cx, name, &funid);
|
nameqn = ToXMLName(cx, name, &funid);
|
||||||
if (!nameqn)
|
if (!nameqn)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -6413,7 +6413,7 @@ xml_processingInstructions(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
|
|
||||||
XML_METHOD_PROLOG;
|
XML_METHOD_PROLOG;
|
||||||
|
|
||||||
name = (argc == 0) ? STRING_TO_JSVAL(cx->runtime->atomState.starAtom) : vp[2];
|
name = (argc == 0) ? STRING_TO_JSVAL(cx->names().star) : vp[2];
|
||||||
nameqn = ToXMLName(cx, name, &funid);
|
nameqn = ToXMLName(cx, name, &funid);
|
||||||
if (!nameqn)
|
if (!nameqn)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -6550,7 +6550,7 @@ xml_replace(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
value = STRING_TO_JSVAL(cx->runtime->atomState.undefinedAtom);
|
value = STRING_TO_JSVAL(cx->names().undefined);
|
||||||
} else {
|
} else {
|
||||||
value = vp[3];
|
value = vp[3];
|
||||||
vxml = VALUE_IS_XML(value)
|
vxml = VALUE_IS_XML(value)
|
||||||
@ -6622,7 +6622,7 @@ xml_setChildren(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
if (!StartNonListXMLMethod(cx, vp, &obj))
|
if (!StartNonListXMLMethod(cx, vp, &obj))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
Rooted<jsid> id(cx, NameToId(cx->runtime->atomState.starAtom));
|
Rooted<jsid> id(cx, NameToId(cx->names().star));
|
||||||
*vp = argc != 0 ? vp[2] : JSVAL_VOID; /* local root */
|
*vp = argc != 0 ? vp[2] : JSVAL_VOID; /* local root */
|
||||||
if (!PutProperty(cx, obj, id, false, MutableHandleValue::fromMarkedLocation(vp)))
|
if (!PutProperty(cx, obj, id, false, MutableHandleValue::fromMarkedLocation(vp)))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
@ -6642,7 +6642,7 @@ xml_setLocalName(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
|
|
||||||
JSAtom *namestr;
|
JSAtom *namestr;
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
namestr = cx->runtime->atomState.undefinedAtom;
|
namestr = cx->names().undefined;
|
||||||
} else {
|
} else {
|
||||||
jsval name = vp[2];
|
jsval name = vp[2];
|
||||||
if (!JSVAL_IS_PRIMITIVE(name) && JSVAL_TO_OBJECT(name)->isQName()) {
|
if (!JSVAL_IS_PRIMITIVE(name) && JSVAL_TO_OBJECT(name)->isQName()) {
|
||||||
@ -6678,7 +6678,7 @@ xml_setName(JSContext *cx, unsigned argc, jsval *vp)
|
|||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
name = STRING_TO_JSVAL(cx->runtime->atomState.undefinedAtom);
|
name = STRING_TO_JSVAL(cx->names().undefined);
|
||||||
} else {
|
} else {
|
||||||
name = vp[2];
|
name = vp[2];
|
||||||
if (!JSVAL_IS_PRIMITIVE(name) &&
|
if (!JSVAL_IS_PRIMITIVE(name) &&
|
||||||
@ -7340,7 +7340,7 @@ js_InitNamespaceClass(JSContext *cx, JSObject *obj)
|
|||||||
|
|
||||||
const unsigned NAMESPACE_CTOR_LENGTH = 2;
|
const unsigned NAMESPACE_CTOR_LENGTH = 2;
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, Namespace, cx->runtime->atomState.NamespaceAtom,
|
ctor = global->createConstructor(cx, Namespace, cx->names().Namespace,
|
||||||
NAMESPACE_CTOR_LENGTH);
|
NAMESPACE_CTOR_LENGTH);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -7373,7 +7373,7 @@ js_InitQNameClass(JSContext *cx, JSObject *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const unsigned QNAME_CTOR_LENGTH = 2;
|
const unsigned QNAME_CTOR_LENGTH = 2;
|
||||||
RootedFunction ctor(cx, global->createConstructor(cx, QName, cx->runtime->atomState.QNameAtom,
|
RootedFunction ctor(cx, global->createConstructor(cx, QName, cx->names().QName,
|
||||||
QNAME_CTOR_LENGTH));
|
QNAME_CTOR_LENGTH));
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -7414,7 +7414,7 @@ js_InitXMLClass(JSContext *cx, JSObject *obj)
|
|||||||
|
|
||||||
const unsigned XML_CTOR_LENGTH = 1;
|
const unsigned XML_CTOR_LENGTH = 1;
|
||||||
RootedFunction ctor(cx);
|
RootedFunction ctor(cx);
|
||||||
ctor = global->createConstructor(cx, XML, cx->runtime->atomState.XMLAtom, XML_CTOR_LENGTH);
|
ctor = global->createConstructor(cx, XML, cx->names().XML, XML_CTOR_LENGTH);
|
||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -7435,7 +7435,7 @@ js_InitXMLClass(JSContext *cx, JSObject *obj)
|
|||||||
if (!xmllist)
|
if (!xmllist)
|
||||||
return NULL;
|
return NULL;
|
||||||
RootedValue value(cx, ObjectValue(*xmlProto));
|
RootedValue value(cx, ObjectValue(*xmlProto));
|
||||||
if (!JSObject::defineProperty(cx, xmllist, cx->runtime->atomState.classPrototypeAtom,
|
if (!JSObject::defineProperty(cx, xmllist, cx->names().classPrototype,
|
||||||
value, JS_PropertyStub, JS_StrictPropertyStub,
|
value, JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY))
|
JSPROP_PERMANENT | JSPROP_READONLY))
|
||||||
{
|
{
|
||||||
@ -7469,9 +7469,8 @@ GlobalObject::getFunctionNamespace(JSContext *cx, Value *vp)
|
|||||||
{
|
{
|
||||||
Value v = getSlot(FUNCTION_NS);
|
Value v = getSlot(FUNCTION_NS);
|
||||||
if (v.isUndefined()) {
|
if (v.isUndefined()) {
|
||||||
JSRuntime *rt = cx->runtime;
|
HandlePropertyName prefix = cx->names().function;
|
||||||
JSLinearString *prefix = rt->atomState.functionAtom;
|
HandlePropertyName uri = cx->names().functionNamespaceURI;
|
||||||
JSLinearString *uri = rt->atomState.functionNamespaceURIAtom;
|
|
||||||
RootedObject obj(cx, NewXMLNamespace(cx, prefix, uri, JS_FALSE));
|
RootedObject obj(cx, NewXMLNamespace(cx, prefix, uri, JS_FALSE));
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
@ -7648,7 +7647,7 @@ js_GetAnyName(JSContext *cx, jsid *idp)
|
|||||||
JS_ASSERT(!obj->getProto());
|
JS_ASSERT(!obj->getProto());
|
||||||
|
|
||||||
JSRuntime *rt = cx->runtime;
|
JSRuntime *rt = cx->runtime;
|
||||||
if (!InitXMLQName(cx, obj, rt->emptyString, rt->emptyString, rt->atomState.starAtom))
|
if (!InitXMLQName(cx, obj, rt->emptyString, rt->emptyString, rt->atomState.star))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
v.setObject(*obj);
|
v.setObject(*obj);
|
||||||
@ -7673,7 +7672,7 @@ js_FindXMLProperty(JSContext *cx, const Value &nameval, MutableHandleObject objp
|
|||||||
JS_ASSERT(nameval.isObject());
|
JS_ASSERT(nameval.isObject());
|
||||||
nameobj = &nameval.toObject();
|
nameobj = &nameval.toObject();
|
||||||
if (nameobj->getClass() == &AnyNameClass) {
|
if (nameobj->getClass() == &AnyNameClass) {
|
||||||
v = STRING_TO_JSVAL(cx->runtime->atomState.starAtom);
|
v = STRING_TO_JSVAL(cx->names().star);
|
||||||
nameobj = ConstructObjectWithArguments(cx, &QNameClass, 1, &v);
|
nameobj = ConstructObjectWithArguments(cx, &QNameClass, 1, &v);
|
||||||
if (!nameobj)
|
if (!nameobj)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -5026,13 +5026,12 @@ mjit::Compiler::jsop_getprop(PropertyName *name, JSValueType knownType,
|
|||||||
*/
|
*/
|
||||||
RejoinState rejoin = REJOIN_GETTER;
|
RejoinState rejoin = REJOIN_GETTER;
|
||||||
if (forPrototype) {
|
if (forPrototype) {
|
||||||
JS_ASSERT(top->isType(JSVAL_TYPE_OBJECT) &&
|
JS_ASSERT(top->isType(JSVAL_TYPE_OBJECT) && name == cx->names().classPrototype);
|
||||||
name == cx->runtime->atomState.classPrototypeAtom);
|
|
||||||
rejoin = REJOIN_THIS_PROTOTYPE;
|
rejoin = REJOIN_THIS_PROTOTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle length accesses on known strings without using a PIC. */
|
/* Handle length accesses on known strings without using a PIC. */
|
||||||
if (name == cx->runtime->atomState.lengthAtom &&
|
if (name == cx->names().length &&
|
||||||
top->isType(JSVAL_TYPE_STRING) &&
|
top->isType(JSVAL_TYPE_STRING) &&
|
||||||
(!cx->typeInferenceEnabled() || knownPushedType(0) == JSVAL_TYPE_INT32)) {
|
(!cx->typeInferenceEnabled() || knownPushedType(0) == JSVAL_TYPE_INT32)) {
|
||||||
if (top->isConstant()) {
|
if (top->isConstant()) {
|
||||||
@ -5052,7 +5051,7 @@ mjit::Compiler::jsop_getprop(PropertyName *name, JSValueType knownType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle lenth accesses of optimize 'arguments'. */
|
/* Handle lenth accesses of optimize 'arguments'. */
|
||||||
if (name == cx->runtime->atomState.lengthAtom &&
|
if (name == cx->names().length &&
|
||||||
cx->typeInferenceEnabled() &&
|
cx->typeInferenceEnabled() &&
|
||||||
analysis->poppedTypes(PC, 0)->isMagicArguments() &&
|
analysis->poppedTypes(PC, 0)->isMagicArguments() &&
|
||||||
knownPushedType(0) == JSVAL_TYPE_INT32)
|
knownPushedType(0) == JSVAL_TYPE_INT32)
|
||||||
@ -6460,15 +6459,15 @@ mjit::Compiler::jsop_getgname(uint32_t index)
|
|||||||
{
|
{
|
||||||
/* Optimize undefined, NaN and Infinity. */
|
/* Optimize undefined, NaN and Infinity. */
|
||||||
PropertyName *name = script->getName(index);
|
PropertyName *name = script->getName(index);
|
||||||
if (name == cx->runtime->atomState.undefinedAtom) {
|
if (name == cx->names().undefined) {
|
||||||
frame.push(UndefinedValue());
|
frame.push(UndefinedValue());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (name == cx->runtime->atomState.NaNAtom) {
|
if (name == cx->names().NaN) {
|
||||||
frame.push(cx->runtime->NaNValue);
|
frame.push(cx->runtime->NaNValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (name == cx->runtime->atomState.InfinityAtom) {
|
if (name == cx->names().Infinity) {
|
||||||
frame.push(cx->runtime->positiveInfinityValue);
|
frame.push(cx->runtime->positiveInfinityValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -6796,7 +6795,7 @@ mjit::Compiler::jsop_instanceof()
|
|||||||
/* This is sadly necessary because the error case needs the object. */
|
/* This is sadly necessary because the error case needs the object. */
|
||||||
frame.dup();
|
frame.dup();
|
||||||
|
|
||||||
if (!jsop_getprop(cx->runtime->atomState.classPrototypeAtom, JSVAL_TYPE_UNKNOWN))
|
if (!jsop_getprop(cx->names().classPrototype, JSVAL_TYPE_UNKNOWN))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Primitive prototypes are invalid. */
|
/* Primitive prototypes are invalid. */
|
||||||
@ -7378,7 +7377,7 @@ mjit::Compiler::constructThis()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsid id = NameToId(cx->runtime->atomState.classPrototypeAtom);
|
Rooted<jsid> id(cx, NameToId(cx->names().classPrototype));
|
||||||
types::HeapTypeSet *protoTypes = fun->getType(cx)->getProperty(cx, id, false);
|
types::HeapTypeSet *protoTypes = fun->getType(cx)->getProperty(cx, id, false);
|
||||||
|
|
||||||
JSObject *proto = protoTypes->getSingleton(cx);
|
JSObject *proto = protoTypes->getSingleton(cx);
|
||||||
@ -7427,7 +7426,7 @@ mjit::Compiler::constructThis()
|
|||||||
frame.pushCallee();
|
frame.pushCallee();
|
||||||
|
|
||||||
// Get callee.prototype.
|
// Get callee.prototype.
|
||||||
if (!jsop_getprop(cx->runtime->atomState.classPrototypeAtom, JSVAL_TYPE_UNKNOWN, false, /* forPrototype = */ true))
|
if (!jsop_getprop(cx->names().classPrototype, JSVAL_TYPE_UNKNOWN, false, /* forPrototype = */ true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Reach into the proto Value and grab a register for its data.
|
// Reach into the proto Value and grab a register for its data.
|
||||||
|
@ -692,22 +692,22 @@ mjit::Compiler::jsop_typeof()
|
|||||||
JSAtom *atom = NULL;
|
JSAtom *atom = NULL;
|
||||||
switch (fe->getKnownType()) {
|
switch (fe->getKnownType()) {
|
||||||
case JSVAL_TYPE_STRING:
|
case JSVAL_TYPE_STRING:
|
||||||
atom = rt->atomState.stringAtom;
|
atom = rt->atomState.string;
|
||||||
break;
|
break;
|
||||||
case JSVAL_TYPE_UNDEFINED:
|
case JSVAL_TYPE_UNDEFINED:
|
||||||
atom = rt->atomState.undefinedAtom;
|
atom = rt->atomState.undefined;
|
||||||
break;
|
break;
|
||||||
case JSVAL_TYPE_NULL:
|
case JSVAL_TYPE_NULL:
|
||||||
atom = rt->atomState.objectAtom;
|
atom = rt->atomState.object;
|
||||||
break;
|
break;
|
||||||
case JSVAL_TYPE_OBJECT:
|
case JSVAL_TYPE_OBJECT:
|
||||||
atom = NULL;
|
atom = NULL;
|
||||||
break;
|
break;
|
||||||
case JSVAL_TYPE_BOOLEAN:
|
case JSVAL_TYPE_BOOLEAN:
|
||||||
atom = rt->atomState.booleanAtom;
|
atom = rt->atomState.boolean;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
atom = rt->atomState.numberAtom;
|
atom = rt->atomState.number;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,13 +730,13 @@ mjit::Compiler::jsop_typeof()
|
|||||||
? Assembler::Equal
|
? Assembler::Equal
|
||||||
: Assembler::NotEqual;
|
: Assembler::NotEqual;
|
||||||
|
|
||||||
if (atom == rt->atomState.undefinedAtom) {
|
if (atom == rt->atomState.undefined) {
|
||||||
type = JSVAL_TYPE_UNDEFINED;
|
type = JSVAL_TYPE_UNDEFINED;
|
||||||
} else if (atom == rt->atomState.stringAtom) {
|
} else if (atom == rt->atomState.string) {
|
||||||
type = JSVAL_TYPE_STRING;
|
type = JSVAL_TYPE_STRING;
|
||||||
} else if (atom == rt->atomState.booleanAtom) {
|
} else if (atom == rt->atomState.boolean) {
|
||||||
type = JSVAL_TYPE_BOOLEAN;
|
type = JSVAL_TYPE_BOOLEAN;
|
||||||
} else if (atom == rt->atomState.numberAtom) {
|
} else if (atom == rt->atomState.number) {
|
||||||
type = JSVAL_TYPE_INT32;
|
type = JSVAL_TYPE_INT32;
|
||||||
|
|
||||||
/* JSVAL_TYPE_DOUBLE is 0x0 and JSVAL_TYPE_INT32 is 0x1, use <= or > to match both */
|
/* JSVAL_TYPE_DOUBLE is 0x0 and JSVAL_TYPE_INT32 is 0x1, use <= or > to match both */
|
||||||
|
@ -849,7 +849,7 @@ LoopState::invariantProperty(const CrossSSAValue &obj, jsid id)
|
|||||||
if (skipAnalysis)
|
if (skipAnalysis)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (id == NameToId(cx->runtime->atomState.lengthAtom))
|
if (id == NameToId(cx->names().length))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
uint32_t objSlot;
|
uint32_t objSlot;
|
||||||
|
@ -1984,7 +1984,7 @@ ic::GetProp(VMFrame &f, ic::PICInfo *pic)
|
|||||||
VoidStubPIC stub = cached ? DisabledGetPropIC : DisabledGetPropNoCacheIC;
|
VoidStubPIC stub = cached ? DisabledGetPropIC : DisabledGetPropNoCacheIC;
|
||||||
|
|
||||||
RootedPropertyName name(f.cx, pic->name);
|
RootedPropertyName name(f.cx, pic->name);
|
||||||
if (name == f.cx->runtime->atomState.lengthAtom) {
|
if (name == f.cx->names().length) {
|
||||||
if (IsOptimizedArguments(f.fp(), &f.regs.sp[-1])) {
|
if (IsOptimizedArguments(f.fp(), &f.regs.sp[-1])) {
|
||||||
f.regs.sp[-1].setInt32(f.regs.fp()->numActualArgs());
|
f.regs.sp[-1].setInt32(f.regs.fp()->numActualArgs());
|
||||||
return;
|
return;
|
||||||
@ -2014,7 +2014,7 @@ ic::GetProp(VMFrame &f, ic::PICInfo *pic)
|
|||||||
|
|
||||||
if (f.regs.sp[-1].isString()) {
|
if (f.regs.sp[-1].isString()) {
|
||||||
GetPropCompiler cc(f, NULL, *pic, name, stub);
|
GetPropCompiler cc(f, NULL, *pic, name, stub);
|
||||||
if (name == f.cx->runtime->atomState.lengthAtom) {
|
if (name == f.cx->names().length) {
|
||||||
LookupStatus status = cc.generateStringLengthStub();
|
LookupStatus status = cc.generateStringLengthStub();
|
||||||
if (status == Lookup_Error)
|
if (status == Lookup_Error)
|
||||||
THROW();
|
THROW();
|
||||||
|
@ -1033,7 +1033,7 @@ stubs::GetPropNoCache(VMFrame &f, PropertyName *name)
|
|||||||
|
|
||||||
// Uncached lookups are only used for .prototype accesses at the start of constructors.
|
// Uncached lookups are only used for .prototype accesses at the start of constructors.
|
||||||
JS_ASSERT(lval.isObject());
|
JS_ASSERT(lval.isObject());
|
||||||
JS_ASSERT(name == cx->runtime->atomState.classPrototypeAtom);
|
JS_ASSERT(name == cx->names().classPrototype);
|
||||||
|
|
||||||
RootedObject obj(cx, &lval.toObject());
|
RootedObject obj(cx, &lval.toObject());
|
||||||
RootedValue rval(cx);
|
RootedValue rval(cx);
|
||||||
@ -1081,7 +1081,7 @@ InitPropOrMethod(VMFrame &f, PropertyName *name, JSOp op)
|
|||||||
/* Get the immediate property name into id. */
|
/* Get the immediate property name into id. */
|
||||||
RootedId id(cx, NameToId(name));
|
RootedId id(cx, NameToId(name));
|
||||||
|
|
||||||
if (JS_UNLIKELY(name == cx->runtime->atomState.protoAtom)
|
if (JS_UNLIKELY(name == cx->names().proto)
|
||||||
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false)
|
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false)
|
||||||
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
||||||
JSPROP_ENUMERATE, 0, 0, 0)) {
|
JSPROP_ENUMERATE, 0, 0, 0)) {
|
||||||
|
@ -122,9 +122,9 @@ args_delProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValu
|
|||||||
unsigned arg = unsigned(JSID_TO_INT(id));
|
unsigned arg = unsigned(JSID_TO_INT(id));
|
||||||
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
||||||
argsobj.markElementDeleted(arg);
|
argsobj.markElementDeleted(arg);
|
||||||
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
} else if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
argsobj.markLengthOverridden();
|
argsobj.markLengthOverridden();
|
||||||
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom)) {
|
} else if (JSID_IS_ATOM(id, cx->names().callee)) {
|
||||||
argsobj.asNormalArguments().clearCallee();
|
argsobj.asNormalArguments().clearCallee();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -145,11 +145,11 @@ ArgGetter(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
|
|||||||
unsigned arg = unsigned(JSID_TO_INT(id));
|
unsigned arg = unsigned(JSID_TO_INT(id));
|
||||||
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
||||||
vp.set(argsobj.element(arg));
|
vp.set(argsobj.element(arg));
|
||||||
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
} else if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
if (!argsobj.hasOverriddenLength())
|
if (!argsobj.hasOverriddenLength())
|
||||||
vp.setInt32(argsobj.initialLength());
|
vp.setInt32(argsobj.initialLength());
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom));
|
JS_ASSERT(JSID_IS_ATOM(id, cx->names().callee));
|
||||||
if (!argsobj.callee().isMagic(JS_OVERWRITTEN_CALLEE))
|
if (!argsobj.callee().isMagic(JS_OVERWRITTEN_CALLEE))
|
||||||
vp.set(argsobj.callee());
|
vp.set(argsobj.callee());
|
||||||
}
|
}
|
||||||
@ -183,8 +183,7 @@ ArgSetter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom) ||
|
JS_ASSERT(JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().callee));
|
||||||
JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -215,11 +214,11 @@ args_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
attrs |= JSPROP_ENUMERATE;
|
attrs |= JSPROP_ENUMERATE;
|
||||||
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
} else if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
if (argsobj->hasOverriddenLength())
|
if (argsobj->hasOverriddenLength())
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (!JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom))
|
if (!JSID_IS_ATOM(id, cx->names().callee))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (argsobj->callee().isMagic(JS_OVERWRITTEN_CALLEE))
|
if (argsobj->callee().isMagic(JS_OVERWRITTEN_CALLEE))
|
||||||
@ -247,9 +246,9 @@ args_enumerate(JSContext *cx, HandleObject obj)
|
|||||||
int argc = int(argsobj->initialLength());
|
int argc = int(argsobj->initialLength());
|
||||||
for (int i = -2; i != argc; i++) {
|
for (int i = -2; i != argc; i++) {
|
||||||
id = (i == -2)
|
id = (i == -2)
|
||||||
? NameToId(cx->runtime->atomState.lengthAtom)
|
? NameToId(cx->names().length)
|
||||||
: (i == -1)
|
: (i == -1)
|
||||||
? NameToId(cx->runtime->atomState.calleeAtom)
|
? NameToId(cx->names().callee)
|
||||||
: INT_TO_JSID(i);
|
: INT_TO_JSID(i);
|
||||||
|
|
||||||
RootedObject pobj(cx);
|
RootedObject pobj(cx);
|
||||||
@ -277,7 +276,7 @@ StrictArgGetter(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue
|
|||||||
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg))
|
||||||
vp.set(argsobj.element(arg));
|
vp.set(argsobj.element(arg));
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom));
|
JS_ASSERT(JSID_IS_ATOM(id, cx->names().length));
|
||||||
if (!argsobj.hasOverriddenLength())
|
if (!argsobj.hasOverriddenLength())
|
||||||
vp.setInt32(argsobj.initialLength());
|
vp.setInt32(argsobj.initialLength());
|
||||||
}
|
}
|
||||||
@ -305,7 +304,7 @@ StrictArgSetter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, Mut
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom));
|
JS_ASSERT(JSID_IS_ATOM(id, cx->names().length));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -337,14 +336,12 @@ strictargs_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
attrs |= JSPROP_ENUMERATE;
|
attrs |= JSPROP_ENUMERATE;
|
||||||
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
|
} else if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||||
if (argsobj->hasOverriddenLength())
|
if (argsobj->hasOverriddenLength())
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (!JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom) &&
|
if (!JSID_IS_ATOM(id, cx->names().callee) && !JSID_IS_ATOM(id, cx->names().caller))
|
||||||
!JSID_IS_ATOM(id, cx->runtime->atomState.callerAtom)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
|
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
|
||||||
getter = CastAsPropertyOp(argsobj->global().getThrowTypeError());
|
getter = CastAsPropertyOp(argsobj->global().getThrowTypeError());
|
||||||
@ -373,17 +370,17 @@ strictargs_enumerate(JSContext *cx, HandleObject obj)
|
|||||||
RootedId id(cx);
|
RootedId id(cx);
|
||||||
|
|
||||||
// length
|
// length
|
||||||
id = NameToId(cx->runtime->atomState.lengthAtom);
|
id = NameToId(cx->names().length);
|
||||||
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// callee
|
// callee
|
||||||
id = NameToId(cx->runtime->atomState.calleeAtom);
|
id = NameToId(cx->names().callee);
|
||||||
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// caller
|
// caller
|
||||||
id = NameToId(cx->runtime->atomState.callerAtom);
|
id = NameToId(cx->names().caller);
|
||||||
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1798,7 +1798,7 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
/* Get Debugger.prototype. */
|
/* Get Debugger.prototype. */
|
||||||
RootedValue v(cx);
|
RootedValue v(cx);
|
||||||
RootedObject callee(cx, &args.callee());
|
RootedObject callee(cx, &args.callee());
|
||||||
if (!JSObject::getProperty(cx, callee, callee, cx->runtime->atomState.classPrototypeAtom, &v))
|
if (!JSObject::getProperty(cx, callee, callee, cx->names().classPrototype, &v))
|
||||||
return false;
|
return false;
|
||||||
RootedObject proto(cx, &v.toObject());
|
RootedObject proto(cx, &v.toObject());
|
||||||
JS_ASSERT(proto->getClass() == &Debugger::jsclass);
|
JS_ASSERT(proto->getClass() == &Debugger::jsclass);
|
||||||
@ -2000,7 +2000,7 @@ class Debugger::ScriptQuery {
|
|||||||
* scripts scoped to a particular global object.
|
* scripts scoped to a particular global object.
|
||||||
*/
|
*/
|
||||||
RootedValue global(cx);
|
RootedValue global(cx);
|
||||||
if (!JSObject::getProperty(cx, query, query, cx->runtime->atomState.globalAtom, &global))
|
if (!JSObject::getProperty(cx, query, query, cx->names().global, &global))
|
||||||
return false;
|
return false;
|
||||||
if (global.isUndefined()) {
|
if (global.isUndefined()) {
|
||||||
matchAllDebuggeeGlobals();
|
matchAllDebuggeeGlobals();
|
||||||
@ -2021,7 +2021,7 @@ class Debugger::ScriptQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for a 'url' property. */
|
/* Check for a 'url' property. */
|
||||||
if (!JSObject::getProperty(cx, query, query, cx->runtime->atomState.urlAtom, &url))
|
if (!JSObject::getProperty(cx, query, query, cx->names().url, &url))
|
||||||
return false;
|
return false;
|
||||||
if (!url.isUndefined() && !url.isString()) {
|
if (!url.isUndefined() && !url.isString()) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
|
||||||
@ -2031,7 +2031,7 @@ class Debugger::ScriptQuery {
|
|||||||
|
|
||||||
/* Check for a 'line' property. */
|
/* Check for a 'line' property. */
|
||||||
RootedValue lineProperty(cx);
|
RootedValue lineProperty(cx);
|
||||||
if (!JSObject::getProperty(cx, query, query, cx->runtime->atomState.lineAtom, &lineProperty))
|
if (!JSObject::getProperty(cx, query, query, cx->names().line, &lineProperty))
|
||||||
return false;
|
return false;
|
||||||
if (lineProperty.isUndefined()) {
|
if (lineProperty.isUndefined()) {
|
||||||
hasLine = false;
|
hasLine = false;
|
||||||
@ -2055,7 +2055,7 @@ class Debugger::ScriptQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for an 'innermost' property. */
|
/* Check for an 'innermost' property. */
|
||||||
PropertyName *innermostName = cx->runtime->atomState.innermostAtom;
|
PropertyName *innermostName = cx->names().innermost;
|
||||||
RootedValue innermostProperty(cx);
|
RootedValue innermostProperty(cx);
|
||||||
if (!JSObject::getProperty(cx, query, query, innermostName, &innermostProperty))
|
if (!JSObject::getProperty(cx, query, query, innermostName, &innermostProperty))
|
||||||
return false;
|
return false;
|
||||||
@ -3065,10 +3065,10 @@ DebuggerFrame_getType(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
* order of checks here is significant.
|
* order of checks here is significant.
|
||||||
*/
|
*/
|
||||||
args.rval().setString(fp->isEvalFrame()
|
args.rval().setString(fp->isEvalFrame()
|
||||||
? cx->runtime->atomState.evalAtom
|
? cx->names().eval
|
||||||
: fp->isGlobalFrame()
|
: fp->isGlobalFrame()
|
||||||
? cx->runtime->atomState.globalAtom
|
? cx->names().global
|
||||||
: cx->runtime->atomState.callAtom);
|
: cx->names().call);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3234,7 +3234,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
JS_ASSERT(fp->numActualArgs() <= 0x7fffffff);
|
JS_ASSERT(fp->numActualArgs() <= 0x7fffffff);
|
||||||
unsigned fargc = fp->numActualArgs();
|
unsigned fargc = fp->numActualArgs();
|
||||||
RootedValue fargcVal(cx, Int32Value(fargc));
|
RootedValue fargcVal(cx, Int32Value(fargc));
|
||||||
if (!DefineNativeProperty(cx, argsobj, cx->runtime->atomState.lengthAtom,
|
if (!DefineNativeProperty(cx, argsobj, cx->names().length,
|
||||||
fargcVal, NULL, NULL,
|
fargcVal, NULL, NULL,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0))
|
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0))
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ ProtoGetterImpl(JSContext *cx, CallArgs args)
|
|||||||
|
|
||||||
unsigned dummy;
|
unsigned dummy;
|
||||||
RootedObject obj(cx, &args.thisv().toObject());
|
RootedObject obj(cx, &args.thisv().toObject());
|
||||||
RootedId nid(cx, NameToId(cx->runtime->atomState.protoAtom));
|
RootedId nid(cx, NameToId(cx->names().proto));
|
||||||
RootedValue v(cx);
|
RootedValue v(cx);
|
||||||
if (!CheckAccess(cx, obj, nid, JSACC_PROTO, &v, &dummy))
|
if (!CheckAccess(cx, obj, nid, JSACC_PROTO, &v, &dummy))
|
||||||
return false;
|
return false;
|
||||||
@ -154,7 +154,7 @@ ProtoSetterImpl(JSContext *cx, CallArgs args)
|
|||||||
Rooted<JSObject*> newProto(cx, args[0].toObjectOrNull());
|
Rooted<JSObject*> newProto(cx, args[0].toObjectOrNull());
|
||||||
|
|
||||||
unsigned dummy;
|
unsigned dummy;
|
||||||
RootedId nid(cx, NameToId(cx->runtime->atomState.protoAtom));
|
RootedId nid(cx, NameToId(cx->names().proto));
|
||||||
RootedValue v(cx);
|
RootedValue v(cx);
|
||||||
if (!CheckAccess(cx, obj, nid, JSAccessMode(JSACC_PROTO | JSACC_WRITE), &v, &dummy))
|
if (!CheckAccess(cx, obj, nid, JSAccessMode(JSACC_PROTO | JSACC_WRITE), &v, &dummy))
|
||||||
return false;
|
return false;
|
||||||
@ -348,7 +348,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
|||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
objectCtor = js_NewFunction(cx, ctor, js_Object, 1, JSFUN_CONSTRUCTOR, self,
|
objectCtor = js_NewFunction(cx, ctor, js_Object, 1, JSFUN_CONSTRUCTOR, self,
|
||||||
cx->runtime->atomState.ObjectAtom);
|
cx->names().Object);
|
||||||
if (!objectCtor)
|
if (!objectCtor)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -367,7 +367,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
|||||||
if (!ctor)
|
if (!ctor)
|
||||||
return NULL;
|
return NULL;
|
||||||
functionCtor = js_NewFunction(cx, ctor, Function, 1, JSFUN_CONSTRUCTOR, self,
|
functionCtor = js_NewFunction(cx, ctor, Function, 1, JSFUN_CONSTRUCTOR, self,
|
||||||
cx->runtime->atomState.FunctionAtom);
|
cx->names().Function);
|
||||||
if (!functionCtor)
|
if (!functionCtor)
|
||||||
return NULL;
|
return NULL;
|
||||||
JS_ASSERT(ctor == functionCtor);
|
JS_ASSERT(ctor == functionCtor);
|
||||||
@ -404,7 +404,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
RootedValue undefinedValue(cx, UndefinedValue());
|
RootedValue undefinedValue(cx, UndefinedValue());
|
||||||
if (!JSObject::defineProperty(cx, objectProto,
|
if (!JSObject::defineProperty(cx, objectProto,
|
||||||
cx->runtime->atomState.protoAtom, undefinedValue,
|
cx->names().proto, undefinedValue,
|
||||||
JS_DATA_TO_FUNC_PTR(PropertyOp, getter.get()),
|
JS_DATA_TO_FUNC_PTR(PropertyOp, getter.get()),
|
||||||
JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setter.get()),
|
JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setter.get()),
|
||||||
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED))
|
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED))
|
||||||
@ -424,17 +424,17 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add the global Function and Object properties now. */
|
/* Add the global Function and Object properties now. */
|
||||||
jsid objectId = NameToId(cx->runtime->atomState.ObjectAtom);
|
jsid objectId = NameToId(cx->names().Object);
|
||||||
if (!self->addDataProperty(cx, objectId, JSProto_Object + JSProto_LIMIT * 2, 0))
|
if (!self->addDataProperty(cx, objectId, JSProto_Object + JSProto_LIMIT * 2, 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
jsid functionId = NameToId(cx->runtime->atomState.FunctionAtom);
|
jsid functionId = NameToId(cx->names().Function);
|
||||||
if (!self->addDataProperty(cx, functionId, JSProto_Function + JSProto_LIMIT * 2, 0))
|
if (!self->addDataProperty(cx, functionId, JSProto_Function + JSProto_LIMIT * 2, 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Heavy lifting done, but lingering tasks remain. */
|
/* Heavy lifting done, but lingering tasks remain. */
|
||||||
|
|
||||||
/* ES5 15.1.2.1. */
|
/* ES5 15.1.2.1. */
|
||||||
RootedId id(cx, NameToId(cx->runtime->atomState.evalAtom));
|
RootedId id(cx, NameToId(cx->names().eval));
|
||||||
JSObject *evalobj = js_DefineFunction(cx, self, id, IndirectEval, 1, JSFUN_STUB_GSOPS);
|
JSObject *evalobj = js_DefineFunction(cx, self, id, IndirectEval, 1, JSFUN_STUB_GSOPS);
|
||||||
if (!evalobj)
|
if (!evalobj)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -504,11 +504,9 @@ GlobalObject::create(JSContext *cx, Class *clasp)
|
|||||||
/* static */ bool
|
/* static */ bool
|
||||||
GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global)
|
GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global)
|
||||||
{
|
{
|
||||||
JSAtomState &state = cx->runtime->atomState;
|
|
||||||
|
|
||||||
/* Define a top-level property 'undefined' with the undefined value. */
|
/* Define a top-level property 'undefined' with the undefined value. */
|
||||||
RootedValue undefinedValue(cx, UndefinedValue());
|
RootedValue undefinedValue(cx, UndefinedValue());
|
||||||
if (!JSObject::defineProperty(cx, global, state.undefinedAtom, undefinedValue,
|
if (!JSObject::defineProperty(cx, global, cx->names().undefined, undefinedValue,
|
||||||
JS_PropertyStub, JS_StrictPropertyStub, JSPROP_PERMANENT | JSPROP_READONLY))
|
JS_PropertyStub, JS_StrictPropertyStub, JSPROP_PERMANENT | JSPROP_READONLY))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -601,10 +599,10 @@ LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor_, JSObject *proto_)
|
|||||||
RootedValue protoVal(cx, ObjectValue(*proto));
|
RootedValue protoVal(cx, ObjectValue(*proto));
|
||||||
RootedValue ctorVal(cx, ObjectValue(*ctor));
|
RootedValue ctorVal(cx, ObjectValue(*ctor));
|
||||||
|
|
||||||
return JSObject::defineProperty(cx, ctor, cx->runtime->atomState.classPrototypeAtom,
|
return JSObject::defineProperty(cx, ctor, cx->names().classPrototype,
|
||||||
protoVal, JS_PropertyStub, JS_StrictPropertyStub,
|
protoVal, JS_PropertyStub, JS_StrictPropertyStub,
|
||||||
JSPROP_PERMANENT | JSPROP_READONLY) &&
|
JSPROP_PERMANENT | JSPROP_READONLY) &&
|
||||||
JSObject::defineProperty(cx, proto, cx->runtime->atomState.constructorAtom,
|
JSObject::defineProperty(cx, proto, cx->names().constructor,
|
||||||
ctorVal, JS_PropertyStub, JS_StrictPropertyStub, 0);
|
ctorVal, JS_PropertyStub, JS_StrictPropertyStub, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,26 +333,26 @@ RegExpObject::assignInitialShape(JSContext *cx)
|
|||||||
RootedObject self(cx, this);
|
RootedObject self(cx, this);
|
||||||
|
|
||||||
/* The lastIndex property alone is writable but non-configurable. */
|
/* The lastIndex property alone is writable but non-configurable. */
|
||||||
if (!addDataProperty(cx, NameToId(cx->runtime->atomState.lastIndexAtom),
|
if (!addDataProperty(cx, NameToId(cx->names().lastIndex),
|
||||||
LAST_INDEX_SLOT, JSPROP_PERMANENT))
|
LAST_INDEX_SLOT, JSPROP_PERMANENT))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remaining instance properties are non-writable and non-configurable. */
|
/* Remaining instance properties are non-writable and non-configurable. */
|
||||||
if (!self->addDataProperty(cx, NameToId(cx->runtime->atomState.sourceAtom),
|
if (!self->addDataProperty(cx, NameToId(cx->names().source),
|
||||||
SOURCE_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
SOURCE_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||||
!self->addDataProperty(cx, NameToId(cx->runtime->atomState.globalAtom),
|
!self->addDataProperty(cx, NameToId(cx->names().global),
|
||||||
GLOBAL_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
GLOBAL_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||||
!self->addDataProperty(cx, NameToId(cx->runtime->atomState.ignoreCaseAtom),
|
!self->addDataProperty(cx, NameToId(cx->names().ignoreCase),
|
||||||
IGNORE_CASE_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
IGNORE_CASE_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||||
!self->addDataProperty(cx, NameToId(cx->runtime->atomState.multilineAtom),
|
!self->addDataProperty(cx, NameToId(cx->names().multiline),
|
||||||
MULTILINE_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY))
|
MULTILINE_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self->addDataProperty(cx, NameToId(cx->runtime->atomState.stickyAtom),
|
return self->addDataProperty(cx, NameToId(cx->names().sticky),
|
||||||
STICKY_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY);
|
STICKY_FLAG_SLOT, JSPROP_PERMANENT | JSPROP_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,18 +374,17 @@ RegExpObject::init(JSContext *cx, HandleAtom source, RegExpFlag flags)
|
|||||||
JS_ASSERT(!self->nativeEmpty());
|
JS_ASSERT(!self->nativeEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugOnly<JSAtomState *> atomState = &cx->runtime->atomState;
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().lastIndex))->slot() ==
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->lastIndexAtom))->slot() ==
|
|
||||||
LAST_INDEX_SLOT);
|
LAST_INDEX_SLOT);
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->sourceAtom))->slot() ==
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().source))->slot() ==
|
||||||
SOURCE_SLOT);
|
SOURCE_SLOT);
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->globalAtom))->slot() ==
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().global))->slot() ==
|
||||||
GLOBAL_FLAG_SLOT);
|
GLOBAL_FLAG_SLOT);
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->ignoreCaseAtom))->slot() ==
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().ignoreCase))->slot() ==
|
||||||
IGNORE_CASE_FLAG_SLOT);
|
IGNORE_CASE_FLAG_SLOT);
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->multilineAtom))->slot() ==
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().multiline))->slot() ==
|
||||||
MULTILINE_FLAG_SLOT);
|
MULTILINE_FLAG_SLOT);
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(atomState->stickyAtom))->slot() ==
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().sticky))->slot() ==
|
||||||
STICKY_FLAG_SLOT);
|
STICKY_FLAG_SLOT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -127,7 +127,7 @@ js::ScopeCoordinateName(JSRuntime *rt, JSScript *script, jsbytecode *pc)
|
|||||||
|
|
||||||
/* Beware nameless destructuring formal. */
|
/* Beware nameless destructuring formal. */
|
||||||
if (!JSID_IS_ATOM(id))
|
if (!JSID_IS_ATOM(id))
|
||||||
return rt->atomState.emptyAtom;
|
return rt->atomState.empty;
|
||||||
return JSID_TO_ATOM(id)->asPropertyName();
|
return JSID_TO_ATOM(id)->asPropertyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1226,7 +1226,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
|||||||
|
|
||||||
static bool isArguments(JSContext *cx, jsid id)
|
static bool isArguments(JSContext *cx, jsid id)
|
||||||
{
|
{
|
||||||
return id == NameToId(cx->runtime->atomState.argumentsAtom);
|
return id == NameToId(cx->names().arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isFunctionScope(ScopeObject &scope)
|
static bool isFunctionScope(ScopeObject &scope)
|
||||||
@ -1381,10 +1381,9 @@ class DebugScopeProxy : public BaseProxyHandler
|
|||||||
{
|
{
|
||||||
ScopeObject &scope = proxy->asDebugScope().scope();
|
ScopeObject &scope = proxy->asDebugScope().scope();
|
||||||
|
|
||||||
if (isMissingArgumentsBinding(scope) &&
|
if (isMissingArgumentsBinding(scope)) {
|
||||||
!props.append(NameToId(cx->runtime->atomState.argumentsAtom)))
|
if (!props.append(NameToId(cx->names().arguments)))
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RootedObject rootedScope(cx, &scope);
|
RootedObject rootedScope(cx, &scope);
|
||||||
|
@ -688,7 +688,7 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,
|
|||||||
else if (type == JSVAL_TYPE_BOOLEAN)
|
else if (type == JSVAL_TYPE_BOOLEAN)
|
||||||
*vp = BooleanValue(false);
|
*vp = BooleanValue(false);
|
||||||
else if (type == JSVAL_TYPE_STRING)
|
else if (type == JSVAL_TYPE_STRING)
|
||||||
*vp = StringValue(rt->atomState.nullAtom);
|
*vp = StringValue(rt->atomState.null);
|
||||||
else if (type == JSVAL_TYPE_NULL)
|
else if (type == JSVAL_TYPE_NULL)
|
||||||
*vp = NullValue();
|
*vp = NullValue();
|
||||||
else if (type == JSVAL_TYPE_OBJECT)
|
else if (type == JSVAL_TYPE_OBJECT)
|
||||||
|
@ -43,7 +43,7 @@ StringBuffer::finishString()
|
|||||||
{
|
{
|
||||||
JSContext *cx = context();
|
JSContext *cx = context();
|
||||||
if (cb.empty())
|
if (cb.empty())
|
||||||
return cx->runtime->atomState.emptyAtom;
|
return cx->names().empty;
|
||||||
|
|
||||||
size_t length = cb.length();
|
size_t length = cb.length();
|
||||||
if (!JSString::validateLength(cx, length))
|
if (!JSString::validateLength(cx, length))
|
||||||
@ -73,7 +73,7 @@ StringBuffer::finishAtom()
|
|||||||
|
|
||||||
size_t length = cb.length();
|
size_t length = cb.length();
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
return cx->runtime->atomState.emptyAtom;
|
return cx->names().empty;
|
||||||
|
|
||||||
JSAtom *atom = AtomizeChars(cx, cb.begin(), length);
|
JSAtom *atom = AtomizeChars(cx, cb.begin(), length);
|
||||||
cb.clear();
|
cb.clear();
|
||||||
@ -94,7 +94,7 @@ js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb)
|
|||||||
if (v.isBoolean())
|
if (v.isBoolean())
|
||||||
return BooleanToStringBuffer(cx, v.toBoolean(), sb);
|
return BooleanToStringBuffer(cx, v.toBoolean(), sb);
|
||||||
if (v.isNull())
|
if (v.isNull())
|
||||||
return sb.append(cx->runtime->atomState.nullAtom);
|
return sb.append(cx->names().null);
|
||||||
JS_ASSERT(v.isUndefined());
|
JS_ASSERT(v.isUndefined());
|
||||||
return sb.append(cx->runtime->atomState.undefinedAtom);
|
return sb.append(cx->names().undefined);
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,7 @@ StringObject::init(JSContext *cx, HandleString str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->runtime->atomState.lengthAtom))->slot()
|
JS_ASSERT(self->nativeLookupNoAllocation(NameToId(cx->names().length))->slot() == LENGTH_SLOT);
|
||||||
== LENGTH_SLOT);
|
|
||||||
|
|
||||||
self->setStringThis(str);
|
self->setStringThis(str);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user