forked from qt-creator/qt-creator
QmlJS: Speed up ValueOwner construction.
* Don't build all default values (including the global object) separately for each ValueOwner instance. * Instead, keep all global, immutable values in a single, shared instance. While refactoring, some cases where we *modified* the global object had to be removed: * C++ context properties no longer get injected into the global object, instead they now have their own scope just above the global one. * The Qt object's prototype no longer gets modified in Link. Instead, it's now a reference to the "Qt" object provided in a qmltypes file. * The whole concept of a function 'Activation' that could potentially affect the global object was removed. Change-Id: Id382faf965efa747fcc7a9b0bc2c90429d84d61b Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -273,13 +273,13 @@ bool Evaluate::visit(AST::NumericLiteral *)
|
||||
|
||||
bool Evaluate::visit(AST::RegExpLiteral *)
|
||||
{
|
||||
_result = _valueOwner->regexpCtor()->construct();
|
||||
_result = _valueOwner->regexpCtor()->returnValue();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Evaluate::visit(AST::ArrayLiteral *)
|
||||
{
|
||||
_result = _valueOwner->arrayCtor()->construct();
|
||||
_result = _valueOwner->arrayCtor()->returnValue();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast)
|
||||
bool Evaluate::visit(AST::NewMemberExpression *ast)
|
||||
{
|
||||
if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->base))) {
|
||||
_result = ctor->construct();
|
||||
_result = ctor->returnValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ bool Evaluate::visit(AST::NewMemberExpression *ast)
|
||||
bool Evaluate::visit(AST::NewExpression *ast)
|
||||
{
|
||||
if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->expression))) {
|
||||
_result = ctor->construct();
|
||||
_result = ctor->returnValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user