Save some memory

Move some boolean flags from Object and FunctionObject
into the Managed class and reduce the size of these
Objects.

Change-Id: Iee9ab09407ec44b447f9597a9b1d55e9092e7ad5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Lars Knoll 2013-01-02 22:35:18 +01:00 committed by Simon Hausmann
parent 18d493f9a3
commit 5e496cc7bd
2 changed files with 13 additions and 14 deletions

View File

@ -398,11 +398,9 @@ private:
struct Object: Managed {
Object *prototype;
QScopedPointer<PropertyTable> members;
bool extensible;
Object()
: prototype(0)
, extensible(true) {}
: prototype(0) {}
virtual ~Object();
@ -538,23 +536,20 @@ struct FunctionObject: Object {
ExecutionContext *scope;
String *name;
String **formalParameterList;
unsigned int formalParameterCount;
String **varList;
unsigned int formalParameterCount;
unsigned int varCount;
bool needsActivation;
bool usesArgumentsObject;
bool strictMode;
FunctionObject(ExecutionContext *scope)
: scope(scope)
, name(0)
, formalParameterList(0)
, formalParameterCount(0)
, varList(0)
, formalParameterCount(0)
, varCount(0)
, needsActivation(false)
, usesArgumentsObject(false)
, strictMode(false) {}
{ needsActivation = false;
usesArgumentsObject = false;
strictMode = false; }
virtual QString className() { return QStringLiteral("Function"); }
virtual FunctionObject *asFunctionObject() { return this; }

View File

@ -61,7 +61,7 @@ private:
void operator = (const Managed &other);
protected:
Managed() : markBit(0), inUse(1), unused(0) { }
Managed() : markBit(0), inUse(1), extensible(true), unused(0) { }
virtual ~Managed();
public:
@ -79,10 +79,14 @@ private:
struct {
quintptr markBit : 1;
quintptr inUse : 1;
quintptr extensible : 1; // used by Object
quintptr needsActivation : 1; // used by FunctionObject
quintptr usesArgumentsObject : 1; // used by FunctionObject
quintptr strictMode : 1; // used by FunctionObject
#if CPU(X86_64)
quintptr unused : 62;
quintptr unused : 58;
#elif CPU(X86)
quintptr unused : 30;
quintptr unused : 26;
#else
#error "implement me"
#endif