- WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; }
-
- WriteBarrier<Unknown>* const * addressOfRegisters() const { return &m_registers; }
- static size_t offsetOfRegisters() { return OBJECT_OFFSETOF(JSVariableObject, m_registers); }
-
- static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(globalData, globalObject, prototype, TypeInfo(VariableObjectType, StructureFlags), &s_info);
- }
-
- protected:
- static const unsigned StructureFlags = OverridesGetPropertyNames | JSNonFinalObject::StructureFlags;
-
- JSVariableObject(JSGlobalData& globalData, Structure* structure, SymbolTable* symbolTable, Register* registers)
- : JSNonFinalObject(globalData, structure)
- , m_symbolTable(symbolTable)
- , m_registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers))
- {
- }
-
- void finishCreation(JSGlobalData& globalData)
- {
- Base::finishCreation(globalData);
- ASSERT(m_symbolTable);
- COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier);
- }
-
- PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts);
- void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray);
-
- bool symbolTableGet(const Identifier&, PropertySlot&);
- JS_EXPORT_PRIVATE bool symbolTableGet(const Identifier&, PropertyDescriptor&);
- bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
- bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow);
- bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes);
-
- SymbolTable* m_symbolTable; // Maps name -> offset from "r" in register file.
- WriteBarrier<Unknown>* m_registers; // "r" in the register file.
- OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
- };
-
- inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
- {
- SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
- if (!entry.isNull()) {
- slot.setValue(registerAt(entry.getIndex()).get());
- return true;
- }
- return false;
- }
-
- inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot, bool& slotIsWriteable)