diff --git a/js2/src/epimetheus.cpp b/js2/src/epimetheus.cpp index 0b52ed2dec80..0a8c995c7576 100644 --- a/js2/src/epimetheus.cpp +++ b/js2/src/epimetheus.cpp @@ -350,7 +350,7 @@ js2val dump(JS2Metadata *meta, const js2val /* thisValue */, js2val argv[], uint stdOut << "type = " << *s->type->name << '\n'; printLocalBindings(&s->localBindings, NULL); stdOut << " Instance Bindings:\n"; - printInstanceVariables(s->type, s->slots); + printInstanceVariables(s->type, s->fixedSlots); if (meta->objectType(argv[0]) == meta->functionClass) { FunctionWrapper *fWrap; fWrap = (checked_cast(fObj))->fWrap; @@ -370,7 +370,7 @@ js2val dump(JS2Metadata *meta, const js2val /* thisValue */, js2val argv[], uint stdOut << "\n"; stdOut << ((c->dynamic) ? " dynamic, " : " non-dynamic, ") << ((c->final) ? "final" : "non-final") << "\n"; stdOut << " slotCount = " << c->slotCount << "\n"; - printLocalBindings(&c->localBindings, c->slots); + printLocalBindings(&c->localBindings, c->frameSlots); stdOut << " Instance Bindings:\n"; for (InstanceBindingIterator rib = c->instanceBindings.begin(), riend = c->instanceBindings.end(); (rib != riend); rib++) { InstanceBindingEntry *ibe = *rib; @@ -423,7 +423,7 @@ js2val dump(JS2Metadata *meta, const js2val /* thisValue */, js2val argv[], uint else stdOut << "super = " << *metadata->toString(pkg->super) << '\n'; stdOut << ((pkg->sealed) ? "sealed " : "not-sealed ") << '\n'; - printLocalBindings(&pkg->localBindings, pkg->slots); + printLocalBindings(&pkg->localBindings, pkg->frameSlots); } break; default: diff --git a/js2/src/js2eval.cpp b/js2/src/js2eval.cpp index 9d935ad80dcd..d852ca757b18 100644 --- a/js2/src/js2eval.cpp +++ b/js2/src/js2eval.cpp @@ -802,15 +802,6 @@ namespace MetaData { return JS2Class::Delete(meta, base, multiname, env, result); } - bool JS2ArrayClass::BracketRead(JS2Metadata *meta, js2val *base, js2val indexVal, Phase phase, js2val *rval) - { - const String *indexStr = meta->toString(indexVal); - DEFINE_ROOTKEEPER(rk, indexStr); - Multiname *mn = new Multiname(indexStr, meta->publicNamespace); - DEFINE_ROOTKEEPER(rk1, mn); - return Read(meta, base, mn, NULL, phase, rval); - } - bool JS2ArrayClass::BracketWrite(JS2Metadata *meta, js2val base, js2val indexVal, js2val newValue) { const String *indexStr = meta->toString(indexVal); @@ -894,6 +885,32 @@ namespace MetaData { return JS2Class::Delete(meta, base, multiname, env, result); } + bool JS2ArrayClass::BracketRead(JS2Metadata *meta, js2val *base, js2val indexVal, Phase phase, js2val *rval) + { + const String *indexStr = meta->toString(indexVal); + DEFINE_ROOTKEEPER(rk, indexStr); + Multiname *mn = new Multiname(indexStr, meta->publicNamespace); + DEFINE_ROOTKEEPER(rk1, mn); + return Read(meta, base, mn, NULL, phase, rval); + } + + bool JS2Class::BracketWrite(JS2Metadata *meta, js2val base, js2val indexVal, js2val newValue) + { + const String *indexStr = meta->toString(indexVal); + DEFINE_ROOTKEEPER(rk, indexStr); + Multiname *mn = new Multiname(indexStr, meta->publicNamespace); + DEFINE_ROOTKEEPER(rk1, mn); + return Write(meta, base, mn, NULL, true, newValue, false); + } + + bool JS2Class::BracketDelete(JS2Metadata *meta, js2val base, js2val indexVal, bool *result) + { + const String *indexStr = meta->toString(indexVal); + DEFINE_ROOTKEEPER(rk, indexStr); + Multiname *mn = new Multiname(indexStr, meta->publicNamespace); + DEFINE_ROOTKEEPER(rk1, mn); + return Delete(meta, base, mn, NULL, result); + } bool JS2Class::Write(JS2Metadata *meta, js2val base, Multiname *multiname, Environment *env, bool createIfMissing, js2val newValue, bool initFlag) { @@ -959,15 +976,6 @@ namespace MetaData { } } - bool JS2Class::BracketWrite(JS2Metadata *meta, js2val base, js2val indexVal, js2val newValue) - { - const String *indexStr = meta->toString(indexVal); - DEFINE_ROOTKEEPER(rk, indexStr); - Multiname *mn = new Multiname(indexStr, meta->publicNamespace); - DEFINE_ROOTKEEPER(rk1, mn); - return Write(meta, base, mn, NULL, true, newValue, false); - } - bool JS2Class::Delete(JS2Metadata *meta, js2val base, Multiname *multiname, Environment *env, bool *result) { InstanceMember *mBase = meta->findBaseInstanceMember(this, multiname, ReadWriteAccess); @@ -1052,15 +1060,6 @@ VariableMemberCommon: } } - bool JS2Class::BracketDelete(JS2Metadata *meta, js2val base, js2val indexVal, bool *result) - { - const String *indexStr = meta->toString(indexVal); - DEFINE_ROOTKEEPER(rk, indexStr); - Multiname *mn = new Multiname(indexStr, meta->publicNamespace); - DEFINE_ROOTKEEPER(rk1, mn); - return Delete(meta, base, mn, NULL, result); - } - js2val JS2Class::ImplicitCoerce(JS2Metadata *meta, js2val newValue) { if (JS2VAL_IS_NULL(newValue) || meta->objectType(newValue)->isAncestor(this) ) diff --git a/js2/src/js2function.cpp b/js2/src/js2function.cpp index 4d680bf81361..31abcca1d58e 100644 --- a/js2/src/js2function.cpp +++ b/js2/src/js2function.cpp @@ -164,21 +164,34 @@ namespace MetaData { callThis = meta->toObject(callThis); if ((argc > 1) && !JS2VAL_IS_NULL(argv[1]) && !JS2VAL_IS_UNDEFINED(argv[1])) { - if (!JS2VAL_IS_OBJECT(argv[1]) - || (JS2VAL_TO_OBJECT(argv[1])->kind != SimpleInstanceKind) - || ((checked_cast(JS2VAL_TO_OBJECT(argv[1])))->type != meta->arrayClass)) - meta->reportError(Exception::typeError, "Function.apply passed a non-array argument list", meta->engine->errorPos()); - ArrayInstance *arrInst = checked_cast(JS2VAL_TO_OBJECT(argv[1])); - uint32 length = getLength(meta, arrInst); - js2val *argArray = new js2val[length]; - DEFINE_ARRAYROOTKEEPER(rk, argArray, length); - for (uint32 i = 0; i < length; i++) - meta->arrayClass->ReadPublic(meta, &argv[1], meta->engine->numberToString(i), RunPhase, &argArray[i]); - return meta->invokeFunction(fnInst, callThis, argArray, length, NULL); + if (JS2VAL_IS_OBJECT(argv[1]) + && (JS2VAL_TO_OBJECT(argv[1])->kind == SimpleInstanceKind)) { + SimpleInstance *obj = checked_cast(JS2VAL_TO_OBJECT(argv[1])); + if (obj->type == meta->arrayClass) { + ArrayInstance *arrInst = checked_cast(obj); + uint32 length = getLength(meta, arrInst); + js2val *argArray = new js2val[length]; + DEFINE_ARRAYROOTKEEPER(rk, argArray, length); + for (uint32 i = 0; i < length; i++) + meta->arrayClass->ReadPublic(meta, &argv[1], meta->engine->numberToString(i), RunPhase, &argArray[i]); + return meta->invokeFunction(fnInst, callThis, argArray, length, NULL); + } + else + if (obj->type == meta->argumentsClass) { + ArgumentsInstance *argInst = checked_cast(obj); + uint32 length = getLength(meta, argInst); + js2val *argArray = new js2val[length]; + DEFINE_ARRAYROOTKEEPER(rk, argArray, length); + for (uint32 i = 0; i < length; i++) + meta->argumentsClass->ReadPublic(meta, &argv[1], meta->engine->numberToString(i), RunPhase, &argArray[i]); + return meta->invokeFunction(fnInst, callThis, argArray, length, NULL); + } + } + meta->reportError(Exception::typeError, "Function.apply passed a non-array or argument value", meta->engine->errorPos()); + return JS2VAL_VOID; } else - return meta->invokeFunction(fnInst, callThis, NULL, 0, NULL); - + return meta->invokeFunction(fnInst, callThis, NULL, 0, NULL); } void initFunctionObject(JS2Metadata *meta) diff --git a/js2/src/js2metadata.cpp b/js2/src/js2metadata.cpp index 7d74f8754ba9..99b1a1cd78e0 100644 --- a/js2/src/js2metadata.cpp +++ b/js2/src/js2metadata.cpp @@ -3118,11 +3118,11 @@ doUnary: LocalBindingEntry *lbe = *bi2; singularFrame->localBindings.insert(lbe->name, lbe->clone()); } - if (buildSlots && pluralFrame->slots) { - size_t count = pluralFrame->slots->size(); - singularFrame->slots = new std::vector(count); + if (buildSlots && pluralFrame->frameSlots) { + size_t count = pluralFrame->frameSlots->size(); + singularFrame->frameSlots = new std::vector(count); for (size_t i = 0; i < count; i++) - (*singularFrame->slots)[i] = (*pluralFrame->slots)[i]; + (*singularFrame->frameSlots)[i] = (*pluralFrame->frameSlots)[i]; } } @@ -3530,7 +3530,7 @@ rescan: else lbe = *lbeP; result = makeFrameVariable(regionalFrame); - (*regionalFrame->slots)[checked_cast(result)->frameSlot] = initVal; + (*regionalFrame->frameSlots)[checked_cast(result)->frameSlot] = initVal; LocalBinding *sb = new LocalBinding(ReadWriteAccess, result, true); lbe->bindingList.push_back(LocalBindingEntry::NamespaceBinding(publicNamespace, sb)); } @@ -4008,10 +4008,7 @@ static const uint8 urlCharType[256] = MAKEBUILTINCLASS(classClass, objectClass, false, true, engine->allocStringPtr(&world.identifiers["Class"]), JS2VAL_NULL); MAKEBUILTINCLASS(functionClass, objectClass, true, true, engine->Function_StringAtom, JS2VAL_NULL); MAKEBUILTINCLASS(packageClass, objectClass, true, true, engine->allocStringPtr(&world.identifiers["Package"]), JS2VAL_NULL); - MAKEBUILTINCLASS(argumentsClass, objectClass, true, true, engine->allocStringPtr(&world.identifiers["Arguments"]), JS2VAL_NULL); - - - + argumentsClass = new JS2ArgumentsClass(objectClass, NULL, new Namespace(engine->private_StringAtom), false, true, engine->allocStringPtr(&world.identifiers["Object"])); argumentsClass->complete = true; argumentsClass->defaultValue = JS2VAL_NULL; // A 'forbidden' member, used to mark hidden bindings forbiddenMember = new LocalMember(Member::ForbiddenMember, true); @@ -4466,19 +4463,19 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... case FrameVariable::Package: { ASSERT(container->kind == PackageKind); - *rval = (*(checked_cast(container))->slots)[fv->frameSlot]; + *rval = (*(checked_cast(container))->frameSlots)[fv->frameSlot]; } break; case FrameVariable::Local: { ASSERT(container->kind == BlockFrameKind); - *rval = (*(checked_cast(container))->slots)[fv->frameSlot]; + *rval = (*(checked_cast(container))->frameSlots)[fv->frameSlot]; } break; case FrameVariable::Parameter: { ASSERT(container->kind == ParameterFrameKind); - *rval = (*(checked_cast(container))->slots)[fv->frameSlot]; + *rval = (*(checked_cast(container))->frameSlots)[fv->frameSlot]; } break; } @@ -4537,19 +4534,19 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... case FrameVariable::Package: { ASSERT(container->kind == PackageKind); - (*(checked_cast(container))->slots)[fv->frameSlot] = newValue; + (*(checked_cast(container))->frameSlots)[fv->frameSlot] = newValue; } break; case FrameVariable::Local: { ASSERT(container->kind == BlockFrameKind); - (*(checked_cast(container))->slots)[fv->frameSlot] = newValue; + (*(checked_cast(container))->frameSlots)[fv->frameSlot] = newValue; } break; case FrameVariable::Parameter: { ASSERT(container->kind == ParameterFrameKind); - (*(checked_cast(container))->slots)[fv->frameSlot] = newValue; + (*(checked_cast(container))->frameSlots)[fv->frameSlot] = newValue; } break; } @@ -4639,7 +4636,7 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... ASSERT(JS2VAL_IS_OBJECT(thisObjVal) && (JS2VAL_TO_OBJECT(thisObjVal)->kind == SimpleInstanceKind)); JS2Object *thisObj = JS2VAL_TO_OBJECT(thisObjVal); - return &checked_cast(thisObj)->slots[id->slotIndex]; + return &checked_cast(thisObj)->fixedSlots[id->slotIndex]; } @@ -4946,7 +4943,7 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... InstanceMember *im = ns.second->content; if (im->memberKind == Member::InstanceVariableMember) { InstanceVariable *iv = checked_cast(im); - slots[iv->slotIndex].value = iv->defaultValue; + fixedSlots[iv->slotIndex].value = iv->defaultValue; } } } @@ -4959,10 +4956,10 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... sealed(false), super(parent), type(type), - slots(new Slot[type->slotCount]) + fixedSlots(new Slot[type->slotCount]) { for (uint32 i = 0; i < type->slotCount; i++) { - slots[i].value = JS2VAL_UNINITIALIZED; + fixedSlots[i].value = JS2VAL_UNINITIALIZED; } initializeSlots(type); } @@ -4972,10 +4969,10 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... { GCMARKOBJECT(type) GCMARKVALUE(super); - if (slots) { + if (fixedSlots) { ASSERT(type); for (uint32 i = 0; (i < type->slotCount); i++) { - GCMARKVALUE(slots[i].value); + GCMARKVALUE(fixedSlots[i].value); } } for (LocalBindingIterator bi = localBindings.begin(), bend = localBindings.end(); (bi != bend); bi++) { @@ -4998,7 +4995,7 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... } delete lbe; } - delete [] slots; + delete [] fixedSlots; } @@ -5098,10 +5095,10 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... // on the list (which may need to be created) for gc tracking. uint16 NonWithFrame::allocateSlot() { - if (slots == NULL) - slots = new std::vector; - uint16 result = (uint16)(slots->size()); - slots->push_back(JS2VAL_VOID); + if (frameSlots == NULL) + frameSlots = new std::vector; + uint16 result = (uint16)(frameSlots->size()); + frameSlots->push_back(JS2VAL_VOID); return result; } @@ -5115,8 +5112,8 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... } delete lbe; } - if (slots) - delete slots; + if (frameSlots) + delete frameSlots; } // gc-mark all contained JS2Objects and visit contained structures to do likewise @@ -5130,8 +5127,8 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... ns.second->content->mark(); } } - if (slots) { - for (std::vector::iterator i = slots->begin(), end = slots->end(); (i != end); i++) + if (frameSlots) { + for (std::vector::iterator i = frameSlots->begin(), end = frameSlots->end(); (i != end); i++) GCMARKVALUE(*i); } } @@ -5167,7 +5164,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... void ParameterFrame::instantiate(Environment *env) { - env->instantiateFrame(pluralFrame, this, !buildArguments); + ASSERT(pluralFrame->kind == ParameterFrameKind); + ParameterFrame *plural = checked_cast(pluralFrame); + env->instantiateFrame(pluralFrame, this, !plural->buildArguments); } // Assume that instantiate has been called, the plural frame will contain @@ -5182,20 +5181,24 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... ArgumentsInstance *argsObj = NULL; DEFINE_ROOTKEEPER(rk2, argsObj); - uint32 slotCount = (plural->slots) ? plural->slots->size() : 0; + // slotCount is the number of slots required by the parameter frame + uint32 slotCount = (plural->frameSlots) ? plural->frameSlots->size() : 0; + ASSERT(length == slotCount); if (plural->buildArguments) { // If we're building an arguments object, the slots for the parameter frame are located // there so that the arguments object itself can survive beyond the life of the function. argsObj = new ArgumentsInstance(meta, meta->objectClass->prototype, meta->argumentsClass); - if (slotCount) + if (argCount > slotCount) + slotCount = argCount; + if (slotCount) argsObj->mSlots = new std::vector(slotCount); - slots = argsObj->mSlots; + frameSlots = argsObj->mSlots; // Add the 'arguments' property String name(widenCString("arguments")); ASSERT(localBindings[name] == NULL); LocalBindingEntry *lbe = new LocalBindingEntry(name); - LocalBinding *sb = new LocalBinding(ReadAccess, new Variable(meta->arrayClass, OBJECT_TO_JS2VAL(argsObj), true), false); + LocalBinding *sb = new LocalBinding(ReadWriteAccess, new Variable(meta->objectClass, OBJECT_TO_JS2VAL(argsObj), false), false); lbe->bindingList.push_back(LocalBindingEntry::NamespaceBinding(meta->publicNamespace, sb)); localBindings.insert(name, lbe); } @@ -5203,17 +5206,17 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... uint32 i; for (i = 0; (i < argCount); i++) { if (i < slotCount) { - (*slots)[i] = argBase[i]; + (*frameSlots)[i] = argBase[i]; } } while (i++ < length) { if (i < slotCount) { - (*slots)[i] = JS2VAL_UNDEFINED; - } + (*frameSlots)[i] = JS2VAL_UNDEFINED; + } } if (plural->buildArguments) { setLength(meta, argsObj, argCount); - meta->objectClass->WritePublic(meta, OBJECT_TO_JS2VAL(argsObj), meta->engine->allocStringPtr("callee"), true, OBJECT_TO_JS2VAL(fnObj)); + meta->argumentsClass->WritePublic(meta, OBJECT_TO_JS2VAL(argsObj), meta->engine->allocStringPtr("callee"), true, OBJECT_TO_JS2VAL(fnObj)); } } @@ -5228,7 +5231,7 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... ParameterFrame::~ParameterFrame() { if (buildArguments) { - slots = NULL; // the slots are in the arguments object, let it do the delete + frameSlots = NULL; // the slots are in the arguments object, let it do the delete } } diff --git a/js2/src/js2metadata.h b/js2/src/js2metadata.h index 299f847d0634..7d8f03f9af23 100644 --- a/js2/src/js2metadata.h +++ b/js2/src/js2metadata.h @@ -687,12 +687,12 @@ typedef std::vector ValueList; class NonWithFrame : public Frame { public: - NonWithFrame(ObjectKind kind) : Frame(kind), slots(NULL), pluralFrame(NULL) { } - NonWithFrame(ObjectKind kind, NonWithFrame *pluralFrame) : Frame(kind), slots(NULL), pluralFrame(pluralFrame) { } + NonWithFrame(ObjectKind kind) : Frame(kind), frameSlots(NULL), pluralFrame(NULL) { } + NonWithFrame(ObjectKind kind, NonWithFrame *pluralFrame) : Frame(kind), frameSlots(NULL), pluralFrame(pluralFrame) { } LocalBindingMap localBindings; // Map of qualified names to members defined in this frame - ValueList *slots; // temporaries or frame variables allocted in this frame + ValueList *frameSlots; // temporaries or frame variables allocted in this frame uint16 allocateSlot(); virtual void instantiate(Environment * /*env*/) { ASSERT(false); } @@ -948,7 +948,7 @@ public: js2val super; // Optional link to the next object in this instance's prototype chain bool sealed; // If true, no more local properties may be added to this instance JS2Class *type; // This instance's type - Slot *slots; // A set of slots that hold this instance's fixed property values + Slot *fixedSlots; // A set of slots that hold this instance's fixed property values void initializeSlots(JS2Class *type); diff --git a/js2/src/js2op_access.cpp b/js2/src/js2op_access.cpp index 56500d67caf1..2306104821bb 100644 --- a/js2/src/js2op_access.cpp +++ b/js2/src/js2op_access.cpp @@ -261,9 +261,9 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); + ASSERT(slotIndex < localFrame->frameSlots->size()); a = top(); - (*localFrame->slots)[slotIndex] = a; + (*localFrame->frameSlots)[slotIndex] = a; } break; @@ -271,7 +271,7 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); + ASSERT(slotIndex < localFrame->frameSlots->size()); // XXX some kind of code here? } break; @@ -280,8 +280,8 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); - push((*localFrame->slots)[slotIndex]); + ASSERT(slotIndex < localFrame->frameSlots->size()); + push((*localFrame->frameSlots)[slotIndex]); } break; @@ -290,8 +290,8 @@ uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); push(JS2VAL_NULL); - ASSERT(slotIndex < localFrame->slots->size()); - push((*localFrame->slots)[slotIndex]); + ASSERT(slotIndex < localFrame->frameSlots->size()); + push((*localFrame->frameSlots)[slotIndex]); } break; @@ -300,8 +300,8 @@ uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); a = top(); - ASSERT(slotIndex < packageFrame->slots->size()); - (*packageFrame->slots)[slotIndex] = a; + ASSERT(slotIndex < packageFrame->frameSlots->size()); + (*packageFrame->frameSlots)[slotIndex] = a; } break; @@ -309,7 +309,7 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); + ASSERT(slotIndex < packageFrame->frameSlots->size()); // XXX some kind of code here? } break; @@ -318,8 +318,8 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); - push((*packageFrame->slots)[slotIndex]); + ASSERT(slotIndex < packageFrame->frameSlots->size()); + push((*packageFrame->frameSlots)[slotIndex]); } break; @@ -328,8 +328,8 @@ uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); push(JS2VAL_NULL); - ASSERT(slotIndex < packageFrame->slots->size()); - push((*packageFrame->slots)[slotIndex]); + ASSERT(slotIndex < packageFrame->frameSlots->size()); + push((*packageFrame->frameSlots)[slotIndex]); } break; @@ -338,8 +338,8 @@ uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); a = top(); - ASSERT(slotIndex < parameterFrame->slots->size()); - (*parameterFrame->slots)[slotIndex] = a; + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + (*parameterFrame->frameSlots)[slotIndex] = a; } break; @@ -347,7 +347,7 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); + ASSERT(slotIndex < parameterFrame->frameSlots->size()); // XXX some kind of code here? } break; @@ -356,8 +356,8 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); - push((*parameterFrame->slots)[slotIndex]); + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + push((*parameterFrame->frameSlots)[slotIndex]); } break; @@ -366,8 +366,8 @@ uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); push(JS2VAL_NULL); - ASSERT(slotIndex < parameterFrame->slots->size()); - push((*parameterFrame->slots)[slotIndex]); + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + push((*parameterFrame->frameSlots)[slotIndex]); } break; @@ -380,7 +380,7 @@ ASSERT(JS2VAL_IS_OBJECT(b)); JS2Object *obj = JS2VAL_TO_OBJECT(b); ASSERT(obj->kind == SimpleInstanceKind); - checked_cast(obj)->slots[slotIndex].value = a; + checked_cast(obj)->fixedSlots[slotIndex].value = a; push(a); } break; @@ -393,7 +393,7 @@ ASSERT(JS2VAL_IS_OBJECT(b)); JS2Object *obj = JS2VAL_TO_OBJECT(b); ASSERT(obj->kind == SimpleInstanceKind); - push(checked_cast(obj)->slots[slotIndex].value); + push(checked_cast(obj)->fixedSlots[slotIndex].value); } break; @@ -405,7 +405,7 @@ ASSERT(JS2VAL_IS_OBJECT(b)); JS2Object *obj = JS2VAL_TO_OBJECT(b); ASSERT(obj->kind == SimpleInstanceKind); - push(checked_cast(obj)->slots[slotIndex].value); + push(checked_cast(obj)->fixedSlots[slotIndex].value); } break; diff --git a/js2/src/js2op_arithmetic.cpp b/js2/src/js2op_arithmetic.cpp index f976baa15262..0333d2e214ee 100644 --- a/js2/src/js2op_arithmetic.cpp +++ b/js2/src/js2op_arithmetic.cpp @@ -1095,9 +1095,9 @@ ASSERT(JS2VAL_IS_OBJECT(baseVal)); JS2Object *obj = JS2VAL_TO_OBJECT(baseVal); ASSERT(obj->kind == SimpleInstanceKind); - a = checked_cast(obj)->slots[slotIndex].value; + a = checked_cast(obj)->fixedSlots[slotIndex].value; float64 num = meta->toFloat64(a); - checked_cast(obj)->slots[slotIndex].value = allocNumber(num + 1.0); + checked_cast(obj)->fixedSlots[slotIndex].value = allocNumber(num + 1.0); pushNumber(num); baseVal = JS2VAL_VOID; } @@ -1110,9 +1110,9 @@ ASSERT(JS2VAL_IS_OBJECT(baseVal)); JS2Object *obj = JS2VAL_TO_OBJECT(baseVal); ASSERT(obj->kind == SimpleInstanceKind); - a = checked_cast(obj)->slots[slotIndex].value; + a = checked_cast(obj)->fixedSlots[slotIndex].value; float64 num = meta->toFloat64(a); - checked_cast(obj)->slots[slotIndex].value = allocNumber(num - 1.0); + checked_cast(obj)->fixedSlots[slotIndex].value = allocNumber(num - 1.0); pushNumber(num); baseVal = JS2VAL_VOID; } @@ -1125,10 +1125,10 @@ ASSERT(JS2VAL_IS_OBJECT(baseVal)); JS2Object *obj = JS2VAL_TO_OBJECT(baseVal); ASSERT(obj->kind == SimpleInstanceKind); - a = checked_cast(obj)->slots[slotIndex].value; + a = checked_cast(obj)->fixedSlots[slotIndex].value; float64 num = meta->toFloat64(a); a = pushNumber(num + 1.0); - checked_cast(obj)->slots[slotIndex].value = a; + checked_cast(obj)->fixedSlots[slotIndex].value = a; baseVal = JS2VAL_VOID; } break; @@ -1140,10 +1140,10 @@ ASSERT(JS2VAL_IS_OBJECT(baseVal)); JS2Object *obj = JS2VAL_TO_OBJECT(baseVal); ASSERT(obj->kind == SimpleInstanceKind); - a = checked_cast(obj)->slots[slotIndex].value; + a = checked_cast(obj)->fixedSlots[slotIndex].value; float64 num = meta->toFloat64(a); a = pushNumber(num - 1.0); - checked_cast(obj)->slots[slotIndex].value = a; + checked_cast(obj)->fixedSlots[slotIndex].value = a; baseVal = JS2VAL_VOID; } break; @@ -1152,10 +1152,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); - a = (*localFrame->slots)[slotIndex]; + ASSERT(slotIndex < localFrame->frameSlots->size()); + a = (*localFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*localFrame->slots)[slotIndex] = allocNumber(num + 1.0); + (*localFrame->frameSlots)[slotIndex] = allocNumber(num + 1.0); pushNumber(num); } break; @@ -1163,10 +1163,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); - a = (*localFrame->slots)[slotIndex]; + ASSERT(slotIndex < localFrame->frameSlots->size()); + a = (*localFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*localFrame->slots)[slotIndex] = allocNumber(num - 1.0); + (*localFrame->frameSlots)[slotIndex] = allocNumber(num - 1.0); pushNumber(num); } break; @@ -1174,22 +1174,22 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); - a = (*localFrame->slots)[slotIndex]; + ASSERT(slotIndex < localFrame->frameSlots->size()); + a = (*localFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num + 1.0); - (*localFrame->slots)[slotIndex] = a; + (*localFrame->frameSlots)[slotIndex] = a; } break; case eFrameSlotPreDec: { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < localFrame->slots->size()); - a = (*localFrame->slots)[slotIndex]; + ASSERT(slotIndex < localFrame->frameSlots->size()); + a = (*localFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num - 1.0); - (*localFrame->slots)[slotIndex] = a; + (*localFrame->frameSlots)[slotIndex] = a; } break; @@ -1197,10 +1197,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); - a = (*packageFrame->slots)[slotIndex]; + ASSERT(slotIndex < packageFrame->frameSlots->size()); + a = (*packageFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*packageFrame->slots)[slotIndex] = allocNumber(num + 1.0); + (*packageFrame->frameSlots)[slotIndex] = allocNumber(num + 1.0); pushNumber(num); } break; @@ -1208,10 +1208,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); - a = (*packageFrame->slots)[slotIndex]; + ASSERT(slotIndex < packageFrame->frameSlots->size()); + a = (*packageFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*packageFrame->slots)[slotIndex] = allocNumber(num - 1.0); + (*packageFrame->frameSlots)[slotIndex] = allocNumber(num - 1.0); pushNumber(num); } break; @@ -1219,22 +1219,22 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); - a = (*packageFrame->slots)[slotIndex]; + ASSERT(slotIndex < packageFrame->frameSlots->size()); + a = (*packageFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num + 1.0); - (*packageFrame->slots)[slotIndex] = a; + (*packageFrame->frameSlots)[slotIndex] = a; } break; case ePackageSlotPreDec: { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < packageFrame->slots->size()); - a = (*packageFrame->slots)[slotIndex]; + ASSERT(slotIndex < packageFrame->frameSlots->size()); + a = (*packageFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num - 1.0); - (*packageFrame->slots)[slotIndex] = a; + (*packageFrame->frameSlots)[slotIndex] = a; } break; @@ -1242,10 +1242,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); - a = (*parameterFrame->slots)[slotIndex]; + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + a = (*parameterFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*parameterFrame->slots)[slotIndex] = allocNumber(num + 1.0); + (*parameterFrame->frameSlots)[slotIndex] = allocNumber(num + 1.0); pushNumber(num); } break; @@ -1253,10 +1253,10 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); - a = (*parameterFrame->slots)[slotIndex]; + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + a = (*parameterFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); - (*parameterFrame->slots)[slotIndex] = allocNumber(num - 1.0); + (*parameterFrame->frameSlots)[slotIndex] = allocNumber(num - 1.0); pushNumber(num); } break; @@ -1264,21 +1264,21 @@ { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); - a = (*parameterFrame->slots)[slotIndex]; + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + a = (*parameterFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num + 1.0); - (*parameterFrame->slots)[slotIndex] = a; + (*parameterFrame->frameSlots)[slotIndex] = a; } break; case eParameterSlotPreDec: { uint16 slotIndex = BytecodeContainer::getShort(pc); pc += sizeof(short); - ASSERT(slotIndex < parameterFrame->slots->size()); - a = (*parameterFrame->slots)[slotIndex]; + ASSERT(slotIndex < parameterFrame->frameSlots->size()); + a = (*parameterFrame->frameSlots)[slotIndex]; float64 num = meta->toFloat64(a); a = pushNumber(num - 1.0); - (*parameterFrame->slots)[slotIndex] = a; + (*parameterFrame->frameSlots)[slotIndex] = a; } break;