diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/v4/qv4isel_masm.cpp | 13 | ||||
-rw-r--r-- | src/v4/qv4runtime.cpp | 18 | ||||
-rw-r--r-- | src/v4/qv4runtime.h | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp index 13a3cc111a..4e49c599ff 100644 --- a/src/v4/qv4isel_masm.cpp +++ b/src/v4/qv4isel_masm.cpp @@ -1078,6 +1078,19 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::E { assert(func != 0); + if (useFastLookups && func->global) { + int argc = prepareVariableArguments(args); + VM::String *s = identifier(*func->id); + + uint index = addGlobalLookup(s); + generateFunctionCall(Assembler::Void, __qmljs_construct_global_lookup, + Assembler::ContextRegister, Assembler::PointerToValue(result), + Assembler::TrustedImm32(index), + baseAddressForCallArguments(), + Assembler::TrustedImm32(argc)); + return; + } + callRuntimeMethod(result, __qmljs_construct_activation_property, func, args); } diff --git a/src/v4/qv4runtime.cpp b/src/v4/qv4runtime.cpp index bf871ffd3e..d15be7bd9e 100644 --- a/src/v4/qv4runtime.cpp +++ b/src/v4/qv4runtime.cpp @@ -929,6 +929,24 @@ void __qmljs_call_value(ExecutionContext *context, Value *result, const Value *t *result = res; } + +void __qmljs_construct_global_lookup(ExecutionContext *context, Value *result, uint index, Value *args, int argc) +{ + Lookup *l = context->lookups + index; + Value func; + l->lookupGlobal(l, context, &func); + + if (Object *f = func.asObject()) { + Value res = f->construct(context, args, argc); + if (result) + *result = res; + return; + } + + context->throwTypeError(); +} + + void __qmljs_construct_activation_property(ExecutionContext *context, Value *result, String *name, Value *args, int argc) { Value func = context->getProperty(name); diff --git a/src/v4/qv4runtime.h b/src/v4/qv4runtime.h index ff34257fcc..dfdaedef47 100644 --- a/src/v4/qv4runtime.h +++ b/src/v4/qv4runtime.h @@ -168,6 +168,7 @@ void __qmljs_get_activation_property(ExecutionContext *ctx, Value *result, Strin void __qmljs_get_global_lookup(ExecutionContext *ctx, Value *result, int lookupIndex); void __qmljs_call_global_lookup(ExecutionContext *context, Value *result, uint index, Value *args, int argc); +void __qmljs_construct_global_lookup(ExecutionContext *context, Value *result, uint index, Value *args, int argc); void __qmljs_get_property_lookup(ExecutionContext *ctx, Value *result, const Value &object, int lookupIndex); void __qmljs_set_property_lookup(ExecutionContext *ctx, const Value &object, int lookupIndex, const Value &value); |