mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Prototype functions --> dynamic instance.
This commit is contained in:
parent
dc79671232
commit
7299369a02
@ -406,10 +406,10 @@ namespace MetaData {
|
||||
&& (f->attributes == NULL)) {
|
||||
HoistedVar *v = defineHoistedVar(env, f->function.name, p);
|
||||
// XXX Here ths spec. has ???, so the following is tentative
|
||||
FixedInstance *fInst = new FixedInstance(functionClass);
|
||||
fInst->fWrap = new FunctionWrapper(unchecked, compileFrame);
|
||||
f->fWrap = fInst->fWrap;
|
||||
v->value = OBJECT_TO_JS2VAL(fInst);
|
||||
DynamicInstance *dInst = new DynamicInstance(functionClass);
|
||||
dInst->fWrap = new FunctionWrapper(unchecked, compileFrame);
|
||||
f->fWrap = dInst->fWrap;
|
||||
v->value = OBJECT_TO_JS2VAL(dInst);
|
||||
}
|
||||
else {
|
||||
FixedInstance *fInst = new FixedInstance(functionClass);
|
||||
@ -3461,6 +3461,7 @@ deleteClassProperty:
|
||||
DynamicInstance::DynamicInstance(JS2Class *type)
|
||||
: JS2Object(DynamicInstanceKind),
|
||||
type(type),
|
||||
fWrap(NULL),
|
||||
call(NULL),
|
||||
construct(NULL),
|
||||
env(NULL),
|
||||
@ -3476,6 +3477,11 @@ deleteClassProperty:
|
||||
void DynamicInstance::markChildren()
|
||||
{
|
||||
GCMARKOBJECT(type)
|
||||
if (fWrap) {
|
||||
GCMARKOBJECT(fWrap->compileFrame);
|
||||
if (fWrap->bCon)
|
||||
fWrap->bCon->mark();
|
||||
}
|
||||
if (slots) {
|
||||
ASSERT(type);
|
||||
for (uint32 i = 0; (i < type->slotCount); i++) {
|
||||
|
@ -506,6 +506,7 @@ public:
|
||||
DynamicInstance(JS2Class *type);
|
||||
|
||||
JS2Class *type; // This instance's type
|
||||
FunctionWrapper *fWrap;
|
||||
Invokable *call; // A procedure to call when this instance is used in a call expression
|
||||
Invokable *construct; // A procedure to call when this instance is used in a new expression
|
||||
Environment *env; // The environment to pass to the call or construct procedure
|
||||
|
@ -47,7 +47,12 @@
|
||||
push(a);
|
||||
}
|
||||
else {
|
||||
if (obj->kind == FixedInstanceKind) {
|
||||
if ((obj->kind == FixedInstanceKind) || (obj->kind == DynamicInstanceKind)) {
|
||||
FunctionWrapper *fWrap;
|
||||
if (obj->kind == FixedInstanceKind)
|
||||
fWrap = (checked_cast<FixedInstance *>(obj))->fWrap;
|
||||
else
|
||||
fWrap = (checked_cast<DynamicInstance *>(obj))->fWrap;
|
||||
// XXX
|
||||
js2val protoVal;
|
||||
JS2Object *protoObj = meta->objectClass->prototype;
|
||||
@ -59,8 +64,6 @@
|
||||
protoObj = JS2VAL_TO_OBJECT(protoVal);
|
||||
}
|
||||
|
||||
FixedInstance *fInst = checked_cast<FixedInstance *>(obj);
|
||||
FunctionWrapper *fWrap = fInst->fWrap;
|
||||
ParameterFrame *runtimeFrame = new ParameterFrame(fWrap->compileFrame);
|
||||
runtimeFrame->instantiate(&meta->env);
|
||||
PrototypeInstance *pInst = new PrototypeInstance(protoObj, meta->objectClass);
|
||||
|
Loading…
Reference in New Issue
Block a user