From 1e87e39a1987da9f0ad454b8b4f6c40055e50799 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 8 Apr 2013 15:38:30 +0200 Subject: Change internal class when attributes of properties change This should allow us to share property attributes for different class instances saving quite some memory. In addition, it can be used to speed up property access (as we then know in the lookup whether it's a data or accessor property). Change-Id: Ide9c6168a07b5c83a1e73d075d8fc4f6594e08fd Reviewed-by: Simon Hausmann --- src/v4/qv4functionobject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/v4/qv4functionobject.cpp') diff --git a/src/v4/qv4functionobject.cpp b/src/v4/qv4functionobject.cpp index 0d8bac82..4deb3189 100644 --- a/src/v4/qv4functionobject.cpp +++ b/src/v4/qv4functionobject.cpp @@ -341,7 +341,7 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function) Object *proto = scope->engine->newObject(); proto->defineDefaultProperty(scope->engine->id_constructor, Value::fromObject(this)); - PropertyDescriptor *pd = insertMember(scope->engine->id_prototype); + PropertyDescriptor *pd = insertMember(scope->engine->id_prototype, Attr_NotEnumerable|Attr_NotConfigurable); pd->type = PropertyDescriptor::Data; pd->writable = PropertyDescriptor::Enabled; pd->enumerable = PropertyDescriptor::Disabled; @@ -482,8 +482,8 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObject *target, Va PropertyDescriptor pd = PropertyDescriptor::fromAccessor(thrower, thrower); pd.configurable = PropertyDescriptor::Disabled; pd.enumerable = PropertyDescriptor::Disabled; - *insertMember(scope->engine->id_arguments) = pd; - *insertMember(scope->engine->id_caller) = pd; + *insertMember(scope->engine->id_arguments, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd; + *insertMember(scope->engine->id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd; } void BoundFunction::destroy(Managed *that) -- cgit v1.2.3