X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..14957cd040308e3eeec43d26bae5d76da13fcd85:/runtime/JSByteArray.h?ds=inline diff --git a/runtime/JSByteArray.h b/runtime/JSByteArray.h index 5b7adcf..c481bb4 100644 --- a/runtime/JSByteArray.h +++ b/runtime/JSByteArray.h @@ -32,14 +32,16 @@ namespace JSC { - class JSByteArray : public JSObject { + class JSByteArray : public JSNonFinalObject { friend class JSGlobalData; public: + typedef JSNonFinalObject Base; + bool canAccessIndex(unsigned i) { return i < m_storage->length(); } - JSValue getIndex(ExecState* exec, unsigned i) + JSValue getIndex(ExecState*, unsigned i) { ASSERT(canAccessIndex(i)); - return jsNumber(exec, m_storage->data()[i]); + return jsNumber(m_storage->data()[i]); } void setIndex(unsigned i, int value) @@ -73,9 +75,9 @@ namespace JSC { setIndex(i, byteValue); } - JSByteArray(ExecState* exec, NonNullPassRefPtr, WTF::ByteArray* storage, const JSC::ClassInfo* = &s_defaultInfo); - static PassRefPtr createStructure(JSValue prototype); - + JSByteArray(ExecState*, Structure*, WTF::ByteArray* storage); + static Structure* createStructure(JSGlobalData&, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); @@ -84,7 +86,6 @@ namespace JSC { virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); - virtual const ClassInfo* classInfo() const { return m_classInfo; } static const ClassInfo s_defaultInfo; size_t length() const { return m_storage->length(); } @@ -99,21 +100,18 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags; private: - enum VPtrStealingHackType { VPtrStealingHack }; - JSByteArray(VPtrStealingHackType) - : JSObject(createStructure(jsNull())) - , m_classInfo(0) + JSByteArray(VPtrStealingHackType) + : JSNonFinalObject(VPtrStealingHack) { } RefPtr m_storage; - const ClassInfo* m_classInfo; }; JSByteArray* asByteArray(JSValue value); inline JSByteArray* asByteArray(JSValue value) { - return static_cast(asCell(value)); + return static_cast(value.asCell()); } inline bool isJSByteArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsByteArrayVPtr; }