aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-09 12:01:06 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-12 11:04:13 +0100
commit4f28d07b8efbe9dfe12a08c8198d99225faa1331 (patch)
tree70f636f3c7f87014cd93111bf579445d3db052d3
parentb935023384120f8a9a38600847324b3810d7bee1 (diff)
Start cleaning up flags in Heap::Base
The goal is to get rid of the flags here and reduce the size of each GC'ed object with a pointer. Change-Id: I8c876810037756b85a646348cc5992a688588ea5 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4value_p.h8
4 files changed, 7 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 081321e956..0cdf6b5d7c 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -144,7 +144,6 @@ void FunctionObject::init(String *n, bool createProto)
ScopedValue protectThis(s, this);
d()->needsActivation = true;
- d()->strictMode = false;
ensureMemberIndex(s.engine, Heap::FunctionObject::Index_Prototype);
if (createProto) {
@@ -452,7 +451,6 @@ Heap::SimpleScriptFunction::SimpleScriptFunction(QV4::ExecutionContext *scope, F
Q_ASSERT(function->code);
needsActivation = function->needsActivation();
- strictMode = function->isStrict();
// global function
if (!scope)
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 5d2715fa2f..7406e9b0ff 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -142,7 +142,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
ReturnedValue protoProperty() { return memberData()->data[Heap::FunctionObject::Index_Prototype].asReturnedValue(); }
bool needsActivation() const { return d()->needsActivation; }
- bool strictMode() const { return d()->strictMode; }
+ bool strictMode() const { return d()->function ? d()->function->isStrict() : false; }
bool bindingKeyFlag() const { return d()->bindingKeyFlag; }
static void markObjects(Heap::Base *that, ExecutionEngine *e);
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index c9d61f7c03..7669fa82bb 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -383,11 +383,9 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
if (!function)
return Encode::undefined();
- d()->strictMode = function->isStrict() || (ctx->d()->strictMode);
-
d()->needsActivation = function->needsActivation();
- if (strictMode()) {
+ if (function->isStrict() || (ctx->d()->strictMode)) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
callData->thisObject = ctx->d()->callData->thisObject;
@@ -397,7 +395,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
ContextStateSaver stateSaver(scope, ctx);
// set the correct strict mode flag on the context
- ctx->d()->strictMode = strictMode();
+ ctx->d()->strictMode = false;
ctx->d()->compilationUnit = function->compilationUnit;
return function->code(ctx->engine(), function->codeData);
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 73200404ab..01a1542b07 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -61,14 +61,14 @@ struct Q_QML_EXPORT Base {
uchar markBit : 1;
uchar inUse : 1;
uchar extensible : 1; // used by Object
- uchar _unused : 1;
uchar needsActivation : 1; // used by FunctionObject
- uchar strictMode : 1; // used by FunctionObject
+ uchar _strictMode : 1; // used by FunctionObject
uchar bindingKeyFlag : 1;
uchar hasAccessorProperty : 1;
- uchar _type;
+ uchar _unused : 1;
mutable uchar subtype;
- uchar _flags;
+ uchar _unused2;
+ uchar _unused3;
};