- if (LIKELY(m_lastIndexIsWritable))
- m_lastIndex.setWithoutWriteBarrier(jsNumber(lastIndex));
- else
- throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
- }
- void setLastIndex(ExecState* exec, JSValue lastIndex, bool shouldThrow)
- {
- if (LIKELY(m_lastIndexIsWritable))
- m_lastIndex.set(exec->globalData(), this, lastIndex);
- else if (shouldThrow)
- throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
- }
- JSValue getLastIndex() const
- {
- return m_lastIndex.get();
- }
-
- bool test(ExecState* exec, JSString* string) { return match(exec, string); }
- JSValue exec(ExecState*, JSString*);
-
- static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
- static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
- static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
-
- static JS_EXPORTDATA const ClassInfo s_info;
-
- static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
- }
-
- protected:
- JS_EXPORT_PRIVATE RegExpObject(JSGlobalObject*, Structure*, RegExp*);
- JS_EXPORT_PRIVATE void finishCreation(JSGlobalObject*);
-
- static const unsigned StructureFlags = OverridesVisitChildren | OverridesGetOwnPropertySlot | Base::StructureFlags;
-
- static void visitChildren(JSCell*, SlotVisitor&);
-
- JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
- JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- JS_EXPORT_PRIVATE static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow);
-
- private:
- MatchResult match(ExecState*, JSString*);
-
- WriteBarrier<RegExp> m_regExp;
- WriteBarrier<Unknown> m_lastIndex;
- bool m_lastIndexIsWritable;
- };
-
- RegExpObject* asRegExpObject(JSValue);
-
- inline RegExpObject* asRegExpObject(JSValue value)
+ else
+ throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+ }
+ void setLastIndex(ExecState* exec, JSValue lastIndex, bool shouldThrow)
+ {
+ if (LIKELY(m_lastIndexIsWritable))
+ m_lastIndex.set(exec->vm(), this, lastIndex);
+ else if (shouldThrow)
+ throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+ }
+ JSValue getLastIndex() const
+ {
+ return m_lastIndex.get();
+ }
+
+ bool test(ExecState* exec, JSString* string) { return match(exec, string); }
+ JSValue exec(ExecState*, JSString*);
+
+ static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+ static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+
+ DECLARE_EXPORT_INFO;
+
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)