Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (127292 => 127293)
--- trunk/Source/_javascript_Core/ChangeLog 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-08-31 18:22:01 UTC (rev 127293)
@@ -1,3 +1,100 @@
+2012-08-31 Geoffrey Garen <[email protected]>
+
+ Shrink activation objects by half
+ https://bugs.webkit.org/show_bug.cgi?id=95591
+
+ Reviewed by Sam Weinig.
+
+ Removed the global object, global data, and global this pointers from
+ JSScope, and changed an int to a bitfield. This gets the JSActivation
+ class down to 64 bytes, which in practice cuts it in half by getting it
+ out of the 128 byte size class.
+
+ Now, it's one extra indirection to get these pointers. These pointers
+ aren't accessed by JIT code, so I thought there would be no cost to the
+ extra indirection. However, some C++-heavy SunSpider tests regressed a
+ bit in an early version of the patch, which added even more indirection.
+ This suggests that calls to exec->globalData() and/or exec->lexicalGlobalObject()
+ are common and probably duplicated in lots of places, and could stand
+ further optimization in C++.
+
+ * dfg/DFGAbstractState.cpp:
+ (JSC::DFG::AbstractState::execute): Test against the specific activation
+ for our global object, since there's no VM-shared activation structure
+ anymore. This is guaranteed to have the same success rate as the old test
+ because activation scope is fixed at compile time.
+
+ * heap/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ * heap/MarkedBlock.h:
+ (JSC::MarkedBlock::globalData):
+ * heap/WeakSet.cpp:
+ (JSC::WeakSet::addAllocator):
+ * heap/WeakSet.h:
+ (WeakSet):
+ (JSC::WeakSet::WeakSet):
+ (JSC::WeakSet::globalData): Store a JSGlobalData* instead of a Heap*
+ because JSGlobalData->Heap is just a constant fold in the addressing
+ mode, while Heap->JSGlobalData is an extra pointer dereference. (These
+ objects should eventually just merge.)
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_global_dynamic): See DFGAbstractState.cpp.
+
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm: Load the activation structure from
+ the code block instead of the global data because the structure is not
+ VM-shared anymore. (See DFGAbstractState.cpp.)
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * runtime/JSActivation.h:
+ (JSActivation): This is the point of the patch: Remove the data.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSGlobalData): No longer VM-shared. (See DFGAbstractState.cpp.)
+
+ (JSC::WeakSet::heap): (See WeakSet.h.)
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ (JSC::JSGlobalObject::setGlobalThis):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ (JSGlobalObject):
+ (JSC::JSGlobalObject::withScopeStructure):
+ (JSC::JSGlobalObject::strictEvalActivationStructure):
+ (JSC::JSGlobalObject::activationStructure):
+ (JSC::JSGlobalObject::nameScopeStructure):
+ (JSC::JSScope::globalThis):
+ (JSC::JSGlobalObject::globalThis): Data that used to be in the JSScope
+ class goes here now, so it's not duplicated across all activations.
+
+ * runtime/JSNameScope.h:
+ (JSC::JSNameScope::JSNameScope):
+ * runtime/JSScope.cpp:
+ (JSC::JSScope::visitChildren): This is the point of the patch: Remove the data.
+
+ * runtime/JSScope.h:
+ (JSScope):
+ (JSC::JSScope::JSScope):
+ (JSC::JSScope::globalObject):
+ (JSC::JSScope::globalData):
+ * runtime/JSSegmentedVariableObject.h:
+ (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
+ * runtime/JSSymbolTableObject.h:
+ (JSC::JSSymbolTableObject::JSSymbolTableObject):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ * runtime/JSWithScope.h:
+ (JSC::JSWithScope::JSWithScope):
+ * runtime/StrictEvalActivation.cpp:
+ (JSC::StrictEvalActivation::StrictEvalActivation): Simplified now that
+ we don't need to pass so much data to JSScope.
+
2012-08-31 Patrick Gansterer <[email protected]>
Build fix for WinCE after r127191.
Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -1171,7 +1171,7 @@
case CreateActivation:
node.setCanExit(false);
- forNode(nodeIndex).set(m_graph.m_globalData.activationStructure.get());
+ forNode(nodeIndex).set(m_codeBlock->globalObjectFor(node.codeOrigin)->activationStructure());
m_haveStructures = true;
break;
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -45,7 +45,7 @@
, m_cellsNeedDestruction(cellsNeedDestruction)
, m_onlyContainsStructures(onlyContainsStructures)
, m_state(New) // All cells start out unmarked.
- , m_weakSet(heap)
+ , m_weakSet(heap->globalData())
{
ASSERT(heap);
HEAP_LOG_BLOCK_STATE_TRANSITION(this);
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.h (127292 => 127293)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -121,6 +121,7 @@
void lastChanceToFinalize();
Heap* heap() const;
+ JSGlobalData* globalData() const;
WeakSet& weakSet();
enum SweepMode { SweepOnly, SweepToFreeList };
@@ -262,6 +263,11 @@
return m_weakSet.heap();
}
+ inline JSGlobalData* MarkedBlock::globalData() const
+ {
+ return m_weakSet.globalData();
+ }
+
inline WeakSet& MarkedBlock::weakSet()
{
return m_weakSet;
Modified: trunk/Source/_javascript_Core/heap/WeakSet.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/heap/WeakSet.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/heap/WeakSet.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -27,6 +27,7 @@
#include "WeakSet.h"
#include "Heap.h"
+#include "JSGlobalData.h"
namespace JSC {
@@ -73,7 +74,7 @@
WeakBlock::FreeCell* WeakSet::addAllocator()
{
WeakBlock* block = WeakBlock::create();
- m_heap->didAllocate(WeakBlock::blockSize);
+ heap()->didAllocate(WeakBlock::blockSize);
m_blocks.append(block);
WeakBlock::SweepResult sweepResult = block->takeSweepResult();
ASSERT(!sweepResult.isNull() && sweepResult.freeList);
Modified: trunk/Source/_javascript_Core/heap/WeakSet.h (127292 => 127293)
--- trunk/Source/_javascript_Core/heap/WeakSet.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/heap/WeakSet.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -38,11 +38,12 @@
static WeakImpl* allocate(JSValue, WeakHandleOwner* = 0, void* context = 0);
static void deallocate(WeakImpl*);
- WeakSet(Heap*);
+ WeakSet(JSGlobalData*);
~WeakSet();
void lastChanceToFinalize();
Heap* heap() const;
+ JSGlobalData* globalData() const;
bool isEmpty() const;
@@ -61,19 +62,19 @@
WeakBlock::FreeCell* m_allocator;
WeakBlock* m_nextAllocator;
DoublyLinkedList<WeakBlock> m_blocks;
- Heap* m_heap;
+ JSGlobalData* m_globalData;
};
-inline WeakSet::WeakSet(Heap* heap)
+inline WeakSet::WeakSet(JSGlobalData* globalData)
: m_allocator(0)
, m_nextAllocator(0)
- , m_heap(heap)
+ , m_globalData(globalData)
{
}
-inline Heap* WeakSet::heap() const
+inline JSGlobalData* WeakSet::globalData() const
{
- return m_heap;
+ return m_globalData;
}
inline bool WeakSet::isEmpty() const
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -1591,12 +1591,12 @@
Jump activationNotCreated;
if (checkTopLevel)
activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
- addSlowCase(checkStructure(regT0, m_globalData->activationStructure.get()));
+ addSlowCase(checkStructure(regT0, m_codeBlock->globalObject()->activationStructure()));
loadPtr(Address(regT0, JSScope::offsetOfNext()), regT0);
activationNotCreated.link(this);
}
while (skip--) {
- addSlowCase(checkStructure(regT0, m_globalData->activationStructure.get()));
+ addSlowCase(checkStructure(regT0, m_codeBlock->globalObject()->activationStructure()));
loadPtr(Address(regT0, JSScope::offsetOfNext()), regT0);
}
emit_op_resolve_global(currentInstruction, true);
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (127292 => 127293)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2012-08-31 18:22:01 UTC (rev 127293)
@@ -1022,8 +1022,9 @@
_llint_op_resolve_global_dynamic:
traceExecution()
- loadp JITStackFrame::globalData[sp], t3
- loadp JSGlobalData::activationStructure[t3], t3
+ loadp CodeBlock[cfr], t3
+ loadp CodeBlock::m_globalObject[t3], t3
+ loadp JSGlobalObject::m_activationStructure[t3], t3
getScope(
20[PC],
macro (scope, scratch)
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (127292 => 127293)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2012-08-31 18:22:01 UTC (rev 127293)
@@ -873,8 +873,9 @@
_llint_op_resolve_global_dynamic:
traceExecution()
- loadp JITStackFrame::globalData[sp], t3
- loadp JSGlobalData::activationStructure[t3], t3
+ loadp CodeBlock[cfr], t3
+ loadp CodeBlock::m_globalObject[t3], t3
+ loadp JSGlobalObject::m_activationStructure[t3], t3
getScope(
40[PB, PC, 8],
macro (scope, scratch)
Modified: trunk/Source/_javascript_Core/runtime/JSActivation.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSActivation.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -44,10 +44,8 @@
JSActivation::JSActivation(CallFrame* callFrame, FunctionExecutable* functionExecutable)
: Base(
callFrame->globalData(),
- callFrame->globalData().activationStructure.get(),
+ callFrame->lexicalGlobalObject()->activationStructure(),
callFrame->registers(),
- callFrame->lexicalGlobalObject(),
- callFrame->globalThisValue(),
callFrame->scope()
)
, m_registerArray(callFrame->globalData(), this, 0)
Modified: trunk/Source/_javascript_Core/runtime/JSActivation.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSActivation.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -96,11 +96,11 @@
size_t registerArraySizeInBytes();
StorageBarrier m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
- int m_numCapturedArgs;
- int m_numCapturedVars : 30;
+ unsigned m_numCapturedArgs;
+ unsigned m_numCapturedVars : 28;
bool m_isTornOff : 1;
bool m_requiresDynamicChecks : 1;
- int m_argumentsRegister;
+ unsigned m_argumentsRegister : 2;
};
JSActivation* asActivation(JSValue);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -188,17 +188,13 @@
IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable);
structureStructure.set(*this, Structure::createStructure(*this));
debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull()));
- activationStructure.set(*this, JSActivation::createStructure(*this, 0, jsNull()));
interruptedExecutionErrorStructure.set(*this, InterruptedExecutionError::createStructure(*this, 0, jsNull()));
terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull()));
- nameScopeStructure.set(*this, JSNameScope::createStructure(*this, 0, jsNull()));
- strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, 0, jsNull()));
stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull()));
notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull()));
propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, 0, jsNull()));
getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull()));
apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, 0, jsNull()));
- JSScopeStructure.set(*this, JSScope::createStructure(*this, 0, jsNull()));
executableStructure.set(*this, ExecutableBase::createStructure(*this, 0, jsNull()));
nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, 0, jsNull()));
evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull()));
@@ -207,7 +203,6 @@
regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull()));
sharedSymbolTableStructure.set(*this, SharedSymbolTable::createStructure(*this, 0, jsNull()));
structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull()));
- withScopeStructure.set(*this, JSWithScope::createStructure(*this, 0, jsNull()));
wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSGlobalData.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -228,17 +228,13 @@
Strong<Structure> structureStructure;
Strong<Structure> debuggerActivationStructure;
- Strong<Structure> activationStructure;
Strong<Structure> interruptedExecutionErrorStructure;
Strong<Structure> terminatedExecutionErrorStructure;
- Strong<Structure> nameScopeStructure;
- Strong<Structure> strictEvalActivationStructure;
Strong<Structure> stringStructure;
Strong<Structure> notAnObjectStructure;
Strong<Structure> propertyNameIteratorStructure;
Strong<Structure> getterSetterStructure;
Strong<Structure> apiWrapperStructure;
- Strong<Structure> JSScopeStructure;
Strong<Structure> executableStructure;
Strong<Structure> nativeExecutableStructure;
Strong<Structure> evalExecutableStructure;
@@ -247,7 +243,6 @@
Strong<Structure> regExpStructure;
Strong<Structure> sharedSymbolTableStructure;
Strong<Structure> structureChainStructure;
- Strong<Structure> withScopeStructure;
IdentifierTable* identifierTable;
CommonIdentifiers* propertyNames;
@@ -474,6 +469,11 @@
}
#endif
+ inline Heap* WeakSet::heap() const
+ {
+ return &m_globalData->heap;
+ }
+
} // namespace JSC
#endif // JSGlobalData_h
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -30,10 +30,6 @@
#include "config.h"
#include "JSGlobalObject.h"
-#include "JSCallbackConstructor.h"
-#include "JSCallbackFunction.h"
-#include "JSCallbackObject.h"
-
#include "Arguments.h"
#include "ArrayConstructor.h"
#include "ArrayPrototype.h"
@@ -42,18 +38,25 @@
#include "CodeBlock.h"
#include "DateConstructor.h"
#include "DatePrototype.h"
+#include "Debugger.h"
#include "Error.h"
#include "ErrorConstructor.h"
#include "ErrorPrototype.h"
#include "FunctionConstructor.h"
#include "FunctionPrototype.h"
#include "GetterSetter.h"
+#include "Interpreter.h"
+#include "JSActivation.h"
#include "JSBoundFunction.h"
+#include "JSCallbackConstructor.h"
+#include "JSCallbackFunction.h"
+#include "JSCallbackObject.h"
#include "JSFunction.h"
#include "JSGlobalObjectFunctions.h"
#include "JSLock.h"
+#include "JSNameScope.h"
#include "JSONObject.h"
-#include "Interpreter.h"
+#include "JSWithScope.h"
#include "Lookup.h"
#include "MathObject.h"
#include "NameConstructor.h"
@@ -70,9 +73,9 @@
#include "RegExpMatchesArray.h"
#include "RegExpObject.h"
#include "RegExpPrototype.h"
+#include "StrictEvalActivation.h"
#include "StringConstructor.h"
#include "StringPrototype.h"
-#include "Debugger.h"
#include "JSGlobalObject.lut.h"
@@ -106,7 +109,7 @@
static const int preferredScriptCheckTimeInterval = 1000;
JSGlobalObject::JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable)
- : Base(globalData, structure, this, this, 0)
+ : Base(globalData, structure, 0)
, m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(InitializedWatching)))
, m_weakRandom(Options::forceWeakRandomSeed() ? Options::forcedWeakRandomSeed() : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
, m_evalEnabled(true)
@@ -128,6 +131,11 @@
static_cast<JSGlobalObject*>(cell)->JSGlobalObject::~JSGlobalObject();
}
+void JSGlobalObject::setGlobalThis(JSGlobalData& globalData, JSObject* globalThis)
+{
+ m_globalThis.set(globalData, this, globalThis);
+}
+
void JSGlobalObject::init(JSObject* thisValue)
{
ASSERT(globalData().apiLock().currentThreadIsHoldingLock());
@@ -208,6 +216,11 @@
m_objectPrototype->putDirectAccessor(exec->globalData(), exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum);
m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get());
+ m_nameScopeStructure.set(exec->globalData(), this, JSNameScope::createStructure(exec->globalData(), this, jsNull()));
+ m_activationStructure.set(exec->globalData(), this, JSActivation::createStructure(exec->globalData(), this, jsNull()));
+ m_strictEvalActivationStructure.set(exec->globalData(), this, StrictEvalActivation::createStructure(exec->globalData(), this, jsNull()));
+ m_withScopeStructure.set(exec->globalData(), this, JSWithScope::createStructure(exec->globalData(), this, jsNull()));
+
m_emptyObjectStructure.set(exec->globalData(), this, m_objectPrototype->inheritorID(exec->globalData()));
m_nullPrototypeObjectStructure.set(exec->globalData(), this, createEmptyObjectStructure(exec->globalData(), this, jsNull()));
@@ -344,6 +357,7 @@
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(thisObject, visitor);
+ visitor.append(&thisObject->m_globalThis);
visitor.append(&thisObject->m_methodCallDummy);
visitor.append(&thisObject->m_regExpConstructor);
@@ -370,6 +384,10 @@
visitor.append(&thisObject->m_regExpPrototype);
visitor.append(&thisObject->m_errorPrototype);
+ visitor.append(&thisObject->m_withScopeStructure);
+ visitor.append(&thisObject->m_strictEvalActivationStructure);
+ visitor.append(&thisObject->m_activationStructure);
+ visitor.append(&thisObject->m_nameScopeStructure);
visitor.append(&thisObject->m_argumentsStructure);
visitor.append(&thisObject->m_arrayStructure);
visitor.append(&thisObject->m_booleanObjectStructure);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -94,6 +94,7 @@
Register m_globalCallFrame[RegisterFile::CallFrameHeaderSize];
+ WriteBarrier<JSObject> m_globalThis;
WriteBarrier<JSObject> m_methodCallDummy;
WriteBarrier<RegExpConstructor> m_regExpConstructor;
@@ -120,6 +121,10 @@
WriteBarrier<RegExpPrototype> m_regExpPrototype;
WriteBarrier<ErrorPrototype> m_errorPrototype;
+ WriteBarrier<Structure> m_withScopeStructure;
+ WriteBarrier<Structure> m_strictEvalActivationStructure;
+ WriteBarrier<Structure> m_activationStructure;
+ WriteBarrier<Structure> m_nameScopeStructure;
WriteBarrier<Structure> m_argumentsStructure;
WriteBarrier<Structure> m_arrayStructure;
WriteBarrier<Structure> m_booleanObjectStructure;
@@ -248,6 +253,10 @@
JSObject* methodCallDummy() const { return m_methodCallDummy.get(); }
+ Structure* withScopeStructure() const { return m_withScopeStructure.get(); }
+ Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); }
+ Structure* activationStructure() const { return m_activationStructure.get(); }
+ Structure* nameScopeStructure() const { return m_nameScopeStructure.get(); }
Structure* argumentsStructure() const { return m_argumentsStructure.get(); }
Structure* arrayStructure() const { return m_arrayStructure.get(); }
Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); }
@@ -301,6 +310,7 @@
void resetPrototype(JSGlobalData&, JSValue prototype);
JSGlobalData& globalData() const { return *Heap::heap(this)->globalData(); }
+ JSObject* globalThis() const;
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
@@ -345,6 +355,7 @@
// FIXME: Fold reset into init.
JS_EXPORT_PRIVATE void init(JSObject* thisValue);
void reset(JSValue prototype);
+ void setGlobalThis(JSGlobalData&, JSObject* globalThis);
void createThrowTypeError(ExecState*);
@@ -485,6 +496,16 @@
return true;
}
+ inline JSObject* JSScope::globalThis()
+ {
+ return globalObject()->globalThis();
+ }
+
+ inline JSObject* JSGlobalObject::globalThis() const
+ {
+ return m_globalThis.get();
+ }
+
} // namespace JSC
#endif // JSGlobalObject_h
Modified: trunk/Source/_javascript_Core/runtime/JSNameScope.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSNameScope.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSNameScope.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -26,6 +26,7 @@
#ifndef JSNameScope_h
#define JSNameScope_h
+#include "JSGlobalObject.h"
#include "JSVariableObject.h"
namespace JSC {
@@ -66,10 +67,8 @@
JSNameScope(ExecState* exec)
: Base(
exec->globalData(),
- exec->globalData().nameScopeStructure.get(),
+ exec->lexicalGlobalObject()->nameScopeStructure(),
reinterpret_cast<Register*>(&m_registerStore + 1),
- exec->lexicalGlobalObject(),
- exec->globalThisValue(),
exec->scope()
)
{
Modified: trunk/Source/_javascript_Core/runtime/JSScope.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSScope.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSScope.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -44,8 +44,6 @@
Base::visitChildren(thisObject, visitor);
visitor.append(&thisObject->m_next);
- visitor.append(&thisObject->m_globalObject);
- visitor.append(&thisObject->m_globalThis);
}
bool JSScope::isDynamicScope(bool& requiresDynamicChecks) const
Modified: trunk/Source/_javascript_Core/runtime/JSScope.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSScope.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSScope.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -73,25 +73,18 @@
JSGlobalObject* globalObject();
JSGlobalData* globalData();
JSObject* globalThis();
- void setGlobalThis(JSGlobalData&, JSObject*);
protected:
- JSScope(JSGlobalData&, Structure*, JSGlobalObject*, JSObject* globalThis, JSScope* next);
+ JSScope(JSGlobalData&, Structure*, JSScope* next);
static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
private:
- JSGlobalData* m_globalData;
WriteBarrier<JSScope> m_next;
- WriteBarrier<JSGlobalObject> m_globalObject;
- WriteBarrier<JSObject> m_globalThis;
};
-inline JSScope::JSScope(JSGlobalData& globalData, Structure* structure, JSGlobalObject* globalObject, JSObject* globalThis, JSScope* next)
+inline JSScope::JSScope(JSGlobalData& globalData, Structure* structure, JSScope* next)
: Base(globalData, structure)
- , m_globalData(&globalData)
, m_next(globalData, this, next, WriteBarrier<JSScope>::MayBeNull)
- , m_globalObject(globalData, this, globalObject)
- , m_globalThis(globalData, this, globalThis)
{
}
@@ -133,24 +126,14 @@
inline JSGlobalObject* JSScope::globalObject()
{
- return m_globalObject.get();
+ return structure()->globalObject();
}
inline JSGlobalData* JSScope::globalData()
{
- return m_globalData;
+ return MarkedBlock::blockFor(this)->globalData();
}
-inline JSObject* JSScope::globalThis()
-{
- return m_globalThis.get();
-}
-
-inline void JSScope::setGlobalThis(JSGlobalData& globalData, JSObject* globalThis)
-{
- m_globalThis.set(globalData, this, globalThis);
-}
-
inline Register& Register::operator=(JSScope* scope)
{
*this = JSValue(scope);
Modified: trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -82,8 +82,8 @@
protected:
static const unsigned StructureFlags = OverridesVisitChildren | JSSymbolTableObject::StructureFlags;
- JSSegmentedVariableObject(JSGlobalData& globalData, Structure* structure, JSGlobalObject* globalObject, JSObject* globalThis, JSScope* scope)
- : JSSymbolTableObject(globalData, structure, globalObject, globalThis, scope)
+ JSSegmentedVariableObject(JSGlobalData& globalData, Structure* structure, JSScope* scope)
+ : JSSymbolTableObject(globalData, structure, scope)
{
}
Modified: trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -49,8 +49,8 @@
protected:
static const unsigned StructureFlags = IsEnvironmentRecord | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
- JSSymbolTableObject(JSGlobalData& globalData, Structure* structure, JSGlobalObject* globalObject, JSObject* globalThis, JSScope* scope)
- : Base(globalData, structure, globalObject, globalThis, scope)
+ JSSymbolTableObject(JSGlobalData& globalData, Structure* structure, JSScope* scope)
+ : Base(globalData, structure, scope)
{
}
Modified: trunk/Source/_javascript_Core/runtime/JSVariableObject.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -60,11 +60,9 @@
JSGlobalData& globalData,
Structure* structure,
Register* registers,
- JSGlobalObject* globalObject,
- JSObject* globalThis,
JSScope* scope
)
- : Base(globalData, structure, globalObject, globalThis, scope)
+ : Base(globalData, structure, scope)
, m_registers(reinterpret_cast<WriteBarrierBase<Unknown>*>(registers))
{
}
Modified: trunk/Source/_javascript_Core/runtime/JSWithScope.h (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/JSWithScope.h 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/JSWithScope.h 2012-08-31 18:22:01 UTC (rev 127293)
@@ -26,7 +26,7 @@
#ifndef JSWithScope_h
#define JSWithScope_h
-#include "JSScope.h"
+#include "JSGlobalObject.h"
namespace JSC {
@@ -66,9 +66,7 @@
JSWithScope(ExecState* exec, JSObject* object)
: Base(
exec->globalData(),
- exec->globalData().withScopeStructure.get(),
- exec->lexicalGlobalObject(),
- exec->globalThisValue(),
+ exec->lexicalGlobalObject()->withScopeStructure(),
exec->scope()
)
, m_object(exec->globalData(), this, object)
@@ -78,9 +76,7 @@
JSWithScope(ExecState* exec, JSObject* object, JSScope* next)
: Base(
exec->globalData(),
- exec->globalData().withScopeStructure.get(),
- exec->lexicalGlobalObject(),
- exec->globalThisValue(),
+ exec->lexicalGlobalObject()->withScopeStructure(),
next
)
, m_object(exec->globalData(), this, object)
Modified: trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp (127292 => 127293)
--- trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp 2012-08-31 18:12:59 UTC (rev 127292)
+++ trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp 2012-08-31 18:22:01 UTC (rev 127293)
@@ -26,6 +26,8 @@
#include "config.h"
#include "StrictEvalActivation.h"
+#include "JSGlobalObject.h"
+
namespace JSC {
ASSERT_HAS_TRIVIAL_DESTRUCTOR(StrictEvalActivation);
@@ -35,9 +37,7 @@
StrictEvalActivation::StrictEvalActivation(ExecState* exec)
: Base(
exec->globalData(),
- exec->globalData().strictEvalActivationStructure.get(),
- exec->lexicalGlobalObject(),
- exec->globalThisValue(),
+ exec->lexicalGlobalObject()->strictEvalActivationStructure(),
exec->scope()
)
{