upvar2, aka the big one (452598, r=mrbkap).

This commit is contained in:
Brendan Eich
2009-04-04 10:05:49 +01:00
parent 106117ffc8
commit 4af509178e
49 changed files with 6182 additions and 2552 deletions

View File

@@ -253,8 +253,10 @@ js_AddProperty(JSContext* cx, JSObject* obj, JSScopeProperty* sprop)
return JS_FALSE;
}
if (slot != sprop->slot)
if (slot != sprop->slot) {
js_FreeSlot(cx, obj, slot);
goto slot_changed;
}
}
SCOPE_EXTEND_SHAPE(cx, scope, sprop);
@@ -274,7 +276,6 @@ js_AddProperty(JSContext* cx, JSObject* obj, JSScopeProperty* sprop)
slot = sprop2->slot;
slot_changed:
js_FreeSlot(cx, obj, slot);
JS_UNLOCK_SCOPE(cx, scope);
return JS_FALSE;
}
@@ -367,6 +368,31 @@ js_Arguments(JSContext* cx)
return NULL;
}
JSObject* FASTCALL
js_NewNullClosure(JSContext* cx, JSObject* funobj, JSObject* proto, JSObject *parent)
{
JS_ASSERT(HAS_FUNCTION_CLASS(funobj));
JSFunction *fun = (JSFunction*) funobj;
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, funobj) == fun);
JS_ASSERT(JS_ON_TRACE(cx));
JSObject* closure = (JSObject*) js_NewGCThing(cx, GCX_OBJECT, sizeof(JSObject));
if (!closure)
return NULL;
closure->classword = jsuword(&js_FunctionClass);
closure->fslots[JSSLOT_PROTO] = OBJECT_TO_JSVAL(proto);
closure->fslots[JSSLOT_PARENT] = OBJECT_TO_JSVAL(parent);
closure->fslots[JSSLOT_PRIVATE] = PRIVATE_TO_JSVAL(fun);
for (unsigned i = JSSLOT_PRIVATE + 1; i != JS_INITIAL_NSLOTS; ++i)
closure->fslots[i] = JSVAL_VOID;
closure->map = js_HoldObjectMap(cx, proto->map);
closure->dslots = NULL;
return closure;
}
#define BUILTIN1 JS_DEFINE_CALLINFO_1
#define BUILTIN2 JS_DEFINE_CALLINFO_2
#define BUILTIN3 JS_DEFINE_CALLINFO_3