aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2014-11-12 16:07:56 +0100
committerSimon Hausmann <[email protected]>2014-11-21 13:08:28 +0100
commitf58b5229a31e9fec49b4eb055c56f9a78e423866 (patch)
tree6214fb89929fd9482c2154b0fe17c7cba0f509cb /src/qml/jsruntime/qv4functionobject.cpp
parente6db292366fa6ad25536fee08b2a972ea617d968 (diff)
Fix run-time string handling with regards to the new heap
Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 410be02639..7c2ab2cc80 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -71,6 +71,16 @@ Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, QV4::String *
f->init(name, createProto);
}
+Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, Function *function, bool createProto)
+ : Heap::Object(scope->d()->engine->functionClass)
+ , scope(scope->d())
+{
+ Scope s(scope->engine());
+ ScopedString name(s, function->name());
+ ScopedFunctionObject f(s, this);
+ f->init(name, createProto);
+}
+
Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const QString &name, bool createProto)
: Heap::Object(scope->d()->engine->functionClass)
, scope(scope->d())
@@ -429,7 +439,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
DEFINE_OBJECT_VTABLE(SimpleScriptFunction);
Heap::SimpleScriptFunction::SimpleScriptFunction(QV4::ExecutionContext *scope, Function *function, bool createProto)
- : Heap::FunctionObject(scope, function->name(), createProto)
+ : Heap::FunctionObject(scope, function, createProto)
{
setVTable(QV4::SimpleScriptFunction::staticVTable());
@@ -468,7 +478,7 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
Scoped<SimpleScriptFunction> f(scope, static_cast<SimpleScriptFunction *>(that));
InternalClass *ic = f->internalClassForConstructor();
- callData->thisObject = Value::fromHeapObject(v4->newObject(ic));
+ callData->thisObject = v4->newObject(ic);
ExecutionContext *context = v4->currentContext();
ExecutionContextSaver ctxSaver(context);