X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..14957cd040308e3eeec43d26bae5d76da13fcd85:/runtime/JSStaticScopeObject.h?ds=inline diff --git a/runtime/JSStaticScopeObject.h b/runtime/JSStaticScopeObject.h index e1400b7..b201fe0 100644 --- a/runtime/JSStaticScopeObject.h +++ b/runtime/JSStaticScopeObject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,37 +31,30 @@ namespace JSC{ class JSStaticScopeObject : public JSVariableObject { - protected: - using JSVariableObject::JSVariableObjectData; - struct JSStaticScopeObjectData : public JSVariableObjectData { - JSStaticScopeObjectData() - : JSVariableObjectData(&symbolTable, ®isterStore + 1) - { - } - SymbolTable symbolTable; - Register registerStore; - }; - public: - JSStaticScopeObject(ExecState* exec, const Identifier& ident, JSValuePtr value, unsigned attributes) - : JSVariableObject(exec->globalData().staticScopeStructure, new JSStaticScopeObjectData()) + JSStaticScopeObject(ExecState* exec, const Identifier& ident, JSValue value, unsigned attributes) + : JSVariableObject(exec->globalData(), exec->globalData().staticScopeStructure.get(), &m_symbolTable, reinterpret_cast(&m_registerStore + 1)) { - d()->registerStore = value; - symbolTable().add(ident.ustring().rep(), SymbolTableEntry(-1, attributes)); + m_registerStore.set(exec->globalData(), this, value); + symbolTable().add(ident.impl(), SymbolTableEntry(-1, attributes)); } - virtual ~JSStaticScopeObject(); - virtual void mark(); - bool isDynamicScope() const; + + virtual void visitChildren(SlotVisitor&); + bool isDynamicScope(bool& requiresDynamicChecks) const; virtual JSObject* toThisObject(ExecState*) const; + virtual JSValue toStrictThisObject(ExecState*) const; virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&, bool& slotIsWriteable); - virtual void put(ExecState*, const Identifier&, JSValuePtr, PutPropertySlot&); - void putWithAttributes(ExecState*, const Identifier&, JSValuePtr, unsigned attributes); + virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); + void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes); - static PassRefPtr createStructure(JSValuePtr proto) { return Structure::create(proto, TypeInfo(ObjectType, NeedsThisConversion)); } + static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } + + protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags; private: - JSStaticScopeObjectData* d() { return static_cast(JSVariableObject::d); } + SymbolTable m_symbolTable; + WriteBarrier m_registerStore; }; }