summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp')
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp96
1 files changed, 46 insertions, 50 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp
index 55286d38cd..60eb1b4d3a 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -80,16 +80,16 @@ static const int initialTickCountThreshold = 255;
// Preferred number of milliseconds between each timeout check
static const int preferredScriptCheckTimeInterval = 1000;
-static inline void markIfNeeded(JSValue v)
+static inline void markIfNeeded(MarkStack& markStack, JSValue v)
{
- if (v && !v.marked())
- v.mark();
+ if (v)
+ markStack.append(v);
}
-static inline void markIfNeeded(const RefPtr<Structure>& s)
+static inline void markIfNeeded(MarkStack& markStack, const RefPtr<Structure>& s)
{
if (s)
- s->mark();
+ s->markAggregate(markStack);
}
JSGlobalObject::~JSGlobalObject()
@@ -112,8 +112,8 @@ JSGlobalObject::~JSGlobalObject()
if (headObject == this)
headObject = 0;
- HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
(*it)->clearGlobalObject();
RegisterFile& registerFile = globalData()->interpreter->registerFile();
@@ -175,18 +175,18 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper
}
}
-void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
+void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
{
PropertySlot slot;
if (!symbolTableGet(propertyName, slot))
- JSVariableObject::defineGetter(exec, propertyName, getterFunc);
+ JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes);
}
-void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
+void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
{
PropertySlot slot;
if (!symbolTableGet(propertyName, slot))
- JSVariableObject::defineSetter(exec, propertyName, setterFunc);
+ JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes);
}
static inline JSObject* lastInPrototypeChain(JSObject* object)
@@ -256,9 +256,9 @@ void JSGlobalObject::reset(JSValue prototype)
// Constructors
- JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype);
+ JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
- JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype);
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
JSCell* stringConstructor = new (exec) StringConstructor(exec, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
JSCell* numberConstructor = new (exec) NumberConstructor(exec, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
@@ -359,43 +359,43 @@ void JSGlobalObject::resetPrototype(JSValue prototype)
oldLastInPrototypeChain->setPrototype(objectPrototype);
}
-void JSGlobalObject::mark()
+void JSGlobalObject::markChildren(MarkStack& markStack)
{
- JSVariableObject::mark();
+ JSVariableObject::markChildren(markStack);
- HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
- for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
- (*it)->mark();
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ (*it)->markAggregate(markStack);
RegisterFile& registerFile = globalData()->interpreter->registerFile();
if (registerFile.globalObject() == this)
- registerFile.markGlobals(&globalData()->heap);
-
- markIfNeeded(d()->regExpConstructor);
- markIfNeeded(d()->errorConstructor);
- markIfNeeded(d()->evalErrorConstructor);
- markIfNeeded(d()->rangeErrorConstructor);
- markIfNeeded(d()->referenceErrorConstructor);
- markIfNeeded(d()->syntaxErrorConstructor);
- markIfNeeded(d()->typeErrorConstructor);
- markIfNeeded(d()->URIErrorConstructor);
-
- markIfNeeded(d()->evalFunction);
- markIfNeeded(d()->callFunction);
- markIfNeeded(d()->applyFunction);
-
- markIfNeeded(d()->objectPrototype);
- markIfNeeded(d()->functionPrototype);
- markIfNeeded(d()->arrayPrototype);
- markIfNeeded(d()->booleanPrototype);
- markIfNeeded(d()->stringPrototype);
- markIfNeeded(d()->numberPrototype);
- markIfNeeded(d()->datePrototype);
- markIfNeeded(d()->regExpPrototype);
-
- markIfNeeded(d()->methodCallDummy);
-
- markIfNeeded(d()->errorStructure);
+ registerFile.markGlobals(markStack, &globalData()->heap);
+
+ markIfNeeded(markStack, d()->regExpConstructor);
+ markIfNeeded(markStack, d()->errorConstructor);
+ markIfNeeded(markStack, d()->evalErrorConstructor);
+ markIfNeeded(markStack, d()->rangeErrorConstructor);
+ markIfNeeded(markStack, d()->referenceErrorConstructor);
+ markIfNeeded(markStack, d()->syntaxErrorConstructor);
+ markIfNeeded(markStack, d()->typeErrorConstructor);
+ markIfNeeded(markStack, d()->URIErrorConstructor);
+
+ markIfNeeded(markStack, d()->evalFunction);
+ markIfNeeded(markStack, d()->callFunction);
+ markIfNeeded(markStack, d()->applyFunction);
+
+ markIfNeeded(markStack, d()->objectPrototype);
+ markIfNeeded(markStack, d()->functionPrototype);
+ markIfNeeded(markStack, d()->arrayPrototype);
+ markIfNeeded(markStack, d()->booleanPrototype);
+ markIfNeeded(markStack, d()->stringPrototype);
+ markIfNeeded(markStack, d()->numberPrototype);
+ markIfNeeded(markStack, d()->datePrototype);
+ markIfNeeded(markStack, d()->regExpPrototype);
+
+ markIfNeeded(markStack, d()->methodCallDummy);
+
+ markIfNeeded(markStack, d()->errorStructure);
// No need to mark the other structures, because their prototypes are all
// guaranteed to be referenced elsewhere.
@@ -405,11 +405,7 @@ void JSGlobalObject::mark()
return;
size_t size = d()->registerArraySize;
- for (size_t i = 0; i < size; ++i) {
- Register& r = registerArray[i];
- if (!r.marked())
- r.mark();
- }
+ markStack.appendValues(reinterpret_cast<JSValue*>(registerArray), size);
}
ExecState* JSGlobalObject::globalExec()