diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/RegExpObject.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/RegExpObject.h | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/runtime/RegExpObject.h b/Source/JavaScriptCore/runtime/RegExpObject.h index 1f89b84..fa2024d 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.h +++ b/Source/JavaScriptCore/runtime/RegExpObject.h @@ -28,14 +28,26 @@ namespace JSC { class RegExpObject : public JSObjectWithGlobalObject { public: + typedef JSObjectWithGlobalObject Base; + RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>); virtual ~RegExpObject(); void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; } RegExp* regExp() const { return d->regExp.get(); } - void setLastIndex(double lastIndex) { d->lastIndex = lastIndex; } - double lastIndex() const { return d->lastIndex; } + void setLastIndex(size_t lastIndex) + { + d->lastIndex.setWithoutWriteBarrier(jsNumber(lastIndex)); + } + void setLastIndex(JSGlobalData& globalData, JSValue lastIndex) + { + d->lastIndex.set(globalData, this, lastIndex); + } + JSValue getLastIndex() const + { + return d->lastIndex.get(); + } JSValue test(ExecState*); JSValue exec(ExecState*); @@ -46,28 +58,30 @@ namespace JSC { static JS_EXPORTDATA const ClassInfo s_info; - static PassRefPtr<Structure> createStructure(JSValue prototype) + static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObjectWithGlobalObject::StructureFlags; - + static const unsigned StructureFlags = OverridesMarkChildren | OverridesGetOwnPropertySlot | JSObjectWithGlobalObject::StructureFlags; + private: + virtual void markChildren(MarkStack&); + bool match(ExecState*); struct RegExpObjectData { WTF_MAKE_FAST_ALLOCATED; public: - RegExpObjectData(NonNullPassRefPtr<RegExp> regExp, double lastIndex) + RegExpObjectData(NonNullPassRefPtr<RegExp> regExp) : regExp(regExp) - , lastIndex(lastIndex) { + lastIndex.setWithoutWriteBarrier(jsNumber(0)); } RefPtr<RegExp> regExp; - double lastIndex; + WriteBarrier<Unknown> lastIndex; }; #if COMPILER(MSVC) friend void WTF::deleteOwnedPtr<RegExpObjectData>(RegExpObjectData*); |