From: Lars Knoll Date: Fri, 30 Nov 2012 22:15:55 +0000 (+0100) Subject: Remove the outer member in declarativeEnvironment X-Git-Tag: upstream/5.2.1~669^2~659^2~769 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b589811f735ffde5dd1272bd9dd69599de421000;p=platform%2Fupstream%2Fqtdeclarative.git Remove the outer member in declarativeEnvironment The function already has it as the scope parameter, so don't duplicate the data. Change-Id: Iadd0418cafa9ad273db11c06c44086ac64b1e5bf Reviewed-by: Simon Hausmann --- diff --git a/qmljs_environment.cpp b/qmljs_environment.cpp index 326ed93..76f1c8c 100644 --- a/qmljs_environment.cpp +++ b/qmljs_environment.cpp @@ -76,7 +76,6 @@ String *DiagnosticMessage::buildFullMessage(ExecutionContext *ctx) const void DeclarativeEnvironment::init(ExecutionEngine *e) { engine = e; - outer = 0; function = 0; arguments = 0; argumentCount = 0; @@ -89,8 +88,7 @@ void DeclarativeEnvironment::init(ExecutionEngine *e) void DeclarativeEnvironment::init(FunctionObject *f, Value *args, uint argc) { function = f; - outer = function->scope; - engine = outer->engine; + engine = f->scope->engine; strictMode = f->strictMode; arguments = args; @@ -210,6 +208,11 @@ void DeclarativeEnvironment::popWithObject() delete w; } +DeclarativeEnvironment *DeclarativeEnvironment::outer() const +{ + return function ? function->scope : 0; +} + String **DeclarativeEnvironment::formals() const { return function ? function->formalParameterList : 0; @@ -243,7 +246,7 @@ void ExecutionContext::init(ExecutionEngine *eng) PropertyDescriptor *ExecutionContext::lookupPropertyDescriptor(String *name, PropertyDescriptor *tmp) { - for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer) { + for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer()) { if (ctx->withObject) { DeclarativeEnvironment::With *w = ctx->withObject; while (w) { @@ -262,7 +265,7 @@ PropertyDescriptor *ExecutionContext::lookupPropertyDescriptor(String *name, Pro bool ExecutionContext::deleteProperty(String *name) { - for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer) { + for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer()) { if (ctx->withObject) { DeclarativeEnvironment::With *w = ctx->withObject; while (w) { @@ -282,7 +285,7 @@ bool ExecutionContext::deleteProperty(String *name) void ExecutionContext::inplaceBitOp(Value value, String *name, BinOp op) { - for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer) { + for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer()) { if (ctx->activation) { if (ctx->activation->inplaceBinOp(value, name, op, this)) return; diff --git a/qmljs_environment.h b/qmljs_environment.h index 6caada9..d780c56 100644 --- a/qmljs_environment.h +++ b/qmljs_environment.h @@ -74,8 +74,6 @@ struct DiagnosticMessage struct DeclarativeEnvironment { ExecutionEngine *engine; - DeclarativeEnvironment *outer; - FunctionObject *function; Value *arguments; @@ -87,6 +85,8 @@ struct DeclarativeEnvironment unsigned int variableCount() const; bool strictMode; + DeclarativeEnvironment *outer() const; + Object *activation; struct With { Object *object;