Commit 95c1bc42 authored by ossy@webkit.org's avatar ossy@webkit.org

Refactoring of the custom allocation framework

https://bugs.webkit.org/show_bug.cgi?id=49897

Patch by Zoltan Horvath <zoltan@webkit.org> on 2011-01-20
Reviewed by Csaba Osztrogonác.

Source/JavaScriptCore:

Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.

* wtf/FastAllocBase.h: Turn FastAllocBase's implementation into a macro.

Source/WebCore:

Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.

Source/WebKit:

Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.

Source/WebKit2:

Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.

Tools:

Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 57fe9f7f
......@@ -34,7 +34,9 @@
#include <runtime/WeakGCPtr.h>
#include <wtf/HashMap.h>
struct StaticValueEntry : FastAllocBase {
struct StaticValueEntry {
WTF_MAKE_FAST_ALLOCATED;
public:
StaticValueEntry(JSObjectGetPropertyCallback _getProperty, JSObjectSetPropertyCallback _setProperty, JSPropertyAttributes _attributes)
: getProperty(_getProperty), setProperty(_setProperty), attributes(_attributes)
{
......@@ -45,7 +47,9 @@ struct StaticValueEntry : FastAllocBase {
JSPropertyAttributes attributes;
};
struct StaticFunctionEntry : FastAllocBase {
struct StaticFunctionEntry {
WTF_MAKE_FAST_ALLOCATED;
public:
StaticFunctionEntry(JSObjectCallAsFunctionCallback _callAsFunction, JSPropertyAttributes _attributes)
: callAsFunction(_callAsFunction), attributes(_attributes)
{
......@@ -62,7 +66,9 @@ struct OpaqueJSClass;
// An OpaqueJSClass (JSClass) is created without a context, so it can be used with any context, even across context groups.
// This structure holds data members that vary across context groups.
struct OpaqueJSClassContextData : Noncopyable {
struct OpaqueJSClassContextData {
WTF_MAKE_NONCOPYABLE(OpaqueJSClassContextData); WTF_MAKE_FAST_ALLOCATED;
public:
OpaqueJSClassContextData(OpaqueJSClass*);
~OpaqueJSClassContextData();
......
......@@ -480,7 +480,9 @@ JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size
return result;
}
struct OpaqueJSPropertyNameArray : FastAllocBase {
struct OpaqueJSPropertyNameArray {
WTF_MAKE_FAST_ALLOCATED;
public:
OpaqueJSPropertyNameArray(JSGlobalData* globalData)
: refCount(0)
, globalData(globalData)
......
2011-01-20 Zoltan Horvath <zoltan@webkit.org>
Reviewed by Csaba Osztrogonác.
Refactoring of the custom allocation framework
https://bugs.webkit.org/show_bug.cgi?id=49897
Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
equivalent macro implementation at the necessary places.
* wtf/FastAllocBase.h: Turn FastAllocBase's implementation into a macro.
2011-01-20 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
......
......@@ -50,7 +50,8 @@ namespace JSC {
// * The address of a Label pointing into the code may be resolved.
// * The value referenced by a DataLabel may be set.
//
class LinkBuffer : public Noncopyable {
class LinkBuffer {
WTF_MAKE_NONCOPYABLE(LinkBuffer);
typedef MacroAssemblerCodeRef CodeRef;
typedef MacroAssemblerCodePtr CodePtr;
typedef MacroAssembler::Label Label;
......
......@@ -242,7 +242,8 @@ namespace JSC {
}
#endif
class CodeBlock : public FastAllocBase {
class CodeBlock {
WTF_MAKE_FAST_ALLOCATED;
friend class JIT;
protected:
CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
......@@ -578,7 +579,9 @@ namespace JSC {
SymbolTable* m_symbolTable;
struct RareData : FastAllocBase {
struct RareData {
WTF_MAKE_FAST_ALLOCATED;
public:
Vector<HandlerInfo> m_exceptionHandlers;
// Rare Constants
......@@ -599,6 +602,9 @@ namespace JSC {
Vector<CallReturnOffsetToBytecodeOffset> m_callReturnIndexVector;
#endif
};
#if PLATFORM(WIN)
friend void WTF::deleteOwnedPtr<RareData>(RareData*);
#endif
OwnPtr<RareData> m_rareData;
};
......
......@@ -54,7 +54,9 @@ namespace JSC {
class StructureChain;
// Structure used by op_get_by_id_self_list and op_get_by_id_proto_list instruction to hold data off the main opcode stream.
struct PolymorphicAccessStructureList : FastAllocBase {
struct PolymorphicAccessStructureList {
WTF_MAKE_FAST_ALLOCATED;
public:
struct PolymorphicStubInfo {
bool isChain;
PolymorphicAccessStructureListStubRoutineType stubRoutine;
......
......@@ -142,7 +142,8 @@ namespace JSC {
friend class HostCallRecord;
#if ENABLE(OPCODE_SAMPLING)
class CallRecord : public Noncopyable {
class CallRecord {
WTF_MAKE_NONCOPYABLE(CallRecord);
public:
CallRecord(SamplingTool* samplingTool)
: m_samplingTool(samplingTool)
......@@ -172,7 +173,8 @@ namespace JSC {
}
};
#else
class CallRecord : public Noncopyable {
class CallRecord {
WTF_MAKE_NONCOPYABLE(CallRecord);
public:
CallRecord(SamplingTool*)
{
......
......@@ -40,7 +40,6 @@
#include "SymbolTable.h"
#include "Debugger.h"
#include "Nodes.h"
#include <wtf/FastAllocBase.h>
#include <wtf/PassRefPtr.h>
#include <wtf/SegmentedVector.h>
#include <wtf/Vector.h>
......@@ -85,7 +84,8 @@ namespace JSC {
RefPtr<RegisterID> propertyRegister;
};
class BytecodeGenerator : public FastAllocBase {
class BytecodeGenerator {
WTF_MAKE_FAST_ALLOCATED;
public:
typedef DeclarationStacks::VarStack VarStack;
typedef DeclarationStacks::FunctionStack FunctionStack;
......
......@@ -30,12 +30,12 @@
#define RegisterID_h
#include <wtf/Assertions.h>
#include <wtf/Noncopyable.h>
#include <wtf/VectorTraits.h>
namespace JSC {
class RegisterID : public Noncopyable {
class RegisterID {
WTF_MAKE_NONCOPYABLE(RegisterID);
public:
RegisterID()
: m_refCount(0)
......
......@@ -32,7 +32,8 @@
#include "Interpreter.h"
namespace JSC {
class CachedCall : public Noncopyable {
class CachedCall {
WTF_MAKE_NONCOPYABLE(CachedCall); WTF_MAKE_FAST_ALLOCATED;
public:
CachedCall(CallFrame* callFrame, JSFunction* function, int argCount)
: m_valid(false)
......
......@@ -30,7 +30,6 @@
#define Interpreter_h
#include "ArgList.h"
#include "FastAllocBase.h"
#include "JSCell.h"
#include "JSValue.h"
#include "JSObject.h"
......@@ -65,7 +64,8 @@ namespace JSC {
enum { MaxLargeThreadReentryDepth = 256, MaxSmallThreadReentryDepth = 32 };
class Interpreter : public FastAllocBase {
class Interpreter {
WTF_MAKE_FAST_ALLOCATED;
friend class JIT;
friend class CachedCall;
public:
......
......@@ -31,7 +31,6 @@
#include "JSValue.h"
#include <wtf/Assertions.h>
#include <wtf/FastAllocBase.h>
#include <wtf/VectorTraits.h>
namespace JSC {
......@@ -47,7 +46,8 @@ namespace JSC {
typedef ExecState CallFrame;
class Register : public WTF::FastAllocBase {
class Register {
WTF_MAKE_FAST_ALLOCATED;
public:
Register();
......
......@@ -89,7 +89,8 @@ namespace JSC {
class JSGlobalObject;
class RegisterFile : public Noncopyable {
class RegisterFile {
WTF_MAKE_NONCOPYABLE(RegisterFile);
friend class JIT;
public:
enum CallFrameHeaderEntry {
......
......@@ -37,7 +37,8 @@ namespace JSC {
class RegExp;
class Lexer : public Noncopyable {
class Lexer {
WTF_MAKE_NONCOPYABLE(Lexer); WTF_MAKE_FAST_ALLOCATED;
public:
// Character manipulation functions.
static bool isWhiteSpace(int character);
......
......@@ -1376,7 +1376,9 @@ namespace JSC {
ParameterNode* m_next;
};
struct ScopeNodeData : FastAllocBase {
struct ScopeNodeData {
WTF_MAKE_FAST_ALLOCATED;
public:
typedef DeclarationStacks::VarStack VarStack;
typedef DeclarationStacks::FunctionStack FunctionStack;
......@@ -1472,6 +1474,7 @@ namespace JSC {
};
class FunctionParameters : public Vector<Identifier>, public RefCounted<FunctionParameters> {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<FunctionParameters> create(ParameterNode* firstParameter) { return adoptRef(new FunctionParameters(firstParameter)); }
......
......@@ -45,8 +45,10 @@ namespace JSC {
template <typename T> struct ParserArenaData : ParserArenaDeletable { T data; };
class Parser : public Noncopyable {
class Parser {
WTF_MAKE_NONCOPYABLE(Parser); WTF_MAKE_FAST_ALLOCATED;
public:
Parser() { }
template <class ParsedNode>
PassRefPtr<ParsedNode> parse(JSGlobalObject* lexicalGlobalObject, Debugger*, ExecState*, const SourceCode& source, FunctionParameters*, JSParserStrictness strictness, JSObject** exception);
......
......@@ -34,7 +34,8 @@ namespace JSC {
class ParserArenaDeletable;
class ParserArenaRefCounted;
class IdentifierArena : public FastAllocBase {
class IdentifierArena {
WTF_MAKE_FAST_ALLOCATED;
public:
ALWAYS_INLINE const Identifier& makeIdentifier(JSGlobalData*, const UChar* characters, size_t length);
const Identifier& makeNumericIdentifier(JSGlobalData*, double number);
......@@ -59,7 +60,8 @@ namespace JSC {
return m_identifiers.last();
}
class ParserArena : Noncopyable {
class ParserArena {
WTF_MAKE_NONCOPYABLE(ParserArena);
public:
ParserArena();
~ParserArena();
......
......@@ -112,7 +112,9 @@ struct BracketChainNode {
const UChar* bracketStart;
};
struct MatchFrame : FastAllocBase {
struct MatchFrame {
WTF_MAKE_FAST_ALLOCATED;
public:
ReturnLocation returnLocation;
struct MatchFrame* previousFrame;
......
......@@ -28,13 +28,14 @@
#define CallIdentifier_h
#include <runtime/UString.h>
#include "FastAllocBase.h"
#include <wtf/text/CString.h>
#include <wtf/text/StringHash.h>
namespace JSC {
struct CallIdentifier : public FastAllocBase {
struct CallIdentifier {
WTF_MAKE_FAST_ALLOCATED;
public:
UString m_name;
UString m_url;
unsigned m_lineNumber;
......
......@@ -44,7 +44,8 @@ namespace JSC {
class UString;
struct CallIdentifier;
class Profiler : public FastAllocBase {
class Profiler {
WTF_MAKE_FAST_ALLOCATED;
public:
static Profiler** enabledProfilerReference()
{
......
......@@ -25,14 +25,14 @@
#include "CallFrame.h"
#include "Register.h"
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
namespace JSC {
class MarkStack;
class MarkedArgumentBuffer : public Noncopyable {
class MarkedArgumentBuffer {
WTF_MAKE_NONCOPYABLE(MarkedArgumentBuffer);
private:
static const unsigned inlineCapacity = 8;
typedef Vector<Register, inlineCapacity> VectorType;
......
......@@ -33,7 +33,10 @@
namespace JSC {
struct ArgumentsData : Noncopyable {
struct ArgumentsData {
WTF_MAKE_NONCOPYABLE(ArgumentsData); WTF_MAKE_FAST_ALLOCATED;
public:
ArgumentsData() { }
JSActivation* activation;
unsigned numParameters;
......
......@@ -27,12 +27,12 @@
#ifndef BatchedTransitionOptimizer_h
#define BatchedTransitionOptimizer_h
#include <wtf/Noncopyable.h>
#include "JSObject.h"
namespace JSC {
class BatchedTransitionOptimizer : public Noncopyable {
class BatchedTransitionOptimizer {
WTF_MAKE_NONCOPYABLE(BatchedTransitionOptimizer);
public:
BatchedTransitionOptimizer(JSObject* object)
: m_object(object)
......
......@@ -84,7 +84,8 @@
namespace JSC {
class CommonIdentifiers : public Noncopyable {
class CommonIdentifiers {
WTF_MAKE_NONCOPYABLE(CommonIdentifiers); WTF_MAKE_FAST_ALLOCATED;
private:
CommonIdentifiers(JSGlobalData*);
friend class JSGlobalData;
......
......@@ -45,7 +45,8 @@ namespace JSC {
enum OperationInProgress { NoOperation, Allocation, Collection };
class Heap : public Noncopyable {
class Heap {
WTF_MAKE_NONCOPYABLE(Heap);
public:
void destroy();
......
......@@ -465,7 +465,8 @@ namespace JSC {
return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
}
class DynamicGlobalObjectScope : public Noncopyable {
class DynamicGlobalObjectScope {
WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);
public:
DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject);
......
......@@ -53,7 +53,8 @@ namespace JSC {
enum JSLockBehavior { SilenceAssertionsOnly, LockForReal };
class JSLock : public Noncopyable {
class JSLock {
WTF_MAKE_NONCOPYABLE(JSLock);
public:
JSLock(ExecState*);
JSLock(JSGlobalData*);
......@@ -89,7 +90,8 @@ namespace JSC {
JSLockBehavior m_lockBehavior;
class DropAllLocks : public Noncopyable {
class DropAllLocks {
WTF_MAKE_NONCOPYABLE(DropAllLocks);
public:
DropAllLocks(ExecState* exec);
DropAllLocks(JSLockBehavior);
......
......@@ -70,7 +70,8 @@ private:
mutable JSValue m_value;
};
class Stringifier : public Noncopyable {
class Stringifier {
WTF_MAKE_NONCOPYABLE(Stringifier);
public:
Stringifier(ExecState*, JSValue replacer, JSValue space);
~Stringifier();
......
......@@ -53,7 +53,8 @@ namespace JSC {
typedef PropertySlot::GetValueFunc GetFunction;
typedef void (*PutFunction)(ExecState*, JSObject* baseObject, JSValue value);
class HashEntry : public FastAllocBase {
class HashEntry {
WTF_MAKE_FAST_ALLOCATED;
public:
void initialize(StringImpl* key, unsigned char attributes, intptr_t v1, intptr_t v2
#if ENABLE(JIT)
......
......@@ -34,7 +34,8 @@ namespace JSC {
class Heap;
class MarkStack;
class MachineStackMarker : public Noncopyable {
class MachineStackMarker {
WTF_MAKE_NONCOPYABLE(MachineStackMarker);
public:
MachineStackMarker(Heap*);
~MachineStackMarker();
......
......@@ -37,7 +37,8 @@ namespace JSC {
enum MarkSetProperties { MayContainNullValues, NoNullValues };
class MarkStack : Noncopyable {
class MarkStack {
WTF_MAKE_NONCOPYABLE(MarkStack);
public:
MarkStack(void* jsArrayVPtr)
: m_jsArrayVPtr(jsArrayVPtr)
......
......@@ -63,7 +63,8 @@ namespace JSC {
}
};
class MarkedSpace : public Noncopyable {
class MarkedSpace {
WTF_MAKE_NONCOPYABLE(MarkedSpace);
public:
MarkedSpace(JSGlobalData*);
void destroy(ProtectCountSet&);
......