aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-04 13:19:27 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-07 16:55:12 +0100
commitf836b9837dda09c09c2ee3307300998ca5dff5c4 (patch)
tree0f49f84a9e6912dbef18c7b58d8c9442c5387180 /src/qml/jsruntime/qv4functionobject.cpp
parent48251fd737447710775727f55e7334ec1c6af1f4 (diff)
Remove the name member of FunctionObject
The data is anyway stored in the name property of the FunctionObject, and is not performance critical. Change-Id: If1784b0ec6f368bc474c246bb9c2c50d5e56b689 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index f0002b3b4e..f0966492a9 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -91,22 +91,30 @@ FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, boo
, protoCacheClass(0)
, protoCacheIndex(UINT_MAX)
{
- // set the name to something here, so that a gc run a few lines below doesn't crash on it
- this->name = scope->engine->id_undefined;
-
Scope s(scope);
ScopedValue protectThis(s, this);
ScopedString n(s, s.engine->newString(name));
init(n, createProto);
}
+FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValue name)
+ : Object(scope->engine->functionClass)
+ , scope(scope)
+ , function(0)
+ , protoCacheClass(0)
+ , protoCacheIndex(UINT_MAX)
+{
+ Scope s(scope);
+ ScopedValue protectThis(s, this);
+ ScopedString n(s, name);
+ init(n, false);
+}
+
FunctionObject::FunctionObject(InternalClass *ic)
: Object(ic)
, scope(ic->engine->rootContext)
, function(0)
{
- name = ic->engine->id_undefined;
-
needsActivation = false;
strictMode = false;
}
@@ -119,8 +127,6 @@ FunctionObject::~FunctionObject()
void FunctionObject::init(const StringRef n, bool createProto)
{
- name = n;
-
Scope s(internalClass->engine);
ScopedValue protectThis(s, this);
@@ -137,6 +143,12 @@ void FunctionObject::init(const StringRef n, bool createProto)
defineReadonlyProperty(scope->engine->id_name, v);
}
+ReturnedValue FunctionObject::name()
+{
+ return get(scope->engine->id_name);
+}
+
+
ReturnedValue FunctionObject::newInstance()
{
Scope scope(internalClass->engine);
@@ -163,8 +175,6 @@ ReturnedValue FunctionObject::call(Managed *, CallData *)
void FunctionObject::markObjects(Managed *that, ExecutionEngine *e)
{
FunctionObject *o = static_cast<FunctionObject *>(that);
- if (o->name.managed())
- o->name->mark(e);
o->scope->mark(e);
Object::markObjects(that, e);