зеркало из https://github.com/mozilla/pjs.git
BROKEN latest arg slots changes
This commit is contained in:
Родитель
660a7650b1
Коммит
a63997f755
|
@ -1129,7 +1129,7 @@ namespace MetaData {
|
|||
JS2Object::mark(float64Table[i]);
|
||||
}
|
||||
if (parameterSlots) {
|
||||
for (i = 0; i < parameterFrame->frameSlots->size(); i++) {
|
||||
for (i = 0; i < parameterCount; i++) {
|
||||
GCMARKVALUE(parameterSlots[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,6 +314,8 @@ public:
|
|||
ParameterFrame *parameterFrame;
|
||||
js2val *parameterSlots;
|
||||
uint32 parameterCount;
|
||||
bool superConstructorCalled;
|
||||
js2val thisVal;
|
||||
};
|
||||
void jsr(Phase execPhase, BytecodeContainer *bCon, uint32 stackBase, js2val returnVal, Environment *env);
|
||||
bool activationStackEmpty() { return (activationStackTop == activationStack); }
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace MetaData {
|
|||
if (init) {
|
||||
ParameterFrame *runtimeFrame;
|
||||
DEFINE_ROOTKEEPER(this, rk, runtimeFrame);
|
||||
runtimeFrame = new (this) ParameterFrame(init->fWrap->compileFrame);
|
||||
runtimeFrame = init->fWrap->compileFrame; //new (this) ParameterFrame(init->fWrap->compileFrame);
|
||||
if (!init->fWrap->compileFrame->callsSuperConstructor) {
|
||||
invokeInit(c->super, thisValue, NULL, 0);
|
||||
runtimeFrame->superConstructorCalled = true;
|
||||
|
@ -324,9 +324,10 @@ namespace MetaData {
|
|||
CompilationData *oldData = startCompilationUnit(bCon, bCon->mSource, bCon->mSourceLocation);
|
||||
DEFINE_ROOTKEEPER(this, rk, runtimeFrame);
|
||||
if (runtimeFrame == NULL)
|
||||
runtimeFrame = new (this) ParameterFrame(fWrap->compileFrame);
|
||||
runtimeFrame = fWrap->compileFrame; //new (this) ParameterFrame(fWrap->compileFrame);
|
||||
runtimeFrame->instantiate(fWrap->env);
|
||||
runtimeFrame->thisObject = thisValue;
|
||||
js2val oldThis = engine->thisVal;
|
||||
uint32 newSlotsCount = 0;
|
||||
js2val *newSlots = runtimeFrame->assignArguments(this, fnObj, argv, argc, newSlotsCount);
|
||||
Frame *oldTopFrame = fWrap->env->getTopFrame();
|
||||
|
@ -342,6 +343,7 @@ namespace MetaData {
|
|||
engine->parameterFrame = runtimeFrame;
|
||||
engine->parameterSlots = newSlots;
|
||||
engine->parameterCount = newSlotsCount;
|
||||
engine->thisVal = thisValue;
|
||||
result = engine->interpret(RunPhase, bCon, fWrap->env);
|
||||
}
|
||||
catch (Exception &x) {
|
||||
|
@ -352,6 +354,7 @@ namespace MetaData {
|
|||
engine->parameterSlots = oldPSlots;
|
||||
if (engine->parameterFrame)
|
||||
engine->parameterFrame->argSlots = engine->parameterSlots;
|
||||
engine->thisVal = oldThis;
|
||||
throw x;
|
||||
}
|
||||
engine->pc = savePC;
|
||||
|
@ -361,6 +364,7 @@ namespace MetaData {
|
|||
engine->parameterSlots = oldPSlots;
|
||||
if (engine->parameterFrame)
|
||||
engine->parameterFrame->argSlots = engine->parameterSlots;
|
||||
engine->thisVal = oldThis;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -583,7 +583,7 @@ namespace MetaData {
|
|||
}
|
||||
|
||||
VariableBinding *vb = vs->bindings;
|
||||
Frame *regionalFrame = (env->getRegionalFrame())->first;
|
||||
Frame *regionalFrame = *(env->getRegionalFrame());
|
||||
while (vb) {
|
||||
ASSERT(vb->name);
|
||||
const StringAtom &name = *vb->name;
|
||||
|
@ -1098,9 +1098,9 @@ namespace MetaData {
|
|||
{
|
||||
SwitchStmtNode *sw = checked_cast<SwitchStmtNode *>(p);
|
||||
FrameListIterator fi = env->getRegionalFrame();
|
||||
NonWithFrame *regionalFrame = checked_cast<NonWithFrame *>(fi->first);
|
||||
NonWithFrame *regionalFrame = checked_cast<NonWithFrame *>(*fi);
|
||||
if (regionalFrame->kind == ParameterFrameKind)
|
||||
regionalFrame = checked_cast<NonWithFrame *>((--fi)->first);
|
||||
regionalFrame = checked_cast<NonWithFrame *>(*--fi);
|
||||
FrameVariable *frV = makeFrameVariable(regionalFrame);
|
||||
ASSERT(frV->kind != FrameVariable::Parameter);
|
||||
Reference *switchTemp;
|
||||
|
@ -2419,7 +2419,7 @@ doUnary:
|
|||
// that the arguments property will get built
|
||||
FrameListIterator fi = env->getBegin(), end = env->getEnd();
|
||||
while (fi != end) {
|
||||
Frame *fr = fi->first;
|
||||
Frame *fr = *fi;
|
||||
if ((fr->kind != WithFrameKind) && (fr->kind != BlockFrameKind)) {
|
||||
NonWithFrame *nwf = checked_cast<NonWithFrame *>(fr);
|
||||
if (nwf->kind == ParameterFrameKind) {
|
||||
|
@ -2446,7 +2446,7 @@ doUnary:
|
|||
FrameListIterator fi = env->getBegin(), end = env->getEnd();
|
||||
bool keepLooking = true;
|
||||
while (fi != end && keepLooking) {
|
||||
Frame *fr = fi->first;
|
||||
Frame *fr = *fi;
|
||||
if (fr->kind == WithFrameKind)
|
||||
// XXX unless it's provably not a dynamic object that been with'd??
|
||||
break;
|
||||
|
@ -2840,8 +2840,8 @@ doUnary:
|
|||
{
|
||||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
while (fi != end) {
|
||||
if ((fi->first)->kind == ClassKind)
|
||||
return checked_cast<JS2Class *>(fi->first);
|
||||
if ((*fi)->kind == ClassKind)
|
||||
return checked_cast<JS2Class *>(*fi);
|
||||
fi++;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -2853,14 +2853,17 @@ doUnary:
|
|||
{
|
||||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
while (fi != end) {
|
||||
switch ((fi->first)->kind) {
|
||||
switch ((*fi)->kind) {
|
||||
case ClassKind:
|
||||
case PackageKind:
|
||||
case SystemKind:
|
||||
return NULL;
|
||||
case ParameterFrameKind:
|
||||
if (thisP) *thisP = fi->second;
|
||||
return checked_cast<ParameterFrame *>(fi->first);
|
||||
{
|
||||
ParameterFrame *pFrame = checked_cast<ParameterFrame *>(*fi);
|
||||
if (thisP) *thisP = pFrame->thisObject;
|
||||
return pFrame;
|
||||
}
|
||||
case BlockFrameKind:
|
||||
case WithFrameKind:
|
||||
break;
|
||||
|
@ -2879,12 +2882,12 @@ doUnary:
|
|||
{
|
||||
FrameListIterator start = getBegin();
|
||||
FrameListIterator fi = start;
|
||||
while (((fi->first)->kind == BlockFrameKind) || ((fi->first)->kind == WithFrameKind)) {
|
||||
while (((*fi)->kind == BlockFrameKind) || ((*fi)->kind == WithFrameKind)) {
|
||||
fi++;
|
||||
ASSERT(fi != getEnd());
|
||||
}
|
||||
if ((fi->first)->kind == ClassKind) {
|
||||
while ((fi != start) && ((fi->first)->kind != BlockFrameKind))
|
||||
if ((*fi)->kind == ClassKind) {
|
||||
while ((fi != start) && ((*fi)->kind != BlockFrameKind))
|
||||
fi--;
|
||||
}
|
||||
return fi;
|
||||
|
@ -2902,7 +2905,7 @@ doUnary:
|
|||
// Returns the penultimate frame, always a Package
|
||||
Package *Environment::getPackageFrame()
|
||||
{
|
||||
Frame *result = (getEnd() - 2)->first;
|
||||
Frame *result = *(getEnd() - 2);
|
||||
ASSERT(result->kind == PackageKind);
|
||||
return checked_cast<Package *>(result);
|
||||
}
|
||||
|
@ -2932,7 +2935,7 @@ doUnary:
|
|||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
bool result = false;
|
||||
while (fi != end) {
|
||||
Frame *f = fi->first;
|
||||
Frame *f = (*fi);
|
||||
switch (f->kind) {
|
||||
case ClassKind:
|
||||
case PackageKind:
|
||||
|
@ -2978,7 +2981,7 @@ doUnary:
|
|||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
bool result = false;
|
||||
while (fi != end) {
|
||||
Frame *f = fi->first;
|
||||
Frame *f = (*fi);
|
||||
switch (f->kind) {
|
||||
case ClassKind:
|
||||
case PackageKind:
|
||||
|
@ -3031,7 +3034,7 @@ doUnary:
|
|||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
bool result = false;
|
||||
while (fi != end) {
|
||||
Frame *f = fi->first;
|
||||
Frame *f = (*fi);
|
||||
switch (f->kind) {
|
||||
case ClassKind:
|
||||
case PackageKind:
|
||||
|
@ -3081,7 +3084,7 @@ doUnary:
|
|||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
bool result = false;
|
||||
while (fi != end) {
|
||||
Frame *f = fi->first;
|
||||
Frame *f = (*fi);
|
||||
switch (f->kind) {
|
||||
case ClassKind:
|
||||
case PackageKind:
|
||||
|
@ -3144,8 +3147,7 @@ doUnary:
|
|||
{
|
||||
FrameListIterator fi = getBegin(), end = getEnd();
|
||||
while (fi != end) {
|
||||
GCMARKOBJECT(fi->first);
|
||||
GCMARKVALUE(fi->second);
|
||||
GCMARKOBJECT(*fi);
|
||||
fi++;
|
||||
}
|
||||
}
|
||||
|
@ -3246,7 +3248,7 @@ doUnary:
|
|||
Attribute::OverrideModifier overrideMod, bool xplicit, Access access,
|
||||
LocalMember *m, size_t pos, bool enumerable)
|
||||
{
|
||||
NonWithFrame *innerFrame = checked_cast<NonWithFrame *>((env->getBegin())->first);
|
||||
NonWithFrame *innerFrame = checked_cast<NonWithFrame *>(*(env->getBegin()));
|
||||
if ((overrideMod != Attribute::NoOverride) || (xplicit && innerFrame->kind != PackageKind))
|
||||
reportError(Exception::definitionError, "Illegal definition", pos);
|
||||
|
||||
|
@ -3268,12 +3270,12 @@ doUnary:
|
|||
|
||||
// Check all frames below the current - up to the RegionalFrame - for a non-forbidden definition
|
||||
FrameListIterator fi = env->getBegin();
|
||||
Frame *regionalFrame = env->getRegionalFrame()->first;
|
||||
Frame *regionalFrame = *(env->getRegionalFrame());
|
||||
if (innerFrame != regionalFrame) {
|
||||
// The frame iterator is pointing at the top of the environment's
|
||||
// frame list, start at the one below that and continue to the frame
|
||||
// returned by 'getRegionalFrame()'.
|
||||
Frame *fr = (++fi)->first;
|
||||
Frame *fr = *++fi;
|
||||
while (true) {
|
||||
if (fr->kind != WithFrameKind) {
|
||||
NonWithFrame *nwfr = checked_cast<NonWithFrame *>(fr);
|
||||
|
@ -3290,7 +3292,7 @@ doUnary:
|
|||
}
|
||||
if (fr == regionalFrame)
|
||||
break;
|
||||
fr = (++fi)->first;
|
||||
fr = *++fi;
|
||||
ASSERT(fr);
|
||||
}
|
||||
}
|
||||
|
@ -3311,7 +3313,7 @@ doUnary:
|
|||
// region if they haven't been marked as such already.
|
||||
if (innerFrame != regionalFrame) {
|
||||
fi = env->getBegin();
|
||||
Frame *fr = (++fi)->first;
|
||||
Frame *fr = *++fi;
|
||||
while (true) {
|
||||
if (fr->kind != WithFrameKind) {
|
||||
NonWithFrame *nwfr = checked_cast<NonWithFrame *>(fr);
|
||||
|
@ -3338,7 +3340,7 @@ doUnary:
|
|||
}
|
||||
if (fr == regionalFrame)
|
||||
break;
|
||||
fr = (++fi)->first;
|
||||
fr = *++fi;
|
||||
}
|
||||
}
|
||||
return multiname;
|
||||
|
@ -3505,7 +3507,7 @@ doUnary:
|
|||
{
|
||||
LocalMember *result = NULL;
|
||||
FrameListIterator regionalFrameEnd = env->getRegionalEnvironment();
|
||||
NonWithFrame *regionalFrame = checked_cast<NonWithFrame *>(regionalFrameEnd->first);
|
||||
NonWithFrame *regionalFrame = checked_cast<NonWithFrame *>(*regionalFrameEnd);
|
||||
ASSERT((regionalFrame->kind == PackageKind) || (regionalFrame->kind == ParameterFrameKind));
|
||||
rescan:
|
||||
// run through all the existing bindings, to see if this variable already exists.
|
||||
|
@ -3529,7 +3531,7 @@ rescan:
|
|||
&& (regionalFrame->kind == ParameterFrameKind)
|
||||
&& (regionalFrameEnd != env->getBegin())) {
|
||||
// re-scan in the frame above the parameter frame
|
||||
regionalFrame = checked_cast<NonWithFrame *>((regionalFrameEnd - 1)->first);
|
||||
regionalFrame = checked_cast<NonWithFrame *>(*(regionalFrameEnd - 1));
|
||||
goto rescan;
|
||||
}
|
||||
|
||||
|
@ -4636,11 +4638,6 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
|
|||
return dv;
|
||||
}
|
||||
|
||||
// char * version of above (XXX inline?)
|
||||
DynamicVariable *JS2Metadata::createDynamicProperty(JS2Object *obj, const char *name, js2val initVal, Access access, bool sealed, bool enumerable)
|
||||
{
|
||||
return createDynamicProperty(obj, world.identifiers[widenCString(name)], initVal, access, sealed, enumerable);
|
||||
}
|
||||
|
||||
// Use the slotIndex from the instanceVariable to access the slot
|
||||
Slot *JS2Metadata::findSlot(js2val thisObjVal, InstanceVariable *id)
|
||||
|
@ -5260,9 +5257,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
|
|||
|
||||
void ParameterFrame::instantiate(Environment *env)
|
||||
{
|
||||
ASSERT(pluralFrame->kind == ParameterFrameKind);
|
||||
ParameterFrame *plural = checked_cast<ParameterFrame *>(pluralFrame);
|
||||
env->instantiateFrame(pluralFrame, this, !plural->buildArguments);
|
||||
// ASSERT(pluralFrame->kind == ParameterFrameKind);
|
||||
// ParameterFrame *plural = checked_cast<ParameterFrame *>(pluralFrame);
|
||||
// env->instantiateFrame(pluralFrame, this, !plural->buildArguments);
|
||||
}
|
||||
|
||||
// Assume that instantiate has been called, the plural frame will contain
|
||||
|
@ -5278,7 +5275,6 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
|
|||
|
||||
// slotCount is the number of slots required by the parameter frame
|
||||
uint32 slotCount = (frameSlots) ? frameSlots->size() : 0;
|
||||
ASSERT(length == slotCount);
|
||||
|
||||
if (buildArguments) {
|
||||
// If we're building an arguments object, the slots for the parameter frame are located
|
||||
|
|
|
@ -1541,8 +1541,10 @@ public:
|
|||
js2val invokeFunction(JS2Object *fnObj, js2val thisValue, js2val *argv, uint32 argc, ParameterFrame *runtimeFrame);
|
||||
void invokeInit(JS2Class *c, js2val thisValue, js2val* argv, uint32 argc);
|
||||
|
||||
DynamicVariable *createDynamicProperty(JS2Object *obj, const char *name, js2val initVal, Access access, bool sealed, bool enumerable);
|
||||
// DynamicVariable *createDynamicProperty(JS2Object *obj, QualifiedName *qName, js2val initVal, Access access, bool sealed, bool enumerable);
|
||||
DynamicVariable *createDynamicProperty(JS2Object *obj, const char *name, js2val initVal, Access access, bool sealed, bool enumerable)
|
||||
{
|
||||
return createDynamicProperty(obj, world.identifiers[widenCString(name)], initVal, access, sealed, enumerable);
|
||||
}
|
||||
DynamicVariable *createDynamicProperty(JS2Object *obj, const StringAtom &name, js2val initVal, Access access, bool sealed, bool enumerable);
|
||||
void addPublicVariableToLocalMap(LocalBindingMap *lMap, const StringAtom &name, LocalMember *v, Access access, bool enumerable);
|
||||
|
||||
|
|
|
@ -81,13 +81,16 @@
|
|||
push(a);
|
||||
}
|
||||
else {
|
||||
pFrame = new (meta) ParameterFrame(fWrap->compileFrame);
|
||||
pFrame = fWrap->compileFrame; //new (meta) ParameterFrame(fWrap->compileFrame);
|
||||
pFrame->instantiate(meta->env);
|
||||
baseVal = OBJECT_TO_JS2VAL(new (meta) SimpleInstance(meta, protoVal, meta->objectType(protoVal)));
|
||||
pFrame->thisObject = baseVal;
|
||||
parameterSlots = pFrame->assignArguments(meta, obj, base(argCount), argCount, length);
|
||||
pFrame->assignArguments(meta, obj, base(argCount), argCount, length);
|
||||
jsr(phase, fWrap->bCon, base(argCount + 1) - execStack, baseVal, fWrap->env);
|
||||
meta->env->addFrame(pFrame, baseVal);
|
||||
parameterSlots = pFrame->argSlots;
|
||||
parameterCount = length;
|
||||
thisVal = a;
|
||||
meta->env->addFrame(pFrame);
|
||||
parameterFrame = pFrame;
|
||||
pFrame = NULL;
|
||||
}
|
||||
|
@ -132,6 +135,8 @@ doCall:
|
|||
push(JS2VAL_UNDEFINED);
|
||||
argCount++;
|
||||
}
|
||||
if (parameterFrame)
|
||||
thisVal = parameterFrame->thisObject;
|
||||
jsr(phase, NULL, base(argCount + 2) - execStack, JS2VAL_VOID, fWrap->env);
|
||||
if (fWrap->alien)
|
||||
a = fWrap->alien(meta, fInst, a, base(argCount), argc);
|
||||
|
@ -146,11 +151,14 @@ doCall:
|
|||
//pFrame->instantiate(meta->env);
|
||||
pFrame->thisObject = a;
|
||||
// XXX (use fWrap->compileFrame->signature)
|
||||
parameterSlots = pFrame->assignArguments(meta, fObj, base(argCount), argCount, length);
|
||||
pFrame->assignArguments(meta, fObj, base(argCount), argCount, length);
|
||||
jsr(phase, fWrap->bCon, base(argCount + 2) - execStack, JS2VAL_VOID, fWrap->env);
|
||||
parameterSlots = pFrame->argSlots;
|
||||
parameterCount = length;
|
||||
thisVal = a;
|
||||
if (fInst->isMethodClosure)
|
||||
meta->env->addFrame(meta->objectType(a));
|
||||
meta->env->addFrame(pFrame, a);
|
||||
meta->env->addFrame(pFrame);
|
||||
parameterFrame = pFrame;
|
||||
pFrame = NULL;
|
||||
}
|
||||
|
@ -162,7 +170,11 @@ doCall:
|
|||
// Still need to mark the frame as a runtime frame (see stmtnode::return in validate)
|
||||
pFrame = fWrap->compileFrame; //new (meta) ParameterFrame(a, fWrap->compileFrame->prototype);
|
||||
pFrame->pluralFrame = fWrap->compileFrame;
|
||||
meta->env->addFrame(pFrame, a);
|
||||
meta->env->addFrame(pFrame);
|
||||
parameterSlots = NULL;
|
||||
parameterCount = 0;
|
||||
thisVal = a;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@
|
|||
FrameListIterator closure_fi = x->fWrap->env->getBegin();
|
||||
FrameListIterator current_fi = meta->env->getBegin();
|
||||
while (true) {
|
||||
Frame *closure_fr = closure_fi->first;
|
||||
Frame *current_fr = current_fi->first;
|
||||
Frame *closure_fr = *closure_fi;
|
||||
Frame *current_fr = *current_fi;
|
||||
ASSERT(closure_fr->kind == current_fr->kind);
|
||||
if ((closure_fr->kind == ClassKind) || (closure_fr->kind == PackageKind) || (closure_fr->kind == SystemKind))
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче