summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/runtime/JSVariableObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSVariableObject.h')
-rw-r--r--Source/JavaScriptCore/runtime/JSVariableObject.h44
1 files changed, 23 insertions, 21 deletions
diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h
index 96a0ec4..e94d277 100644
--- a/Source/JavaScriptCore/runtime/JSVariableObject.h
+++ b/Source/JavaScriptCore/runtime/JSVariableObject.h
@@ -40,7 +40,7 @@ namespace JSC {
class Register;
- class JSVariableObject : public JSObject {
+ class JSVariableObject : public JSNonFinalObject {
friend class JIT;
public:
@@ -54,11 +54,11 @@ namespace JSC {
virtual bool isVariableObject() const;
virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0;
- Register& registerAt(int index) const { return d->registers[index]; }
+ WriteBarrier<Unknown>& registerAt(int index) const { return d->registers[index]; }
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
@@ -69,14 +69,14 @@ namespace JSC {
struct JSVariableObjectData {
JSVariableObjectData(SymbolTable* symbolTable, Register* registers)
: symbolTable(symbolTable)
- , registers(registers)
+ , registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers))
{
ASSERT(symbolTable);
}
SymbolTable* symbolTable; // Maps name -> offset from "r" in register file.
- Register* registers; // "r" in the register file.
- OwnArrayPtr<Register> registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
+ WriteBarrier<Unknown>* registers; // "r" in the register file.
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
private:
JSVariableObjectData(const JSVariableObjectData&);
@@ -84,19 +84,20 @@ namespace JSC {
};
JSVariableObject(NonNullPassRefPtr<Structure> structure, JSVariableObjectData* data)
- : JSObject(structure)
+ : JSNonFinalObject(structure)
, d(data) // Subclass owns this pointer.
{
+ COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier);
}
- PassOwnArrayPtr<Register> copyRegisterArray(Register* src, size_t count);
- void setRegisters(Register* registers, PassOwnArrayPtr<Register> registerArray);
+ PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count);
+ void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray);
bool symbolTableGet(const Identifier&, PropertySlot&);
bool symbolTableGet(const Identifier&, PropertyDescriptor&);
bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
- bool symbolTablePut(const Identifier&, JSValue);
- bool symbolTablePutWithAttributes(const Identifier&, JSValue, unsigned attributes);
+ bool symbolTablePut(JSGlobalData&, const Identifier&, JSValue);
+ bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes);
JSVariableObjectData* d;
};
@@ -105,7 +106,7 @@ namespace JSC {
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (!entry.isNull()) {
- slot.setRegisterSlot(&registerAt(entry.getIndex()));
+ slot.setValue(registerAt(entry.getIndex()).get());
return true;
}
return false;
@@ -115,14 +116,14 @@ namespace JSC {
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (!entry.isNull()) {
- slot.setRegisterSlot(&registerAt(entry.getIndex()));
+ slot.setValue(registerAt(entry.getIndex()).get());
slotIsWriteable = !entry.isReadOnly();
return true;
}
return false;
}
- inline bool JSVariableObject::symbolTablePut(const Identifier& propertyName, JSValue value)
+ inline bool JSVariableObject::symbolTablePut(JSGlobalData& globalData, const Identifier& propertyName, JSValue value)
{
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
@@ -131,11 +132,11 @@ namespace JSC {
return false;
if (entry.isReadOnly())
return true;
- registerAt(entry.getIndex()) = value;
+ registerAt(entry.getIndex()).set(globalData, this, value);
return true;
}
- inline bool JSVariableObject::symbolTablePutWithAttributes(const Identifier& propertyName, JSValue value, unsigned attributes)
+ inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
{
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
@@ -145,19 +146,20 @@ namespace JSC {
SymbolTableEntry& entry = iter->second;
ASSERT(!entry.isNull());
entry.setAttributes(attributes);
- registerAt(entry.getIndex()) = value;
+ registerAt(entry.getIndex()).set(globalData, this, value);
return true;
}
- inline PassOwnArrayPtr<Register> JSVariableObject::copyRegisterArray(Register* src, size_t count)
+ inline PassOwnArrayPtr<WriteBarrier<Unknown> > JSVariableObject::copyRegisterArray(JSGlobalData& globalData, WriteBarrier<Unknown>* src, size_t count)
{
- OwnArrayPtr<Register> registerArray = adoptArrayPtr(new Register[count]);
- memcpy(registerArray.get(), src, count * sizeof(Register));
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[count]);
+ for (size_t i = 0; i < count; i++)
+ registerArray[i].set(globalData, this, src[i].get());
return registerArray.release();
}
- inline void JSVariableObject::setRegisters(Register* registers, PassOwnArrayPtr<Register> registerArray)
+ inline void JSVariableObject::setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray)
{
ASSERT(registerArray != d->registerArray);
d->registerArray = registerArray;