Fixed indentations and some style warnings in JavaScriptCore/runtime.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 19:10:36 +0000 (19:10 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 19:10:36 +0000 (19:10 +0000)
<https://webkit.org/b/136518>

Reviewed by Michael Saboff.

Also removed some superflous spaces.  There are no semantic changes.

* runtime/Completion.h:
* runtime/ConstructData.h:
* runtime/DateConstructor.h:
* runtime/DateInstance.h:
* runtime/DateInstanceCache.h:
* runtime/DatePrototype.h:
* runtime/Error.h:
* runtime/ErrorConstructor.h:
* runtime/ErrorInstance.h:
* runtime/ErrorPrototype.h:
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.h:
* runtime/GetterSetter.h:
* runtime/Identifier.h:
* runtime/InitializeThreading.h:
* runtime/InternalFunction.h:
* runtime/JSAPIValueWrapper.h:
* runtime/JSFunction.h:
* runtime/JSLock.h:
* runtime/JSNotAnObject.h:
* runtime/JSONObject.h:
* runtime/JSString.h:
* runtime/JSTypeInfo.h:
* runtime/JSWrapperObject.h:
* runtime/Lookup.h:
* runtime/MathObject.h:
* runtime/NativeErrorConstructor.h:
* runtime/NativeErrorPrototype.h:
* runtime/NumberConstructor.h:
* runtime/NumberObject.h:
* runtime/NumberPrototype.h:
* runtime/NumericStrings.h:
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.h:
* runtime/PropertyDescriptor.h:
* runtime/Protect.h:
* runtime/PutPropertySlot.h:
* runtime/RegExp.h:
* runtime/RegExpCachedResult.h:
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
* runtime/RegExpObject.h:
* runtime/RegExpPrototype.h:
* runtime/SmallStrings.h:
* runtime/StringConstructor.h:
* runtime/StringObject.h:
* runtime/StringPrototype.h:
* runtime/StructureChain.h:
* runtime/VM.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

50 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/Completion.h
Source/JavaScriptCore/runtime/ConstructData.h
Source/JavaScriptCore/runtime/DateConstructor.h
Source/JavaScriptCore/runtime/DateInstance.h
Source/JavaScriptCore/runtime/DateInstanceCache.h
Source/JavaScriptCore/runtime/DatePrototype.h
Source/JavaScriptCore/runtime/Error.h
Source/JavaScriptCore/runtime/ErrorConstructor.h
Source/JavaScriptCore/runtime/ErrorInstance.h
Source/JavaScriptCore/runtime/ErrorPrototype.h
Source/JavaScriptCore/runtime/FunctionConstructor.h
Source/JavaScriptCore/runtime/FunctionPrototype.h
Source/JavaScriptCore/runtime/GetterSetter.h
Source/JavaScriptCore/runtime/Identifier.h
Source/JavaScriptCore/runtime/InitializeThreading.h
Source/JavaScriptCore/runtime/InternalFunction.h
Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
Source/JavaScriptCore/runtime/JSFunction.h
Source/JavaScriptCore/runtime/JSLock.h
Source/JavaScriptCore/runtime/JSNotAnObject.h
Source/JavaScriptCore/runtime/JSONObject.h
Source/JavaScriptCore/runtime/JSString.h
Source/JavaScriptCore/runtime/JSTypeInfo.h
Source/JavaScriptCore/runtime/JSWrapperObject.h
Source/JavaScriptCore/runtime/Lookup.h
Source/JavaScriptCore/runtime/MathObject.h
Source/JavaScriptCore/runtime/NativeErrorConstructor.h
Source/JavaScriptCore/runtime/NativeErrorPrototype.h
Source/JavaScriptCore/runtime/NumberConstructor.h
Source/JavaScriptCore/runtime/NumberObject.h
Source/JavaScriptCore/runtime/NumberPrototype.h
Source/JavaScriptCore/runtime/NumericStrings.h
Source/JavaScriptCore/runtime/ObjectConstructor.h
Source/JavaScriptCore/runtime/ObjectPrototype.h
Source/JavaScriptCore/runtime/PropertyDescriptor.h
Source/JavaScriptCore/runtime/Protect.h
Source/JavaScriptCore/runtime/PutPropertySlot.h
Source/JavaScriptCore/runtime/RegExp.h
Source/JavaScriptCore/runtime/RegExpCachedResult.h
Source/JavaScriptCore/runtime/RegExpConstructor.h
Source/JavaScriptCore/runtime/RegExpMatchesArray.h
Source/JavaScriptCore/runtime/RegExpObject.h
Source/JavaScriptCore/runtime/RegExpPrototype.h
Source/JavaScriptCore/runtime/SmallStrings.h
Source/JavaScriptCore/runtime/StringConstructor.h
Source/JavaScriptCore/runtime/StringObject.h
Source/JavaScriptCore/runtime/StringPrototype.h
Source/JavaScriptCore/runtime/StructureChain.h
Source/JavaScriptCore/runtime/VM.h

index dd7710e..e2e508b 100644 (file)
@@ -1,3 +1,62 @@
+2014-09-04  Mark Lam  <mark.lam@apple.com>
+
+        Fixed indentations and some style warnings in JavaScriptCore/runtime.
+        <https://webkit.org/b/136518>
+
+        Reviewed by Michael Saboff.
+
+        Also removed some superflous spaces.  There are no semantic changes.
+
+        * runtime/Completion.h:
+        * runtime/ConstructData.h:
+        * runtime/DateConstructor.h:
+        * runtime/DateInstance.h:
+        * runtime/DateInstanceCache.h:
+        * runtime/DatePrototype.h:
+        * runtime/Error.h:
+        * runtime/ErrorConstructor.h:
+        * runtime/ErrorInstance.h:
+        * runtime/ErrorPrototype.h:
+        * runtime/FunctionConstructor.h:
+        * runtime/FunctionPrototype.h:
+        * runtime/GetterSetter.h:
+        * runtime/Identifier.h:
+        * runtime/InitializeThreading.h:
+        * runtime/InternalFunction.h:
+        * runtime/JSAPIValueWrapper.h:
+        * runtime/JSFunction.h:
+        * runtime/JSLock.h:
+        * runtime/JSNotAnObject.h:
+        * runtime/JSONObject.h:
+        * runtime/JSString.h:
+        * runtime/JSTypeInfo.h:
+        * runtime/JSWrapperObject.h:
+        * runtime/Lookup.h:
+        * runtime/MathObject.h:
+        * runtime/NativeErrorConstructor.h:
+        * runtime/NativeErrorPrototype.h:
+        * runtime/NumberConstructor.h:
+        * runtime/NumberObject.h:
+        * runtime/NumberPrototype.h:
+        * runtime/NumericStrings.h:
+        * runtime/ObjectConstructor.h:
+        * runtime/ObjectPrototype.h:
+        * runtime/PropertyDescriptor.h:
+        * runtime/Protect.h:
+        * runtime/PutPropertySlot.h:
+        * runtime/RegExp.h:
+        * runtime/RegExpCachedResult.h:
+        * runtime/RegExpConstructor.h:
+        * runtime/RegExpMatchesArray.h:
+        * runtime/RegExpObject.h:
+        * runtime/RegExpPrototype.h:
+        * runtime/SmallStrings.h:
+        * runtime/StringConstructor.h:
+        * runtime/StringObject.h:
+        * runtime/StringPrototype.h:
+        * runtime/StructureChain.h:
+        * runtime/VM.h:
+
 2014-09-04  Eva Balazsfalvi  <evab.u-szeged@partner.samsung.com>
 
         Remove CSS_FILTERS flag
index 78f8ac7..33c7b9d 100644 (file)
 
 namespace JSC {
     
-    struct ParserError;
-    class ExecState;
-    class JSScope;
-    class SourceCode;
-    class VM;
+struct ParserError;
+class ExecState;
+class JSScope;
+class SourceCode;
+class VM;
 
-    JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&);
-    JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0);
-    JS_EXPORT_PRIVATE JSValue evaluate(ExecState*, const SourceCode&, JSValue thisValue = JSValue(), JSValue* exception = 0);
+JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&);
+JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0);
+JS_EXPORT_PRIVATE JSValue evaluate(ExecState*, const SourceCode&, JSValue thisValue = JSValue(), JSValue* exception = 0);
 
 } // namespace JSC
 
index 91b1e20..8d4ed8f 100644 (file)
 
 namespace JSC {
 
-    class ArgList;
-    class ExecState;
-    class FunctionExecutable;
-    class JSObject;
-    class JSScope;
-
-    enum ConstructType {
-        ConstructTypeNone,
-        ConstructTypeHost,
-        ConstructTypeJS
-    };
-
-    union ConstructData {
-        struct {
-            NativeFunction function;
-        } native;
-        struct {
-            FunctionExecutable* functionExecutable;
-            JSScope* scope;
-        } js;
-    };
-
-    JS_EXPORT_PRIVATE JSObject* construct(ExecState*, JSValue constructor, ConstructType, const ConstructData&, const ArgList&);
+class ArgList;
+class ExecState;
+class FunctionExecutable;
+class JSObject;
+class JSScope;
+
+enum ConstructType {
+    ConstructTypeNone,
+    ConstructTypeHost,
+    ConstructTypeJS
+};
+
+union ConstructData {
+    struct {
+        NativeFunction function;
+    } native;
+    struct {
+        FunctionExecutable* functionExecutable;
+        JSScope* scope;
+    } js;
+};
+
+JS_EXPORT_PRIVATE JSObject* construct(ExecState*, JSValue constructor, ConstructType, const ConstructData&, const ArgList&);
 
 } // namespace JSC
 
index 383e6f1..18bc340 100644 (file)
 
 namespace JSC {
 
-    class DatePrototype;
+class DatePrototype;
 
-    class DateConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class DateConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static DateConstructor* create(VM& vm, Structure* structure, DatePrototype* datePrototype)
-        {
-            DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(vm.heap)) DateConstructor(vm, structure);
-            constructor->finishCreation(vm, datePrototype);
-            return constructor;
-        }
+    static DateConstructor* create(VM& vm, Structure* structure, DatePrototype* datePrototype)
+    {
+        DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(vm.heap)) DateConstructor(vm, structure);
+        constructor->finishCreation(vm, datePrototype);
+        return constructor;
+    }
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    protected:
-        void finishCreation(VM&, DatePrototype*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
+protected:
+    void finishCreation(VM&, DatePrototype*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
-    private:
-        DateConstructor(VM&, Structure*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
+private:
+    DateConstructor(VM&, Structure*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
 
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    };
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
 
-    JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&);
+JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&);
 
 } // namespace JSC
 
index 9b47d7b..000e1a1 100644 (file)
 
 namespace JSC {
 
-    class DateInstance : public JSWrapperObject {
-    protected:
-        JS_EXPORT_PRIVATE DateInstance(VM&, Structure*);
-        void finishCreation(VM&);
-        JS_EXPORT_PRIVATE void finishCreation(VM&, double);
-
-        JS_EXPORT_PRIVATE static void destroy(JSCell*);
-    public:
-        typedef JSWrapperObject Base;
-
-        static DateInstance* create(VM& vm, Structure* structure, double date)
-        {
-            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
-            instance->finishCreation(vm, date);
-            return instance;
-        }
-
-        static DateInstance* create(VM& vm, Structure* structure)
-        {
-            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
-            instance->finishCreation(vm);
-            return instance;
-        }
-
-        double internalNumber() const { return internalValue().asNumber(); }
-
-        DECLARE_EXPORT_INFO;
-
-        const GregorianDateTime* gregorianDateTime(ExecState* exec) const
-        {
-            if (m_data && m_data->m_gregorianDateTimeCachedForMS == internalNumber())
-                return &m_data->m_cachedGregorianDateTime;
-            return calculateGregorianDateTime(exec);
-        }
-        
-        const GregorianDateTime* gregorianDateTimeUTC(ExecState* exec) const
-        {
-            if (m_data && m_data->m_gregorianDateTimeUTCCachedForMS == internalNumber())
-                return &m_data->m_cachedGregorianDateTimeUTC;
-            return calculateGregorianDateTimeUTC(exec);
-        }
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    private:
-        JS_EXPORT_PRIVATE const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
-        JS_EXPORT_PRIVATE const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
-
-        mutable RefPtr<DateInstanceData> m_data;
-    };
-
-    DateInstance* asDateInstance(JSValue);
-
-    inline DateInstance* asDateInstance(JSValue value)
+class DateInstance : public JSWrapperObject {
+protected:
+    JS_EXPORT_PRIVATE DateInstance(VM&, Structure*);
+    void finishCreation(VM&);
+    JS_EXPORT_PRIVATE void finishCreation(VM&, double);
+
+    JS_EXPORT_PRIVATE static void destroy(JSCell*);
+
+public:
+    typedef JSWrapperObject Base;
+
+    static DateInstance* create(VM& vm, Structure* structure, double date)
+    {
+        DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+        instance->finishCreation(vm, date);
+        return instance;
+    }
+
+    static DateInstance* create(VM& vm, Structure* structure)
+    {
+        DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+        instance->finishCreation(vm);
+        return instance;
+    }
+
+    double internalNumber() const { return internalValue().asNumber(); }
+
+    DECLARE_EXPORT_INFO;
+
+    const GregorianDateTime* gregorianDateTime(ExecState* exec) const
     {
-        ASSERT(asObject(value)->inherits(DateInstance::info()));
-        return static_cast<DateInstance*>(asObject(value));
+        if (m_data && m_data->m_gregorianDateTimeCachedForMS == internalNumber())
+            return &m_data->m_cachedGregorianDateTime;
+        return calculateGregorianDateTime(exec);
     }
 
+    const GregorianDateTime* gregorianDateTimeUTC(ExecState* exec) const
+    {
+        if (m_data && m_data->m_gregorianDateTimeUTCCachedForMS == internalNumber())
+            return &m_data->m_cachedGregorianDateTimeUTC;
+        return calculateGregorianDateTimeUTC(exec);
+    }
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+private:
+    JS_EXPORT_PRIVATE const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
+    JS_EXPORT_PRIVATE const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
+
+    mutable RefPtr<DateInstanceData> m_data;
+};
+
+DateInstance* asDateInstance(JSValue);
+
+inline DateInstance* asDateInstance(JSValue value)
+{
+    ASSERT(asObject(value)->inherits(DateInstance::info()));
+    return static_cast<DateInstance*>(asObject(value));
+}
+
 } // namespace JSC
 
 #endif // DateInstance_h
index 0705306..5f8b1b2 100644 (file)
 
 namespace JSC {
 
-    class DateInstanceData : public RefCounted<DateInstanceData> {
-    public:
-        static PassRefPtr<DateInstanceData> create() { return adoptRef(new DateInstanceData); }
-
-        double m_gregorianDateTimeCachedForMS;
-        GregorianDateTime m_cachedGregorianDateTime;
-        double m_gregorianDateTimeUTCCachedForMS;
-        GregorianDateTime m_cachedGregorianDateTimeUTC;
-
-    private:
-        DateInstanceData()
-            : m_gregorianDateTimeCachedForMS(PNaN)
-            , m_gregorianDateTimeUTCCachedForMS(PNaN)
-        {
-        }
-    };
+class DateInstanceData : public RefCounted<DateInstanceData> {
+public:
+    static PassRefPtr<DateInstanceData> create() { return adoptRef(new DateInstanceData); }
 
-    class DateInstanceCache {
-    public:
-        DateInstanceCache()
-        {
-            reset();
-        }
-        
-        void reset()
-        {
-            for (size_t i = 0; i < cacheSize; ++i)
-                m_cache[i].key = PNaN;
-        }
-        
-        DateInstanceData* add(double d)
-        {
-            CacheEntry& entry = lookup(d);
-            if (d == entry.key)
-                return entry.value.get();
-
-            entry.key = d;
-            entry.value = DateInstanceData::create();
-            return entry.value.get();
-        }
+    double m_gregorianDateTimeCachedForMS;
+    GregorianDateTime m_cachedGregorianDateTime;
+    double m_gregorianDateTimeUTCCachedForMS;
+    GregorianDateTime m_cachedGregorianDateTimeUTC;
+
+private:
+    DateInstanceData()
+        : m_gregorianDateTimeCachedForMS(PNaN)
+        , m_gregorianDateTimeUTCCachedForMS(PNaN)
+    {
+    }
+};
+
+class DateInstanceCache {
+public:
+    DateInstanceCache()
+    {
+        reset();
+    }
 
-    private:
-        static const size_t cacheSize = 16;
+    void reset()
+    {
+        for (size_t i = 0; i < cacheSize; ++i)
+            m_cache[i].key = PNaN;
+    }
 
-        struct CacheEntry {
-            double key;
-            RefPtr<DateInstanceData> value;
-        };
+    DateInstanceData* add(double d)
+    {
+        CacheEntry& entry = lookup(d);
+        if (d == entry.key)
+            return entry.value.get();
+
+        entry.key = d;
+        entry.value = DateInstanceData::create();
+        return entry.value.get();
+    }
 
-        CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+private:
+    static const size_t cacheSize = 16;
 
-        std::array<CacheEntry, cacheSize> m_cache;
+    struct CacheEntry {
+        double key;
+        RefPtr<DateInstanceData> value;
     };
 
+    CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+
+    std::array<CacheEntry, cacheSize> m_cache;
+};
+
 } // namespace JSC
 
 #endif // DateInstanceCache_h
index a9bfbd4..820e60b 100644 (file)
 
 namespace JSC {
 
-    class ObjectPrototype;
-
-    class DatePrototype : public DateInstance {
-    private:
-        DatePrototype(VM&, Structure*);
-
-    public:
-        typedef DateInstance Base;
-
-        static DatePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-        {
-            DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(vm, structure);
-            prototype->finishCreation(vm, globalObject);
-            return prototype;
-        }
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        void finishCreation(VM&, JSGlobalObject*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
-    };
+class ObjectPrototype;
+
+class DatePrototype : public DateInstance {
+private:
+    DatePrototype(VM&, Structure*);
+
+public:
+    typedef DateInstance Base;
+
+    static DatePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
+        return prototype;
+    }
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+protected:
+    void finishCreation(VM&, JSGlobalObject*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
+};
 
 } // namespace JSC
 
index 50674ee..4cc1cda 100644 (file)
 
 namespace JSC {
 
-    class ExecState;
-    class VM;
-    class JSGlobalObject;
-    class JSObject;
-    class SourceCode;
-    class Structure;
-
-    // Methods to create a range of internal errors.
-    JSObject* createError(JSGlobalObject*, const String&);
-    JSObject* createEvalError(JSGlobalObject*, const String&);
-    JSObject* createRangeError(JSGlobalObject*, const String&);
-    JSObject* createReferenceError(JSGlobalObject*, const String&);
-    JSObject* createSyntaxError(JSGlobalObject*, const String&);
-    JSObject* createTypeError(JSGlobalObject*, const String&);
-    JSObject* createNotEnoughArgumentsError(JSGlobalObject*);
-    JSObject* createURIError(JSGlobalObject*, const String&);
-    // ExecState wrappers.
-    JS_EXPORT_PRIVATE JSObject* createError(ExecState*, const String&);
-    JSObject* createEvalError(ExecState*, const String&);
-    JS_EXPORT_PRIVATE JSObject* createRangeError(ExecState*, const String&);
-    JS_EXPORT_PRIVATE JSObject* createReferenceError(ExecState*, const String&);
-    JS_EXPORT_PRIVATE JSObject* createSyntaxError(ExecState*, const String&);
-    JS_EXPORT_PRIVATE JSObject* createTypeError(ExecState*, const String&);
-    JS_EXPORT_PRIVATE JSObject* createNotEnoughArgumentsError(ExecState*);
-    JSObject* createURIError(ExecState*, const String&);
-
-    // Methods to add 
-    bool hasErrorInfo(ExecState*, JSObject* error);
-    // ExecState wrappers.
-    JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
-
-    // Methods to throw Errors.
-
-    // Convenience wrappers, create an throw an exception with a default message.
-    JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*);
-    JS_EXPORT_PRIVATE JSObject* throwSyntaxError(ExecState*);
-
-    // Convenience wrappers, wrap result as an EncodedJSValue.
-    inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(exec->vm().throwException(exec, error)); }
-    inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); }
-    inline EncodedJSValue throwVMTypeError(ExecState* exec, const String& errorMessage) { return JSValue::encode(throwTypeError(exec, errorMessage)); }
-    
-    class StrictModeTypeErrorFunction : public InternalFunction {
-    private:
-        StrictModeTypeErrorFunction(VM& vm, Structure* structure, const String& message)
-            : InternalFunction(vm, structure)
-            , m_message(message)
-        {
-        }
-
-        static void destroy(JSCell*);
-
-    public:
-        typedef InternalFunction Base;
-
-        static StrictModeTypeErrorFunction* create(VM& vm, Structure* structure, const String& message)
-        {
-            StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(vm.heap)) StrictModeTypeErrorFunction(vm, structure, message);
-            function->finishCreation(vm, String());
-            return function;
-        }
-    
-        static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec)
-        {
-            throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
-            return JSValue::encode(jsNull());
-        }
-    
-        static ConstructType getConstructData(JSCell*, ConstructData& constructData)
-        {
-            constructData.native.function = constructThrowTypeError;
-            return ConstructTypeHost;
-        }
-    
-        static EncodedJSValue JSC_HOST_CALL callThrowTypeError(ExecState* exec)
-        {
-            throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
-            return JSValue::encode(jsNull());
-        }
-
-        static CallType getCallData(JSCell*, CallData& callData)
-        {
-            callData.native.function = callThrowTypeError;
-            return CallTypeHost;
-        }
-
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
-        
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
-        }
-
-    private:
-        String m_message;
-    };
+class ExecState;
+class VM;
+class JSGlobalObject;
+class JSObject;
+class SourceCode;
+class Structure;
+
+// Methods to create a range of internal errors.
+JSObject* createError(JSGlobalObject*, const String&);
+JSObject* createEvalError(JSGlobalObject*, const String&);
+JSObject* createRangeError(JSGlobalObject*, const String&);
+JSObject* createReferenceError(JSGlobalObject*, const String&);
+JSObject* createSyntaxError(JSGlobalObject*, const String&);
+JSObject* createTypeError(JSGlobalObject*, const String&);
+JSObject* createNotEnoughArgumentsError(JSGlobalObject*);
+JSObject* createURIError(JSGlobalObject*, const String&);
+// ExecState wrappers.
+JS_EXPORT_PRIVATE JSObject* createError(ExecState*, const String&);
+JSObject* createEvalError(ExecState*, const String&);
+JS_EXPORT_PRIVATE JSObject* createRangeError(ExecState*, const String&);
+JS_EXPORT_PRIVATE JSObject* createReferenceError(ExecState*, const String&);
+JS_EXPORT_PRIVATE JSObject* createSyntaxError(ExecState*, const String&);
+JS_EXPORT_PRIVATE JSObject* createTypeError(ExecState*, const String&);
+JS_EXPORT_PRIVATE JSObject* createNotEnoughArgumentsError(ExecState*);
+JSObject* createURIError(ExecState*, const String&);
+
+// Methods to add 
+bool hasErrorInfo(ExecState*, JSObject* error);
+// ExecState wrappers.
+JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
+
+// Methods to throw Errors.
+
+// Convenience wrappers, create an throw an exception with a default message.
+JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*);
+JS_EXPORT_PRIVATE JSObject* throwSyntaxError(ExecState*);
+
+// Convenience wrappers, wrap result as an EncodedJSValue.
+inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(exec->vm().throwException(exec, error)); }
+inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); }
+inline EncodedJSValue throwVMTypeError(ExecState* exec, const String& errorMessage) { return JSValue::encode(throwTypeError(exec, errorMessage)); }
+
+class StrictModeTypeErrorFunction : public InternalFunction {
+private:
+    StrictModeTypeErrorFunction(VM& vm, Structure* structure, const String& message)
+        : InternalFunction(vm, structure)
+        , m_message(message)
+    {
+    }
+
+    static void destroy(JSCell*);
+
+public:
+    typedef InternalFunction Base;
+
+    static StrictModeTypeErrorFunction* create(VM& vm, Structure* structure, const String& message)
+    {
+        StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(vm.heap)) StrictModeTypeErrorFunction(vm, structure, message);
+        function->finishCreation(vm, String());
+        return function;
+    }
+
+    static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec)
+    {
+        throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
+        return JSValue::encode(jsNull());
+    }
+
+    static ConstructType getConstructData(JSCell*, ConstructData& constructData)
+    {
+        constructData.native.function = constructThrowTypeError;
+        return ConstructTypeHost;
+    }
+
+    static EncodedJSValue JSC_HOST_CALL callThrowTypeError(ExecState* exec)
+    {
+        throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
+        return JSValue::encode(jsNull());
+    }
+
+    static CallType getCallData(JSCell*, CallData& callData)
+    {
+        callData.native.function = callThrowTypeError;
+        return CallTypeHost;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
+    { 
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
+
+private:
+    String m_message;
+};
 
 } // namespace JSC
 
index 29283d0..b11894d 100644 (file)
 
 namespace JSC {
 
-    class ErrorPrototype;
+class ErrorPrototype;
 
-    class ErrorConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class ErrorConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static ErrorConstructor* create(VM& vm, Structure* structure, ErrorPrototype* errorPrototype)
-        {
-            ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
-            constructor->finishCreation(vm, errorPrototype);
-            return constructor;
-        }
+    static ErrorConstructor* create(VM& vm, Structure* structure, ErrorPrototype* errorPrototype)
+    {
+        ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
+        constructor->finishCreation(vm, errorPrototype);
+        return constructor;
+    }
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
-        
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
+    { 
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
 
-    protected:
-        void finishCreation(VM&, ErrorPrototype*);
+protected:
+    void finishCreation(VM&, ErrorPrototype*);
         
-    private:
-        ErrorConstructor(VM&, Structure*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-    };
+private:
+    ErrorConstructor(VM&, Structure*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+};
 
 } // namespace JSC
 
index 91dd7ef..879e14a 100644 (file)
 
 namespace JSC {
 
-    class ErrorInstance : public JSNonFinalObject {
-    public:
-        typedef JSNonFinalObject Base;
+class ErrorInstance : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info());
+    }
 
-        static ErrorInstance* create(VM& vm, Structure* structure, const String& message, Vector<StackFrame> stackTrace = Vector<StackFrame>())
-        {
-            ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure);
-            instance->finishCreation(vm, message, stackTrace);
-            return instance;
-        }
+    static ErrorInstance* create(VM& vm, Structure* structure, const String& message, Vector<StackFrame> stackTrace = Vector<StackFrame>())
+    {
+        ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure);
+        instance->finishCreation(vm, message, stackTrace);
+        return instance;
+    }
 
-        static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message, Vector<StackFrame> stackTrace = Vector<StackFrame>())
-        {
-            return create(exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), stackTrace);
-        }
+    static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message, Vector<StackFrame> stackTrace = Vector<StackFrame>())
+    {
+        return create(exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), stackTrace);
+    }
 
-        bool appendSourceToMessage() { return m_appendSourceToMessage; }
-        void setAppendSourceToMessage() { m_appendSourceToMessage = true; }
-        void clearAppendSourceToMessage() { m_appendSourceToMessage = false; }
+    bool appendSourceToMessage() { return m_appendSourceToMessage; }
+    void setAppendSourceToMessage() { m_appendSourceToMessage = true; }
+    void clearAppendSourceToMessage() { m_appendSourceToMessage = false; }
 
-    protected:
-        explicit ErrorInstance(VM&, Structure*);
+protected:
+    explicit ErrorInstance(VM&, Structure*);
 
-        void finishCreation(VM&, const String&, Vector<StackFrame> = Vector<StackFrame>());
+    void finishCreation(VM&, const String&, Vector<StackFrame> = Vector<StackFrame>());
 
-        bool m_appendSourceToMessage;
-    };
+    bool m_appendSourceToMessage;
+};
 
 } // namespace JSC
 
index 10707ab..2157ce4 100644 (file)
 
 namespace JSC {
 
-    class ObjectPrototype;
-
-    class ErrorPrototype : public ErrorInstance {
-    public:
-        typedef ErrorInstance Base;
-
-        static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-        {
-            ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
-            prototype->finishCreation(vm, globalObject);
-            return prototype;
-        }
-        
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info());
-        }
-
-    protected:
-        ErrorPrototype(VM&, Structure*);
-        void finishCreation(VM&, JSGlobalObject*);
-
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
-
-    private:
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    };
+class ObjectPrototype;
+
+class ErrorPrototype : public ErrorInstance {
+public:
+    typedef ErrorInstance Base;
+
+    static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
+        return prototype;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info());
+    }
+
+protected:
+    ErrorPrototype(VM&, Structure*);
+    void finishCreation(VM&, JSGlobalObject*);
+
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
+
+private:
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
 
 } // namespace JSC
 
index 61443e9..dd7a662 100644 (file)
@@ -29,37 +29,37 @@ class TextPosition;
 
 namespace JSC {
 
-    class FunctionPrototype;
+class FunctionPrototype;
 
-    class FunctionConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class FunctionConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static FunctionConstructor* create(VM& vm, Structure* structure, FunctionPrototype* functionPrototype)
-        {
-            FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
-            constructor->finishCreation(vm, functionPrototype);
-            return constructor;
-        }
+    static FunctionConstructor* create(VM& vm, Structure* structure, FunctionPrototype* functionPrototype)
+    {
+        FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
+        constructor->finishCreation(vm, functionPrototype);
+        return constructor;
+    }
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
-        
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
+    { 
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
 
-    private:
-        FunctionConstructor(VM&, Structure*);
-        void finishCreation(VM&, FunctionPrototype*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-    };
+private:
+    FunctionConstructor(VM&, Structure*);
+    void finishCreation(VM&, FunctionPrototype*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+};
 
-    JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const String& sourceURL, const WTF::TextPosition&);
-    JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&);
+JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const String& sourceURL, const WTF::TextPosition&);
+JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&);
 
-    JS_EXPORT_PRIVATE JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState*, JSGlobalObject*, const ArgList&, const Identifier&, const String&, const WTF::TextPosition&);
+JS_EXPORT_PRIVATE JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState*, JSGlobalObject*, const ArgList&, const Identifier&, const String&, const WTF::TextPosition&);
 
 } // namespace JSC
 
index 68d2f6a..52ce8f1 100644 (file)
 
 namespace JSC {
 
-    class FunctionPrototype : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
-
-        static FunctionPrototype* create(VM& vm, Structure* structure)
-        {
-            FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(vm, structure);
-            prototype->finishCreation(vm, String());
-            return prototype;
-        }
-        
-        void addFunctionProperties(ExecState*, JSGlobalObject*, JSFunction** callFunction, JSFunction** applyFunction);
-        
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
-        {
-            return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-        DECLARE_INFO;
-
-    protected:
-        void finishCreation(VM&, const String& name);
-
-    private:
-        FunctionPrototype(VM&, Structure*);
-        static CallType getCallData(JSCell*, CallData&);
-    };
+class FunctionPrototype : public InternalFunction {
+public:
+    typedef InternalFunction Base;
+
+    static FunctionPrototype* create(VM& vm, Structure* structure)
+    {
+        FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(vm, structure);
+        prototype->finishCreation(vm, String());
+        return prototype;
+    }
+
+    void addFunctionProperties(ExecState*, JSGlobalObject*, JSFunction** callFunction, JSFunction** applyFunction);
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
+    {
+        return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+    DECLARE_INFO;
+
+protected:
+    void finishCreation(VM&, const String& name);
+
+private:
+    FunctionPrototype(VM&, Structure*);
+    static CallType getCallData(JSCell*, CallData&);
+};
 
 } // namespace JSC
 
index b9b2bda..4535824 100644 (file)
 
 namespace JSC {
 
-    class JSObject;
-
-    // This is an internal value object which stores getter and setter functions
-    // for a property. Instances of this class have the property that once a getter
-    // or setter is set to a non-null value, then they cannot be changed. This means
-    // that if a property holding a GetterSetter reference is constant-inferred and
-    // that constant is observed to have a non-null setter (or getter) then we can
-    // constant fold that setter (or getter).
-    class GetterSetter : public JSCell {
-        friend class JIT;
-
-    private:        
-        GetterSetter(VM& vm)
-            : JSCell(vm, vm.getterSetterStructure.get())
-        {
-        }
-
-    public:
-        typedef JSCell Base;
-
-        static GetterSetter* create(VM& vm)
-        {
-            GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(vm.heap)) GetterSetter(vm);
-            getterSetter->finishCreation(vm);
-            return getterSetter;
-        }
-
-        static void visitChildren(JSCell*, SlotVisitor&);
-
-        JSObject* getter() const { return m_getter.get(); }
-        
-        JSObject* getterConcurrently() const
-        {
-            JSObject* result = getter();
-            WTF::loadLoadFence();
-            return result;
-        }
-        
-        // Set the getter. It's only valid to call this if you've never set the getter on this
-        // object.
-        void setGetter(VM& vm, JSObject* getter)
-        {
-            RELEASE_ASSERT(!m_getter);
-            WTF::storeStoreFence();
-            m_getter.setMayBeNull(vm, this, getter);
-        }
-        
-        JSObject* setter() const { return m_setter.get(); }
-        
-        JSObject* setterConcurrently() const
-        {
-            JSObject* result = setter();
-            WTF::loadLoadFence();
-            return result;
-        }
-        
-        // Set the setter. It's only valid to call this if you've never set the setter on this
-        // object.
-        void setSetter(VM& vm, JSObject* setter)
-        {
-            RELEASE_ASSERT(!m_setter);
-            WTF::storeStoreFence();
-            m_setter.setMayBeNull(vm, this, setter);
-        }
-        
-        GetterSetter* withGetter(VM&, JSObject* getter);
-        GetterSetter* withSetter(VM&, JSObject* setter);
-        
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(GetterSetterType), info());
-        }
-        
-        static ptrdiff_t offsetOfGetter()
-        {
-            return OBJECT_OFFSETOF(GetterSetter, m_getter);
-        }
-        
-        static ptrdiff_t offsetOfSetter()
-        {
-            return OBJECT_OFFSETOF(GetterSetter, m_setter);
-        }
-        
-        DECLARE_INFO;
-
-    private:
-        WriteBarrier<JSObject> m_getter;
-        WriteBarrier<JSObject> m_setter;  
-    };
-
-    GetterSetter* asGetterSetter(JSValue);
-
-    inline GetterSetter* asGetterSetter(JSValue value)
+class JSObject;
+
+// This is an internal value object which stores getter and setter functions
+// for a property. Instances of this class have the property that once a getter
+// or setter is set to a non-null value, then they cannot be changed. This means
+// that if a property holding a GetterSetter reference is constant-inferred and
+// that constant is observed to have a non-null setter (or getter) then we can
+// constant fold that setter (or getter).
+class GetterSetter : public JSCell {
+    friend class JIT;
+
+private:        
+    GetterSetter(VM& vm)
+        : JSCell(vm, vm.getterSetterStructure.get())
     {
-        ASSERT_WITH_SECURITY_IMPLICATION(value.asCell()->isGetterSetter());
-        return static_cast<GetterSetter*>(value.asCell());
     }
 
-    JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter);
-    void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue value, ECMAMode);
+public:
+    typedef JSCell Base;
+
+    static GetterSetter* create(VM& vm)
+    {
+        GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(vm.heap)) GetterSetter(vm);
+        getterSetter->finishCreation(vm);
+        return getterSetter;
+    }
+
+    static void visitChildren(JSCell*, SlotVisitor&);
+
+    JSObject* getter() const { return m_getter.get(); }
+
+    JSObject* getterConcurrently() const
+    {
+        JSObject* result = getter();
+        WTF::loadLoadFence();
+        return result;
+    }
+
+    // Set the getter. It's only valid to call this if you've never set the getter on this
+    // object.
+    void setGetter(VM& vm, JSObject* getter)
+    {
+        RELEASE_ASSERT(!m_getter);
+        WTF::storeStoreFence();
+        m_getter.setMayBeNull(vm, this, getter);
+    }
+
+    JSObject* setter() const { return m_setter.get(); }
+
+    JSObject* setterConcurrently() const
+    {
+        JSObject* result = setter();
+        WTF::loadLoadFence();
+        return result;
+    }
+
+    // Set the setter. It's only valid to call this if you've never set the setter on this
+    // object.
+    void setSetter(VM& vm, JSObject* setter)
+    {
+        RELEASE_ASSERT(!m_setter);
+        WTF::storeStoreFence();
+        m_setter.setMayBeNull(vm, this, setter);
+    }
+
+    GetterSetter* withGetter(VM&, JSObject* getter);
+    GetterSetter* withSetter(VM&, JSObject* setter);
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(GetterSetterType), info());
+    }
+
+    static ptrdiff_t offsetOfGetter()
+    {
+        return OBJECT_OFFSETOF(GetterSetter, m_getter);
+    }
+
+    static ptrdiff_t offsetOfSetter()
+    {
+        return OBJECT_OFFSETOF(GetterSetter, m_setter);
+    }
+
+    DECLARE_INFO;
+
+private:
+    WriteBarrier<JSObject> m_getter;
+    WriteBarrier<JSObject> m_setter;  
+};
+
+GetterSetter* asGetterSetter(JSValue);
+
+inline GetterSetter* asGetterSetter(JSValue value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value.asCell()->isGetterSetter());
+    return static_cast<GetterSetter*>(value.asCell());
+}
+
+JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter);
+void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue, ECMAMode);
 
 } // namespace JSC
 
index 7f74e4d..71d0053 100644 (file)
 
 namespace JSC {
 
-    class ExecState;
-
-    class Identifier {
-        friend class Structure;
-    public:
-        Identifier() { }
-        enum EmptyIdentifierFlag { EmptyIdentifier };
-        Identifier(EmptyIdentifierFlag) : m_string(StringImpl::empty()) { ASSERT(m_string.impl()->isAtomic()); }
-
-        // Only to be used with string literals.
-        template<unsigned charactersCount>
-        Identifier(ExecState* exec, const char (&characters)[charactersCount]) : m_string(add(exec, characters)) { ASSERT(m_string.impl()->isAtomic()); }
-        template<unsigned charactersCount>
-        Identifier(VM* vm, const char (&characters)[charactersCount]) : m_string(add(vm, characters)) { ASSERT(m_string.impl()->isAtomic()); }
-
-        Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { ASSERT(m_string.impl()->isAtomic()); }
-        Identifier(ExecState* exec, const String& s) : m_string(add(exec, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
-
-        Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
-        Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
-        Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { ASSERT(m_string.impl()->isAtomic()); }
-        Identifier(VM* vm, const String& s) : m_string(add(vm, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
-
-        const String& string() const { return m_string; }
-        StringImpl* impl() const { return m_string.impl(); }
-        
-        int length() const { return m_string.length(); }
-        
-        CString ascii() const { return m_string.ascii(); }
-        CString utf8() const { return m_string.utf8(); }
-        
-        static Identifier from(const PrivateName& name)
-        {
-            Identifier result;
-            result.m_string = name.uid();
-            return result;
-        }
-
-        static Identifier createLCharFromUChar(VM* vm, const UChar* s, int length) { return Identifier(vm, add8(vm, s, length)); }
-
-        JS_EXPORT_PRIVATE static Identifier from(ExecState* exec, unsigned y);
-        JS_EXPORT_PRIVATE static Identifier from(ExecState* exec, int y);
-        static Identifier from(ExecState* exec, double y);
-        static Identifier from(VM*, unsigned y);
-        static Identifier from(VM*, int y);
-        static Identifier from(VM*, double y);
-
-        bool isNull() const { return m_string.isNull(); }
-        bool isEmpty() const { return m_string.isEmpty(); }
-        
-        friend bool operator==(const Identifier&, const Identifier&);
-        friend bool operator!=(const Identifier&, const Identifier&);
-
-        friend bool operator==(const Identifier&, const LChar*);
-        friend bool operator==(const Identifier&, const char*);
-        friend bool operator!=(const Identifier&, const LChar*);
-        friend bool operator!=(const Identifier&, const char*);
-    
-        static bool equal(const StringImpl*, const LChar*);
-        static inline bool equal(const StringImpl*a, const char*b) { return Identifier::equal(a, reinterpret_cast<const LChar*>(b)); };
-        static bool equal(const StringImpl*, const LChar*, unsigned length);
-        static bool equal(const StringImpl*, const UChar*, unsigned length);
-        static bool equal(const StringImpl* a, const StringImpl* b) { return ::equal(a, b); }
-
-        // Only to be used with string literals.
-        JS_EXPORT_PRIVATE static PassRef<StringImpl> add(VM*, const char*);
-        JS_EXPORT_PRIVATE static PassRef<StringImpl> add(ExecState*, const char*);
-        
-        void dump(PrintStream&) const;
-
-    private:
-        String m_string;
-
-        template <typename CharType>
-        ALWAYS_INLINE static uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok);
-
-        static bool equal(const Identifier& a, const Identifier& b) { return a.m_string.impl() == b.m_string.impl(); }
-        static bool equal(const Identifier& a, const LChar* b) { return equal(a.m_string.impl(), b); }
-
-        template <typename T> static PassRef<StringImpl> add(VM*, const T*, int length);
-        static PassRef<StringImpl> add8(VM*, const UChar*, int length);
-        template <typename T> ALWAYS_INLINE static bool canUseSingleCharacterString(T);
-
-        static PassRef<StringImpl> add(ExecState*, StringImpl*);
-        static PassRef<StringImpl> add(VM*, StringImpl*);
+class ExecState;
 
-#ifndef NDEBUG
-        JS_EXPORT_PRIVATE static void checkCurrentAtomicStringTable(ExecState*);
-        JS_EXPORT_PRIVATE static void checkCurrentAtomicStringTable(VM*);
-#else
-        JS_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH static void checkCurrentAtomicStringTable(ExecState*);
-        JS_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH static void checkCurrentAtomicStringTable(VM*);
-#endif
-    };
+class Identifier {
+    friend class Structure;
+public:
+    Identifier() { }
+    enum EmptyIdentifierFlag { EmptyIdentifier };
+    Identifier(EmptyIdentifierFlag) : m_string(StringImpl::empty()) { ASSERT(m_string.impl()->isAtomic()); }
 
-    template <> ALWAYS_INLINE bool Identifier::canUseSingleCharacterString(LChar)
-    {
-        ASSERT(maxSingleCharacterString == 0xff);
-        return true;
-    }
+    // Only to be used with string literals.
+    template<unsigned charactersCount>
+    Identifier(ExecState* exec, const char (&characters)[charactersCount]) : m_string(add(exec, characters)) { ASSERT(m_string.impl()->isAtomic()); }
+    template<unsigned charactersCount>
+    Identifier(VM* vm, const char (&characters)[charactersCount]) : m_string(add(vm, characters)) { ASSERT(m_string.impl()->isAtomic()); }
 
-    template <> ALWAYS_INLINE bool Identifier::canUseSingleCharacterString(UChar c)
-    {
-        return (c <= maxSingleCharacterString);
-    }
+    Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(ExecState* exec, const String& s) : m_string(add(exec, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
 
-    template <typename T>
-    PassRef<StringImpl> Identifier::add(VM* vm, const T* s, int length)
-    {
-        if (length == 1) {
-            T c = s[0];
-            if (canUseSingleCharacterString(c))
-                return *vm->smallStrings.singleCharacterStringRep(c);
-        }
-        if (!length)
-            return *StringImpl::empty();
-        
-        return *AtomicString::add(s, length);
-    }
+    Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(VM* vm, const String& s) : m_string(add(vm, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
 
-    inline bool operator==(const Identifier& a, const Identifier& b)
-    {
-        return Identifier::equal(a, b);
-    }
+    const String& string() const { return m_string; }
+    StringImpl* impl() const { return m_string.impl(); }
 
-    inline bool operator!=(const Identifier& a, const Identifier& b)
-    {
-        return !Identifier::equal(a, b);
-    }
+    int length() const { return m_string.length(); }
 
-    inline bool operator==(const Identifier& a, const LChar* b)
-    {
-        return Identifier::equal(a, b);
-    }
+    CString ascii() const { return m_string.ascii(); }
+    CString utf8() const { return m_string.utf8(); }
 
-    inline bool operator==(const Identifier& a, const char* b)
+    static Identifier from(const PrivateName& name)
     {
-        return Identifier::equal(a, reinterpret_cast<const LChar*>(b));
-    }
-    
-    inline bool operator!=(const Identifier& a, const LChar* b)
-    {
-        return !Identifier::equal(a, b);
+        Identifier result;
+        result.m_string = name.uid();
+        return result;
     }
 
-    inline bool operator!=(const Identifier& a, const char* b)
-    {
-        return !Identifier::equal(a, reinterpret_cast<const LChar*>(b));
-    }
-    
-    inline bool Identifier::equal(const StringImpl* r, const LChar* s)
-    {
-        return WTF::equal(r, s);
-    }
+    static Identifier createLCharFromUChar(VM* vm, const UChar* s, int length) { return Identifier(vm, add8(vm, s, length)); }
 
-    inline bool Identifier::equal(const StringImpl* r, const LChar* s, unsigned length)
-    {
-        return WTF::equal(r, s, length);
-    }
+    JS_EXPORT_PRIVATE static Identifier from(ExecState*, unsigned y);
+    JS_EXPORT_PRIVATE static Identifier from(ExecState*, int y);
+    static Identifier from(ExecState*, double y);
+    static Identifier from(VM*, unsigned y);
+    static Identifier from(VM*, int y);
+    static Identifier from(VM*, double y);
 
-    inline bool Identifier::equal(const StringImpl* r, const UChar* s, unsigned length)
-    {
-        return WTF::equal(r, s, length);
+    bool isNull() const { return m_string.isNull(); }
+    bool isEmpty() const { return m_string.isEmpty(); }
+
+    friend bool operator==(const Identifier&, const Identifier&);
+    friend bool operator!=(const Identifier&, const Identifier&);
+
+    friend bool operator==(const Identifier&, const LChar*);
+    friend bool operator==(const Identifier&, const char*);
+    friend bool operator!=(const Identifier&, const LChar*);
+    friend bool operator!=(const Identifier&, const char*);
+
+    static bool equal(const StringImpl*, const LChar*);
+    static inline bool equal(const StringImpl*a, const char*b) { return Identifier::equal(a, reinterpret_cast<const LChar*>(b)); };
+    static bool equal(const StringImpl*, const LChar*, unsigned length);
+    static bool equal(const StringImpl*, const UChar*, unsigned length);
+    static bool equal(const StringImpl* a, const StringImpl* b) { return ::equal(a, b); }
+
+    // Only to be used with string literals.
+    JS_EXPORT_PRIVATE static PassRef<StringImpl> add(VM*, const char*);
+    JS_EXPORT_PRIVATE static PassRef<StringImpl> add(ExecState*, const char*);
+
+    void dump(PrintStream&) const;
+
+private:
+    String m_string;
+
+    template <typename CharType>
+    ALWAYS_INLINE static uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok);
+
+    static bool equal(const Identifier& a, const Identifier& b) { return a.m_string.impl() == b.m_string.impl(); }
+    static bool equal(const Identifier& a, const LChar* b) { return equal(a.m_string.impl(), b); }
+
+    template <typename T> static PassRef<StringImpl> add(VM*, const T*, int length);
+    static PassRef<StringImpl> add8(VM*, const UChar*, int length);
+    template <typename T> ALWAYS_INLINE static bool canUseSingleCharacterString(T);
+
+    static PassRef<StringImpl> add(ExecState*, StringImpl*);
+    static PassRef<StringImpl> add(VM*, StringImpl*);
+
+#ifndef NDEBUG
+    JS_EXPORT_PRIVATE static void checkCurrentAtomicStringTable(ExecState*);
+    JS_EXPORT_PRIVATE static void checkCurrentAtomicStringTable(VM*);
+#else
+    JS_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH static void checkCurrentAtomicStringTable(ExecState*);
+    JS_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH static void checkCurrentAtomicStringTable(VM*);
+#endif
+};
+
+template <> ALWAYS_INLINE bool Identifier::canUseSingleCharacterString(LChar)
+{
+    ASSERT(maxSingleCharacterString == 0xff);
+    return true;
+}
+
+template <> ALWAYS_INLINE bool Identifier::canUseSingleCharacterString(UChar c)
+{
+    return (c <= maxSingleCharacterString);
+}
+
+template <typename T>
+PassRef<StringImpl> Identifier::add(VM* vm, const T* s, int length)
+{
+    if (length == 1) {
+        T c = s[0];
+        if (canUseSingleCharacterString(c))
+            return *vm->smallStrings.singleCharacterStringRep(c);
     }
-    
-    struct IdentifierRepHash : PtrHash<RefPtr<StringImpl>> {
-        static unsigned hash(const RefPtr<StringImpl>& key) { return key->existingHash(); }
-        static unsigned hash(StringImpl* key) { return key->existingHash(); }
-    };
-
-    struct IdentifierMapIndexHashTraits : HashTraits<int> {
-        static int emptyValue() { return std::numeric_limits<int>::max(); }
-        static const bool emptyValueIsZero = false;
-    };
-
-    typedef HashMap<RefPtr<StringImpl>, int, IdentifierRepHash, HashTraits<RefPtr<StringImpl>>, IdentifierMapIndexHashTraits> IdentifierMap;
-    typedef HashMap<StringImpl*, int, IdentifierRepHash, HashTraits<StringImpl*>, IdentifierMapIndexHashTraits> BorrowedIdentifierMap;
+    if (!length)
+        return *StringImpl::empty();
+
+    return *AtomicString::add(s, length);
+}
+
+inline bool operator==(const Identifier& a, const Identifier& b)
+{
+    return Identifier::equal(a, b);
+}
+
+inline bool operator!=(const Identifier& a, const Identifier& b)
+{
+    return !Identifier::equal(a, b);
+}
+
+inline bool operator==(const Identifier& a, const LChar* b)
+{
+    return Identifier::equal(a, b);
+}
+
+inline bool operator==(const Identifier& a, const char* b)
+{
+    return Identifier::equal(a, reinterpret_cast<const LChar*>(b));
+}
+
+inline bool operator!=(const Identifier& a, const LChar* b)
+{
+    return !Identifier::equal(a, b);
+}
+
+inline bool operator!=(const Identifier& a, const char* b)
+{
+    return !Identifier::equal(a, reinterpret_cast<const LChar*>(b));
+}
+
+inline bool Identifier::equal(const StringImpl* r, const LChar* s)
+{
+    return WTF::equal(r, s);
+}
+
+inline bool Identifier::equal(const StringImpl* r, const LChar* s, unsigned length)
+{
+    return WTF::equal(r, s, length);
+}
+
+inline bool Identifier::equal(const StringImpl* r, const UChar* s, unsigned length)
+{
+    return WTF::equal(r, s, length);
+}
+
+struct IdentifierRepHash : PtrHash<RefPtr<StringImpl>> {
+    static unsigned hash(const RefPtr<StringImpl>& key) { return key->existingHash(); }
+    static unsigned hash(StringImpl* key) { return key->existingHash(); }
+};
+
+struct IdentifierMapIndexHashTraits : HashTraits<int> {
+    static int emptyValue() { return std::numeric_limits<int>::max(); }
+    static const bool emptyValueIsZero = false;
+};
+
+typedef HashMap<RefPtr<StringImpl>, int, IdentifierRepHash, HashTraits<RefPtr<StringImpl>>, IdentifierMapIndexHashTraits> IdentifierMap;
+typedef HashMap<StringImpl*, int, IdentifierRepHash, HashTraits<StringImpl*>, IdentifierMapIndexHashTraits> BorrowedIdentifierMap;
 
 } // namespace JSC
 
index b05ce41..39845c2 100644 (file)
@@ -31,9 +31,9 @@
 
 namespace JSC {
 
-    // This function must be called from the main thread. It is safe to call it repeatedly.
-    // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
-    JS_EXPORT_PRIVATE void initializeThreading();
+// This function must be called from the main thread. It is safe to call it repeatedly.
+// Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
+JS_EXPORT_PRIVATE void initializeThreading();
 
 }
 
index e216c2f..37b5fe1 100644 (file)
 
 namespace JSC {
 
-    class FunctionPrototype;
+class FunctionPrototype;
 
-    class InternalFunction : public JSDestructibleObject {
-    public:
-        typedef JSDestructibleObject Base;
+class InternalFunction : public JSDestructibleObject {
+public:
+    typedef JSDestructibleObject Base;
 
-        DECLARE_EXPORT_INFO;
+    DECLARE_EXPORT_INFO;
 
-        JS_EXPORT_PRIVATE const String& name(ExecState*);
-        const String displayName(ExecState*);
-        const String calculatedDisplayName(ExecState*);
+    JS_EXPORT_PRIVATE const String& name(ExecState*);
+    const String displayName(ExecState*);
+    const String calculatedDisplayName(ExecState*);
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) 
-        
-            return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info()); 
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) 
+    { 
+        return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
 
-    protected:
-        static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
+protected:
+    static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
 
-        JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*);
+    JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*);
 
-        JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name);
+    JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name);
 
-        static CallType getCallData(JSCell*, CallData&);
-    };
+    static CallType getCallData(JSCell*, CallData&);
+};
 
-    InternalFunction* asInternalFunction(JSValue);
+InternalFunction* asInternalFunction(JSValue);
 
-    inline InternalFunction* asInternalFunction(JSValue value)
-    {
-        ASSERT(asObject(value)->inherits(InternalFunction::info()));
-        return static_cast<InternalFunction*>(asObject(value));
-    }
+inline InternalFunction* asInternalFunction(JSValue value)
+{
+    ASSERT(asObject(value)->inherits(InternalFunction::info()));
+    return static_cast<InternalFunction*>(asObject(value));
+}
 
 } // namespace JSC
 
index 5ac2a28..56a816d 100644 (file)
 
 namespace JSC {
 
-    class JSAPIValueWrapper : public JSCell {
-        friend JSValue jsAPIValueWrapper(ExecState*, JSValue);
-    public:
-        typedef JSCell Base;
+class JSAPIValueWrapper : public JSCell {
+    friend JSValue jsAPIValueWrapper(ExecState*, JSValue);
+public:
+    typedef JSCell Base;
 
-        JSValue value() const { return m_value.get(); }
+    JSValue value() const { return m_value.get(); }
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(APIValueWrapperType, OverridesGetPropertyNames), info());
-        }
-        
-        DECLARE_EXPORT_INFO;
-        
-        static JSAPIValueWrapper* create(ExecState* exec, JSValue value) 
-        {
-            VM& vm = exec->vm();
-            JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(vm.heap)) JSAPIValueWrapper(exec);
-            wrapper->finishCreation(vm, value);
-            return wrapper;
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(APIValueWrapperType, OverridesGetPropertyNames), info());
+    }
 
-    protected:
-        void finishCreation(VM& vm, JSValue value)
-        {
-            Base::finishCreation(vm);
-            m_value.set(vm, this, value);
-            ASSERT(!value.isCell());
-        }
+    DECLARE_EXPORT_INFO;
 
-    private:
-        JSAPIValueWrapper(ExecState* exec)
-            : JSCell(exec->vm(), exec->vm().apiWrapperStructure.get())
-        {
-        }
+    static JSAPIValueWrapper* create(ExecState* exec, JSValue value) 
+    {
+        VM& vm = exec->vm();
+        JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(vm.heap)) JSAPIValueWrapper(exec);
+        wrapper->finishCreation(vm, value);
+        return wrapper;
+    }
 
-        WriteBarrier<Unknown> m_value;
-    };
+protected:
+    void finishCreation(VM& vm, JSValue value)
+    {
+        Base::finishCreation(vm);
+        m_value.set(vm, this, value);
+        ASSERT(!value.isCell());
+    }
 
-    inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value)
+private:
+    JSAPIValueWrapper(ExecState* exec)
+        : JSCell(exec->vm(), exec->vm().apiWrapperStructure.get())
     {
-        return JSAPIValueWrapper::create(exec, value);
     }
 
+    WriteBarrier<Unknown> m_value;
+};
+
+inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value)
+{
+    return JSAPIValueWrapper::create(exec, value);
+}
+
 } // namespace JSC
 
 #endif // JSAPIValueWrapper_h
index e1bfc3a..6487ca6 100644 (file)
 
 namespace JSC {
 
-    class ExecutableBase;
-    class FunctionExecutable;
-    class FunctionPrototype;
-    class JSActivation;
-    class JSGlobalObject;
-    class LLIntOffsetsExtractor;
-    class NativeExecutable;
-    class SourceCode;
-    namespace DFG {
-    class SpeculativeJIT;
-    class JITCompiler;
+class ExecutableBase;
+class FunctionExecutable;
+class FunctionPrototype;
+class JSActivation;
+class JSGlobalObject;
+class LLIntOffsetsExtractor;
+class NativeExecutable;
+class SourceCode;
+namespace DFG {
+class SpeculativeJIT;
+class JITCompiler;
+}
+
+JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+
+JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
+    
+class JSFunction : public JSDestructibleObject {
+    friend class JIT;
+    friend class DFG::SpeculativeJIT;
+    friend class DFG::JITCompiler;
+    friend class VM;
+
+public:
+    typedef JSDestructibleObject Base;
+
+    JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
+
+    static JSFunction* create(VM& vm, FunctionExecutable* executable, JSScope* scope)
+    {
+        JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, executable, scope);
+        ASSERT(function->structure()->globalObject());
+        function->finishCreation(vm);
+        return function;
     }
 
-    JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+    static JSFunction* createBuiltinFunction(VM&, FunctionExecutable*, JSGlobalObject*);
 
-    JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
-    
-    class JSFunction : public JSDestructibleObject {
-        friend class JIT;
-        friend class DFG::SpeculativeJIT;
-        friend class DFG::JITCompiler;
-        friend class VM;
-
-    public:
-        typedef JSDestructibleObject Base;
-
-        JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
-
-        static JSFunction* create(VM& vm, FunctionExecutable* executable, JSScope* scope)
-        {
-            JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, executable, scope);
-            ASSERT(function->structure()->globalObject());
-            function->finishCreation(vm);
-            return function;
-        }
-        
-        static JSFunction* createBuiltinFunction(VM&, FunctionExecutable*, JSGlobalObject*);
-        
-        static void destroy(JSCell*);
-        
-        JS_EXPORT_PRIVATE String name(ExecState*);
-        JS_EXPORT_PRIVATE String displayName(ExecState*);
-        const String calculatedDisplayName(ExecState*);
-
-        JSScope* scope()
-        {
-            ASSERT(!isHostFunctionNonInline());
-            return m_scope.get();
-        }
-        // This method may be called for host functins, in which case it
-        // will return an arbitrary value. This should only be used for
-        // optimized paths in which the return value does not matter for
-        // host functions, and checking whether the function is a host
-        // function is deemed too expensive.
-        JSScope* scopeUnchecked()
-        {
-            return m_scope.get();
-        }
-        void setScope(VM& vm, JSScope* scope)
-        {
-            ASSERT(!isHostFunctionNonInline());
-            m_scope.set(vm, this, scope);
-        }
-        void addNameScopeIfNeeded(VM&);
-
-        ExecutableBase* executable() const { return m_executable.get(); }
-
-        // To call either of these methods include Executable.h
-        bool isHostFunction() const;
-        FunctionExecutable* jsExecutable() const;
-
-        JS_EXPORT_PRIVATE const SourceCode* sourceCode() const;
-
-        DECLARE_EXPORT_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
-        {
-            ASSERT(globalObject);
-            return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info()); 
-        }
-
-        NativeFunction nativeFunction();
-        NativeFunction nativeConstructor();
-
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-
-        static inline ptrdiff_t offsetOfScopeChain()
-        {
-            return OBJECT_OFFSETOF(JSFunction, m_scope);
-        }
-
-        static inline ptrdiff_t offsetOfExecutable()
-        {
-            return OBJECT_OFFSETOF(JSFunction, m_executable);
-        }
-
-        static inline ptrdiff_t offsetOfAllocationProfile()
-        {
-            return OBJECT_OFFSETOF(JSFunction, m_allocationProfile);
-        }
-
-        ObjectAllocationProfile* allocationProfile(ExecState* exec, unsigned inlineCapacity)
-        {
-            if (UNLIKELY(m_allocationProfile.isNull()))
-                return createAllocationProfile(exec, inlineCapacity);
-            return &m_allocationProfile;
-        }
-        
-        Structure* allocationStructure() { return m_allocationProfile.structure(); }
-
-        InlineWatchpointSet& allocationProfileWatchpointSet()
-        {
-            return m_allocationProfileWatchpoint;
-        }
-
-        bool isHostOrBuiltinFunction() const;
-        bool isBuiltinFunction() const;
-        JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
-
-    protected:
-        const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesGetPropertyNames | JSObject::StructureFlags;
-
-        JS_EXPORT_PRIVATE JSFunction(VM&, JSGlobalObject*, Structure*);
-        JSFunction(VM&, FunctionExecutable*, JSScope*);
-        
-        void finishCreation(VM&, NativeExecutable*, int length, const String& name);
-        using Base::finishCreation;
-
-        ObjectAllocationProfile* createAllocationProfile(ExecState*, size_t inlineCapacity);
-
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-        static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode = ExcludeDontEnumProperties);
-        static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
-
-        static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
-
-        static bool deleteProperty(JSCell*, ExecState*, PropertyName);
-
-        static void visitChildren(JSCell*, SlotVisitor&);
-
-    private:
-        friend class LLIntOffsetsExtractor;
-        
-        static EncodedJSValue argumentsGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-        static EncodedJSValue callerGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-        static EncodedJSValue lengthGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-        static EncodedJSValue nameGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-
-        WriteBarrier<ExecutableBase> m_executable;
-        WriteBarrier<JSScope> m_scope;
-        ObjectAllocationProfile m_allocationProfile;
-        InlineWatchpointSet m_allocationProfileWatchpoint;
-    };
+    static void destroy(JSCell*);
+
+    JS_EXPORT_PRIVATE String name(ExecState*);
+    JS_EXPORT_PRIVATE String displayName(ExecState*);
+    const String calculatedDisplayName(ExecState*);
+
+    JSScope* scope()
+    {
+        ASSERT(!isHostFunctionNonInline());
+        return m_scope.get();
+    }
+    // This method may be called for host functins, in which case it
+    // will return an arbitrary value. This should only be used for
+    // optimized paths in which the return value does not matter for
+    // host functions, and checking whether the function is a host
+    // function is deemed too expensive.
+    JSScope* scopeUnchecked()
+    {
+        return m_scope.get();
+    }
+    void setScope(VM& vm, JSScope* scope)
+    {
+        ASSERT(!isHostFunctionNonInline());
+        m_scope.set(vm, this, scope);
+    }
+    void addNameScopeIfNeeded(VM&);
+
+    ExecutableBase* executable() const { return m_executable.get(); }
+
+    // To call either of these methods include Executable.h
+    bool isHostFunction() const;
+    FunctionExecutable* jsExecutable() const;
+
+    JS_EXPORT_PRIVATE const SourceCode* sourceCode() const;
+
+    DECLARE_EXPORT_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
+    {
+        ASSERT(globalObject);
+        return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info()); 
+    }
+
+    NativeFunction nativeFunction();
+    NativeFunction nativeConstructor();
+
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+
+    static inline ptrdiff_t offsetOfScopeChain()
+    {
+        return OBJECT_OFFSETOF(JSFunction, m_scope);
+    }
+
+    static inline ptrdiff_t offsetOfExecutable()
+    {
+        return OBJECT_OFFSETOF(JSFunction, m_executable);
+    }
+
+    static inline ptrdiff_t offsetOfAllocationProfile()
+    {
+        return OBJECT_OFFSETOF(JSFunction, m_allocationProfile);
+    }
+
+    ObjectAllocationProfile* allocationProfile(ExecState* exec, unsigned inlineCapacity)
+    {
+        if (UNLIKELY(m_allocationProfile.isNull()))
+            return createAllocationProfile(exec, inlineCapacity);
+        return &m_allocationProfile;
+    }
+
+    Structure* allocationStructure() { return m_allocationProfile.structure(); }
+
+    InlineWatchpointSet& allocationProfileWatchpointSet()
+    {
+        return m_allocationProfileWatchpoint;
+    }
+
+    bool isHostOrBuiltinFunction() const;
+    bool isBuiltinFunction() const;
+    JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
+
+protected:
+    const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+    JS_EXPORT_PRIVATE JSFunction(VM&, JSGlobalObject*, Structure*);
+    JSFunction(VM&, FunctionExecutable*, JSScope*);
+
+    void finishCreation(VM&, NativeExecutable*, int length, const String& name);
+    using Base::finishCreation;
+
+    ObjectAllocationProfile* createAllocationProfile(ExecState*, size_t inlineCapacity);
+
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode = ExcludeDontEnumProperties);
+    static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
+
+    static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+
+    static bool deleteProperty(JSCell*, ExecState*, PropertyName);
+
+    static void visitChildren(JSCell*, SlotVisitor&);
+
+private:
+    friend class LLIntOffsetsExtractor;
+
+    static EncodedJSValue argumentsGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
+    static EncodedJSValue callerGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
+    static EncodedJSValue lengthGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
+    static EncodedJSValue nameGetter(ExecState*, JSObject*, EncodedJSValue, PropertyName);
+
+    WriteBarrier<ExecutableBase> m_executable;
+    WriteBarrier<JSScope> m_scope;
+    ObjectAllocationProfile m_allocationProfile;
+    InlineWatchpointSet m_allocationProfileWatchpoint;
+};
 
 } // namespace JSC
 
index f4a34eb..c4339c0 100644 (file)
 
 namespace JSC {
 
-    // To make it safe to use JavaScript on multiple threads, it is
-    // important to lock before doing anything that allocates a
-    // JavaScript data structure or that interacts with shared state
-    // such as the protect count hash table. The simplest way to lock
-    // is to create a local JSLockHolder object in the scope where the lock 
-    // must be held and pass it the context that requires protection. 
-    // The lock is recursive so nesting is ok. The JSLock 
-    // object also acts as a convenience short-hand for running important
-    // initialization routines.
-
-    // To avoid deadlock, sometimes it is necessary to temporarily
-    // release the lock. Since it is recursive you actually have to
-    // release all locks held by your thread. This is safe to do if
-    // you are executing code that doesn't require the lock, and you
-    // reacquire the right number of locks at the end. You can do this
-    // by constructing a locally scoped JSLock::DropAllLocks object. The 
-    // DropAllLocks object takes care to release the JSLock only if your
-    // thread acquired it to begin with.
-
-    class ExecState;
-    class VM;
-
-    // This class is used to protect the initialization of the legacy single 
-    // shared VM.
-    class GlobalJSLock {
-        WTF_MAKE_NONCOPYABLE(GlobalJSLock);
+// To make it safe to use JavaScript on multiple threads, it is
+// important to lock before doing anything that allocates a
+// JavaScript data structure or that interacts with shared state
+// such as the protect count hash table. The simplest way to lock
+// is to create a local JSLockHolder object in the scope where the lock 
+// must be held and pass it the context that requires protection. 
+// The lock is recursive so nesting is ok. The JSLock 
+// object also acts as a convenience short-hand for running important
+// initialization routines.
+
+// To avoid deadlock, sometimes it is necessary to temporarily
+// release the lock. Since it is recursive you actually have to
+// release all locks held by your thread. This is safe to do if
+// you are executing code that doesn't require the lock, and you
+// reacquire the right number of locks at the end. You can do this
+// by constructing a locally scoped JSLock::DropAllLocks object. The 
+// DropAllLocks object takes care to release the JSLock only if your
+// thread acquired it to begin with.
+
+class ExecState;
+class VM;
+
+// This class is used to protect the initialization of the legacy single 
+// shared VM.
+class GlobalJSLock {
+    WTF_MAKE_NONCOPYABLE(GlobalJSLock);
+public:
+    JS_EXPORT_PRIVATE GlobalJSLock();
+    JS_EXPORT_PRIVATE ~GlobalJSLock();
+
+    static void initialize();
+private:
+    static std::mutex* s_sharedInstanceMutex;
+};
+
+class JSLockHolder {
+public:
+    JS_EXPORT_PRIVATE JSLockHolder(VM*);
+    JS_EXPORT_PRIVATE JSLockHolder(VM&);
+    JS_EXPORT_PRIVATE JSLockHolder(ExecState*);
+
+    JS_EXPORT_PRIVATE ~JSLockHolder();
+private:
+    void init();
+
+    RefPtr<VM> m_vm;
+};
+
+class JSLock : public ThreadSafeRefCounted<JSLock> {
+    WTF_MAKE_NONCOPYABLE(JSLock);
+public:
+    JSLock(VM*);
+    JS_EXPORT_PRIVATE ~JSLock();
+
+    JS_EXPORT_PRIVATE void lock();
+    JS_EXPORT_PRIVATE void unlock();
+
+    static void lock(ExecState*);
+    static void unlock(ExecState*);
+    static void lock(VM&);
+    static void unlock(VM&);
+
+    VM* vm() { return m_vm; }
+
+    bool hasExclusiveThread() const { return m_hasExclusiveThread; }
+    std::thread::id exclusiveThread() const
+    {
+        ASSERT(m_hasExclusiveThread);
+        return m_ownerThreadID;
+    }
+    JS_EXPORT_PRIVATE void setExclusiveThread(std::thread::id);
+    JS_EXPORT_PRIVATE bool currentThreadIsHoldingLock();
+
+    void willDestroyVM(VM*);
+
+    class DropAllLocks {
+        WTF_MAKE_NONCOPYABLE(DropAllLocks);
     public:
-        JS_EXPORT_PRIVATE GlobalJSLock();
-        JS_EXPORT_PRIVATE ~GlobalJSLock();
+        JS_EXPORT_PRIVATE DropAllLocks(ExecState*);
+        JS_EXPORT_PRIVATE DropAllLocks(VM*);
+        JS_EXPORT_PRIVATE DropAllLocks(VM&);
+        JS_EXPORT_PRIVATE ~DropAllLocks();
 
-        static void initialize();
-    private:
-        static std::mutex* s_sharedInstanceMutex;
-    };
+        void setDropDepth(unsigned depth) { m_dropDepth = depth; }
+        unsigned dropDepth() const { return m_dropDepth; }
 
-    class JSLockHolder {
-    public:
-        JS_EXPORT_PRIVATE JSLockHolder(VM*);
-        JS_EXPORT_PRIVATE JSLockHolder(VM&);
-        JS_EXPORT_PRIVATE JSLockHolder(ExecState*);
-
-        JS_EXPORT_PRIVATE ~JSLockHolder();
     private:
-        void init();
-
+        intptr_t m_droppedLockCount;
         RefPtr<VM> m_vm;
+        unsigned m_dropDepth;
     };
 
-    class JSLock : public ThreadSafeRefCounted<JSLock> {
-        WTF_MAKE_NONCOPYABLE(JSLock);
-    public:
-        JSLock(VM*);
-        JS_EXPORT_PRIVATE ~JSLock();
-
-        JS_EXPORT_PRIVATE void lock();
-        JS_EXPORT_PRIVATE void unlock();
-
-        static void lock(ExecState*);
-        static void unlock(ExecState*);
-        static void lock(VM&);
-        static void unlock(VM&);
-
-        VM* vm() { return m_vm; }
-
-        bool hasExclusiveThread() const { return m_hasExclusiveThread; }
-        std::thread::id exclusiveThread() const
-        {
-            ASSERT(m_hasExclusiveThread);
-            return m_ownerThreadID;
-        }
-        JS_EXPORT_PRIVATE void setExclusiveThread(std::thread::id);
-        JS_EXPORT_PRIVATE bool currentThreadIsHoldingLock();
-
-        void willDestroyVM(VM*);
-
-        class DropAllLocks {
-            WTF_MAKE_NONCOPYABLE(DropAllLocks);
-        public:
-            JS_EXPORT_PRIVATE DropAllLocks(ExecState*);
-            JS_EXPORT_PRIVATE DropAllLocks(VM*);
-            JS_EXPORT_PRIVATE DropAllLocks(VM&);
-            JS_EXPORT_PRIVATE ~DropAllLocks();
-            
-            void setDropDepth(unsigned depth) { m_dropDepth = depth; }
-            unsigned dropDepth() const { return m_dropDepth; }
-
-        private:
-            intptr_t m_droppedLockCount;
-            RefPtr<VM> m_vm;
-            unsigned m_dropDepth;
-        };
+private:
+    void lock(intptr_t lockCount);
+    void unlock(intptr_t unlockCount);
 
-    private:
-        void lock(intptr_t lockCount);
-        void unlock(intptr_t unlockCount);
-
-        void didAcquireLock();
-        void willReleaseLock();
-
-        unsigned dropAllLocks(DropAllLocks*);
-        void grabAllLocks(DropAllLocks*, unsigned lockCount);
-
-        std::mutex m_lock;
-        std::thread::id m_ownerThreadID;
-        intptr_t m_lockCount;
-        unsigned m_lockDropDepth;
-        bool m_hasExclusiveThread;
-        VM* m_vm;
-        AtomicStringTable* m_entryAtomicStringTable; 
-    };
+    void didAcquireLock();
+    void willReleaseLock();
+
+    unsigned dropAllLocks(DropAllLocks*);
+    void grabAllLocks(DropAllLocks*, unsigned lockCount);
+
+    std::mutex m_lock;
+    std::thread::id m_ownerThreadID;
+    intptr_t m_lockCount;
+    unsigned m_lockDropDepth;
+    bool m_hasExclusiveThread;
+    VM* m_vm;
+    AtomicStringTable* m_entryAtomicStringTable; 
+};
 
 } // namespace
 
index a841002..e7c0a04 100644 (file)
 
 namespace JSC {
 
-    // This unholy class is used to allow us to avoid multiple exception checks
-    // in certain SquirrelFish bytecodes -- effectively it just silently consumes
-    // any operations performed on the result of a failed toObject call.
-    class JSNotAnObject : public JSNonFinalObject {
-    private:
-        explicit JSNotAnObject(VM& vm)
-            : JSNonFinalObject(vm, vm.notAnObjectStructure.get())
-        {
-        }
-        
-    public:
-        typedef JSNonFinalObject Base;
-
-        static JSNotAnObject* create(VM& vm)
-        {
-            JSNotAnObject* object = new (NotNull, allocateCell<JSNotAnObject>(vm.heap)) JSNotAnObject(vm);
-            object->finishCreation(vm);
-            return object;
-        }
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-        DECLARE_INFO;
-
-     private:
-        
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | JSObject::StructureFlags;
-
-        // JSValue methods
-        static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
-
-        // JSObject methods
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-        static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
-
-        static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
-        static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
-
-        static bool deleteProperty(JSCell*, ExecState*, PropertyName);
-        static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
-
-        static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
-    };
+// This unholy class is used to allow us to avoid multiple exception checks
+// in certain SquirrelFish bytecodes -- effectively it just silently consumes
+// any operations performed on the result of a failed toObject call.
+class JSNotAnObject : public JSNonFinalObject {
+private:
+    explicit JSNotAnObject(VM& vm)
+        : JSNonFinalObject(vm, vm.notAnObjectStructure.get())
+    {
+    }
+
+public:
+    typedef JSNonFinalObject Base;
+
+    static JSNotAnObject* create(VM& vm)
+    {
+        JSNotAnObject* object = new (NotNull, allocateCell<JSNotAnObject>(vm.heap)) JSNotAnObject(vm);
+        object->finishCreation(vm);
+        return object;
+    }
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+    DECLARE_INFO;
+
+private:
+
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+    // JSValue methods
+    static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
+
+    // JSObject methods
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
+
+    static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+    static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
+
+    static bool deleteProperty(JSCell*, ExecState*, PropertyName);
+    static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
+
+    static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+};
 
 } // namespace JSC
 
index cacfc5d..fc4dc86 100644 (file)
 
 namespace JSC {
 
-    class Stringifier;
+class Stringifier;
 
-    class JSONObject : public JSNonFinalObject {
-    public:
-        typedef JSNonFinalObject Base;
+class JSONObject : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
 
-        static JSONObject* create(VM& vm, Structure* structure)
-        {
-            JSONObject* object = new (NotNull, allocateCell<JSONObject>(vm.heap)) JSONObject(vm, structure);
-            object->finishCreation(vm);
-            return object;
-        }
-        
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-        
-        DECLARE_INFO;
+    static JSONObject* create(VM& vm, Structure* structure)
+    {
+        JSONObject* object = new (NotNull, allocateCell<JSONObject>(vm.heap)) JSONObject(vm, structure);
+        object->finishCreation(vm);
+        return object;
+    }
 
-    protected:
-        void finishCreation(VM&);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    private:
-        JSONObject(VM&, Structure*);
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    DECLARE_INFO;
 
-    };
+protected:
+    void finishCreation(VM&);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
 
-    JS_EXPORT_PRIVATE JSValue JSONParse(ExecState*, const String&);
-    JS_EXPORT_PRIVATE String JSONStringify(ExecState*, JSValue, unsigned indent);
+private:
+    JSONObject(VM&, Structure*);
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
 
-    void escapeStringToBuilder(StringBuilder&, const String&);
+JS_EXPORT_PRIVATE JSValue JSONParse(ExecState*, const String&);
+JS_EXPORT_PRIVATE String JSONStringify(ExecState*, JSValue, unsigned indent);
+
+void escapeStringToBuilder(StringBuilder&, const String&);
     
 } // namespace JSC
 
index 2213f82..08c6d17 100644 (file)
 
 namespace JSC {
 
-    class JSString;
-    class JSRopeString;
-    class LLIntOffsetsExtractor;
-
-    JSString* jsEmptyString(VM*);
-    JSString* jsEmptyString(ExecState*);
-    JSString* jsString(VM*, const String&); // returns empty string if passed null string
-    JSString* jsString(ExecState*, const String&); // returns empty string if passed null string
-
-    JSString* jsSingleCharacterString(VM*, UChar);
-    JSString* jsSingleCharacterString(ExecState*, UChar);
-    JSString* jsSingleCharacterSubstring(ExecState*, const String&, unsigned offset);
-    JSString* jsSubstring(VM*, const String&, unsigned offset, unsigned length);
-    JSString* jsSubstring(ExecState*, const String&, unsigned offset, unsigned length);
-
-    // Non-trivial strings are two or more characters long.
-    // These functions are faster than just calling jsString.
-    JSString* jsNontrivialString(VM*, const String&);
-    JSString* jsNontrivialString(ExecState*, const String&);
-
-    // Should be used for strings that are owned by an object that will
-    // likely outlive the JSValue this makes, such as the parse tree or a
-    // DOM object that contains a String
-    JSString* jsOwnedString(VM*, const String&);
-    JSString* jsOwnedString(ExecState*, const String&);
-
-    JSRopeString* jsStringBuilder(VM*);
-
-    class JSString : public JSCell {
-    public:
-        friend class JIT;
-        friend class VM;
-        friend class SpecializedThunkJIT;
-        friend class JSRopeString;
-        friend class MarkStack;
-        friend class SlotVisitor;
-        friend struct ThunkHelpers;
-
-        typedef JSCell Base;
-
-        static const bool needsDestruction = true;
-        static const bool hasImmortalStructure = true;
-        static void destroy(JSCell*);
-
-    private:
-        JSString(VM& vm, PassRefPtr<StringImpl> value)
-            : JSCell(vm, vm.stringStructure.get())
-            , m_flags(0)
-            , m_value(value)
-        {
-        }
+class JSString;
+class JSRopeString;
+class LLIntOffsetsExtractor;
+
+JSString* jsEmptyString(VM*);
+JSString* jsEmptyString(ExecState*);
+JSString* jsString(VM*, const String&); // returns empty string if passed null string
+JSString* jsString(ExecState*, const String&); // returns empty string if passed null string
+
+JSString* jsSingleCharacterString(VM*, UChar);
+JSString* jsSingleCharacterString(ExecState*, UChar);
+JSString* jsSingleCharacterSubstring(ExecState*, const String&, unsigned offset);
+JSString* jsSubstring(VM*, const String&, unsigned offset, unsigned length);
+JSString* jsSubstring(ExecState*, const String&, unsigned offset, unsigned length);
+
+// Non-trivial strings are two or more characters long.
+// These functions are faster than just calling jsString.
+JSString* jsNontrivialString(VM*, const String&);
+JSString* jsNontrivialString(ExecState*, const String&);
+
+// Should be used for strings that are owned by an object that will
+// likely outlive the JSValue this makes, such as the parse tree or a
+// DOM object that contains a String
+JSString* jsOwnedString(VM*, const String&);
+JSString* jsOwnedString(ExecState*, const String&);
+
+JSRopeString* jsStringBuilder(VM*);
+
+class JSString : public JSCell {
+public:
+    friend class JIT;
+    friend class VM;
+    friend class SpecializedThunkJIT;
+    friend class JSRopeString;
+    friend class MarkStack;
+    friend class SlotVisitor;
+    friend struct ThunkHelpers;
+
+    typedef JSCell Base;
+
+    static const bool needsDestruction = true;
+    static const bool hasImmortalStructure = true;
+    static void destroy(JSCell*);
+
+private:
+    JSString(VM& vm, PassRefPtr<StringImpl> value)
+        : JSCell(vm, vm.stringStructure.get())
+        , m_flags(0)
+        , m_value(value)
+    {
+    }
 
-        JSString(VM& vm)
-            : JSCell(vm, vm.stringStructure.get())
-            , m_flags(0)
-        {
-        }
+    JSString(VM& vm)
+        : JSCell(vm, vm.stringStructure.get())
+        , m_flags(0)
+    {
+    }
 
-        void finishCreation(VM& vm, size_t length)
-        {
-            ASSERT(!m_value.isNull());
-            Base::finishCreation(vm);
-            m_length = length;
-            setIs8Bit(m_value.impl()->is8Bit());
-            vm.m_newStringsSinceLastHashCons++;
-        }
+    void finishCreation(VM& vm, size_t length)
+    {
+        ASSERT(!m_value.isNull());
+        Base::finishCreation(vm);
+        m_length = length;
+        setIs8Bit(m_value.impl()->is8Bit());
+        vm.m_newStringsSinceLastHashCons++;
+    }
 
-        void finishCreation(VM& vm, size_t length, size_t cost)
-        {
-            ASSERT(!m_value.isNull());
-            Base::finishCreation(vm);
-            m_length = length;
-            setIs8Bit(m_value.impl()->is8Bit());
-            Heap::heap(this)->reportExtraMemoryCost(cost);
-            vm.m_newStringsSinceLastHashCons++;
-        }
+    void finishCreation(VM& vm, size_t length, size_t cost)
+    {
+        ASSERT(!m_value.isNull());
+        Base::finishCreation(vm);
+        m_length = length;
+        setIs8Bit(m_value.impl()->is8Bit());
+        Heap::heap(this)->reportExtraMemoryCost(cost);
+        vm.m_newStringsSinceLastHashCons++;
+    }
 
-    protected:
-        void finishCreation(VM& vm)
-        {
-            Base::finishCreation(vm);
-            m_length = 0;
-            setIs8Bit(true);
-            vm.m_newStringsSinceLastHashCons++;
-        }
-            
-    public:
-        static JSString* create(VM& vm, PassRefPtr<StringImpl> value)
-        {
-            ASSERT(value);
-            int32_t length = value->length();
-            RELEASE_ASSERT(length >= 0);
-            size_t cost = value->cost();
-            JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, value);
-            newString->finishCreation(vm, length, cost);
-            return newString;
-        }
-        static JSString* createHasOtherOwner(VM& vm, PassRefPtr<StringImpl> value)
-        {
-            ASSERT(value);
-            size_t length = value->length();
-            JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, value);
-            newString->finishCreation(vm, length);
-            return newString;
-        }
+protected:
+    void finishCreation(VM& vm)
+    {
+        Base::finishCreation(vm);
+        m_length = 0;
+        setIs8Bit(true);
+        vm.m_newStringsSinceLastHashCons++;
+    }
 
-        Identifier toIdentifier(ExecState*) const;
-        AtomicString toAtomicString(ExecState*) const;
-        AtomicStringImpl* toExistingAtomicString(ExecState*) const;
-        const String& value(ExecState*) const;
-        const String& tryGetValue() const;
-        const StringImpl* tryGetValueImpl() const;
-        unsigned length() const { return m_length; }
-
-        JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
-        JS_EXPORT_PRIVATE bool toBoolean() const;
-        bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
-        JSObject* toObject(ExecState*, JSGlobalObject*) const;
-        double toNumber(ExecState*) const;
-            
-        bool getStringPropertySlot(ExecState*, PropertyName, PropertySlot&);
-        bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
-        bool getStringPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&);
-
-        bool canGetIndex(unsigned i) { return i < m_length; }
-        JSString* getIndex(ExecState*, unsigned);
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
-        {
-            return Structure::create(vm, globalObject, proto, TypeInfo(StringType, StructureFlags), info());
-        }
+public:
+    static JSString* create(VM& vm, PassRefPtr<StringImpl> value)
+    {
+        ASSERT(value);
+        int32_t length = value->length();
+        RELEASE_ASSERT(length >= 0);
+        size_t cost = value->cost();
+        JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, value);
+        newString->finishCreation(vm, length, cost);
+        return newString;
+    }
+    static JSString* createHasOtherOwner(VM& vm, PassRefPtr<StringImpl> value)
+    {
+        ASSERT(value);
+        size_t length = value->length();
+        JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, value);
+        newString->finishCreation(vm, length);
+        return newString;
+    }
 
-        static size_t offsetOfLength() { return OBJECT_OFFSETOF(JSString, m_length); }
-        static size_t offsetOfFlags() { return OBJECT_OFFSETOF(JSString, m_flags); }
-        static size_t offsetOfValue() { return OBJECT_OFFSETOF(JSString, m_value); }
+    Identifier toIdentifier(ExecState*) const;
+    AtomicString toAtomicString(ExecState*) const;
+    AtomicStringImpl* toExistingAtomicString(ExecState*) const;
+    const String& value(ExecState*) const;
+    const String& tryGetValue() const;
+    const StringImpl* tryGetValueImpl() const;
+    unsigned length() const { return m_length; }
 
-        DECLARE_EXPORT_INFO;
+    JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
+    JS_EXPORT_PRIVATE bool toBoolean() const;
+    bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
+    JSObject* toObject(ExecState*, JSGlobalObject*) const;
+    double toNumber(ExecState*) const;
 
-        static void dumpToStream(const JSCell*, PrintStream&);
-        static void visitChildren(JSCell*, SlotVisitor&);
+    bool getStringPropertySlot(ExecState*, PropertyName, PropertySlot&);
+    bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+    bool getStringPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&);
 
-        enum {
-            HashConsLock = 1u << 2,
-            IsHashConsSingleton = 1u << 1,
-            Is8Bit = 1u
-        };
+    bool canGetIndex(unsigned i) { return i < m_length; }
+    JSString* getIndex(ExecState*, unsigned);
 
-    protected:
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | StructureIsImmortal;
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
+    {
+        return Structure::create(vm, globalObject, proto, TypeInfo(StringType, StructureFlags), info());
+    }
 
-        friend class JSValue;
-            
-        bool isRope() const { return m_value.isNull(); }
-        bool is8Bit() const { return m_flags & Is8Bit; }
-        void setIs8Bit(bool flag) const
-        {
-            if (flag)
-                m_flags |= Is8Bit;
-            else
-                m_flags &= ~Is8Bit;
-        }
-        bool shouldTryHashCons();
-        bool isHashConsSingleton() const { return m_flags & IsHashConsSingleton; }
-        void clearHashConsSingleton() { m_flags &= ~IsHashConsSingleton; }
-        void setHashConsSingleton() { m_flags |= IsHashConsSingleton; }
-        bool tryHashConsLock();
-        void releaseHashConsLock();
-
-        mutable unsigned m_flags;
-            
-        // A string is represented either by a String or a rope of fibers.
-        unsigned m_length;
-        mutable String m_value;
+    static size_t offsetOfLength() { return OBJECT_OFFSETOF(JSString, m_length); }
+    static size_t offsetOfFlags() { return OBJECT_OFFSETOF(JSString, m_flags); }
+    static size_t offsetOfValue() { return OBJECT_OFFSETOF(JSString, m_value); }
 
-    private:
-        friend class LLIntOffsetsExtractor;
-            
-        static JSValue toThis(JSCell*, ExecState*, ECMAMode);
+    DECLARE_EXPORT_INFO;
 
-        String& string() { ASSERT(!isRope()); return m_value; }
+    static void dumpToStream(const JSCell*, PrintStream&);
+    static void visitChildren(JSCell*, SlotVisitor&);
 
-        friend JSValue jsString(ExecState*, JSString*, JSString*);
-        friend JSString* jsSubstring(ExecState*, JSString*, unsigned offset, unsigned length);
+    enum {
+        HashConsLock = 1u << 2,
+        IsHashConsSingleton = 1u << 1,
+        Is8Bit = 1u
     };
 
-    class JSRopeString : public JSString {
-        friend class JSString;
+protected:
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | StructureIsImmortal;
 
-        friend JSRopeString* jsStringBuilder(VM*);
+    friend class JSValue;
 
-        class RopeBuilder {
-        public:
-            RopeBuilder(VM& vm)
-                : m_vm(vm)
-                , m_jsString(jsStringBuilder(&vm))
-                , m_index(0)
-            {
-            }
+    bool isRope() const { return m_value.isNull(); }
+    bool is8Bit() const { return m_flags & Is8Bit; }
+    void setIs8Bit(bool flag) const
+    {
+        if (flag)
+            m_flags |= Is8Bit;
+        else
+            m_flags &= ~Is8Bit;
+    }
+    bool shouldTryHashCons();
+    bool isHashConsSingleton() const { return m_flags & IsHashConsSingleton; }
+    void clearHashConsSingleton() { m_flags &= ~IsHashConsSingleton; }
+    void setHashConsSingleton() { m_flags |= IsHashConsSingleton; }
+    bool tryHashConsLock();
+    void releaseHashConsLock();
 
-            bool append(JSString* jsString)
-            {
-                if (m_index == JSRopeString::s_maxInternalRopeLength)
-                    expand();
-                if (static_cast<int32_t>(m_jsString->length() + jsString->length()) < 0) {
-                    m_jsString = nullptr;
-                    return false;
-                }
-                m_jsString->append(m_vm, m_index++, jsString);
-                return true;
-            }
+    mutable unsigned m_flags;
 
-            JSRopeString* release()
-            {
-                RELEASE_ASSERT(m_jsString);
-                JSRopeString* tmp = m_jsString;
-                m_jsString = 0;
-                return tmp;
-            }
+    // A string is represented either by a String or a rope of fibers.
+    unsigned m_length;
+    mutable String m_value;
 
-            unsigned length() const { return m_jsString->m_length; }
+private:
+    friend class LLIntOffsetsExtractor;
 
-        private:
-            void expand();
-                
-            VM& m_vm;
-            JSRopeString* m_jsString;
-            size_t m_index;
-        };
-            
-    private:
-        JSRopeString(VM& vm)
-            : JSString(vm)
-        {
-        }
+    static JSValue toThis(JSCell*, ExecState*, ECMAMode);
 
-        void finishCreation(VM& vm, JSString* s1, JSString* s2)
-        {
-            Base::finishCreation(vm);
-            m_length = s1->length() + s2->length();
-            setIs8Bit(s1->is8Bit() && s2->is8Bit());
-            setIsSubstring(false);
-            fiber(0).set(vm, this, s1);
-            fiber(1).set(vm, this, s2);
-            fiber(2).clear();
-        }
-            
-        void finishCreation(VM& vm, JSString* s1, JSString* s2, JSString* s3)
-        {
-            Base::finishCreation(vm);
-            m_length = s1->length() + s2->length() + s3->length();
-            setIs8Bit(s1->is8Bit() && s2->is8Bit() &&  s3->is8Bit());
-            setIsSubstring(false);
-            fiber(0).set(vm, this, s1);
-            fiber(1).set(vm, this, s2);
-            fiber(2).set(vm, this, s3);
-        }
-        
-        void finishCreation(VM& vm, JSString* base, unsigned offset, unsigned length)
-        {
-            Base::finishCreation(vm);
-            ASSERT(!base->isRope());
-            ASSERT(!sumOverflows<int32_t>(offset, length));
-            ASSERT(offset + length <= base->length());
-            m_length = length;
-            setIs8Bit(base->is8Bit());
-            setIsSubstring(true);
-            substringBase().set(vm, this, base);
-            substringOffset() = offset;
-        }
+    String& string() { ASSERT(!isRope()); return m_value; }
 
-        void finishCreation(VM& vm)
-        {
-            JSString::finishCreation(vm);
-            setIsSubstring(false);
-            fiber(0).clear();
-            fiber(1).clear();
-            fiber(2).clear();
-        }
+    friend JSValue jsString(ExecState*, JSString*, JSString*);
+    friend JSString* jsSubstring(ExecState*, JSString*, unsigned offset, unsigned length);
+};
 
-        void append(VM& vm, size_t index, JSString* jsString)
-        {
-            fiber(index).set(vm, this, jsString);
-            m_length += jsString->m_length;
-            RELEASE_ASSERT(static_cast<int32_t>(m_length) >= 0);
-            setIs8Bit(is8Bit() && jsString->is8Bit());
-        }
+class JSRopeString : public JSString {
+    friend class JSString;
 
-        static JSRopeString* createNull(VM& vm)
-        {
-            JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
-            newString->finishCreation(vm);
-            return newString;
-        }
+    friend JSRopeString* jsStringBuilder(VM*);
 
+    class RopeBuilder {
     public:
-        static JSString* create(VM& vm, JSString* s1, JSString* s2)
+        RopeBuilder(VM& vm)
+            : m_vm(vm)
+            , m_jsString(jsStringBuilder(&vm))
+            , m_index(0)
         {
-            JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
-            newString->finishCreation(vm, s1, s2);
-            return newString;
         }
-        static JSString* create(VM& vm, JSString* s1, JSString* s2, JSString* s3)
+
+        bool append(JSString* jsString)
         {
-            JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
-            newString->finishCreation(vm, s1, s2, s3);
-            return newString;
+            if (m_index == JSRopeString::s_maxInternalRopeLength)
+                expand();
+            if (static_cast<int32_t>(m_jsString->length() + jsString->length()) < 0) {
+                m_jsString = nullptr;
+                return false;
+            }
+            m_jsString->append(m_vm, m_index++, jsString);
+            return true;
         }
-        
-        static JSString* create(VM& vm, JSString* base, unsigned offset, unsigned length)
+
+        JSRopeString* release()
         {
-            JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
-            newString->finishCreation(vm, base, offset, length);
-            return newString;
+            RELEASE_ASSERT(m_jsString);
+            JSRopeString* tmp = m_jsString;
+            m_jsString = 0;
+            return tmp;
         }
 
-        void visitFibers(SlotVisitor&);
-            
-        static ptrdiff_t offsetOfFibers() { return OBJECT_OFFSETOF(JSRopeString, u); }
+        unsigned length() const { return m_jsString->m_length; }
 
-        static const unsigned s_maxInternalRopeLength = 3;
-            
     private:
-        friend JSValue jsStringFromRegisterArray(ExecState*, Register*, unsigned);
-        friend JSValue jsStringFromArguments(ExecState*, JSValue);
-
-        JS_EXPORT_PRIVATE void resolveRope(ExecState*) const;
-        JS_EXPORT_PRIVATE void resolveRopeToAtomicString(ExecState*) const;
-        JS_EXPORT_PRIVATE AtomicStringImpl* resolveRopeToExistingAtomicString(ExecState*) const;
-        void resolveRopeSlowCase8(LChar*) const;
-        void resolveRopeSlowCase(UChar*) const;
-        void outOfMemory(ExecState*) const;
-        void resolveRopeInternal8(LChar*) const;
-        void resolveRopeInternal8NoSubstring(LChar*) const;
-        void resolveRopeInternal16(UChar*) const;
-        void resolveRopeInternal16NoSubstring(UChar*) const;
-        void clearFibers() const;
-            
-        JS_EXPORT_PRIVATE JSString* getIndexSlowCase(ExecState*, unsigned);
-        
-        WriteBarrierBase<JSString>& fiber(unsigned i) const
-        {
-            ASSERT(!isSubstring());
-            ASSERT(i < s_maxInternalRopeLength);
-            return u[i].string;
-        }
-        
-        WriteBarrierBase<JSString>& substringBase() const
-        {
-            return u[1].string;
-        }
-        
-        uintptr_t& substringOffset() const
-        {
-            return u[2].number;
-        }
-        
-        static uintptr_t notSubstringSentinel()
-        {
-            return 0;
-        }
-        
-        static uintptr_t substringSentinel()
-        {
-            return 1;
-        }
-        
-        bool isSubstring() const
-        {
-            return u[0].number == substringSentinel();
-        }
-        
-        void setIsSubstring(bool isSubstring)
-        {
-            u[0].number = isSubstring ? substringSentinel() : notSubstringSentinel();
-        }
+        void expand();
 
-        mutable union {
-            uintptr_t number;
-            WriteBarrierBase<JSString> string;
-        } u[s_maxInternalRopeLength];
+        VM& m_vm;
+        JSRopeString* m_jsString;
+        size_t m_index;
     };
 
-
-    inline const StringImpl* JSString::tryGetValueImpl() const
+private:
+    JSRopeString(VM& vm)
+        : JSString(vm)
     {
-        return m_value.impl();
     }
 
-    JSString* asString(JSValue);
-
-    inline JSString* asString(JSValue value)
+    void finishCreation(VM& vm, JSString* s1, JSString* s2)
     {
-        ASSERT(value.asCell()->isString());
-        return jsCast<JSString*>(value.asCell());
+        Base::finishCreation(vm);
+        m_length = s1->length() + s2->length();
+        setIs8Bit(s1->is8Bit() && s2->is8Bit());
+        setIsSubstring(false);
+        fiber(0).set(vm, this, s1);
+        fiber(1).set(vm, this, s2);
+        fiber(2).clear();
     }
 
-    inline JSString* jsEmptyString(VM* vm)
+    void finishCreation(VM& vm, JSString* s1, JSString* s2, JSString* s3)
     {
-        return vm->smallStrings.emptyString();
+        Base::finishCreation(vm);
+        m_length = s1->length() + s2->length() + s3->length();
+        setIs8Bit(s1->is8Bit() && s2->is8Bit() &&  s3->is8Bit());
+        setIsSubstring(false);
+        fiber(0).set(vm, this, s1);
+        fiber(1).set(vm, this, s2);
+        fiber(2).set(vm, this, s3);
     }
 
-    ALWAYS_INLINE JSString* jsSingleCharacterString(VM* vm, UChar c)
+    void finishCreation(VM& vm, JSString* base, unsigned offset, unsigned length)
     {
-        if (c <= maxSingleCharacterString)
-            return vm->smallStrings.singleCharacterString(c);
-        return JSString::create(*vm, String(&c, 1).impl());
+        Base::finishCreation(vm);
+        ASSERT(!base->isRope());
+        ASSERT(!sumOverflows<int32_t>(offset, length));
+        ASSERT(offset + length <= base->length());
+        m_length = length;
+        setIs8Bit(base->is8Bit());
+        setIsSubstring(true);
+        substringBase().set(vm, this, base);
+        substringOffset() = offset;
     }
 
-    ALWAYS_INLINE JSString* jsSingleCharacterSubstring(ExecState* exec, const String& s, unsigned offset)
+    void finishCreation(VM& vm)
     {
-        VM* vm = &exec->vm();
-        ASSERT(offset < static_cast<unsigned>(s.length()));
-        UChar c = s.characterAt(offset);
-        if (c <= maxSingleCharacterString)
-            return vm->smallStrings.singleCharacterString(c);
-        return JSString::create(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, 1));
+        JSString::finishCreation(vm);
+        setIsSubstring(false);
+        fiber(0).clear();
+        fiber(1).clear();
+        fiber(2).clear();
     }
 
-    inline JSString* jsNontrivialString(VM* vm, const String& s)
+    void append(VM& vm, size_t index, JSString* jsString)
     {
-        ASSERT(s.length() > 1);
-        return JSString::create(*vm, s.impl());
+        fiber(index).set(vm, this, jsString);
+        m_length += jsString->m_length;
+        RELEASE_ASSERT(static_cast<int32_t>(m_length) >= 0);
+        setIs8Bit(is8Bit() && jsString->is8Bit());
     }
 
-    ALWAYS_INLINE Identifier JSString::toIdentifier(ExecState* exec) const
+    static JSRopeString* createNull(VM& vm)
     {
-        return Identifier(exec, toAtomicString(exec));
+        JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
+        newString->finishCreation(vm);
+        return newString;
     }
 
-    ALWAYS_INLINE AtomicString JSString::toAtomicString(ExecState* exec) const
+public:
+    static JSString* create(VM& vm, JSString* s1, JSString* s2)
     {
-        if (isRope())
-            static_cast<const JSRopeString*>(this)->resolveRopeToAtomicString(exec);
-        return AtomicString(m_value);
+        JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
+        newString->finishCreation(vm, s1, s2);
+        return newString;
     }
-
-    ALWAYS_INLINE AtomicStringImpl* JSString::toExistingAtomicString(ExecState* exec) const
+    static JSString* create(VM& vm, JSString* s1, JSString* s2, JSString* s3)
     {
-        if (isRope())
-            return static_cast<const JSRopeString*>(this)->resolveRopeToExistingAtomicString(exec);
-        if (m_value.impl()->isAtomic())
-            return static_cast<AtomicStringImpl*>(m_value.impl());
-        if (AtomicStringImpl* existingAtomicString = AtomicString::find(m_value.impl())) {
-            m_value = *existingAtomicString;
-            setIs8Bit(m_value.impl()->is8Bit());
-            return existingAtomicString;
-        }
-        return nullptr;
+        JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
+        newString->finishCreation(vm, s1, s2, s3);
+        return newString;
     }
 
-    inline const String& JSString::value(ExecState* exec) const
+    static JSString* create(VM& vm, JSString* base, unsigned offset, unsigned length)
     {
-        if (isRope())
-            static_cast<const JSRopeString*>(this)->resolveRope(exec);
-        return m_value;
+        JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(vm.heap)) JSRopeString(vm);
+        newString->finishCreation(vm, base, offset, length);
+        return newString;
     }
 
-    inline const String& JSString::tryGetValue() const
-    {
-        if (isRope())
-            static_cast<const JSRopeString*>(this)->resolveRope(0);
-        return m_value;
-    }
+    void visitFibers(SlotVisitor&);
 
-    inline JSString* JSString::getIndex(ExecState* exec, unsigned i)
-    {
-        ASSERT(canGetIndex(i));
-        if (isRope())
-            return static_cast<JSRopeString*>(this)->getIndexSlowCase(exec, i);
-        ASSERT(i < m_value.length());
-        return jsSingleCharacterSubstring(exec, m_value, i);
-    }
+    static ptrdiff_t offsetOfFibers() { return OBJECT_OFFSETOF(JSRopeString, u); }
 
-    inline JSString* jsString(VM* vm, const String& s)
-    {
-        int size = s.length();
-        if (!size)
-            return vm->smallStrings.emptyString();
-        if (size == 1) {
-            UChar c = s.characterAt(0);
-            if (c <= maxSingleCharacterString)
-                return vm->smallStrings.singleCharacterString(c);
-        }
-        return JSString::create(*vm, s.impl());
-    }
+    static const unsigned s_maxInternalRopeLength = 3;
 
-    inline JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length)
-    {
-        ASSERT(offset <= static_cast<unsigned>(s->length()));
-        ASSERT(length <= static_cast<unsigned>(s->length()));
-        ASSERT(offset + length <= static_cast<unsigned>(s->length()));
-        VM& vm = exec->vm();
-        if (!length)
-            return vm.smallStrings.emptyString();
-        s->value(exec); // For effect. We need to ensure that any string that is used as a substring base is not a rope.
-        return JSRopeString::create(vm, s, offset, length);
-    }
+private:
+    friend JSValue jsStringFromRegisterArray(ExecState*, Register*, unsigned);
+    friend JSValue jsStringFromArguments(ExecState*, JSValue);
+
+    JS_EXPORT_PRIVATE void resolveRope(ExecState*) const;
+    JS_EXPORT_PRIVATE void resolveRopeToAtomicString(ExecState*) const;
+    JS_EXPORT_PRIVATE AtomicStringImpl* resolveRopeToExistingAtomicString(ExecState*) const;
+    void resolveRopeSlowCase8(LChar*) const;
+    void resolveRopeSlowCase(UChar*) const;
+    void outOfMemory(ExecState*) const;
+    void resolveRopeInternal8(LChar*) const;
+    void resolveRopeInternal8NoSubstring(LChar*) const;
+    void resolveRopeInternal16(UChar*) const;
+    void resolveRopeInternal16NoSubstring(UChar*) const;
+    void clearFibers() const;
 
-    inline JSString* jsSubstring8(VM* vm, const String& s, unsigned offset, unsigned length)
+    JS_EXPORT_PRIVATE JSString* getIndexSlowCase(ExecState*, unsigned);
+
+    WriteBarrierBase<JSString>& fiber(unsigned i) const
     {
-        ASSERT(offset <= static_cast<unsigned>(s.length()));
-        ASSERT(length <= static_cast<unsigned>(s.length()));
-        ASSERT(offset + length <= static_cast<unsigned>(s.length()));
-        if (!length)
-            return vm->smallStrings.emptyString();
-        if (length == 1) {
-            UChar c = s.characterAt(offset);
-            if (c <= maxSingleCharacterString)
-                return vm->smallStrings.singleCharacterString(c);
-        }
-        return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl8(s.impl(), offset, length));
+        ASSERT(!isSubstring());
+        ASSERT(i < s_maxInternalRopeLength);
+        return u[i].string;
     }
 
-    inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)
+    WriteBarrierBase<JSString>& substringBase() const
     {
-        ASSERT(offset <= static_cast<unsigned>(s.length()));
-        ASSERT(length <= static_cast<unsigned>(s.length()));
-        ASSERT(offset + length <= static_cast<unsigned>(s.length()));
-        if (!length)
-            return vm->smallStrings.emptyString();
-        if (length == 1) {
-            UChar c = s.characterAt(offset);
-            if (c <= maxSingleCharacterString)
-                return vm->smallStrings.singleCharacterString(c);
-        }
-        return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length));
+        return u[1].string;
     }
 
-    inline JSString* jsOwnedString(VM* vm, const String& s)
+    uintptr_t& substringOffset() const
     {
-        int size = s.length();
-        if (!size)
-            return vm->smallStrings.emptyString();
-        if (size == 1) {
-            UChar c = s.characterAt(0);
-            if (c <= maxSingleCharacterString)
-                return vm->smallStrings.singleCharacterString(c);
-        }
-        return JSString::createHasOtherOwner(*vm, s.impl());
+        return u[2].number;
     }
 
-    inline JSRopeString* jsStringBuilder(VM* vm)
+    static uintptr_t notSubstringSentinel()
     {
-        return JSRopeString::createNull(*vm);
+        return 0;
     }
 
-    inline JSString* jsEmptyString(ExecState* exec) { return jsEmptyString(&exec->vm()); }
-    inline JSString* jsString(ExecState* exec, const String& s) { return jsString(&exec->vm(), s); }
-    inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->vm(), c); }
-    inline JSString* jsSubstring8(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->vm(), s, offset, length); }
-    inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->vm(), s, offset, length); }
-    inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->vm(), s); }
-    inline JSString* jsOwnedString(ExecState* exec, const String& s) { return jsOwnedString(&exec->vm(), s); }
-
-    JS_EXPORT_PRIVATE JSString* jsStringWithCacheSlowCase(VM&, StringImpl&);
-
-    ALWAYS_INLINE JSString* jsStringWithCache(ExecState* exec, const String& s)
+    static uintptr_t substringSentinel()
     {
-        VM& vm = exec->vm();
-        StringImpl* stringImpl = s.impl();
-        if (!stringImpl || !stringImpl->length())
-            return jsEmptyString(&vm);
-
-        if (stringImpl->length() == 1) {
-            UChar singleCharacter = (*stringImpl)[0u];
-            if (singleCharacter <= maxSingleCharacterString)
-                return vm.smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter));
-        }
-
-        if (JSString* lastCachedString = vm.lastCachedString.get()) {
-            if (lastCachedString->tryGetValueImpl() == stringImpl)
-                return lastCachedString;
-        }
-
-        return jsStringWithCacheSlowCase(vm, *stringImpl);
+        return 1;
     }
 
-    ALWAYS_INLINE JSString* jsStringWithCache(ExecState* exec, const AtomicString& s)
+    bool isSubstring() const
     {
-        return jsStringWithCache(exec, s.string());
+        return u[0].number == substringSentinel();
     }
 
-    ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+    void setIsSubstring(bool isSubstring)
     {
-        if (propertyName == exec->propertyNames().length) {
-            slot.setValue(this, DontEnum | DontDelete | ReadOnly, jsNumber(m_length));
-            return true;
-        }
+        u[0].number = isSubstring ? substringSentinel() : notSubstringSentinel();
+    }
 
-        unsigned i = propertyName.asIndex();
-        if (i < m_length) {
-            ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
-            slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, i));
-            return true;
-        }
+    mutable union {
+        uintptr_t number;
+        WriteBarrierBase<JSString> string;
+    } u[s_maxInternalRopeLength];
+};
+
+
+inline const StringImpl* JSString::tryGetValueImpl() const
+{
+    return m_value.impl();
+}
+
+JSString* asString(JSValue);
+
+inline JSString* asString(JSValue value)
+{
+    ASSERT(value.asCell()->isString());
+    return jsCast<JSString*>(value.asCell());
+}
+
+inline JSString* jsEmptyString(VM* vm)
+{
+    return vm->smallStrings.emptyString();
+}
+
+ALWAYS_INLINE JSString* jsSingleCharacterString(VM* vm, UChar c)
+{
+    if (c <= maxSingleCharacterString)
+        return vm->smallStrings.singleCharacterString(c);
+    return JSString::create(*vm, String(&c, 1).impl());
+}
+
+ALWAYS_INLINE JSString* jsSingleCharacterSubstring(ExecState* exec, const String& s, unsigned offset)
+{
+    VM* vm = &exec->vm();
+    ASSERT(offset < static_cast<unsigned>(s.length()));
+    UChar c = s.characterAt(offset);
+    if (c <= maxSingleCharacterString)
+        return vm->smallStrings.singleCharacterString(c);
+    return JSString::create(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, 1));
+}
+
+inline JSString* jsNontrivialString(VM* vm, const String& s)
+{
+    ASSERT(s.length() > 1);
+    return JSString::create(*vm, s.impl());
+}
+
+ALWAYS_INLINE Identifier JSString::toIdentifier(ExecState* exec) const
+{
+    return Identifier(exec, toAtomicString(exec));
+}
+
+ALWAYS_INLINE AtomicString JSString::toAtomicString(ExecState* exec) const
+{
+    if (isRope())
+        static_cast<const JSRopeString*>(this)->resolveRopeToAtomicString(exec);
+    return AtomicString(m_value);
+}
+
+ALWAYS_INLINE AtomicStringImpl* JSString::toExistingAtomicString(ExecState* exec) const
+{
+    if (isRope())
+        return static_cast<const JSRopeString*>(this)->resolveRopeToExistingAtomicString(exec);
+    if (m_value.impl()->isAtomic())
+        return static_cast<AtomicStringImpl*>(m_value.impl());
+    if (AtomicStringImpl* existingAtomicString = AtomicString::find(m_value.impl())) {
+        m_value = *existingAtomicString;
+        setIs8Bit(m_value.impl()->is8Bit());
+        return existingAtomicString;
+    }
+    return nullptr;
+}
+
+inline const String& JSString::value(ExecState* exec) const
+{
+    if (isRope())
+        static_cast<const JSRopeString*>(this)->resolveRope(exec);
+    return m_value;
+}
+
+inline const String& JSString::tryGetValue() const
+{
+    if (isRope())
+        static_cast<const JSRopeString*>(this)->resolveRope(0);
+    return m_value;
+}
+
+inline JSString* JSString::getIndex(ExecState* exec, unsigned i)
+{
+    ASSERT(canGetIndex(i));
+    if (isRope())
+        return static_cast<JSRopeString*>(this)->getIndexSlowCase(exec, i);
+    ASSERT(i < m_value.length());
+    return jsSingleCharacterSubstring(exec, m_value, i);
+}
+
+inline JSString* jsString(VM* vm, const String& s)
+{
+    int size = s.length();
+    if (!size)
+        return vm->smallStrings.emptyString();
+    if (size == 1) {
+        UChar c = s.characterAt(0);
+        if (c <= maxSingleCharacterString)
+            return vm->smallStrings.singleCharacterString(c);
+    }
+    return JSString::create(*vm, s.impl());
+}
+
+inline JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length)
+{
+    ASSERT(offset <= static_cast<unsigned>(s->length()));
+    ASSERT(length <= static_cast<unsigned>(s->length()));
+    ASSERT(offset + length <= static_cast<unsigned>(s->length()));
+    VM& vm = exec->vm();
+    if (!length)
+        return vm.smallStrings.emptyString();
+    s->value(exec); // For effect. We need to ensure that any string that is used as a substring base is not a rope.
+    return JSRopeString::create(vm, s, offset, length);
+}
+
+inline JSString* jsSubstring8(VM* vm, const String& s, unsigned offset, unsigned length)
+{
+    ASSERT(offset <= static_cast<unsigned>(s.length()));
+    ASSERT(length <= static_cast<unsigned>(s.length()));
+    ASSERT(offset + length <= static_cast<unsigned>(s.length()));
+    if (!length)
+        return vm->smallStrings.emptyString();
+    if (length == 1) {
+        UChar c = s.characterAt(offset);
+        if (c <= maxSingleCharacterString)
+            return vm->smallStrings.singleCharacterString(c);
+    }
+    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl8(s.impl(), offset, length));
+}
+
+inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)
+{
+    ASSERT(offset <= static_cast<unsigned>(s.length()));
+    ASSERT(length <= static_cast<unsigned>(s.length()));
+    ASSERT(offset + length <= static_cast<unsigned>(s.length()));
+    if (!length)
+        return vm->smallStrings.emptyString();
+    if (length == 1) {
+        UChar c = s.characterAt(offset);
+        if (c <= maxSingleCharacterString)
+            return vm->smallStrings.singleCharacterString(c);
+    }
+    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length));
+}
 
-        return false;
+inline JSString* jsOwnedString(VM* vm, const String& s)
+{
+    int size = s.length();
+    if (!size)
+        return vm->smallStrings.emptyString();
+    if (size == 1) {
+        UChar c = s.characterAt(0);
+        if (c <= maxSingleCharacterString)
+            return vm->smallStrings.singleCharacterString(c);
+    }
+    return JSString::createHasOtherOwner(*vm, s.impl());
+}
+
+inline JSRopeString* jsStringBuilder(VM* vm)
+{
+    return JSRopeString::createNull(*vm);
+}
+
+inline JSString* jsEmptyString(ExecState* exec) { return jsEmptyString(&exec->vm()); }
+inline JSString* jsString(ExecState* exec, const String& s) { return jsString(&exec->vm(), s); }
+inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->vm(), c); }
+inline JSString* jsSubstring8(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->vm(), s, offset, length); }
+inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->vm(), s, offset, length); }
+inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->vm(), s); }
+inline JSString* jsOwnedString(ExecState* exec, const String& s) { return jsOwnedString(&exec->vm(), s); }
+
+JS_EXPORT_PRIVATE JSString* jsStringWithCacheSlowCase(VM&, StringImpl&);
+
+ALWAYS_INLINE JSString* jsStringWithCache(ExecState* exec, const String& s)
+{
+    VM& vm = exec->vm();
+    StringImpl* stringImpl = s.impl();
+    if (!stringImpl || !stringImpl->length())
+        return jsEmptyString(&vm);
+
+    if (stringImpl->length() == 1) {
+        UChar singleCharacter = (*stringImpl)[0u];
+        if (singleCharacter <= maxSingleCharacterString)
+            return vm.smallStrings.singleCharacterString(static_cast<unsigned char>(singleCharacter));
     }
-            
-    ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
-    {
-        if (propertyName < m_length) {
-            slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, propertyName));
-            return true;
-        }
 
-        return false;
+    if (JSString* lastCachedString = vm.lastCachedString.get()) {
+        if (lastCachedString->tryGetValueImpl() == stringImpl)
+            return lastCachedString;
     }
 
-    inline bool isJSString(JSValue v) { return v.isCell() && v.asCell()->type() == StringType; }
+    return jsStringWithCacheSlowCase(vm, *stringImpl);
+}
 
-    // --- JSValue inlines ----------------------------
-        
-    inline bool JSValue::toBoolean(ExecState* exec) const
-    {
-        if (isInt32())
-            return asInt32();
-        if (isDouble())
-            return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
-        if (isCell())
-            return asCell()->toBoolean(exec);
-        return isTrue(); // false, null, and undefined all convert to false.
-    }
+ALWAYS_INLINE JSString* jsStringWithCache(ExecState* exec, const AtomicString& s)
+{
+    return jsStringWithCache(exec, s.string());
+}
 
-    inline JSString* JSValue::toString(ExecState* exec) const
-    {
-        if (isString())
-            return jsCast<JSString*>(asCell());
-        return toStringSlowCase(exec);
+ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+{
+    if (propertyName == exec->propertyNames().length) {
+        slot.setValue(this, DontEnum | DontDelete | ReadOnly, jsNumber(m_length));
+        return true;
     }
 
-    inline String JSValue::toWTFString(ExecState* exec) const
-    {
-        if (isString())
-            return static_cast<JSString*>(asCell())->value(exec);
-        return toWTFStringSlowCase(exec);
+    unsigned i = propertyName.asIndex();
+    if (i < m_length) {
+        ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
+        slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, i));
+        return true;
     }
 
-    ALWAYS_INLINE String inlineJSValueNotStringtoString(const JSValue& value, ExecState* exec)
-    {
-        VM& vm = exec->vm();
-        if (value.isInt32())
-            return vm.numericStrings.add(value.asInt32());
-        if (value.isDouble())
-            return vm.numericStrings.add(value.asDouble());
-        if (value.isTrue())
-            return vm.propertyNames->trueKeyword.string();
-        if (value.isFalse())
-            return vm.propertyNames->falseKeyword.string();
-        if (value.isNull())
-            return vm.propertyNames->nullKeyword.string();
-        if (value.isUndefined())
-            return vm.propertyNames->undefinedKeyword.string();
-        return value.toString(exec)->value(exec);
-    }
-
-    ALWAYS_INLINE String JSValue::toWTFStringInline(ExecState* exec) const
-    {
-        if (isString())
-            return static_cast<JSString*>(asCell())->value(exec);
+    return false;
+}
 
-        return inlineJSValueNotStringtoString(*this, exec);
+ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+    if (propertyName < m_length) {
+        slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, propertyName));
+        return true;
     }
 
+    return false;
+}
+
+inline bool isJSString(JSValue v) { return v.isCell() && v.asCell()->type() == StringType; }
+
+// --- JSValue inlines ----------------------------
+
+inline bool JSValue::toBoolean(ExecState* exec) const
+{
+    if (isInt32())
+        return asInt32();
+    if (isDouble())
+        return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
+    if (isCell())
+        return asCell()->toBoolean(exec);
+    return isTrue(); // false, null, and undefined all convert to false.
+}
+
+inline JSString* JSValue::toString(ExecState* exec) const
+{
+    if (isString())
+        return jsCast<JSString*>(asCell());
+    return toStringSlowCase(exec);
+}
+
+inline String JSValue::toWTFString(ExecState* exec) const
+{
+    if (isString())
+        return static_cast<JSString*>(asCell())->value(exec);
+    return toWTFStringSlowCase(exec);
+}
+
+ALWAYS_INLINE String inlineJSValueNotStringtoString(const JSValue& value, ExecState* exec)
+{
+    VM& vm = exec->vm();
+    if (value.isInt32())
+        return vm.numericStrings.add(value.asInt32());
+    if (value.isDouble())
+        return vm.numericStrings.add(value.asDouble());
+    if (value.isTrue())
+        return vm.propertyNames->trueKeyword.string();
+    if (value.isFalse())
+        return vm.propertyNames->falseKeyword.string();
+    if (value.isNull())
+        return vm.propertyNames->nullKeyword.string();
+    if (value.isUndefined())
+        return vm.propertyNames->undefinedKeyword.string();
+    return value.toString(exec)->value(exec);
+}
+
+ALWAYS_INLINE String JSValue::toWTFStringInline(ExecState* exec) const
+{
+    if (isString())
+        return static_cast<JSString*>(asCell())->value(exec);
+
+    return inlineJSValueNotStringtoString(*this, exec);
+}
+
 } // namespace JSC
 
 #endif // JSString_h
index 7bafbc6..49118f3 100644 (file)
 
 namespace JSC {
 
-    class LLIntOffsetsExtractor;
-
-    static const unsigned MasqueradesAsUndefined = 1; // WebCore uses MasqueradesAsUndefined to make document.all undetectable.
-    static const unsigned ImplementsHasInstance = 1 << 1;
-    static const unsigned OverridesHasInstance = 1 << 2;
-    static const unsigned ImplementsDefaultHasInstance = 1 << 3;
-    static const unsigned IsEnvironmentRecord = 1 << 4;
-    static const unsigned OverridesGetOwnPropertySlot = 1 << 5;
-    static const unsigned InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero = 1 << 6;
-
-    static const unsigned OverridesGetPropertyNames = 1 << 8;
-    static const unsigned ProhibitsPropertyCaching = 1 << 9;
-    static const unsigned HasImpureGetOwnPropertySlot = 1 << 10;
-    static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 11;
-    static const unsigned StructureIsImmortal = 1 << 12;
-
-    class TypeInfo {
-    public:
-        typedef uint8_t InlineTypeFlags;
-        typedef uint8_t OutOfLineTypeFlags;
-
-        TypeInfo(JSType type, unsigned flags = 0)
-            : TypeInfo(type, flags & 0xff, flags >> 8)
-        {
-        }
-        
-        TypeInfo(JSType type, InlineTypeFlags inlineTypeFlags, OutOfLineTypeFlags outOfLineTypeFlags)
-            : m_type(type)
-            , m_flags(inlineTypeFlags)
-            , m_flags2(outOfLineTypeFlags)
-        {
-            // No object that doesn't ImplementsHasInstance should override it!
-            ASSERT((m_flags & (ImplementsHasInstance | OverridesHasInstance)) != OverridesHasInstance);
-            // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance)
-            if ((m_flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance)
-                m_flags |= ImplementsDefaultHasInstance;
-        }
-
-        JSType type() const { return static_cast<JSType>(m_type); }
-        bool isObject() const { return isObject(type()); }
-        static bool isObject(JSType type) { return type >= ObjectType; }
-        bool isFinalObject() const { return type() == FinalObjectType; }
-        bool isNumberObject() const { return type() == NumberObjectType; }
-        bool isName() const { return type() == NameInstanceType; }
-
-        unsigned flags() const { return (static_cast<unsigned>(m_flags2) << 8) | static_cast<unsigned>(m_flags); }
-        bool masqueradesAsUndefined() const { return isSetOnFlags1(MasqueradesAsUndefined); }
-        bool implementsHasInstance() const { return isSetOnFlags1(ImplementsHasInstance); }
-        bool isEnvironmentRecord() const { return isSetOnFlags1(IsEnvironmentRecord); }
-        bool overridesHasInstance() const { return isSetOnFlags1(OverridesHasInstance); }
-        bool implementsDefaultHasInstance() const { return isSetOnFlags1(ImplementsDefaultHasInstance); }
-        bool overridesGetOwnPropertySlot() const { return overridesGetOwnPropertySlot(inlineTypeFlags()); }
-        static bool overridesGetOwnPropertySlot(InlineTypeFlags flags) { return flags & OverridesGetOwnPropertySlot; }
-        bool interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero() const { return isSetOnFlags1(InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero); }
-        bool overridesGetPropertyNames() const { return isSetOnFlags2(OverridesGetPropertyNames); }
-        bool prohibitsPropertyCaching() const { return isSetOnFlags2(ProhibitsPropertyCaching); }
-        bool hasImpureGetOwnPropertySlot() const { return isSetOnFlags2(HasImpureGetOwnPropertySlot); }
-        bool newImpurePropertyFiresWatchpoints() const { return isSetOnFlags2(NewImpurePropertyFiresWatchpoints); }
-        bool structureIsImmortal() const { return isSetOnFlags2(StructureIsImmortal); }
-
-        static ptrdiff_t flagsOffset()
-        {
-            return OBJECT_OFFSETOF(TypeInfo, m_flags);
-        }
-
-        static ptrdiff_t typeOffset()
-        {
-            return OBJECT_OFFSETOF(TypeInfo, m_type);
-        }
-
-        InlineTypeFlags inlineTypeFlags() const { return m_flags; }
-        OutOfLineTypeFlags outOfLineTypeFlags() const { return m_flags2; }
-
-    private:
-        friend class LLIntOffsetsExtractor;
-        
-        bool isSetOnFlags1(unsigned flag) const { ASSERT(flag <= (1 << 7)); return m_flags & flag; }
-        bool isSetOnFlags2(unsigned flag) const { ASSERT(flag >= (1 << 8)); return m_flags2 & (flag >> 8); }
-
-        unsigned char m_type;
-        unsigned char m_flags;
-        unsigned char m_flags2;
-    };
+class LLIntOffsetsExtractor;
+
+static const unsigned MasqueradesAsUndefined = 1; // WebCore uses MasqueradesAsUndefined to make document.all undetectable.
+static const unsigned ImplementsHasInstance = 1 << 1;
+static const unsigned OverridesHasInstance = 1 << 2;
+static const unsigned ImplementsDefaultHasInstance = 1 << 3;
+static const unsigned IsEnvironmentRecord = 1 << 4;
+static const unsigned OverridesGetOwnPropertySlot = 1 << 5;
+static const unsigned InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero = 1 << 6;
+
+static const unsigned OverridesGetPropertyNames = 1 << 8;
+static const unsigned ProhibitsPropertyCaching = 1 << 9;
+static const unsigned HasImpureGetOwnPropertySlot = 1 << 10;
+static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 11;
+static const unsigned StructureIsImmortal = 1 << 12;
+
+class TypeInfo {
+public:
+    typedef uint8_t InlineTypeFlags;
+    typedef uint8_t OutOfLineTypeFlags;
+
+    TypeInfo(JSType type, unsigned flags = 0)
+        : TypeInfo(type, flags & 0xff, flags >> 8)
+    {
+    }
+
+    TypeInfo(JSType type, InlineTypeFlags inlineTypeFlags, OutOfLineTypeFlags outOfLineTypeFlags)
+        : m_type(type)
+        , m_flags(inlineTypeFlags)
+        , m_flags2(outOfLineTypeFlags)
+    {
+        // No object that doesn't ImplementsHasInstance should override it!
+        ASSERT((m_flags & (ImplementsHasInstance | OverridesHasInstance)) != OverridesHasInstance);
+        // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance)
+        if ((m_flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance)
+            m_flags |= ImplementsDefaultHasInstance;
+    }
+
+    JSType type() const { return static_cast<JSType>(m_type); }
+    bool isObject() const { return isObject(type()); }
+    static bool isObject(JSType type) { return type >= ObjectType; }
+    bool isFinalObject() const { return type() == FinalObjectType; }
+    bool isNumberObject() const { return type() == NumberObjectType; }
+    bool isName() const { return type() == NameInstanceType; }
+
+    unsigned flags() const { return (static_cast<unsigned>(m_flags2) << 8) | static_cast<unsigned>(m_flags); }
+    bool masqueradesAsUndefined() const { return isSetOnFlags1(MasqueradesAsUndefined); }
+    bool implementsHasInstance() const { return isSetOnFlags1(ImplementsHasInstance); }
+    bool isEnvironmentRecord() const { return isSetOnFlags1(IsEnvironmentRecord); }
+    bool overridesHasInstance() const { return isSetOnFlags1(OverridesHasInstance); }
+    bool implementsDefaultHasInstance() const { return isSetOnFlags1(ImplementsDefaultHasInstance); }
+    bool overridesGetOwnPropertySlot() const { return overridesGetOwnPropertySlot(inlineTypeFlags()); }
+    static bool overridesGetOwnPropertySlot(InlineTypeFlags flags) { return flags & OverridesGetOwnPropertySlot; }
+    bool interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero() const { return isSetOnFlags1(InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero); }
+    bool overridesGetPropertyNames() const { return isSetOnFlags2(OverridesGetPropertyNames); }
+    bool prohibitsPropertyCaching() const { return isSetOnFlags2(ProhibitsPropertyCaching); }
+    bool hasImpureGetOwnPropertySlot() const { return isSetOnFlags2(HasImpureGetOwnPropertySlot); }
+    bool newImpurePropertyFiresWatchpoints() const { return isSetOnFlags2(NewImpurePropertyFiresWatchpoints); }
+    bool structureIsImmortal() const { return isSetOnFlags2(StructureIsImmortal); }
+
+    static ptrdiff_t flagsOffset()
+    {
+        return OBJECT_OFFSETOF(TypeInfo, m_flags);
+    }
+
+    static ptrdiff_t typeOffset()
+    {
+        return OBJECT_OFFSETOF(TypeInfo, m_type);
+    }
+
+    InlineTypeFlags inlineTypeFlags() const { return m_flags; }
+    OutOfLineTypeFlags outOfLineTypeFlags() const { return m_flags2; }
+
+private:
+    friend class LLIntOffsetsExtractor;
+
+    bool isSetOnFlags1(unsigned flag) const { ASSERT(flag <= (1 << 7)); return m_flags & flag; }
+    bool isSetOnFlags2(unsigned flag) const { ASSERT(flag >= (1 << 8)); return m_flags2 & (flag >> 8); }
+
+    unsigned char m_type;
+    unsigned char m_flags;
+    unsigned char m_flags2;
+};
 
 }
 
index 6f3b73b..1036add 100644 (file)
 
 namespace JSC {
 
-    // This class is used as a base for classes such as String,
-    // Number, Boolean and Date which are wrappers for primitive types.
-    class JSWrapperObject : public JSDestructibleObject {
-    public:
-        typedef JSDestructibleObject Base;
-
-        static size_t allocationSize(size_t inlineCapacity)
-        {
-            ASSERT_UNUSED(inlineCapacity, !inlineCapacity);
-            return sizeof(JSWrapperObject);
-        }
-
-        JSValue internalValue() const;
-        void setInternalValue(VM&, JSValue);
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
-        
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-        
-        static ptrdiff_t internalValueOffset() { return OBJECT_OFFSETOF(JSWrapperObject, m_internalValue); }
-        static ptrdiff_t internalValueCellOffset()
-        {
+// This class is used as a base for classes such as String,
+// Number, Boolean and Date which are wrappers for primitive types.
+class JSWrapperObject : public JSDestructibleObject {
+public:
+    typedef JSDestructibleObject Base;
+
+    static size_t allocationSize(size_t inlineCapacity)
+    {
+        ASSERT_UNUSED(inlineCapacity, !inlineCapacity);
+        return sizeof(JSWrapperObject);
+    }
+
+    JSValue internalValue() const;
+    void setInternalValue(VM&, JSValue);
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
+    { 
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+    static ptrdiff_t internalValueOffset() { return OBJECT_OFFSETOF(JSWrapperObject, m_internalValue); }
+    static ptrdiff_t internalValueCellOffset()
+    {
 #if USE(JSVALUE64)
-            return internalValueOffset();
+        return internalValueOffset();
 #else
-            return internalValueOffset() + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload);
+        return internalValueOffset() + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload);
 #endif
-        }
+    }
 
-    protected:
-        explicit JSWrapperObject(VM&, Structure*);
+protected:
+    explicit JSWrapperObject(VM&, Structure*);
 
-        JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
+    JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
 
-    private:
-        WriteBarrier<Unknown> m_internalValue;
-    };
+private:
+    WriteBarrier<Unknown> m_internalValue;
+};
 
-    inline JSWrapperObject::JSWrapperObject(VM& vm, Structure* structure)
-        : JSDestructibleObject(vm, structure)
-    {
-    }
+inline JSWrapperObject::JSWrapperObject(VM& vm, Structure* structure)
+    : JSDestructibleObject(vm, structure)
+{
+}
 
-    inline JSValue JSWrapperObject::internalValue() const
-    {
-        return m_internalValue.get();
-    }
+inline JSValue JSWrapperObject::internalValue() const
+{
+    return m_internalValue.get();
+}
 
-    inline void JSWrapperObject::setInternalValue(VM& vm, JSValue value)
-    {
-        ASSERT(value);
-        ASSERT(!value.isObject());
-        m_internalValue.set(vm, this, value);
-    }
+inline void JSWrapperObject::setInternalValue(VM& vm, JSValue value)
+{
+    ASSERT(value);
+    ASSERT(!value.isObject());
+    m_internalValue.set(vm, this, value);
+}
 
 } // namespace JSC
 
index 8533656..b7ecbb1 100644 (file)
 #include <wtf/Assertions.h>
 
 namespace JSC {
-    struct CompactHashIndex {
-        const int16_t value;
-        const int16_t next;
-    };
 
-    // FIXME: There is no reason this get function can't be simpler.
-    // ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject)
-    typedef PropertySlot::GetValueFunc GetFunction;
-    typedef PutPropertySlot::PutValueFunc PutFunction;
-    typedef FunctionExecutable* (*BuiltinGenerator)(VM&);
+struct CompactHashIndex {
+    const int16_t value;
+    const int16_t next;
+};
 
-    // Hash table generated by the create_hash_table script.
-    struct HashTableValue {
-        const char* m_key; // property name
-        unsigned m_attributes; // JSObject attributes
-        Intrinsic m_intrinsic;
-        intptr_t m_value1;
-        intptr_t m_value2;
+// FIXME: There is no reason this get function can't be simpler.
+// ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject)
+typedef PropertySlot::GetValueFunc GetFunction;
+typedef PutPropertySlot::PutValueFunc PutFunction;
+typedef FunctionExecutable* (*BuiltinGenerator)(VM&);
 
-        unsigned attributes() const { return m_attributes; }
+// Hash table generated by the create_hash_table script.
+struct HashTableValue {
+    const char* m_key; // property name
+    unsigned m_attributes; // JSObject attributes
+    Intrinsic m_intrinsic;
+    intptr_t m_value1;
+    intptr_t m_value2;
 
-        Intrinsic intrinsic() const { ASSERT(m_attributes & Function); return m_intrinsic; }
-        BuiltinGenerator builtinGenerator() const { ASSERT(m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_value1); }
-        NativeFunction function() const { ASSERT(m_attributes & Function); return reinterpret_cast<NativeFunction>(m_value1); }
-        unsigned char functionLength() const { ASSERT(m_attributes & Function); return static_cast<unsigned char>(m_value2); }
+    unsigned attributes() const { return m_attributes; }
 
-        GetFunction propertyGetter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrConstant)); return reinterpret_cast<GetFunction>(m_value1); }
-        PutFunction propertyPutter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrConstant)); return reinterpret_cast<PutFunction>(m_value2); }
+    Intrinsic intrinsic() const { ASSERT(m_attributes & Function); return m_intrinsic; }
+    BuiltinGenerator builtinGenerator() const { ASSERT(m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_value1); }
+    NativeFunction function() const { ASSERT(m_attributes & Function); return reinterpret_cast<NativeFunction>(m_value1); }
+    unsigned char functionLength() const { ASSERT(m_attributes & Function); return static_cast<unsigned char>(m_value2); }
 
-        intptr_t constantInteger() const { ASSERT(m_attributes & ConstantInteger); return m_value1; }
+    GetFunction propertyGetter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrConstant)); return reinterpret_cast<GetFunction>(m_value1); }
+    PutFunction propertyPutter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrConstant)); return reinterpret_cast<PutFunction>(m_value2); }
 
-        intptr_t lexerValue() const { ASSERT(!m_attributes); return m_value1; }
-    };
+    intptr_t constantInteger() const { ASSERT(m_attributes & ConstantInteger); return m_value1; }
+
+    intptr_t lexerValue() const { ASSERT(!m_attributes); return m_value1; }
+};
+
+struct HashTable {
+    mutable int numberOfValues;
+    int indexMask;
+    bool hasSetterOrReadonlyProperties;
+
+    const HashTableValue* values; // Fixed values generated by script.
+    mutable const char** keys; // Table allocated at runtime.
+    const CompactHashIndex* index;
+
+    ALWAYS_INLINE HashTable copy() const
+    {
+        // Don't copy dynamic table since it's thread specific.
+        HashTable result = { numberOfValues, indexMask, hasSetterOrReadonlyProperties, values, 0, index };
+        return result;
+    }
+
+    ALWAYS_INLINE void initializeIfNeeded() const
+    {
+        if (!keys)
+            createTable();
+    }
+
+    JS_EXPORT_PRIVATE void deleteTable() const;
+
+    // Find an entry in the table, and return the entry.
+    ALWAYS_INLINE const HashTableValue* entry(PropertyName propertyName) const
+    {
+        initializeIfNeeded();
+
+        StringImpl* impl = propertyName.uid();
+        if (!impl)
+            return 0;
 
-    struct HashTable {
-        mutable int numberOfValues;
-        int indexMask;
-        bool hasSetterOrReadonlyProperties;
+        ASSERT(keys);
 
-        const HashTableValue* values; // Fixed values generated by script.
-        mutable const char** keys; // Table allocated at runtime.
-        const CompactHashIndex* index;
+        int indexEntry = impl->existingHash() & indexMask;
+        int valueIndex = index[indexEntry].value;
+        if (valueIndex == -1)
+            return 0;
 
-        ALWAYS_INLINE HashTable copy() const
+        while (true) {
+            if (WTF::equal(impl, keys[valueIndex]))
+                return &values[valueIndex];
+
+            indexEntry = index[indexEntry].next;
+            if (indexEntry == -1)
+                return nullptr;
+            valueIndex = index[indexEntry].value;
+            ASSERT(valueIndex != -1);
+        };
+    }
+
+    class ConstIterator {
+    public:
+        ConstIterator(const HashTable* table, int position)
+            : m_table(table)
+            , m_position(position)
         {
-            // Don't copy dynamic table since it's thread specific.
-            HashTable result = { numberOfValues, indexMask, hasSetterOrReadonlyProperties, values, 0, index };
-            return result;
+            skipInvalidKeys();
         }
 
-        ALWAYS_INLINE void initializeIfNeeded() const
+        const HashTableValue* value()
         {
-            if (!keys)
-                createTable();
+            return &m_table->values[m_position];
         }
 
-        JS_EXPORT_PRIVATE void deleteTable() const;
-
-        // Find an entry in the table, and return the entry.
-        ALWAYS_INLINE const HashTableValue* entry(PropertyName propertyName) const
+        const char* key()
         {
-            initializeIfNeeded();
-
-            StringImpl* impl = propertyName.uid();
-            if (!impl)
-                return 0;
-        
-            ASSERT(keys);
-
-            int indexEntry = impl->existingHash() & indexMask;
-            int valueIndex = index[indexEntry].value;
-            if (valueIndex == -1)
-                return 0;
-
-            while (true) {
-                if (WTF::equal(impl, keys[valueIndex]))
-                    return &values[valueIndex];
-
-                indexEntry = index[indexEntry].next;
-                if (indexEntry == -1)
-                    return nullptr;
-                valueIndex = index[indexEntry].value;
-                ASSERT(valueIndex != -1);
-            };
+            return m_table->keys[m_position];
         }
 
-        class ConstIterator {
-        public:
-            ConstIterator(const HashTable* table, int position)
-                : m_table(table)
-                , m_position(position)
-            {
-                skipInvalidKeys();
-            }
-
-            const HashTableValue* value()
-            {
-                return &m_table->values[m_position];
-            }
-
-            const char* key()
-            {
-                return m_table->keys[m_position];
-            }
-
-            const HashTableValue* operator->()
-            {
-                return value();
-            }
-
-            bool operator!=(const ConstIterator& other)
-            {
-                ASSERT(m_table == other.m_table);
-                return m_position != other.m_position;
-            }
-            
-            ConstIterator& operator++()
-            {
-                ASSERT(m_position < m_table->numberOfValues);
-                ++m_position;
-                skipInvalidKeys();
-                return *this;
-            }
-
-        private:
-            void skipInvalidKeys()
-            {
-                ASSERT(m_position <= m_table->numberOfValues);
-                while (m_position < m_table->numberOfValues && !m_table->keys[m_position])
-                    ++m_position;
-                ASSERT(m_position <= m_table->numberOfValues);
-            }
-            
-            const HashTable* m_table;
-            int m_position;
-        };
+        const HashTableValue* operator->()
+        {
+            return value();
+        }
 
-        ConstIterator begin() const
+        bool operator!=(const ConstIterator& other)
         {
-            initializeIfNeeded();
-            return ConstIterator(this, 0);
+            ASSERT(m_table == other.m_table);
+            return m_position != other.m_position;
         }
-        ConstIterator end() const
+
+        ConstIterator& operator++()
         {
-            initializeIfNeeded();
-            return ConstIterator(this, numberOfValues);
+            ASSERT(m_position < m_table->numberOfValues);
+            ++m_position;
+            skipInvalidKeys();
+            return *this;
         }
 
     private:
-        // Convert the hash table keys to identifiers.
-        JS_EXPORT_PRIVATE void createTable() const;
-    };
+        void skipInvalidKeys()
+        {
+            ASSERT(m_position <= m_table->numberOfValues);
+            while (m_position < m_table->numberOfValues && !m_table->keys[m_position])
+                ++m_position;
+            ASSERT(m_position <= m_table->numberOfValues);
+        }
 
-    JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashTableValue*, JSObject* thisObject, PropertyName, PropertySlot&);
+        const HashTable* m_table;
+        int m_position;
+    };
 
-    /**
-     * This method does it all (looking in the hashtable, checking for function
-     * overrides, creating the function or retrieving from cache, calling
-     * getValueProperty in case of a non-function property, forwarding to parent if
-     * unknown property).
-     */
-    template <class ThisImp, class ParentImp>
-    inline bool getStaticPropertySlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
+    ConstIterator begin() const
     {
-        const HashTableValue* entry = table.entry(propertyName);
+        initializeIfNeeded();
+        return ConstIterator(this, 0);
+    }
+    ConstIterator end() const
+    {
+        initializeIfNeeded();
+        return ConstIterator(this, numberOfValues);
+    }
 
-        if (!entry) // not found, forward to parent
-            return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
+private:
+    // Convert the hash table keys to identifiers.
+    JS_EXPORT_PRIVATE void createTable() const;
+};
 
-        if (entry->attributes() & BuiltinOrFunction)
-            return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashTableValue*, JSObject* thisObject, PropertyName, PropertySlot&);
 
-        if (entry->attributes() & ConstantInteger) {
-            slot.setValue(thisObj, entry->attributes(), jsNumber(entry->constantInteger()));
-            return true;
-        }
-    
-        slot.setCacheableCustom(thisObj, entry->attributes(), entry->propertyGetter());
+/**
+ * This method does it all (looking in the hashtable, checking for function
+ * overrides, creating the function or retrieving from cache, calling
+ * getValueProperty in case of a non-function property, forwarding to parent if
+ * unknown property).
+ */
+template <class ThisImp, class ParentImp>
+inline bool getStaticPropertySlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
+{
+    const HashTableValue* entry = table.entry(propertyName);
+
+    if (!entry) // not found, forward to parent
+        return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
+
+    if (entry->attributes() & BuiltinOrFunction)
+        return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+
+    if (entry->attributes() & ConstantInteger) {
+        slot.setValue(thisObj, entry->attributes(), jsNumber(entry->constantInteger()));
         return true;
     }
 
-    /**
-     * Simplified version of getStaticPropertySlot in case there are only functions.
-     * Using this instead of getStaticPropertySlot allows 'this' to avoid implementing
-     * a dummy getValueProperty.
-     */
-    template <class ParentImp>
-    inline bool getStaticFunctionSlot(ExecState* exec, const HashTable& table, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot)
-    {
-        if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot))
-            return true;
+    slot.setCacheableCustom(thisObj, entry->attributes(), entry->propertyGetter());
+    return true;
+}
 
-        const HashTableValue* entry = table.entry(propertyName);
-        if (!entry)
-            return false;
+/**
+ * Simplified version of getStaticPropertySlot in case there are only functions.
+ * Using this instead of getStaticPropertySlot allows 'this' to avoid implementing
+ * a dummy getValueProperty.
+ */
+template <class ParentImp>
+inline bool getStaticFunctionSlot(ExecState* exec, const HashTable& table, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot)
+{
+    if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot))
+        return true;
 
-        return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
-    }
+    const HashTableValue* entry = table.entry(propertyName);
+    if (!entry)
+        return false;
 
-    /**
-     * Simplified version of getStaticPropertySlot in case there are no functions, only "values".
-     * Using this instead of getStaticPropertySlot removes the need for a FuncImp class.
-     */
-    template <class ThisImp, class ParentImp>
-    inline bool getStaticValueSlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
-    {
-        const HashTableValue* entry = table.entry(propertyName);
+    return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+}
 
-        if (!entry) // not found, forward to parent
-            return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
+/**
+ * Simplified version of getStaticPropertySlot in case there are no functions, only "values".
+ * Using this instead of getStaticPropertySlot removes the need for a FuncImp class.
+ */
+template <class ThisImp, class ParentImp>
+inline bool getStaticValueSlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
+{
+    const HashTableValue* entry = table.entry(propertyName);
 
-        ASSERT(!(entry->attributes() & BuiltinOrFunction));
+    if (!entry) // not found, forward to parent
+        return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
 
-        if (entry->attributes() & ConstantInteger) {
-            slot.setValue(thisObj, entry->attributes(), jsNumber(entry->constantInteger()));
-            return true;
-        }
+    ASSERT(!(entry->attributes() & BuiltinOrFunction));
 
-        slot.setCacheableCustom(thisObj, entry->attributes(), entry->propertyGetter());
+    if (entry->attributes() & ConstantInteger) {
+        slot.setValue(thisObj, entry->attributes(), jsNumber(entry->constantInteger()));
         return true;
     }
 
-    inline void putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
-    {
-        // If this is a function put it as an override property.
-        if (entry->attributes() & BuiltinOrFunction) {
-            if (JSObject* thisObject = jsDynamicCast<JSObject*>(slot.thisValue()))
-                thisObject->putDirect(exec->vm(), propertyName, value);
-        } else if (!(entry->attributes() & ReadOnly)) {
-            entry->propertyPutter()(exec, base, JSValue::encode(slot.thisValue()), JSValue::encode(value));
-            slot.setCustomProperty(base, entry->propertyPutter());
-        } else if (slot.isStrictMode())
-            throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
-    }
-
-    /**
-     * This one is for "put".
-     * It looks up a hash entry for the property to be set.  If an entry
-     * is found it sets the value and returns true, else it returns false.
-     */
-    inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSObject* base, JSValue value, const HashTable& table, PutPropertySlot& slot)
-    {
-        const HashTableValue* entry = table.entry(propertyName);
+    slot.setCacheableCustom(thisObj, entry->attributes(), entry->propertyGetter());
+    return true;
+}
+
+inline void putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
+{
+    // If this is a function put it as an override property.
+    if (entry->attributes() & BuiltinOrFunction) {
+        if (JSObject* thisObject = jsDynamicCast<JSObject*>(slot.thisValue()))
+            thisObject->putDirect(exec->vm(), propertyName, value);
+    } else if (!(entry->attributes() & ReadOnly)) {
+        entry->propertyPutter()(exec, base, JSValue::encode(slot.thisValue()), JSValue::encode(value));
+        slot.setCustomProperty(base, entry->propertyPutter());
+    } else if (slot.isStrictMode())
+        throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+}
+
+/**
+ * This one is for "put".
+ * It looks up a hash entry for the property to be set.  If an entry
+ * is found it sets the value and returns true, else it returns false.
+ */
+inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSObject* base, JSValue value, const HashTable& table, PutPropertySlot& slot)
+{
+    const HashTableValue* entry = table.entry(propertyName);
+
+    if (!entry)
+        return false;
+
+    putEntry(exec, entry, base, propertyName, value, slot);
+    return true;
+}
+
+template<unsigned numberOfValues>
+inline void reifyStaticProperties(VM& vm, const HashTableValue (&values)[numberOfValues], JSObject& thisObj)
+{
+    BatchedTransitionOptimizer transitionOptimizer(vm, &thisObj);
+    for (auto& value : values) {
+        if (!value.m_key)
+            continue;                
+
+        Identifier propertyName(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
+        if (value.attributes() & Builtin) {
+            thisObj.putDirectBuiltinFunction(vm, thisObj.globalObject(), propertyName, value.builtinGenerator()(vm), value.attributes());
+            continue;
+        }
 
-        if (!entry)
-            return false;
+        if (value.attributes() & Function) {
+            thisObj.putDirectNativeFunction(vm, thisObj.globalObject(), propertyName, value.functionLength(),
+                value.function(), value.intrinsic(), value.attributes());
+            continue;
+        }
 
-        putEntry(exec, entry, base, propertyName, value, slot);
-        return true;
-    }
+        if (value.attributes() & ConstantInteger) {
+            thisObj.putDirect(vm, propertyName, jsNumber(value.constantInteger()), value.attributes());
+            continue;
+        }
 
-    template<unsigned numberOfValues>
-    inline void reifyStaticProperties(VM& vm, const HashTableValue (&values)[numberOfValues], JSObject& thisObj)
-    {
-        BatchedTransitionOptimizer transitionOptimizer(vm, &thisObj);
-        for (auto& value : values) {
-            if (!value.m_key)
-                continue;                
-        
-            Identifier propertyName(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
-            if (value.attributes() & Builtin) {
-                thisObj.putDirectBuiltinFunction(vm, thisObj.globalObject(), propertyName, value.builtinGenerator()(vm), value.attributes());
-                continue;
-            }
-
-            if (value.attributes() & Function) {
-                thisObj.putDirectNativeFunction(vm, thisObj.globalObject(), propertyName, value.functionLength(),
-                    value.function(), value.intrinsic(), value.attributes());
-                continue;
-            }
-
-            if (value.attributes() & ConstantInteger) {
-                thisObj.putDirect(vm, propertyName, jsNumber(value.constantInteger()), value.attributes());
-                continue;
-            }
-
-            if (value.attributes() & Accessor) {
-                RELEASE_ASSERT_NOT_REACHED();
-                continue;
-            }
-
-            CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, value.propertyGetter(), value.propertyPutter());
-            thisObj.putDirectCustomAccessor(vm, propertyName, customGetterSetter, value.attributes());
+        if (value.attributes() & Accessor) {
+            RELEASE_ASSERT_NOT_REACHED();
+            continue;
         }
+
+        CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, value.propertyGetter(), value.propertyPutter());
+        thisObj.putDirectCustomAccessor(vm, propertyName, customGetterSetter, value.attributes());
     }
+}
 
 } // namespace JSC
 
index 4b2a5bb..84d1f4f 100644 (file)
 
 namespace JSC {
 
-    class MathObject : public JSNonFinalObject {
-    private:
-        MathObject(VM&, Structure*);
-
-    public:
-        typedef JSNonFinalObject Base;
-
-        static MathObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-        {
-            MathObject* object = new (NotNull, allocateCell<MathObject>(vm.heap)) MathObject(vm, structure);
-            object->finishCreation(vm, globalObject);
-            return object;
-        }
-
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        void finishCreation(VM&, JSGlobalObject*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
-    };
+class MathObject : public JSNonFinalObject {
+private:
+    MathObject(VM&, Structure*);
+
+public:
+    typedef JSNonFinalObject Base;
+
+    static MathObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        MathObject* object = new (NotNull, allocateCell<MathObject>(vm.heap)) MathObject(vm, structure);
+        object->finishCreation(vm, globalObject);
+        return object;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+protected:
+    void finishCreation(VM&, JSGlobalObject*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+};
 
 } // namespace JSC
 
index faf4ada..b582ef3 100644 (file)
 
 namespace JSC {
 
-    class ErrorInstance;
-    class FunctionPrototype;
-    class NativeErrorPrototype;
+class ErrorInstance;
+class FunctionPrototype;
+class NativeErrorPrototype;
 
-    class NativeErrorConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class NativeErrorConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
-        {
-            NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(vm, structure);
-            constructor->finishCreation(vm, globalObject, prototypeStructure, name);
-            return constructor;
-        }
-        
-        DECLARE_INFO;
+    static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
+    {
+        NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(vm, structure);
+        constructor->finishCreation(vm, globalObject, prototypeStructure, name);
+        return constructor;
+    }
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    DECLARE_INFO;
 
-        Structure* errorStructure() { return m_errorStructure.get(); }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    protected:
-        void finishCreation(VM&, JSGlobalObject*, Structure* prototypeStructure, const String& name);
+    Structure* errorStructure() { return m_errorStructure.get(); }
 
-    private:
-        NativeErrorConstructor(VM&, Structure*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-        static void visitChildren(JSCell*, SlotVisitor&);
+protected:
+    void finishCreation(VM&, JSGlobalObject*, Structure* prototypeStructure, const String& name);
 
-        WriteBarrier<Structure> m_errorStructure;
-    };
+private:
+    NativeErrorConstructor(VM&, Structure*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+    static void visitChildren(JSCell*, SlotVisitor&);
+
+    WriteBarrier<Structure> m_errorStructure;
+};
 
 } // namespace JSC
 
index 9326c5c..5812e63 100644 (file)
 #include "ErrorPrototype.h"
 
 namespace JSC {
-    class NativeErrorConstructor;
-
-    class NativeErrorPrototype : public ErrorPrototype {
-    private:
-        NativeErrorPrototype(VM&, Structure*);
-    
-    public:
-        typedef ErrorPrototype Base;
-
-        static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
-        {
-            NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure);
-            prototype->finishCreation(vm, globalObject, name, constructor);
-            return prototype;
-        }
-
-    protected:
-        void finishCreation(VM&, JSGlobalObject*, const String& nameAndMessage, NativeErrorConstructor*);
-    };
+
+class NativeErrorConstructor;
+
+class NativeErrorPrototype : public ErrorPrototype {
+private:
+    NativeErrorPrototype(VM&, Structure*);
+
+public:
+    typedef ErrorPrototype Base;
+
+    static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
+    {
+        NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject, name, constructor);
+        return prototype;
+    }
+
+protected:
+    void finishCreation(VM&, JSGlobalObject*, const String& nameAndMessage, NativeErrorConstructor*);
+};
 
 } // namespace JSC
 
index 6c8ed89..8826e9c 100644 (file)
 
 namespace JSC {
 
-    class NumberPrototype;
+class NumberPrototype;
 
-    class NumberConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class NumberConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static NumberConstructor* create(VM& vm, Structure* structure, NumberPrototype* numberPrototype)
-        {
-            NumberConstructor* constructor = new (NotNull, allocateCell<NumberConstructor>(vm.heap)) NumberConstructor(vm, structure);
-            constructor->finishCreation(vm, numberPrototype);
-            return constructor;
-        }
+    static NumberConstructor* create(VM& vm, Structure* structure, NumberPrototype* numberPrototype)
+    {
+        NumberConstructor* constructor = new (NotNull, allocateCell<NumberConstructor>(vm.heap)) NumberConstructor(vm, structure);
+        constructor->finishCreation(vm, numberPrototype);
+        return constructor;
+    }
 
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-        JSValue getValueProperty(ExecState*, int token) const;
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    JSValue getValueProperty(ExecState*, int token) const;
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) 
-        
-            return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info()); 
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) 
+    { 
+        return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
 
-        enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
+    enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
 
-    protected:
-        void finishCreation(VM&, NumberPrototype*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
+protected:
+    void finishCreation(VM&, NumberPrototype*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
 
-    private:
-        NumberConstructor(VM&, Structure*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-    };
+private:
+    NumberConstructor(VM&, Structure*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+};
 
 } // namespace JSC
 
index 4bdf281..d979dd4 100644 (file)
 
 namespace JSC {
 
-    class NumberObject : public JSWrapperObject {
-    protected:
-        NumberObject(VM&, Structure*);
-        void finishCreation(VM&);
-
-    public:
-        typedef JSWrapperObject Base;
-
-        static NumberObject* create(VM& vm, Structure* structure)
-        {
-            NumberObject* number = new (NotNull, allocateCell<NumberObject>(vm.heap)) NumberObject(vm, structure);
-            number->finishCreation(vm);
-            return number;
-        }
-
-        DECLARE_EXPORT_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), info());
-        }
-    };
-
-    JS_EXPORT_PRIVATE NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue);
+class NumberObject : public JSWrapperObject {
+protected:
+    NumberObject(VM&, Structure*);
+    void finishCreation(VM&);
+
+public:
+    typedef JSWrapperObject Base;
+
+    static NumberObject* create(VM& vm, Structure* structure)
+    {
+        NumberObject* number = new (NotNull, allocateCell<NumberObject>(vm.heap)) NumberObject(vm, structure);
+        number->finishCreation(vm);
+        return number;
+    }
+
+    DECLARE_EXPORT_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), info());
+    }
+};
+
+JS_EXPORT_PRIVATE NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue);
 
 } // namespace JSC
 
index 723544f..5972f7b 100644 (file)
 
 namespace JSC {
 
-    class NumberPrototype : public NumberObject {
-    public:
-        typedef NumberObject Base;
-
-        static NumberPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-        {
-            NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(vm, structure);
-            prototype->finishCreation(vm, globalObject);
-            return prototype;
-        }
-        
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), info());
-        }
-
-    protected:
-        void finishCreation(VM&, JSGlobalObject*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
-
-    private:
-        NumberPrototype(VM&, Structure*);
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    };
+class NumberPrototype : public NumberObject {
+public:
+    typedef NumberObject Base;
+
+    static NumberPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
+        return prototype;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(NumberObjectType, StructureFlags), info());
+    }
+
+protected:
+    void finishCreation(VM&, JSGlobalObject*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
+
+private:
+    NumberPrototype(VM&, Structure*);
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
 
 } // namespace JSC
 
index 3bb5b91..ac8d416 100644 (file)
 
 namespace JSC {
 
-    class NumericStrings {
-    public:
-        ALWAYS_INLINE String add(double d)
-        {
-            CacheEntry<double>& entry = lookup(d);
-            if (d == entry.key && !entry.value.isNull())
-                return entry.value;
-            entry.key = d;
-            entry.value = String::numberToStringECMAScript(d);
+class NumericStrings {
+public:
+    ALWAYS_INLINE String add(double d)
+    {
+        CacheEntry<double>& entry = lookup(d);
+        if (d == entry.key && !entry.value.isNull())
             return entry.value;
-        }
+        entry.key = d;
+        entry.value = String::numberToStringECMAScript(d);
+        return entry.value;
+    }
 
-        ALWAYS_INLINE String add(int i)
-        {
-            if (static_cast<unsigned>(i) < cacheSize)
-                return lookupSmallString(static_cast<unsigned>(i));
-            CacheEntry<int>& entry = lookup(i);
-            if (i == entry.key && !entry.value.isNull())
-                return entry.value;
-            entry.key = i;
-            entry.value = String::number(i);
+    ALWAYS_INLINE String add(int i)
+    {
+        if (static_cast<unsigned>(i) < cacheSize)
+            return lookupSmallString(static_cast<unsigned>(i));
+        CacheEntry<int>& entry = lookup(i);
+        if (i == entry.key && !entry.value.isNull())
             return entry.value;
-        }
+        entry.key = i;
+        entry.value = String::number(i);
+        return entry.value;
+    }
 
-        ALWAYS_INLINE String add(unsigned i)
-        {
-            if (i < cacheSize)
-                return lookupSmallString(static_cast<unsigned>(i));
-            CacheEntry<unsigned>& entry = lookup(i);
-            if (i == entry.key && !entry.value.isNull())
-                return entry.value;
-            entry.key = i;
-            entry.value = String::number(i);
+    ALWAYS_INLINE String add(unsigned i)
+    {
+        if (i < cacheSize)
+            return lookupSmallString(static_cast<unsigned>(i));
+        CacheEntry<unsigned>& entry = lookup(i);
+        if (i == entry.key && !entry.value.isNull())
             return entry.value;
-        }
-    private:
-        static const size_t cacheSize = 64;
+        entry.key = i;
+        entry.value = String::number(i);
+        return entry.value;
+    }
+private:
+    static const size_t cacheSize = 64;
 
-        template<typename T>
-        struct CacheEntry {
-            T key;
-            String value;
-        };
+    template<typename T>
+    struct CacheEntry {
+        T key;
+        String value;
+    };
 
-        CacheEntry<double>& lookup(double d) { return doubleCache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
-        CacheEntry<int>& lookup(int i) { return intCache[WTF::IntHash<int>::hash(i) & (cacheSize - 1)]; }
-        CacheEntry<unsigned>& lookup(unsigned i) { return unsignedCache[WTF::IntHash<unsigned>::hash(i) & (cacheSize - 1)]; }
-        ALWAYS_INLINE const String& lookupSmallString(unsigned i)
-        {
-            ASSERT(i < cacheSize);
-            if (smallIntCache[i].isNull())
-                smallIntCache[i] = String::number(i);
-            return smallIntCache[i];
-        }
+    CacheEntry<double>& lookup(double d) { return doubleCache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+    CacheEntry<int>& lookup(int i) { return intCache[WTF::IntHash<int>::hash(i) & (cacheSize - 1)]; }
+    CacheEntry<unsigned>& lookup(unsigned i) { return unsignedCache[WTF::IntHash<unsigned>::hash(i) & (cacheSize - 1)]; }
+    ALWAYS_INLINE const String& lookupSmallString(unsigned i)
+    {
+        ASSERT(i < cacheSize);
+        if (smallIntCache[i].isNull())
+            smallIntCache[i] = String::number(i);
+        return smallIntCache[i];
+    }
 
-        std::array<CacheEntry<double>, cacheSize> doubleCache;
-        std::array<CacheEntry<int>, cacheSize> intCache;
-        std::array<CacheEntry<unsigned>, cacheSize> unsignedCache;
-        std::array<String, cacheSize> smallIntCache;
-    };
+    std::array<CacheEntry<double>, cacheSize> doubleCache;
+    std::array<CacheEntry<int>, cacheSize> intCache;
+    std::array<CacheEntry<unsigned>, cacheSize> unsignedCache;
+    std::array<String, cacheSize> smallIntCache;
+};
 
 } // namespace JSC
 
index 4a6b471..1252781 100644 (file)
 
 namespace JSC {
 
-    class ObjectPrototype;
+class ObjectPrototype;
 
-    class ObjectConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class ObjectConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static ObjectConstructor* create(VM& vm, Structure* structure, ObjectPrototype* objectPrototype)
-        {
-            ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(vm, structure);
-            constructor->finishCreation(vm, objectPrototype);
-            return constructor;
-        }
-
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        void finishCreation(VM& vm, ObjectPrototype*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
-
-    private:
-        ObjectConstructor(VM&, Structure*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
-    };
-
-    inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure)
+    static ObjectConstructor* create(VM& vm, Structure* structure, ObjectPrototype* objectPrototype)
     {
-        return JSFinalObject::create(exec, structure);
+        ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(vm, structure);
+        constructor->finishCreation(vm, objectPrototype);
+        return constructor;
     }
 
-    inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype, unsigned inlineCapacity)
-    {
-        JSGlobalObject* globalObject = exec->lexicalGlobalObject();
-        PrototypeMap& prototypeMap = globalObject->vm().prototypeMap;
-        Structure* structure = prototypeMap.emptyObjectStructureForPrototype(
-            prototype, inlineCapacity);
-        return constructEmptyObject(exec, structure);
-    }
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 
-    inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype)
-    {
-        return constructEmptyObject(exec, prototype, JSFinalObject::defaultInlineCapacity());
-    }
+    DECLARE_INFO;
 
-    inline JSObject* constructEmptyObject(ExecState* exec)
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
-        return constructEmptyObject(exec, exec->lexicalGlobalObject()->objectPrototype());
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
     }
 
+protected:
+    void finishCreation(VM&, ObjectPrototype*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
+
+private:
+    ObjectConstructor(VM&, Structure*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
+};
+
+inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure)
+{
+    return JSFinalObject::create(exec, structure);
+}
+
+inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype, unsigned inlineCapacity)
+{
+    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+    PrototypeMap& prototypeMap = globalObject->vm().prototypeMap;
+    Structure* structure = prototypeMap.emptyObjectStructureForPrototype(
+        prototype, inlineCapacity);
+    return constructEmptyObject(exec, structure);
+}
+
+inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype)
+{
+    return constructEmptyObject(exec, prototype, JSFinalObject::defaultInlineCapacity());
+}
+
+inline JSObject* constructEmptyObject(ExecState* exec)
+{
+    return constructEmptyObject(exec, exec->lexicalGlobalObject()->objectPrototype());
+}
+
 } // namespace JSC
 
 #endif // ObjectConstructor_h
index 75a2a95..34238a9 100644 (file)
 
 namespace JSC {
 
-    class ObjectPrototype : public JSNonFinalObject {
-    public:
-        typedef JSNonFinalObject Base;
+class ObjectPrototype : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
 
-        static ObjectPrototype* create(VM&, JSGlobalObject*, Structure*);
+    static ObjectPrototype* create(VM&, JSGlobalObject*, Structure*);
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    protected:
-        void finishCreation(VM&, JSGlobalObject*);
+protected:
+    void finishCreation(VM&, JSGlobalObject*);
 
-    private:
-        ObjectPrototype(VM&, Structure*);
-    };
+private:
+    ObjectPrototype(VM&, Structure*);
+};
 
-    JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
+JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
 
 } // namespace JSC
 
index df74d9e..209ba59 100644 (file)
 #include "JSCJSValue.h"
 
 namespace JSC {
-    class GetterSetter;
 
-    // See ES5.1 9.12
-    bool sameValue(ExecState*, JSValue, JSValue);
+class GetterSetter;
 
-    class PropertyDescriptor {
-    public:
-        PropertyDescriptor()
-            : m_attributes(defaultAttributes)
-            , m_seenAttributes(0)
-        {
-        }
-        PropertyDescriptor(JSValue value, unsigned attributes)
-            : m_value(value)
-            , m_attributes(attributes)
-            , m_seenAttributes(EnumerablePresent | ConfigurablePresent | WritablePresent)
-        {
-            ASSERT(m_value);
-            ASSERT(!m_value.isGetterSetter());
-            ASSERT(!m_value.isCustomGetterSetter());
-        }
-        JS_EXPORT_PRIVATE bool writable() const;
-        JS_EXPORT_PRIVATE bool enumerable() const;
-        JS_EXPORT_PRIVATE bool configurable() const;
-        JS_EXPORT_PRIVATE bool isDataDescriptor() const;
-        bool isGenericDescriptor() const;
-        JS_EXPORT_PRIVATE bool isAccessorDescriptor() const;
-        unsigned attributes() const { return m_attributes; }
-        JSValue value() const { return m_value; }
-        JS_EXPORT_PRIVATE JSValue getter() const;
-        JS_EXPORT_PRIVATE JSValue setter() const;
-        JSObject* getterObject() const;
-        JSObject* setterObject() const;
-        JS_EXPORT_PRIVATE void setUndefined();
-        JS_EXPORT_PRIVATE void setDescriptor(JSValue value, unsigned attributes);
-        JS_EXPORT_PRIVATE void setCustomDescriptor(unsigned attributes);
-        JS_EXPORT_PRIVATE void setAccessorDescriptor(GetterSetter* accessor, unsigned attributes);
-        JS_EXPORT_PRIVATE void setWritable(bool);
-        JS_EXPORT_PRIVATE void setEnumerable(bool);
-        JS_EXPORT_PRIVATE void setConfigurable(bool);
-        void setValue(JSValue value) { m_value = value; }
-        JS_EXPORT_PRIVATE void setSetter(JSValue);
-        JS_EXPORT_PRIVATE void setGetter(JSValue);
-        bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); }
-        bool writablePresent() const { return m_seenAttributes & WritablePresent; }
-        bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; }
-        bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; }
-        bool setterPresent() const { return m_setter; }
-        bool getterPresent() const { return m_getter; }
-        bool equalTo(ExecState* exec, const PropertyDescriptor& other) const;
-        bool attributesEqual(const PropertyDescriptor& other) const;
-        unsigned attributesOverridingCurrent(const PropertyDescriptor& current) const;
+// See ES5.1 9.12
+bool sameValue(ExecState*, JSValue, JSValue);
+
+class PropertyDescriptor {
+public:
+    PropertyDescriptor()
+        : m_attributes(defaultAttributes)
+        , m_seenAttributes(0)
+    {
+    }
+    PropertyDescriptor(JSValue value, unsigned attributes)
+        : m_value(value)
+        , m_attributes(attributes)
+        , m_seenAttributes(EnumerablePresent | ConfigurablePresent | WritablePresent)
+    {
+        ASSERT(m_value);
+        ASSERT(!m_value.isGetterSetter());
+        ASSERT(!m_value.isCustomGetterSetter());
+    }
+    JS_EXPORT_PRIVATE bool writable() const;
+    JS_EXPORT_PRIVATE bool enumerable() const;
+    JS_EXPORT_PRIVATE bool configurable() const;
+    JS_EXPORT_PRIVATE bool isDataDescriptor() const;
+    bool isGenericDescriptor() const;
+    JS_EXPORT_PRIVATE bool isAccessorDescriptor() const;
+    unsigned attributes() const { return m_attributes; }
+    JSValue value() const { return m_value; }
+    JS_EXPORT_PRIVATE JSValue getter() const;
+    JS_EXPORT_PRIVATE JSValue setter() const;
+    JSObject* getterObject() const;
+    JSObject* setterObject() const;
+    JS_EXPORT_PRIVATE void setUndefined();
+    JS_EXPORT_PRIVATE void setDescriptor(JSValue, unsigned attributes);
+    JS_EXPORT_PRIVATE void setCustomDescriptor(unsigned attributes);
+    JS_EXPORT_PRIVATE void setAccessorDescriptor(GetterSetter* accessor, unsigned attributes);
+    JS_EXPORT_PRIVATE void setWritable(bool);
+    JS_EXPORT_PRIVATE void setEnumerable(bool);
+    JS_EXPORT_PRIVATE void setConfigurable(bool);
+    void setValue(JSValue value) { m_value = value; }
+    JS_EXPORT_PRIVATE void setSetter(JSValue);
+    JS_EXPORT_PRIVATE void setGetter(JSValue);
+    bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); }
+    bool writablePresent() const { return m_seenAttributes & WritablePresent; }
+    bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; }
+    bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; }
+    bool setterPresent() const { return m_setter; }
+    bool getterPresent() const { return m_getter; }
+    bool equalTo(ExecState*, const PropertyDescriptor& other) const;
+    bool attributesEqual(const PropertyDescriptor& other) const;
+    unsigned attributesOverridingCurrent(const PropertyDescriptor& current) const;
+
+private:
+    JS_EXPORTDATA static unsigned defaultAttributes;
+    bool operator==(const PropertyDescriptor&) { return false; }
+    enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4};
+    // May be a getter/setter
+    JSValue m_value;
+    JSValue m_getter;
+    JSValue m_setter;
+    unsigned m_attributes;
+    unsigned m_seenAttributes;
+};
 
-    private:
-        JS_EXPORTDATA static unsigned defaultAttributes;
-        bool operator==(const PropertyDescriptor&){ return false; }
-        enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4};
-        // May be a getter/setter
-        JSValue m_value;
-        JSValue m_getter;
-        JSValue m_setter;
-        unsigned m_attributes;
-        unsigned m_seenAttributes;
-    };
 }
 
 #endif
index 78dd319..e72cafb 100644 (file)
 
 namespace JSC {
 
-    inline void gcProtect(JSCell* val) 
-    {
-        Heap::heap(val)->protect(val);
-    }
+inline void gcProtect(JSCell* val) 
+{
+    Heap::heap(val)->protect(val);
+}
 
-    inline void gcUnprotect(JSCell* val)
-    {
-        Heap::heap(val)->unprotect(val);
-    }
+inline void gcUnprotect(JSCell* val)
+{
+    Heap::heap(val)->unprotect(val);
+}
 
-    inline void gcProtectNullTolerant(JSCell* val) 
-    {
-        if (val) 
-            gcProtect(val);
-    }
+inline void gcProtectNullTolerant(JSCell* val) 
+{
+    if (val) 
+        gcProtect(val);
+}
 
-    inline void gcUnprotectNullTolerant(JSCell* val) 
-    {
-        if (val) 
-            gcUnprotect(val);
-    }
-    
-    inline void gcProtect(JSValue value)
-    {
-        if (value && value.isCell())
-            gcProtect(value.asCell());
-    }
+inline void gcUnprotectNullTolerant(JSCell* val) 
+{
+    if (val) 
+        gcUnprotect(val);
+}
 
-    inline void gcUnprotect(JSValue value)
-    {
-        if (value && value.isCell())
-            gcUnprotect(value.asCell());
-    }
+inline void gcProtect(JSValue value)
+{
+    if (value && value.isCell())
+        gcProtect(value.asCell());
+}
+
+inline void gcUnprotect(JSValue value)
+{
+    if (value && value.isCell())
+        gcUnprotect(value.asCell());
+}
 
 } // namespace JSC
 
index 0095a30..fdf87d5 100644 (file)
 
 namespace JSC {
     
-    class JSObject;
-    class JSFunction;
+class JSObject;
+class JSFunction;
     
-    class PutPropertySlot {
-    public:
-        enum Type { Uncachable, ExistingProperty, NewProperty, SetterProperty, CustomProperty };
-        enum Context { UnknownContext, PutById, PutByIdEval };
-        typedef void (*PutValueFunc)(ExecState*, JSObject* base, EncodedJSValue thisObject, EncodedJSValue value);
-
-        PutPropertySlot(JSValue thisValue, bool isStrictMode = false, Context context = UnknownContext)
-            : m_type(Uncachable)
-            , m_base(0)
-            , m_thisValue(thisValue)
-            , m_isStrictMode(isStrictMode)
-            , m_context(context)
-            , m_putFunction(nullptr)
-        {
-        }
-
-        void setExistingProperty(JSObject* base, PropertyOffset offset)
-        {
-            m_type = ExistingProperty;
-            m_base = base;
-            m_offset = offset;
-        }
-
-        void setNewProperty(JSObject* base, PropertyOffset offset)
-        {
-            m_type = NewProperty;
-            m_base = base;
-            m_offset = offset;
-        }
-
-        void setCustomProperty(JSObject* base, PutValueFunc function)
-        {
-            m_type = CustomProperty;
-            m_base = base;
-            m_putFunction = function;
-        }
-        
-        void setCacheableSetter(JSObject* base, PropertyOffset offset)
-        {
-            m_type = SetterProperty;
-            m_base = base;
-            m_offset = offset;
-        }
-
-        void setThisValue(JSValue thisValue)
-        {
-            m_thisValue = thisValue;
-        }
-
-        PutValueFunc customSetter() const { return m_putFunction; }
-
-        Context context() const { return static_cast<Context>(m_context); }
-
-        Type type() const { return m_type; }
-        JSObject* base() const { return m_base; }
-        JSValue thisValue() const { return m_thisValue; }
-
-        bool isStrictMode() const { return m_isStrictMode; }
-        bool isCacheablePut() const { return m_type == NewProperty || m_type == ExistingProperty; }
-        bool isCacheableSetter() const { return m_type == SetterProperty; }
-        bool isCacheableCustom() const { return m_type == CustomProperty; }
-
-        PropertyOffset cachedOffset() const
-        {
-            return m_offset;
-        }
-
-    private:
-        Type m_type;
-        JSObject* m_base;
-        JSValue m_thisValue;
-        PropertyOffset m_offset;
-        bool m_isStrictMode;
-        uint8_t m_context;
-        PutValueFunc m_putFunction;
-
-    };
+class PutPropertySlot {
+public:
+    enum Type { Uncachable, ExistingProperty, NewProperty, SetterProperty, CustomProperty };
+    enum Context { UnknownContext, PutById, PutByIdEval };
+    typedef void (*PutValueFunc)(ExecState*, JSObject* base, EncodedJSValue thisObject, EncodedJSValue value);
+
+    PutPropertySlot(JSValue thisValue, bool isStrictMode = false, Context context = UnknownContext)
+        : m_type(Uncachable)
+        , m_base(0)
+        , m_thisValue(thisValue)
+        , m_isStrictMode(isStrictMode)
+        , m_context(context)
+        , m_putFunction(nullptr)
+    {
+    }
+
+    void setExistingProperty(JSObject* base, PropertyOffset offset)
+    {
+        m_type = ExistingProperty;
+        m_base = base;
+        m_offset = offset;
+    }
+
+    void setNewProperty(JSObject* base, PropertyOffset offset)
+    {
+        m_type = NewProperty;
+        m_base = base;
+        m_offset = offset;
+    }
+
+    void setCustomProperty(JSObject* base, PutValueFunc function)
+    {
+        m_type = CustomProperty;
+        m_base = base;
+        m_putFunction = function;
+    }
+
+    void setCacheableSetter(JSObject* base, PropertyOffset offset)
+    {
+        m_type = SetterProperty;
+        m_base = base;
+        m_offset = offset;
+    }
+
+    void setThisValue(JSValue thisValue)
+    {
+        m_thisValue = thisValue;
+    }
+
+    PutValueFunc customSetter() const { return m_putFunction; }
+
+    Context context() const { return static_cast<Context>(m_context); }
+
+    Type type() const { return m_type; }
+    JSObject* base() const { return m_base; }
+    JSValue thisValue() const { return m_thisValue; }
+
+    bool isStrictMode() const { return m_isStrictMode; }
+    bool isCacheablePut() const { return m_type == NewProperty || m_type == ExistingProperty; }
+    bool isCacheableSetter() const { return m_type == SetterProperty; }
+    bool isCacheableCustom() const { return m_type == CustomProperty; }
+
+    PropertyOffset cachedOffset() const
+    {
+        return m_offset;
+    }
+
+private:
+    Type m_type;
+    JSObject* m_base;
+    JSValue m_thisValue;
+    PropertyOffset m_offset;
+    bool m_isStrictMode;
+    uint8_t m_context;
+    PutValueFunc m_putFunction;
+};
 
 } // namespace JSC
 
index da7d950..4162862 100644 (file)
 
 namespace JSC {
 
-    struct RegExpRepresentation;
-    class VM;
+struct RegExpRepresentation;
+class VM;
 
-    JS_EXPORT_PRIVATE RegExpFlags regExpFlags(const String&);
+JS_EXPORT_PRIVATE RegExpFlags regExpFlags(const String&);
 
-    class RegExp : public JSCell {
-    public:
-        typedef JSCell Base;
+class RegExp : public JSCell {
+public:
+    typedef JSCell Base;
 
-        JS_EXPORT_PRIVATE static RegExp* create(VM&, const String& pattern, RegExpFlags);
-        static const bool needsDestruction = true;
-        static const bool hasImmortalStructure = true;
-        static void destroy(JSCell*);
+    JS_EXPORT_PRIVATE static RegExp* create(VM&, const String& pattern, RegExpFlags);
+    static const bool needsDestruction = true;
+    static const bool hasImmortalStructure = true;
+    static void destroy(JSCell*);
 
-        bool global() const { return m_flags & FlagGlobal; }
-        bool ignoreCase() const { return m_flags & FlagIgnoreCase; }
-        bool multiline() const { return m_flags & FlagMultiline; }
+    bool global() const { return m_flags & FlagGlobal; }
+    bool ignoreCase() const { return m_flags & FlagIgnoreCase; }
+    bool multiline() const { return m_flags & FlagMultiline; }
 
-        const String& pattern() const { return m_patternString; }
+    const String& pattern() const { return m_patternString; }
 
-        bool isValid() const { return !m_constructionError && m_flags != InvalidFlags; }
-        const char* errorMessage() const { return m_constructionError; }
+    bool isValid() const { return !m_constructionError && m_flags != InvalidFlags; }
+    const char* errorMessage() const { return m_constructionError; }
 
-        JS_EXPORT_PRIVATE int match(VM&, const String&, unsigned startOffset, Vector<int, 32>& ovector);
-        JS_EXPORT_PRIVATE MatchResult match(VM&, const String&, unsigned startOffset);
-        unsigned numSubpatterns() const { return m_numSubpatterns; }
+    JS_EXPORT_PRIVATE int match(VM&, const String&, unsigned startOffset, Vector<int, 32>& ovector);
+    JS_EXPORT_PRIVATE MatchResult match(VM&, const String&, unsigned startOffset);
+    unsigned numSubpatterns() const { return m_numSubpatterns; }
 
-        bool hasCode()
-        {
-            return m_state != NotCompiled;
-        }
+    bool hasCode()
+    {
+        return m_state != NotCompiled;
+    }
+
+    void invalidateCode();
 
-        void invalidateCode();
-        
 #if ENABLE(REGEXP_TRACING)
-        void printTraceData();
+    void printTraceData();
 #endif
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
-        }
-        
-        DECLARE_INFO;
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
+    }
+
+    DECLARE_INFO;
 
-        RegExpKey key() { return RegExpKey(m_flags, m_patternString); }
+    RegExpKey key() { return RegExpKey(m_flags, m_patternString); }
 
-    protected:
-        static const unsigned StructureFlags = StructureIsImmortal;
+protected:
+    static const unsigned StructureFlags = StructureIsImmortal;
 
-        void finishCreation(VM&);
+    void finishCreation(VM&);
 
-    private:
-        friend class RegExpCache;
-        RegExp(VM&, const String&, RegExpFlags);
+private:
+    friend class RegExpCache;
+    RegExp(VM&, const String&, RegExpFlags);
 
-        static RegExp* createWithoutCaching(VM&, const String&, RegExpFlags);
+    static RegExp* createWithoutCaching(VM&, const String&, RegExpFlags);
 
-        enum RegExpState {
-            ParseError,
-            JITCode,
-            ByteCode,
-            NotCompiled
-        } m_state;
+    enum RegExpState {
+        ParseError,
+        JITCode,
+        ByteCode,
+        NotCompiled
+    };
 
-        void compile(VM*, Yarr::YarrCharSize);
-        void compileIfNecessary(VM&, Yarr::YarrCharSize);
+    RegExpState m_state;
 
-        void compileMatchOnly(VM*, Yarr::YarrCharSize);
-        void compileIfNecessaryMatchOnly(VM&, Yarr::YarrCharSize);
+    void compile(VM*, Yarr::YarrCharSize);
+    void compileIfNecessary(VM&, Yarr::YarrCharSize);
+
+    void compileMatchOnly(VM*, Yarr::YarrCharSize);
+    void compileIfNecessaryMatchOnly(VM&, Yarr::YarrCharSize);
 
 #if ENABLE(YARR_JIT_DEBUG)
-        void matchCompareWithInterpreter(const String&, int startOffset, int* offsetVector, int jitResult);
+    void matchCompareWithInterpreter(const String&, int startOffset, int* offsetVector, int jitResult);
 #endif
 
-        String m_patternString;
-        RegExpFlags m_flags;
-        const char* m_constructionError;
-        unsigned m_numSubpatterns;
+    String m_patternString;
+    RegExpFlags m_flags;
+    const char* m_constructionError;
+    unsigned m_numSubpatterns;
 #if ENABLE(REGEXP_TRACING)
-        double m_rtMatchOnlyTotalSubjectStringLen;
-        double m_rtMatchTotalSubjectStringLen;
-        unsigned m_rtMatchOnlyCallCount;
-        unsigned m_rtMatchOnlyFoundCount;
-        unsigned m_rtMatchCallCount;
-        unsigned m_rtMatchFoundCount;
+    double m_rtMatchOnlyTotalSubjectStringLen;
+    double m_rtMatchTotalSubjectStringLen;
+    unsigned m_rtMatchOnlyCallCount;
+    unsigned m_rtMatchOnlyFoundCount;
+    unsigned m_rtMatchCallCount;
+    unsigned m_rtMatchFoundCount;
 #endif
 
 #if ENABLE(YARR_JIT)
-        Yarr::YarrCodeBlock m_regExpJITCode;
+    Yarr::YarrCodeBlock m_regExpJITCode;
 #endif
-        OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
-    };
+    OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
+};
 
 } // namespace JSC
 
index d2763bc..20a525c 100644 (file)
 
 namespace JSC {
 
-    class JSString;
-    class RegExpMatchesArray;
+class JSString;
+class RegExpMatchesArray;
 
-    // RegExpCachedResult is used to track the cached results of the last
-    // match, stores on the RegExp constructor (e.g. $&, $_, $1, $2 ...).
-    // These values will be lazily generated on demand, so the cached result
-    // may be in a lazy or reified state. A lazy state is indicated by a
-    // value of m_result indicating a successful match, and a reified state
-    // is indicated by setting m_result to MatchResult::failed().
-    // Following a successful match, m_result, m_lastInput and m_lastRegExp
-    // can be used to reify the results from the match, following reification
-    // m_reifiedResult and m_reifiedInput hold the cached results.
-    class RegExpCachedResult {
-    public:
-        RegExpCachedResult(VM& vm, JSObject* owner, RegExp* emptyRegExp)
-            : m_result(0, 0)
-        {
-            m_lastInput.set(vm, owner, jsEmptyString(&vm));
-            m_lastRegExp.set(vm, owner, emptyRegExp);
-        }
+// RegExpCachedResult is used to track the cached results of the last
+// match, stores on the RegExp constructor (e.g. $&, $_, $1, $2 ...).
+// These values will be lazily generated on demand, so the cached result
+// may be in a lazy or reified state. A lazy state is indicated by a
+// value of m_result indicating a successful match, and a reified state
+// is indicated by setting m_result to MatchResult::failed().
+// Following a successful match, m_result, m_lastInput and m_lastRegExp
+// can be used to reify the results from the match, following reification
+// m_reifiedResult and m_reifiedInput hold the cached results.
+class RegExpCachedResult {
+public:
+    RegExpCachedResult(VM& vm, JSObject* owner, RegExp* emptyRegExp)
+        : m_result(0, 0)
+    {
+        m_lastInput.set(vm, owner, jsEmptyString(&vm));
+        m_lastRegExp.set(vm, owner, emptyRegExp);
+    }
 
-        ALWAYS_INLINE void record(VM& vm, JSObject* owner, RegExp* regExp, JSString* input, MatchResult result)
-        {
-            m_lastRegExp.set(vm, owner, regExp);
-            m_lastInput.set(vm, owner, input);
-            m_result = result;
-        }
+    ALWAYS_INLINE void record(VM& vm, JSObject* owner, RegExp* regExp, JSString* input, MatchResult result)
+    {
+        m_lastRegExp.set(vm, owner, regExp);
+        m_lastInput.set(vm, owner, input);
+        m_result = result;
+    }
 
-        RegExpMatchesArray* lastResult(ExecState*, JSObject* owner);
-        void setInput(ExecState*, JSObject* owner, JSString*);
+    RegExpMatchesArray* lastResult(ExecState*, JSObject* owner);
+    void setInput(ExecState*, JSObject* owner, JSString*);
 
-        JSString* input()
-        {
-            // If m_result showas a match then we're in a lazy state, so m_lastInput
-            // is the most recent value of the input property. If not then we have
-            // reified, in which case m_reifiedInput will contain the correct value.
-            return m_result ? m_lastInput.get() : m_reifiedInput.get();
-        }
+    JSString* input()
+    {
+        // If m_result showas a match then we're in a lazy state, so m_lastInput
+        // is the most recent value of the input property. If not then we have
+        // reified, in which case m_reifiedInput will contain the correct value.
+        return m_result ? m_lastInput.get() : m_reifiedInput.get();
+    }
 
-        void visitChildren(SlotVisitor&);
+    void visitChildren(SlotVisitor&);
 
-    private:
-        MatchResult m_result;
-        WriteBarrier<JSString> m_lastInput;
-        WriteBarrier<RegExp> m_lastRegExp;
-        WriteBarrier<RegExpMatchesArray> m_reifiedResult;
-        WriteBarrier<JSString> m_reifiedInput;
-    };
+private:
+    MatchResult m_result;
+    WriteBarrier<JSString> m_lastInput;
+    WriteBarrier<RegExp> m_lastRegExp;
+    WriteBarrier<RegExpMatchesArray> m_reifiedResult;
+    WriteBarrier<JSString> m_reifiedInput;
+};
 
 } // namespace JSC
 
index c6f15c0..0420d1e 100644 (file)
 
 namespace JSC {
 
-    class RegExpPrototype;
+class RegExpPrototype;
 
-    class RegExpConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class RegExpConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static RegExpConstructor* create(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype)
-        {
-            RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(vm.heap)) RegExpConstructor(vm, structure, regExpPrototype);
-            constructor->finishCreation(vm, regExpPrototype);
-            return constructor;
-        }
+    static RegExpConstructor* create(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype)
+    {
+        RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(vm.heap)) RegExpConstructor(vm, structure, regExpPrototype);
+        constructor->finishCreation(vm, regExpPrototype);
+        return constructor;
+    }
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        MatchResult performMatch(VM&, RegExp*, JSString*, const String&, int startOffset, int** ovector);
-        MatchResult performMatch(VM&, RegExp*, JSString*, const String&, int startOffset);
+    MatchResult performMatch(VM&, RegExp*, JSString*, const String&, int startOffset, int** ovector);
+    MatchResult performMatch(VM&, RegExp*, JSString*, const String&, int startOffset);
 
-        void setMultiline(bool multiline) { m_multiline = multiline; }
-        bool multiline() const { return m_multiline; }
+    void setMultiline(bool multiline) { m_multiline = multiline; }
+    bool multiline() const { return m_multiline; }
 
-        JSValue getBackref(ExecState*, unsigned);
-        JSValue getLastParen(ExecState*);
-        JSValue getLeftContext(ExecState*);
-        JSValue getRightContext(ExecState*);
+    JSValue getBackref(ExecState*, unsigned);
+    JSValue getLastParen(ExecState*);
+    JSValue getLeftContext(ExecState*);
+    JSValue getRightContext(ExecState*);
 
-        void setInput(ExecState* exec, JSString* string) { m_cachedResult.setInput(exec, this, string); }
-        JSString* input() { return m_cachedResult.input(); }
+    void setInput(ExecState* exec, JSString* string) { m_cachedResult.setInput(exec, this, string); }
+    JSString* input() { return m_cachedResult.input(); }
 
-        static void visitChildren(JSCell*, SlotVisitor&);
+    static void visitChildren(JSCell*, SlotVisitor&);
 
-    protected:
-        void finishCreation(VM&, RegExpPrototype*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
+protected:
+    void finishCreation(VM&, RegExpPrototype*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
 
-    private:
-        RegExpConstructor(VM&, Structure*, RegExpPrototype*);
-        static void destroy(JSCell*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
+private:
+    RegExpConstructor(VM&, Structure*, RegExpPrototype*);
+    static void destroy(JSCell*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
 
-        RegExpCachedResult m_cachedResult;
-        bool m_multiline;
-        Vector<int, 32> m_ovector;
-    };
+    RegExpCachedResult m_cachedResult;
+    bool m_multiline;
+    Vector<int, 32> m_ovector;
+};
 
-    RegExpConstructor* asRegExpConstructor(JSValue);
+RegExpConstructor* asRegExpConstructor(JSValue);
 
-    JSObject* constructRegExp(ExecState*, JSGlobalObject*, const ArgList&, bool callAsConstructor = false);
+JSObject* constructRegExp(ExecState*, JSGlobalObject*, const ArgList&, bool callAsConstructor = false);
 
-    inline RegExpConstructor* asRegExpConstructor(JSValue value)
-    {
-        ASSERT(asObject(value)->inherits(RegExpConstructor::info()));
-        return static_cast<RegExpConstructor*>(asObject(value));
-    }
+inline RegExpConstructor* asRegExpConstructor(JSValue value)
+{
+    ASSERT(asObject(value)->inherits(RegExpConstructor::info()));
+    return static_cast<RegExpConstructor*>(asObject(value));
+}
 
-    /* 
-      To facilitate result caching, exec(), test(), match(), search(), and replace() dipatch regular
-      expression matching through the performMatch function. We use cached results to calculate, 
-      e.g., RegExp.lastMatch and RegExp.leftParen.
-    */
-    ALWAYS_INLINE MatchResult RegExpConstructor::performMatch(VM& vm, RegExp* regExp, JSString* string, const String& input, int startOffset, int** ovector)
-    {
-        int position = regExp->match(vm, input, startOffset, m_ovector);
+/* 
+   To facilitate result caching, exec(), test(), match(), search(), and replace() dipatch regular
+   expression matching through the performMatch function. We use cached results to calculate, 
+   e.g., RegExp.lastMatch and RegExp.leftParen.
+*/
+ALWAYS_INLINE MatchResult RegExpConstructor::performMatch(VM& vm, RegExp* regExp, JSString* string, const String& input, int startOffset, int** ovector)
+{
+    int position = regExp->match(vm, input, startOffset, m_ovector);
 
-        if (ovector)
-            *ovector = m_ovector.data();
+    if (ovector)
+        *ovector = m_ovector.data();
 
-        if (position == -1)
-            return MatchResult::failed();
+    if (position == -1)
+        return MatchResult::failed();
 
-        ASSERT(!m_ovector.isEmpty());
-        ASSERT(m_ovector[0] == position);
-        ASSERT(m_ovector[1] >= position);
-        size_t end = m_ovector[1];
+    ASSERT(!m_ovector.isEmpty());
+    ASSERT(m_ovector[0] == position);
+    ASSERT(m_ovector[1] >= position);
+    size_t end = m_ovector[1];
 
-        m_cachedResult.record(vm, this, regExp, string, MatchResult(position, end));
+    m_cachedResult.record(vm, this, regExp, string, MatchResult(position, end));
 
-        return MatchResult(position, end);
-    }
-    ALWAYS_INLINE MatchResult RegExpConstructor::performMatch(VM& vm, RegExp* regExp, JSString* string, const String& input, int startOffset)
-    {
-        MatchResult result = regExp->match(vm, input, startOffset);
-        if (result)
-            m_cachedResult.record(vm, this, regExp, string, result);
-        return result;
-    }
+    return MatchResult(position, end);
+}
+ALWAYS_INLINE MatchResult RegExpConstructor::performMatch(VM& vm, RegExp* regExp, JSString* string, const String& input, int startOffset)
+{
+    MatchResult result = regExp->match(vm, input, startOffset);
+    if (result)
+        m_cachedResult.record(vm, this, regExp, string, result);
+    return result;
+}
 
 } // namespace JSC
 
index a416b36..ac7f895 100644 (file)
 
 namespace JSC {
 
-    class RegExpMatchesArray : public JSArray {
-    private:
-        RegExpMatchesArray(VM&, Butterfly*, JSGlobalObject*, JSString*, RegExp*, MatchResult);
+class RegExpMatchesArray : public JSArray {
+private:
+    RegExpMatchesArray(VM&, Butterfly*, JSGlobalObject*, JSString*, RegExp*, MatchResult);
 
-        enum ReifiedState { ReifiedNone, ReifiedMatch, ReifiedAll };
+    enum ReifiedState { ReifiedNone, ReifiedMatch, ReifiedAll };
 
-    public:
-        typedef JSArray Base;
+public:
+    typedef JSArray Base;
 
-        static RegExpMatchesArray* create(ExecState*, JSString*, RegExp*, MatchResult);
+    static RegExpMatchesArray* create(ExecState*, JSString*, RegExp*, MatchResult);
 
-        JSString* leftContext(ExecState*);
-        JSString* rightContext(ExecState*);
+    JSString* leftContext(ExecState*);
+    JSString* rightContext(ExecState*);
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info(), ArrayWithSlowPutArrayStorage);
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info(), ArrayWithSlowPutArrayStorage);
+    }
 
-        static void visitChildren(JSCell*, SlotVisitor&);
+    static void visitChildren(JSCell*, SlotVisitor&);
 
-    protected:
-        void finishCreation(VM&);
+protected:
+    void finishCreation(VM&);
 
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | Base::StructureFlags;
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | Base::StructureFlags;
 
-    private:
-        ALWAYS_INLINE void reifyAllPropertiesIfNecessary(ExecState* exec)
-        {
-            if (m_state != ReifiedAll)
-                reifyAllProperties(exec);
-        }
+private:
+    ALWAYS_INLINE void reifyAllPropertiesIfNecessary(ExecState* exec)
+    {
+        if (m_state != ReifiedAll)
+            reifyAllProperties(exec);
+    }
 
-        ALWAYS_INLINE void reifyMatchPropertyIfNecessary(ExecState* exec)
-        {
-            if (m_state == ReifiedNone)
-                reifyMatchProperty(exec);
-        }
+    ALWAYS_INLINE void reifyMatchPropertyIfNecessary(ExecState* exec)
+    {
+        if (m_state == ReifiedNone)
+            reifyMatchProperty(exec);
+    }
 
-        static bool getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            return JSArray::getOwnPropertySlot(thisObject, exec, propertyName, slot);
-        }
-
-        static bool getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned propertyName, PropertySlot& slot)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
-            if (propertyName)
-                thisObject->reifyAllPropertiesIfNecessary(exec);
-            else
-                thisObject->reifyMatchPropertyIfNecessary(exec);
-            return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot);
-        }
-
-        static void put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue v, PutPropertySlot& slot)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            JSArray::put(thisObject, exec, propertyName, v, slot);
-        }
-        
-        static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v, bool shouldThrow)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            JSArray::putByIndex(thisObject, exec, propertyName, v, shouldThrow);
-        }
+    static bool getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        return JSArray::getOwnPropertySlot(thisObject, exec, propertyName, slot);
+    }
 
-        static bool deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
+    static bool getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned propertyName, PropertySlot& slot)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
+        if (propertyName)
             thisObject->reifyAllPropertiesIfNecessary(exec);
-            return JSArray::deleteProperty(thisObject, exec, propertyName);
-        }
-
-        static bool deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            return JSArray::deletePropertyByIndex(thisObject, exec, propertyName);
-        }
-
-        static void getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            JSArray::getOwnPropertyNames(thisObject, exec, arr, mode);
-        }
-
-        static bool defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
-        {
-            RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
-            thisObject->reifyAllPropertiesIfNecessary(exec);
-            return JSArray::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow);
-        }
-
-        void reifyAllProperties(ExecState*);
-        void reifyMatchProperty(ExecState*);
-
-        WriteBarrier<JSString> m_input;
-        WriteBarrier<RegExp> m_regExp;
-        MatchResult m_result;
-        ReifiedState m_state;
+        else
+            thisObject->reifyMatchPropertyIfNecessary(exec);
+        return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot);
+    }
+
+    static void put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue v, PutPropertySlot& slot)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        JSArray::put(thisObject, exec, propertyName, v, slot);
+    }
+
+    static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v, bool shouldThrow)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        JSArray::putByIndex(thisObject, exec, propertyName, v, shouldThrow);
+    }
+
+    static bool deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        return JSArray::deleteProperty(thisObject, exec, propertyName);
+    }
+
+    static bool deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        return JSArray::deletePropertyByIndex(thisObject, exec, propertyName);
+    }
+
+    static void getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        JSArray::getOwnPropertyNames(thisObject, exec, arr, mode);
+    }
+
+    static bool defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
+    {
+        RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
+        thisObject->reifyAllPropertiesIfNecessary(exec);
+        return JSArray::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow);
+    }
+
+    void reifyAllProperties(ExecState*);
+    void reifyMatchProperty(ExecState*);
+
+    WriteBarrier<JSString> m_input;
+    WriteBarrier<RegExp> m_regExp;
+    MatchResult m_result;
+    ReifiedState m_state;
 };
 
 inline bool isRegExpMatchesArray(JSValue value)
index 870038c..7c4b750 100644 (file)
 
 namespace JSC {
     
-    class RegExpObject : public JSNonFinalObject {
-    public:
-        typedef JSNonFinalObject Base;
-
-        static RegExpObject* create(VM& vm, Structure* structure, RegExp* regExp)
-        {
-            RegExpObject* object = new (NotNull, allocateCell<RegExpObject>(vm.heap)) RegExpObject(vm, structure, regExp);
-            object->finishCreation(vm);
-            return object;
-        }
-
-        void setRegExp(VM& vm, RegExp* r) { m_regExp.set(vm, this, r); }
-        RegExp* regExp() const { return m_regExp.get(); }
-
-        void setLastIndex(ExecState* exec, size_t lastIndex)
-        {
+class RegExpObject : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
+
+    static RegExpObject* create(VM& vm, Structure* structure, RegExp* regExp)
+    {
+        RegExpObject* object = new (NotNull, allocateCell<RegExpObject>(vm.heap)) RegExpObject(vm, structure, regExp);
+        object->finishCreation(vm);
+        return object;
+    }
+
+    void setRegExp(VM& vm, RegExp* r) { m_regExp.set(vm, this, r); }
+    RegExp* regExp() const { return m_regExp.get(); }
+
+    void setLastIndex(ExecState* exec, size_t lastIndex)
+    {
+        m_lastIndex.setWithoutWriteBarrier(jsNumber(lastIndex));
+        if (LIKELY(m_lastIndexIsWritable))
             m_lastIndex.setWithoutWriteBarrier(jsNumber(lastIndex));
-            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->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)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        JS_EXPORT_PRIVATE RegExpObject(VM&, Structure*, RegExp*);
-        JS_EXPORT_PRIVATE void finishCreation(VM&);
-
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | Base::StructureFlags;
-
-        static void visitChildren(JSCell*, SlotVisitor&);
-
-        JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
-        JS_EXPORT_PRIVATE static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
-        JS_EXPORT_PRIVATE static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
-        JS_EXPORT_PRIVATE static void getGenericPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
-        JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const 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
     {
-        ASSERT(asObject(value)->inherits(RegExpObject::info()));
-        return static_cast<RegExpObject*>(asObject(value));
+        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)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+protected:
+    JS_EXPORT_PRIVATE RegExpObject(VM&, Structure*, RegExp*);
+    JS_EXPORT_PRIVATE void finishCreation(VM&);
+
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | Base::StructureFlags;
+
+    static void visitChildren(JSCell*, SlotVisitor&);
+
+    JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
+    JS_EXPORT_PRIVATE static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+    JS_EXPORT_PRIVATE static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+    JS_EXPORT_PRIVATE static void getGenericPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+    JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const 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)
+{
+    ASSERT(asObject(value)->inherits(RegExpObject::info()));
+    return static_cast<RegExpObject*>(asObject(value));
+}
+
 } // namespace JSC
 
 #endif // RegExpObject_h
index e9fef17..f98fd06 100644 (file)
 
 namespace JSC {
 
-    class RegExpPrototype : public RegExpObject {
-    public:
-        typedef RegExpObject Base;
-
-        static RegExpPrototype* create(VM& vm, Structure* structure, RegExp* regExp)
-        {
-            RegExpPrototype* prototype = new (NotNull, allocateCell<RegExpPrototype>(vm.heap)) RegExpPrototype(vm, structure, regExp);
-            prototype->finishCreation(vm);
-            return prototype;
-        }
-        
-        DECLARE_INFO;
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        RegExpPrototype(VM&, Structure*, RegExp*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | RegExpObject::StructureFlags;
-
-    private:
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    };
+class RegExpPrototype : public RegExpObject {
+public:
+    typedef RegExpObject Base;
+
+    static RegExpPrototype* create(VM& vm, Structure* structure, RegExp* regExp)
+    {
+        RegExpPrototype* prototype = new (NotNull, allocateCell<RegExpPrototype>(vm.heap)) RegExpPrototype(vm, structure, regExp);
+        prototype->finishCreation(vm);
+        return prototype;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+protected:
+    RegExpPrototype(VM&, Structure*, RegExp*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | RegExpObject::StructureFlags;
+
+private:
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
 
 } // namespace JSC
 
index e3d3981..25127b3 100644 (file)
@@ -47,65 +47,65 @@ class StringImpl;
 
 namespace JSC {
 
-    class HeapRootVisitor;
-    class VM;
-    class JSString;
-    class SmallStringsStorage;
-    class SlotVisitor;
+class HeapRootVisitor;
+class VM;
+class JSString;
+class SmallStringsStorage;
+class SlotVisitor;
 
-    static const unsigned maxSingleCharacterString = 0xFF;
+static const unsigned maxSingleCharacterString = 0xFF;
 
-    class SmallStrings {
-        WTF_MAKE_NONCOPYABLE(SmallStrings);
-    public:
-        SmallStrings();
-        ~SmallStrings();
+class SmallStrings {
+    WTF_MAKE_NONCOPYABLE(SmallStrings);
+public:
+    SmallStrings();
+    ~SmallStrings();
 
-        JSString* emptyString()
-        {
-            return m_emptyString;
-        }
+    JSString* emptyString()
+    {
+        return m_emptyString;
+    }
 
-        JSString* singleCharacterString(unsigned char character)
-        {
-            return m_singleCharacterStrings[character];
-        }
+    JSString* singleCharacterString(unsigned char character)
+    {
+        return m_singleCharacterStrings[character];
+    }
 
-        JS_EXPORT_PRIVATE WTF::StringImpl* singleCharacterStringRep(unsigned char character);
+    JS_EXPORT_PRIVATE WTF::StringImpl* singleCharacterStringRep(unsigned char character);
 
-        JSString** singleCharacterStrings() { return &m_singleCharacterStrings[0]; }
+    JSString** singleCharacterStrings() { return &m_singleCharacterStrings[0]; }
 
-        void initializeCommonStrings(VM&);
-        void visitStrongReferences(SlotVisitor&);
+    void initializeCommonStrings(VM&);
+    void visitStrongReferences(SlotVisitor&);
 
 #define JSC_COMMON_STRINGS_ACCESSOR_DEFINITION(name) \
-        JSString* name##String() const \
-        { \
-            return m_##name; \
-        }
-        JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ACCESSOR_DEFINITION)
+    JSString* name##String() const                   \
+    {                                                \
+        return m_##name;                             \
+    }
+    JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ACCESSOR_DEFINITION)
 #undef JSC_COMMON_STRINGS_ACCESSOR_DEFINITION
 
-        JSString* nullObjectString() const { return m_nullObjectString; }
-        JSString* undefinedObjectString() const { return m_undefinedObjectString; }
+    JSString* nullObjectString() const { return m_nullObjectString; }
+    JSString* undefinedObjectString() const { return m_undefinedObjectString; }
 
-    private:
-        static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
+private:
+    static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
 
-        JS_EXPORT_PRIVATE void createEmptyString(VM*);
-        JS_EXPORT_PRIVATE void createSingleCharacterString(VM*, unsigned char);
+    JS_EXPORT_PRIVATE void createEmptyString(VM*);
+    JS_EXPORT_PRIVATE void createSingleCharacterString(VM*, unsigned char);
 
-        void initialize(VM* vm, JSString*& string, const char* value) const;
+    void initialize(VM*, JSString*&, const char* value) const;
 
-        JSString* m_emptyString;
+    JSString* m_emptyString;
 #define JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION(name) JSString* m_##name;
-        JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION)
+    JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION)
 #undef JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION
-        JSString* m_nullObjectString;
-        JSString* m_undefinedObjectString;
-        JSString* m_singleCharacterStrings[singleCharacterStringCount];
-        OwnPtr<SmallStringsStorage> m_storage;
-    };
+    JSString* m_nullObjectString;
+    JSString* m_undefinedObjectString;
+    JSString* m_singleCharacterStrings[singleCharacterStringCount];
+    OwnPtr<SmallStringsStorage> m_storage;
+};
 
 } // namespace JSC
 
index a2c0823..e8bcefd 100644 (file)
 
 namespace JSC {
 
-    class StringPrototype;
+class StringPrototype;
 
-    class StringConstructor : public InternalFunction {
-    public:
-        typedef InternalFunction Base;
+class StringConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static StringConstructor* create(VM& vm, Structure* structure, StringPrototype* stringPrototype)
-        {
-            StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(vm.heap)) StringConstructor(vm, structure);
-            constructor->finishCreation(vm, stringPrototype);
-            return constructor;
-        }
+    static StringConstructor* create(VM& vm, Structure* structure, StringPrototype* stringPrototype)
+    {
+        StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(vm.heap)) StringConstructor(vm, structure);
+        constructor->finishCreation(vm, stringPrototype);
+        return constructor;
+    }
 
-        DECLARE_INFO;
+    DECLARE_INFO;
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    protected:
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
+protected:
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
-    private:
-        StringConstructor(VM&, Structure*);
-        void finishCreation(VM&, StringPrototype*);
-        static ConstructType getConstructData(JSCell*, ConstructData&);
-        static CallType getCallData(JSCell*, CallData&);
+private:
+    StringConstructor(VM&, Structure*);
+    void finishCreation(VM&, StringPrototype*);
+    static ConstructType getConstructData(JSCell*, ConstructData&);
+    static CallType getCallData(JSCell*, CallData&);
 
-        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    };
+    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+};
     
-    JSCell* JSC_HOST_CALL stringFromCharCode(ExecState*, int32_t);
+JSCell* JSC_HOST_CALL stringFromCharCode(ExecState*, int32_t);
 
 } // namespace JSC
 
index 9508cd3..0cebfde 100644 (file)
 
 namespace JSC {
 
-    class StringObject : public JSWrapperObject {
-    public:
-        typedef JSWrapperObject Base;
-
-        static StringObject* create(VM& vm, Structure* structure)
-        {
-            JSString* string = jsEmptyString(&vm);
-            StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
-            object->finishCreation(vm, string);
-            return object;
-        }
-        static StringObject* create(VM& vm, Structure* structure, JSString* string)
-        {
-            StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
-            object->finishCreation(vm, string);
-            return object;
-        }
-        static StringObject* create(VM&, JSGlobalObject*, JSString*);
-
-        JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-        JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
-
-        JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
-        JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
-
-        JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
-        JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
-        JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
-        JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
-
-        DECLARE_EXPORT_INFO;
-
-        JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
-
-    protected:
-        JS_EXPORT_PRIVATE void finishCreation(VM&, JSString*);
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
-        JS_EXPORT_PRIVATE StringObject(VM&, Structure*);
-    };
-
-    StringObject* asStringObject(JSValue);
-
-    inline StringObject* asStringObject(JSValue value)
+class StringObject : public JSWrapperObject {
+public:
+    typedef JSWrapperObject Base;
+
+    static StringObject* create(VM& vm, Structure* structure)
+    {
+        JSString* string = jsEmptyString(&vm);
+        StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
+        object->finishCreation(vm, string);
+        return object;
+    }
+    static StringObject* create(VM& vm, Structure* structure, JSString* string)
+    {
+        StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
+        object->finishCreation(vm, string);
+        return object;
+    }
+    static StringObject* create(VM&, JSGlobalObject*, JSString*);
+
+    JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+    JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
+
+    JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+    JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
+
+    JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
+    JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
+    JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+    JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
+
+    DECLARE_EXPORT_INFO;
+
+    JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
-        ASSERT(asObject(value)->inherits(StringObject::info()));
-        return static_cast<StringObject*>(asObject(value));
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
     }
 
-    JS_EXPORT_PRIVATE StringObject* constructString(VM&, JSGlobalObject*, JSValue);
+protected:
+    JS_EXPORT_PRIVATE void finishCreation(VM&, JSString*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
+    JS_EXPORT_PRIVATE StringObject(VM&, Structure*);
+};
+
+StringObject* asStringObject(JSValue);
+
+inline StringObject* asStringObject(JSValue value)
+{
+    ASSERT(asObject(value)->inherits(StringObject::info()));
+    return static_cast<StringObject*>(asObject(value));
+}
+
+JS_EXPORT_PRIVATE StringObject* constructString(VM&, JSGlobalObject*, JSValue);
 
 } // namespace JSC
 
index fe22453..9657796 100644 (file)
 
 namespace JSC {
 
-    class ObjectPrototype;
+class ObjectPrototype;
 
-    class StringPrototype : public StringObject {
-    private:
-        StringPrototype(VM&, Structure*);
+class StringPrototype : public StringObject {
+private:
+    StringPrototype(VM&, Structure*);
 
-    public:
-        typedef StringObject Base;
+public:
+    typedef StringObject Base;
 
-        static StringPrototype* create(VM&, JSGlobalObject*, Structure*);
+    static StringPrototype* create(VM&, JSGlobalObject*, Structure*);
 
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-        }
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-        DECLARE_INFO;
-        
-    protected:
-        void finishCreation(VM&, JSGlobalObject*, JSString*);
-        static const unsigned StructureFlags = StringObject::StructureFlags;
+    DECLARE_INFO;
 
-    };
+protected:
+    void finishCreation(VM&, JSGlobalObject*, JSString*);
+    static const unsigned StructureFlags = StringObject::StructureFlags;
+};
 
 } // namespace JSC
 
index 1b2fe0f..49f3e46 100644 (file)
 
 namespace JSC {
 
-    class LLIntOffsetsExtractor;
-    class Structure;
-
-    class StructureChain : public JSCell {
-        friend class JIT;
-
-    public:
-        typedef JSCell Base;
-
-        static StructureChain* create(VM& vm, Structure* head)
-        
-            StructureChain* chain = new (NotNull, allocateCell<StructureChain>(vm.heap)) StructureChain(vm, vm.structureChainStructure.get());
-            chain->finishCreation(vm, head);
-            return chain;
-        }
-        WriteBarrier<Structure>* head() { return m_vector.get(); }
-        static void visitChildren(JSCell*, SlotVisitor&);
-
-        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-        {
-            return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
-        }
-        
-        DECLARE_INFO;
-
-        static const bool needsDestruction = true;
-        static const bool hasImmortalStructure = true;
-        static void destroy(JSCell*);
-
-    protected:
-        static const unsigned StructureFlags = StructureIsImmortal;
-
-        void finishCreation(VM& vm, Structure* head)
-        {
-            Base::finishCreation(vm);
-            size_t size = 0;
-            for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
-                ++size;
-    
-            m_vector = std::make_unique<WriteBarrier<Structure>[]>(size + 1);
-
-            size_t i = 0;
-            for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
-                m_vector[i++].set(vm, this, current);
-        }
-
-    private:
-        friend class LLIntOffsetsExtractor;
-        
-        StructureChain(VM&, Structure*);
-        std::unique_ptr<WriteBarrier<Structure>[]> m_vector;
-    };
+class LLIntOffsetsExtractor;
+class Structure;
+
+class StructureChain : public JSCell {
+    friend class JIT;
+
+public:
+    typedef JSCell Base;
+
+    static StructureChain* create(VM& vm, Structure* head)
+    { 
+        StructureChain* chain = new (NotNull, allocateCell<StructureChain>(vm.heap)) StructureChain(vm, vm.structureChainStructure.get());
+        chain->finishCreation(vm, head);
+        return chain;
+    }
+    WriteBarrier<Structure>* head() { return m_vector.get(); }
+    static void visitChildren(JSCell*, SlotVisitor&);
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
+    }
+
+    DECLARE_INFO;
+
+    static const bool needsDestruction = true;
+    static const bool hasImmortalStructure = true;
+    static void destroy(JSCell*);
+
+protected:
+    static const unsigned StructureFlags = StructureIsImmortal;
+
+    void finishCreation(VM& vm, Structure* head)
+    {
+        Base::finishCreation(vm);
+        size_t size = 0;
+        for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+            ++size;
+
+        m_vector = std::make_unique<WriteBarrier<Structure>[]>(size + 1);
+
+        size_t i = 0;
+        for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+            m_vector[i++].set(vm, this, current);
+    }
+
+private:
+    friend class LLIntOffsetsExtractor;
+
+    StructureChain(VM&, Structure*);
+    std::unique_ptr<WriteBarrier<Structure>[]> m_vector;
+};
 
 } // namespace JSC
 
index fca639b..9c12e2d 100644 (file)
 
 namespace JSC {
 
-    class ArityCheckFailReturnThunks;
-    class BuiltinExecutables;
-    class CallEdgeLog;
-    class CodeBlock;
-    class CodeCache;
-    class CommonIdentifiers;
-    class ExecState;
-    class HandleStack;
-    class TypeProfiler;
-    class TypeProfilerLog;
-    class Identifier;
-    class Interpreter;
-    class JSGlobalObject;
-    class JSObject;
-    class Keywords;
-    class LLIntOffsetsExtractor;
-    class LegacyProfiler;
-    class NativeExecutable;
-    class ParserArena;
-    class RegExpCache;
-    class ScriptExecutable;
-    class SourceProvider;
-    class SourceProviderCache;
-    struct StackFrame;
-    class Stringifier;
-    class Structure;
+class ArityCheckFailReturnThunks;
+class BuiltinExecutables;
+class CallEdgeLog;
+class CodeBlock;
+class CodeCache;
+class CommonIdentifiers;
+class ExecState;
+class HandleStack;
+class TypeProfiler;
+class TypeProfilerLog;
+class Identifier;
+class Interpreter;
+class JSGlobalObject;
+class JSObject;
+class Keywords;
+class LLIntOffsetsExtractor;
+class LegacyProfiler;
+class NativeExecutable;
+class ParserArena;
+class RegExpCache;
+class ScriptExecutable;
+class SourceProvider;
+class SourceProviderCache;
+struct StackFrame;
+class Stringifier;
+class Structure;
 #if ENABLE(REGEXP_TRACING)
-    class RegExp;
+class RegExp;
 #endif
-    class UnlinkedCodeBlock;
-    class UnlinkedEvalCodeBlock;
-    class UnlinkedFunctionExecutable;
-    class UnlinkedProgramCodeBlock;
-    class VirtualRegister;
-    class VMEntryScope;
-    class Watchpoint;
-    class WatchpointSet;
+class UnlinkedCodeBlock;
+class UnlinkedEvalCodeBlock;
+class UnlinkedFunctionExecutable;
+class UnlinkedProgramCodeBlock;
+class VirtualRegister;
+class VMEntryScope;
+class Watchpoint;
+class WatchpointSet;
 
 #if ENABLE(DFG_JIT)
-    namespace DFG {
-    class LongLivedState;
-    }
+namespace DFG {
+class LongLivedState;
+}
 #endif // ENABLE(DFG_JIT)
 #if ENABLE(FTL_JIT)
-    namespace FTL {
-    class Thunks;
-    }
+namespace FTL {
+class Thunks;
+}
 #endif // ENABLE(FTL_JIT)
-    namespace CommonSlowPaths {
-    struct ArityCheckData;
-    }
-    namespace Profiler {
-    class Database;
+namespace CommonSlowPaths {
+struct ArityCheckData;
+}
+namespace Profiler {
+class Database;
+}
+
+struct HashTable;
+struct Instruction;
+
+struct LocalTimeOffsetCache {
+    LocalTimeOffsetCache()
+        : start(0.0)
+        , end(-1.0)
+        , increment(0.0)
+    {
     }
 
-    struct HashTable;
-    struct Instruction;
-
-    struct LocalTimeOffsetCache {
-        LocalTimeOffsetCache()
-            : start(0.0)
-            , end(-1.0)
-            , increment(0.0)
-        {
-        }
-        
-        void reset()
-        {
-            offset = LocalTimeOffset();
-            start = 0.0;
-            end = -1.0;
-            increment = 0.0;
-        }
+    void reset()
+    {
+        offset = LocalTimeOffset();
+        start = 0.0;
+        end = -1.0;
+        increment = 0.0;
+    }
 
-        LocalTimeOffset offset;
-        double start;
-        double end;
-        double increment;
-    };
+    LocalTimeOffset offset;
+    double start;
+    double end;
+    double increment;
+};
 
-    class ConservativeRoots;
+class ConservativeRoots;
 
 #if COMPILER(MSVC)
 #pragma warning(push)
 #pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning
 #endif
-    struct ScratchBuffer {
-        ScratchBuffer()
-        {
-            u.m_activeLength = 0;
-        }
+struct ScratchBuffer {
+    ScratchBuffer()
+    {
+        u.m_activeLength = 0;
+    }
 
-        static ScratchBuffer* create(size_t size)
-        {
-            ScratchBuffer* result = new (fastMalloc(ScratchBuffer::allocationSize(size))) ScratchBuffer;
+    static ScratchBuffer* create(size_t size)
+    {
+        ScratchBuffer* result = new (fastMalloc(ScratchBuffer::allocationSize(size))) ScratchBuffer;
 
-            return result;
-        }
+        return result;
+    }
 
-        static size_t allocationSize(size_t bufferSize) { return sizeof(ScratchBuffer) + bufferSize; }
-        void setActiveLength(size_t activeLength) { u.m_activeLength = activeLength; }
-        size_t activeLength() const { return u.m_activeLength; };
-        size_t* activeLengthPtr() { return &u.m_activeLength; };
-        void* dataBuffer() { return m_buffer; }
+    static size_t allocationSize(size_t bufferSize) { return sizeof(ScratchBuffer) + bufferSize; }
+    void setActiveLength(size_t activeLength) { u.m_activeLength = activeLength; }
+    size_t activeLength() const { return u.m_activeLength; };
+    size_t* activeLengthPtr() { return &u.m_activeLength; };
+    void* dataBuffer() { return m_buffer; }
 
-        union {
-            size_t m_activeLength;
-            double pad; // Make sure m_buffer is double aligned.
-        } u;
+    union {
+        size_t m_activeLength;
+        double pad; // Make sure m_buffer is double aligned.
+    } u;
 #if CPU(MIPS) && (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == 2)
-        void* m_buffer[0] __attribute__((aligned(8)));
+    void* m_buffer[0] __attribute__((aligned(8)));
 #else
-        void* m_buffer[0];
+    void* m_buffer[0];
 #endif
-    };
+};
 #if COMPILER(MSVC)
 #pragma warning(pop)
 #endif
 
-    class VM : public ThreadSafeRefCounted<VM> {
-    public:
-        // WebCore has a one-to-one mapping of threads to VMs;
-        // either create() or createLeaked() should only be called once
-        // on a thread, this is the 'default' VM (it uses the
-        // thread's default string uniquing table from wtfThreadData).
-        // API contexts created using the new context group aware interface
-        // create APIContextGroup objects which require less locking of JSC
-        // than the old singleton APIShared VM created for use by
-        // the original API.
-        enum VMType { Default, APIContextGroup, APIShared };
-        
-        struct ClientData {
-            JS_EXPORT_PRIVATE virtual ~ClientData() = 0;
-        };
-
-        bool isSharedInstance() { return vmType == APIShared; }
-        bool usingAPI() { return vmType != Default; }
-        JS_EXPORT_PRIVATE static bool sharedInstanceExists();
-        JS_EXPORT_PRIVATE static VM& sharedInstance();
-
-        JS_EXPORT_PRIVATE static PassRefPtr<VM> create(HeapType = SmallHeap);
-        JS_EXPORT_PRIVATE static PassRefPtr<VM> createLeaked(HeapType = SmallHeap);
-        static PassRefPtr<VM> createContextGroup(HeapType = SmallHeap);
-        JS_EXPORT_PRIVATE ~VM();
-
-        void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); }
-        
-    private:
-        RefPtr<JSLock> m_apiLock;
-
-    public:
+class VM : public ThreadSafeRefCounted<VM> {
+public:
+    // WebCore has a one-to-one mapping of threads to VMs;
+    // either create() or createLeaked() should only be called once
+    // on a thread, this is the 'default' VM (it uses the
+    // thread's default string uniquing table from wtfThreadData).
+    // API contexts created using the new context group aware interface
+    // create APIContextGroup objects which require less locking of JSC
+    // than the old singleton APIShared VM created for use by
+    // the original API.
+    enum VMType { Default, APIContextGroup, APIShared };
+
+    struct ClientData {
+        JS_EXPORT_PRIVATE virtual ~ClientData() = 0;
+    };
+
+    bool isSharedInstance() { return vmType == APIShared; }
+    bool usingAPI() { return vmType != Default; }
+    JS_EXPORT_PRIVATE static bool sharedInstanceExists();
+    JS_EXPORT_PRIVATE static VM& sharedInstance();
+
+    JS_EXPORT_PRIVATE static PassRefPtr<VM> create(HeapType = SmallHeap);
+    JS_EXPORT_PRIVATE static PassRefPtr<VM> createLeaked(HeapType = SmallHeap);
+    static PassRefPtr<VM> createContextGroup(HeapType = SmallHeap);
+    JS_EXPORT_PRIVATE ~VM();
+
+    void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); }
+
+private:
+    RefPtr<JSLock> m_apiLock;
+
+public:
 #if ENABLE(ASSEMBLER)
-        // executableAllocator should be destructed after the heap, as the heap can call executableAllocator
-        // in its destructor.
-        ExecutableAllocator executableAllocator;
+    // executableAllocator should be destructed after the heap, as the heap can call executableAllocator
+    // in its destructor.
+    ExecutableAllocator executableAllocator;
 #endif
 
-        // The heap should be just after executableAllocator and before other members to ensure that it's
-        // destructed after all the objects that reference it.
-        Heap heap;
-        
+    // The heap should be just after executableAllocator and before other members to ensure that it's
+    // destructed after all the objects that reference it.
+    Heap heap;
+
 #if ENABLE(DFG_JIT)
-        OwnPtr<DFG::LongLivedState> dfgState;
+    OwnPtr<DFG::LongLivedState> dfgState;
 #endif // ENABLE(DFG_JIT)
-        
-        std::unique_ptr<CallEdgeLog> callEdgeLog;
-        CallEdgeLog& ensureCallEdgeLog();
-
-        VMType vmType;
-        ClientData* clientData;
-        VMEntryFrame* topVMEntryFrame;
-        ExecState* topCallFrame;
-        std::unique_ptr<Watchdog> watchdog;
-
-        Strong<Structure> structureStructure;
-        Strong<Structure> structureRareDataStructure;
-        Strong<Structure> terminatedExecutionErrorStructure;
-        Strong<Structure> stringStructure;
-        Strong<Structure> notAnObjectStructure;
-        Strong<Structure> propertyNameIteratorStructure;
-        Strong<Structure> propertyNameEnumeratorStructure;
-        Strong<Structure> getterSetterStructure;
-        Strong<Structure> customGetterSetterStructure;
-        Strong<Structure> apiWrapperStructure;
-        Strong<Structure> JSScopeStructure;
-        Strong<Structure> executableStructure;
-        Strong<Structure> nativeExecutableStructure;
-        Strong<Structure> evalExecutableStructure;
-        Strong<Structure> programExecutableStructure;
-        Strong<Structure> functionExecutableStructure;
-        Strong<Structure> regExpStructure;
-        Strong<Structure> symbolTableStructure;
-        Strong<Structure> structureChainStructure;
-        Strong<Structure> sparseArrayValueMapStructure;
-        Strong<Structure> arrayBufferNeuteringWatchpointStructure;
-        Strong<Structure> unlinkedFunctionExecutableStructure;
-        Strong<Structure> unlinkedProgramCodeBlockStructure;
-        Strong<Structure> unlinkedEvalCodeBlockStructure;
-        Strong<Structure> unlinkedFunctionCodeBlockStructure;
-        Strong<Structure> propertyTableStructure;
-        Strong<Structure> mapDataStructure;
-        Strong<Structure> weakMapDataStructure;
+
+    std::unique_ptr<CallEdgeLog> callEdgeLog;
+    CallEdgeLog& ensureCallEdgeLog();
+
+    VMType vmType;
+    ClientData* clientData;
+    VMEntryFrame* topVMEntryFrame;
+    ExecState* topCallFrame;
+    std::unique_ptr<Watchdog> watchdog;
+
+    Strong<Structure> structureStructure;
+    Strong<Structure> structureRareDataStructure;
+    Strong<Structure> terminatedExecutionErrorStructure;
+    Strong<Structure> stringStructure;
+    Strong<Structure> notAnObjectStructure;
+    Strong<Structure> propertyNameIteratorStructure;
+    Strong<Structure> propertyNameEnumeratorStructure;
+    Strong<Structure> getterSetterStructure;
+    Strong<Structure> customGetterSetterStructure;
+    Strong<Structure> apiWrapperStructure;
+    Strong<Structure> JSScopeStructure;
+    Strong<Structure> executableStructure;
+    Strong<Structure> nativeExecutableStructure;
+    Strong<Structure> evalExecutableStructure;
+    Strong<Structure> programExecutableStructure;
+    Strong<Structure> functionExecutableStructure;
+    Strong<Structure> regExpStructure;
+    Strong<Structure> symbolTableStructure;
+    Strong<Structure> structureChainStructure;
+    Strong<Structure> sparseArrayValueMapStructure;
+    Strong<Structure> arrayBufferNeuteringWatchpointStructure;
+    Strong<Structure> unlinkedFunctionExecutableStructure;
+    Strong<Structure> unlinkedProgramCodeBlockStructure;
+    Strong<Structure> unlinkedEvalCodeBlockStructure;
+    Strong<Structure> unlinkedFunctionCodeBlockStructure;
+    Strong<Structure> propertyTableStructure;
+    Strong<Structure> mapDataStructure;
+    Strong<Structure> weakMapDataStructure;
 #if ENABLE(PROMISES)
-        Strong<Structure> promiseDeferredStructure;
-        Strong<Structure> promiseReactionStructure;
+    Strong<Structure> promiseDeferredStructure;
+    Strong<Structure> promiseReactionStructure;
 #endif
-        Strong<JSCell> iterationTerminator;
-        Strong<JSCell> emptyPropertyNameEnumerator;
-
-        AtomicStringTable* m_atomicStringTable;
-        CommonIdentifiers* propertyNames;
-        const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
-        SmallStrings smallStrings;
-        NumericStrings numericStrings;
-        DateInstanceCache dateInstanceCache;
-        WTF::SimpleStats machineCodeBytesPerBytecodeWordForBaselineJIT;
-        WeakGCMap<StringImpl*, JSString, PtrHash<StringImpl*>> stringCache;
-        Strong<JSString> lastCachedString;
-
-        AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; }
-
-        void setInDefineOwnProperty(bool inDefineOwnProperty)
-        {
-            m_inDefineOwnProperty = inDefineOwnProperty;
-        }
+    Strong<JSCell> iterationTerminator;
+    Strong<JSCell> emptyPropertyNameEnumerator;
+
+    AtomicStringTable* m_atomicStringTable;
+    CommonIdentifiers* propertyNames;
+    const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
+    SmallStrings smallStrings;
+    NumericStrings numericStrings;
+    DateInstanceCache dateInstanceCache;
+    WTF::SimpleStats machineCodeBytesPerBytecodeWordForBaselineJIT;
+    WeakGCMap<StringImpl*, JSString, PtrHash<StringImpl*>> stringCache;
+    Strong<JSString> lastCachedString;
+
+    AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; }
+
+    void setInDefineOwnProperty(bool inDefineOwnProperty)
+    {
+        m_inDefineOwnProperty = inDefineOwnProperty;
+    }
 
-        bool isInDefineOwnProperty()
-        {
-            return m_inDefineOwnProperty;
-        }
+    bool isInDefineOwnProperty()
+    {
+        return m_inDefineOwnProperty;
+    }
 
-        LegacyProfiler* enabledProfiler() { return m_enabledProfiler; }
-        void setEnabledProfiler(LegacyProfiler*);
+    LegacyProfiler* enabledProfiler() { return m_enabledProfiler; }
+    void setEnabledProfiler(LegacyProfiler*);
 
-        void* enabledProfilerAddress() { return &m_enabledProfiler; }
+    void* enabledProfilerAddress() { return &m_enabledProfiler; }
 
 #if ENABLE(JIT)
-        bool canUseJIT() { return m_canUseJIT; }
+    bool canUseJIT() { return m_canUseJIT; }
 #else
-        bool canUseJIT() { return false; } // interpreter only
+    bool canUseJIT() { return false; } // interpreter only
 #endif
 
 #if ENABLE(YARR_JIT)
-        bool canUseRegExpJIT() { return m_canUseRegExpJIT; }
+    bool canUseRegExpJIT() { return m_canUseRegExpJIT; }
 #else
-        bool canUseRegExpJIT() { return false; } // interpreter only
+    bool canUseRegExpJIT() { return false; } // interpreter only
 #endif
 
-        SourceProviderCache* addSourceProviderCache(SourceProvider*);
-        void clearSourceProviderCaches();
+    SourceProviderCache* addSourceProviderCache(SourceProvider*);
+    void clearSourceProviderCaches();
 
-        PrototypeMap prototypeMap;
+    PrototypeMap prototypeMap;
 
-        OwnPtr<ParserArena> parserArena;
-        typedef HashMap<RefPtr<SourceProvider>, RefPtr<SourceProviderCache>> SourceProviderCacheMap;
-        SourceProviderCacheMap sourceProviderCacheMap;
-        OwnPtr<Keywords> keywords;
-        Interpreter* interpreter;
+    OwnPtr<ParserArena> parserArena;
+    typedef HashMap<RefPtr<SourceProvider>, RefPtr<SourceProviderCache>> SourceProviderCacheMap;
+    SourceProviderCacheMap sourceProviderCacheMap;
+    OwnPtr<Keywords> keywords;
+    Interpreter* interpreter;
 #if ENABLE(JIT)
-        OwnPtr<JITThunks> jitStubs;
-        MacroAssemblerCodeRef getCTIStub(ThunkGenerator generator)
-        {
-            return jitStubs->ctiStub(this, generator);
-        }
-        NativeExecutable* getHostFunction(NativeFunction, Intrinsic);
-        
-        std::unique_ptr<ArityCheckFailReturnThunks> arityCheckFailReturnThunks;
+    OwnPtr<JITThunks> jitStubs;
+    MacroAssemblerCodeRef getCTIStub(ThunkGenerator generator)
+    {
+        return jitStubs->ctiStub(this, generator);
+    }
+    NativeExecutable* getHostFunction(NativeFunction, Intrinsic);
+
+    std::unique_ptr<ArityCheckFailReturnThunks> arityCheckFailReturnThunks;
 #endif // ENABLE(JIT)
-        std::unique_ptr<CommonSlowPaths::ArityCheckData> arityCheckData;
+    std::unique_ptr<CommonSlowPaths::ArityCheckData> arityCheckData;
 #if ENABLE(FTL_JIT)
-        std::unique_ptr<FTL::Thunks> ftlThunks;
+    std::unique_ptr<FTL::Thunks> ftlThunks;
 #endif
-        NativeExecutable* getHostFunction(NativeFunction, NativeFunction constructor);
+    NativeExecutable* getHostFunction(NativeFunction, NativeFunction constructor);
 
-        static ptrdiff_t exceptionOffset()
-        {
-            return OBJECT_OFFSETOF(VM, m_exception);
-        }
+    static ptrdiff_t exceptionOffset()
+    {
+        return OBJECT_OFFSETOF(VM, m_exception);
+    }
 
-        static ptrdiff_t vmEntryFrameForThrowOffset()
-        {
-            return OBJECT_OFFSETOF(VM, vmEntryFrameForThrow);
-        }
+    static ptrdiff_t vmEntryFrameForThrowOffset()
+    {
+        return OBJECT_OFFSETOF(VM, vmEntryFrameForThrow);
+    }
 
-        static ptrdiff_t topVMEntryFrameOffset()
-        {
-            return OBJECT_OFFSETOF(VM, topVMEntryFrame);
-        }
+    static ptrdiff_t topVMEntryFrameOffset()
+    {
+        return OBJECT_OFFSETOF(VM, topVMEntryFrame);
+    }
 
-        static ptrdiff_t callFrameForThrowOffset()
-        {
-            return OBJECT_OFFSETOF(VM, callFrameForThrow);
-        }
+    static ptrdiff_t callFrameForThrowOffset()
+    {
+        return OBJECT_OFFSETOF(VM, callFrameForThrow);
+    }
 
-        static ptrdiff_t targetMachinePCForThrowOffset()
-        {
-            return OBJECT_OFFSETOF(VM, targetMachinePCForThrow);
-        }
+    static ptrdiff_t targetMachinePCForThrowOffset()
+    {
+        return OBJECT_OFFSETOF(VM, targetMachinePCForThrow);
+    }
+
+    JS_EXPORT_PRIVATE void clearException();
+    JS_EXPORT_PRIVATE void clearExceptionStack();
+    void getExceptionInfo(JSValue& exception, RefCountedArray<StackFrame>& exceptionStack);
+    void setExceptionInfo(JSValue& exception, RefCountedArray<StackFrame>& exceptionStack);
+    JSValue exception() const { return m_exception; }
+    JSValue* addressOfException() { return &m_exception; }
+    const RefCountedArray<StackFrame>& exceptionStack() const { return m_exceptionStack; }
 
-        JS_EXPORT_PRIVATE void clearException();
-        JS_EXPORT_PRIVATE void clearExceptionStack();
-        void getExceptionInfo(JSValue& exception, RefCountedArray<StackFrame>& exceptionStack);
-        void setExceptionInfo(JSValue& exception, RefCountedArray<StackFrame>& exceptionStack);
-        JSValue exception() const { return m_exception; }
-        JSValue* addressOfException() { return &m_exception; }
-        const RefCountedArray<StackFrame>& exceptionStack() const { return m_exceptionStack; }
+    JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
+    JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
 
-        JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
-        JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
-        
-        void* stackPointerAtVMEntry() const { return m_stackPointerAtVMEntry; }
-        void setStackPointerAtVMEntry(void*);
+    void* stackPointerAtVMEntry() const { return m_stackPointerAtVMEntry; }
+    void setStackPointerAtVMEntry(void*);
 
-        size_t reservedZoneSize() const { return m_reservedZoneSize; }
-        size_t updateReservedZoneSize(size_t reservedZoneSize);
+    size_t reservedZoneSize() const { return m_reservedZoneSize; }
+    size_t updateReservedZoneSize(size_t reservedZoneSize);
 
 #if ENABLE(FTL_JIT)
-        void updateFTLLargestStackSize(size_t);
-        void** addressOfFTLStackLimit() { return &m_ftlStackLimit; }
+    void updateFTLLargestStackSize(size_t);
+    void** addressOfFTLStackLimit() { return &m_ftlStackLimit; }
 #endif
 
 #if !ENABLE(JIT)
-        void* jsStackLimit() { return m_jsStackLimit; }
-        void setJSStackLimit(void* limit) { m_jsStackLimit = limit; }
+    void* jsStackLimit() { return m_jsStackLimit; }
+    void setJSStackLimit(void* limit) { m_jsStackLimit = limit; }
 #endif
-        void* stackLimit() { return m_stackLimit; }
-        void** addressOfStackLimit() { return &m_stackLimit; }
-
-        bool isSafeToRecurse(size_t neededStackInBytes = 0) const
-        {
-            ASSERT(wtfThreadData().stack().isGrowingDownward());
-            int8_t* curr = reinterpret_cast<int8_t*>(&curr);
-            int8_t* limit = reinterpret_cast<int8_t*>(m_stackLimit);
-            return curr >= limit && static_cast<size_t>(curr - limit) >= neededStackInBytes;
-        }
+    void* stackLimit() { return m_stackLimit; }
+    void** addressOfStackLimit() { return &m_stackLimit; }
+
+    bool isSafeToRecurse(size_t neededStackInBytes = 0) const
+    {
+        ASSERT(wtfThreadData().stack().isGrowingDownward());
+        int8_t* curr = reinterpret_cast<int8_t*>(&curr);
+        int8_t* limit = reinterpret_cast<int8_t*>(m_stackLimit);
+        return curr >= limit && static_cast<size_t>(curr - limit) >= neededStackInBytes;
+    }
+
+    void* lastStackTop() { return m_lastStackTop; }
+    void setLastStackTop(void* lastStackTop) { m_lastStackTop = lastStackTop; }
+
+    const ClassInfo* const jsArrayClassInfo;
+    const ClassInfo* const jsFinalObjectClassInfo;
 
-        void* lastStackTop() { return m_lastStackTop; }
-        void setLastStackTop(void* lastStackTop) { m_lastStackTop = lastStackTop; }
-
-        const ClassInfo* const jsArrayClassInfo;
-        const ClassInfo* const jsFinalObjectClassInfo;
-
-        JSValue hostCallReturnValue;
-        ExecState* newCallFrameReturnValue;
-        VMEntryFrame* vmEntryFrameForThrow;
-        ExecState* callFrameForThrow;
-        void* targetMachinePCForThrow;
-        Instruction* targetInterpreterPCForThrow;
-        uint32_t osrExitIndex;
-        void* osrExitJumpDestination;
-        Vector<ScratchBuffer*> scratchBuffers;
-        size_t sizeOfLastScratchBuffer;
-        
-        ScratchBuffer* scratchBufferForSize(size_t size)
-        {
-            if (!size)
-                return 0;
-            
-            if (size > sizeOfLastScratchBuffer) {
-                // Protect against a N^2 memory usage pathology by ensuring
-                // that at worst, we get a geometric series, meaning that the
-                // total memory usage is somewhere around
-                // max(scratch buffer size) * 4.
-                sizeOfLastScratchBuffer = size * 2;
-
-                ScratchBuffer* newBuffer = ScratchBuffer::create(sizeOfLastScratchBuffer);
-                RELEASE_ASSERT(newBuffer);
-                scratchBuffers.append(newBuffer);
-            }
-
-            ScratchBuffer* result = scratchBuffers.last();
-            result->setActiveLength(0);
-            return result;
+    JSValue hostCallReturnValue;
+    ExecState* newCallFrameReturnValue;
+    VMEntryFrame* vmEntryFrameForThrow;
+    ExecState* callFrameForThrow;
+    void* targetMachinePCForThrow;
+    Instruction* targetInterpreterPCForThrow;
+    uint32_t osrExitIndex;
+    void* osrExitJumpDestination;
+    Vector<ScratchBuffer*> scratchBuffers;
+    size_t sizeOfLastScratchBuffer;
+
+    ScratchBuffer* scratchBufferForSize(size_t size)
+    {
+        if (!size)
+            return 0;
+
+        if (size > sizeOfLastScratchBuffer) {
+            // Protect against a N^2 memory usage pathology by ensuring
+            // that at worst, we get a geometric series, meaning that the
+            // total memory usage is somewhere around
+            // max(scratch buffer size) * 4.
+            sizeOfLastScratchBuffer = size * 2;
+
+            ScratchBuffer* newBuffer = ScratchBuffer::create(sizeOfLastScratchBuffer);
+            RELEASE_ASSERT(newBuffer);
+            scratchBuffers.append(newBuffer);
         }
 
-        void gatherConservativeRoots(ConservativeRoots&);
+        ScratchBuffer* result = scratchBuffers.last();
+        result->setActiveLength(0);
+        return result;
+    }
+
+    void gatherConservativeRoots(ConservativeRoots&);
+
+    VMEntryScope* entryScope;
 
-        VMEntryScope* entryScope;
+    HashSet<JSObject*> stringRecursionCheckVisitedObjects;
 
-        HashSet<JSObject*> stringRecursionCheckVisitedObjects;
+    LocalTimeOffsetCache localTimeOffsetCache;
 
-        LocalTimeOffsetCache localTimeOffsetCache;
-        
-        String cachedDateString;
-        double cachedDateStringValue;
+    String cachedDateString;
+    double cachedDateStringValue;
 
-        OwnPtr<Profiler::Database> m_perBytecodeProfiler;
-        RefPtr<TypedArrayController> m_typedArrayController;
-        RegExpCache* m_regExpCache;
-        BumpPointerAllocator m_regExpAllocator;
+    OwnPtr<Profiler::Database> m_perBytecodeProfiler;
+    RefPtr<TypedArrayController> m_typedArrayController;
+    RegExpCache* m_regExpCache;
+    BumpPointerAllocator m_regExpAllocator;
 
 #if ENABLE(REGEXP_TRACING)
-        typedef ListHashSet<RegExp*> RTTraceList;
-        RTTraceList* m_rtTraceList;
+    typedef ListHashSet<RegExp*> RTTraceList;
+    RTTraceList* m_rtTraceList;
 #endif
 
-        bool hasExclusiveThread() const { return m_apiLock->hasExclusiveThread(); }
-        std::thread::id exclusiveThread() const { return m_apiLock->exclusiveThread(); }
-        void setExclusiveThread(std::thread::id threadId) { m_apiLock->setExclusiveThread(threadId); }
+    bool hasExclusiveThread() const { return m_apiLock->hasExclusiveThread(); }
+    std::thread::id exclusiveThread() const { return m_apiLock->exclusiveThread(); }
+    void setExclusiveThread(std::thread::id threadId) { m_apiLock->setExclusiveThread(threadId); }
 
-        JS_EXPORT_PRIVATE void resetDateCache();
+    JS_EXPORT_PRIVATE void resetDateCache();
 
-        JS_EXPORT_PRIVATE void startSampling();
-        JS_EXPORT_PRIVATE void stopSampling();
-        JS_EXPORT_PRIVATE void dumpSampleData(ExecState* exec);
-        RegExpCache* regExpCache() { return m_regExpCache; }
+    JS_EXPORT_PRIVATE void startSampling();
+    JS_EXPORT_PRIVATE void stopSampling();
+    JS_EXPORT_PRIVATE void dumpSampleData(ExecState*);
+    RegExpCache* regExpCache() { return m_regExpCache; }
 #if ENABLE(REGEXP_TRACING)
-        void addRegExpToTrace(RegExp*);
+    void addRegExpToTrace(RegExp*);
 #endif
-        JS_EXPORT_PRIVATE void dumpRegExpTrace();
+    JS_EXPORT_PRIVATE void dumpRegExpTrace();
 
-        bool isCollectorBusy() { return heap.isBusy(); }
-        JS_EXPORT_PRIVATE void releaseExecutableMemory();
+    bool isCollectorBusy() { return heap.isBusy(); }
+    JS_EXPORT_PRIVATE void releaseExecutableMemory();
 
 #if ENABLE(GC_VALIDATION)
-        bool isInitializingObject() const; 
-        void setInitializingObjectClass(const ClassInfo*);
+    bool isInitializingObject() const; 
+    void setInitializingObjectClass(const ClassInfo*);
 #endif
 
-        unsigned m_newStringsSinceLastHashCons;
+    unsigned m_newStringsSinceLastHashCons;
 
-        static const unsigned s_minNumberOfNewStringsToHashCons = 100;
+    static const unsigned s_minNumberOfNewStringsToHashCons = 100;
 
-        bool haveEnoughNewStringsToHashCons() { return m_newStringsSinceLastHashCons > s_minNumberOfNewStringsToHashCons; }
-        void resetNewStringsSinceLastHashCons() { m_newStringsSinceLastHashCons = 0; }
+    bool haveEnoughNewStringsToHashCons() { return m_newStringsSinceLastHashCons > s_minNumberOfNewStringsToHashCons; }
+    void resetNewStringsSinceLastHashCons() { m_newStringsSinceLastHashCons = 0; }
 
-        bool currentThreadIsHoldingAPILock() const { return m_apiLock->currentThreadIsHoldingLock(); }
+    bool currentThreadIsHoldingAPILock() const { return m_apiLock->currentThreadIsHoldingLock(); }
 
-        JSLock& apiLock() { return *m_apiLock; }
-        CodeCache* codeCache() { return m_codeCache.get(); }
+    JSLock& apiLock() { return *m_apiLock; }
+    CodeCache* codeCache() { return m_codeCache.get(); }
 
-        void waitForCompilationsToComplete();
-        
-        JS_EXPORT_PRIVATE void discardAllCode();
+    void waitForCompilationsToComplete();
 
-        void registerWatchpointForImpureProperty(const Identifier&, Watchpoint*);
-        // FIXME: Use AtomicString once it got merged with Identifier.
-        JS_EXPORT_PRIVATE void addImpureProperty(const String&);
-        
-        BuiltinExecutables* builtinExecutables() { return m_builtinExecutables.get(); }
+    JS_EXPORT_PRIVATE void discardAllCode();
 
-        bool enableTypeProfiler();
-        bool disableTypeProfiler();
-        TypeProfilerLog* typeProfilerLog() { return m_typeProfilerLog.get(); }
-        TypeProfiler* typeProfiler() { return m_typeProfiler.get(); }
-        TypeLocation* nextTypeLocation();
-        JS_EXPORT_PRIVATE void dumpTypeProfilerData();
-        void invalidateTypeSetCache();
-        GlobalVariableID getNextUniqueVariableID() { return m_nextUniqueVariableID++; }
+    void registerWatchpointForImpureProperty(const Identifier&, Watchpoint*);
+    // FIXME: Use AtomicString once it got merged with Identifier.
+    JS_EXPORT_PRIVATE void addImpureProperty(const String&);
 
-    private:
-        friend class LLIntOffsetsExtractor;
-        friend class ClearExceptionScope;
-        friend class RecursiveAllocationScope;
-        
-        VM(VMType, HeapType);
-        static VM*& sharedInstanceInternal();
-        void createNativeThunk();
+    BuiltinExecutables* builtinExecutables() { return m_builtinExecutables.get(); }
 
-        void updateStackLimit();
+    bool enableTypeProfiler();
+    bool disableTypeProfiler();
+    TypeProfilerLog* typeProfilerLog() { return m_typeProfilerLog.get(); }
+    TypeProfiler* typeProfiler() { return m_typeProfiler.get(); }
+    TypeLocation* nextTypeLocation();
+    JS_EXPORT_PRIVATE void dumpTypeProfilerData();
+    void invalidateTypeSetCache();
+    GlobalVariableID getNextUniqueVariableID() { return m_nextUniqueVariableID++; }
+
+private:
+    friend class LLIntOffsetsExtractor;
+    friend class ClearExceptionScope;
+    friend class RecursiveAllocationScope;
+
+    VM(VMType, HeapType);
+    static VM*& sharedInstanceInternal();
+    void createNativeThunk();
+
+    void updateStackLimit();
 
 #if ENABLE(ASSEMBLER)
-        bool m_canUseAssembler;
+    bool m_canUseAssembler;
 #endif
 #if ENABLE(JIT)
-        bool m_canUseJIT;
+    bool m_canUseJIT;
 #endif
 #if ENABLE(YARR_JIT)
-        bool m_canUseRegExpJIT;
+    bool m_canUseRegExpJIT;
 #endif
 #if ENABLE(GC_VALIDATION)
-        const ClassInfo* m_initializingObjectClass;
+    const ClassInfo* m_initializingObjectClass;
 #endif
-        void* m_stackPointerAtVMEntry;
-        size_t m_reservedZoneSize;
+    void* m_stackPointerAtVMEntry;
+    size_t m_reservedZoneSize;
 #if !ENABLE(JIT)
-        struct {
-            void* m_stackLimit;
-            void* m_jsStackLimit;
-        };
+    struct {
+        void* m_stackLimit;
+        void* m_jsStackLimit;
+    };
 #else
-        union {
-            void* m_stackLimit;
-            void* m_jsStackLimit;
-        };
+    union {
+        void* m_stackLimit;
+        void* m_jsStackLimit;
+    };
 #if ENABLE(FTL_JIT)
-        void* m_ftlStackLimit;
-        size_t m_largestFTLStackSize;
+    void* m_ftlStackLimit;
+    size_t m_largestFTLStackSize;
 #endif
 #endif
-        void* m_lastStackTop;
-        JSValue m_exception;
-        bool m_inDefineOwnProperty;
-        OwnPtr<CodeCache> m_codeCache;
-        LegacyProfiler* m_enabledProfiler;
-        OwnPtr<BuiltinExecutables> m_builtinExecutables;
-        RefCountedArray<StackFrame> m_exceptionStack;
-        HashMap<String, RefPtr<WatchpointSet>> m_impurePropertyWatchpointSets;
-        std::unique_ptr<TypeProfiler> m_typeProfiler;
-        std::unique_ptr<TypeProfilerLog> m_typeProfilerLog;
-        GlobalVariableID m_nextUniqueVariableID;
-        unsigned m_typeProfilerEnabledCount;
-        std::unique_ptr<Bag<TypeLocation>> m_typeLocationInfo;
-    };
+    void* m_lastStackTop;
+    JSValue m_exception;
+    bool m_inDefineOwnProperty;
+    OwnPtr<CodeCache> m_codeCache;
+    LegacyProfiler* m_enabledProfiler;
+    OwnPtr<BuiltinExecutables> m_builtinExecutables;
+    RefCountedArray<StackFrame> m_exceptionStack;
+    HashMap<String, RefPtr<WatchpointSet>> m_impurePropertyWatchpointSets;
+    std::unique_ptr<TypeProfiler> m_typeProfiler;
+    std::unique_ptr<TypeProfilerLog> m_typeProfilerLog;
+    GlobalVariableID m_nextUniqueVariableID;
+    unsigned m_typeProfilerEnabledCount;
+    std::unique_ptr<Bag<TypeLocation>> m_typeLocationInfo;
+};
 
 #if ENABLE(GC_VALIDATION)
-    inline bool VM::isInitializingObject() const
-    {
-        return !!m_initializingObjectClass;
-    }
-
-    inline void VM::setInitializingObjectClass(const ClassInfo* initializingObjectClass)
-    {
-        m_initializingObjectClass = initializingObjectClass;
-    }
+inline bool VM::isInitializingObject() const
+{
+    return !!m_initializingObjectClass;
+}
+
+inline void VM::setInitializingObjectClass(const ClassInfo* initializingObjectClass)
+{
+    m_initializingObjectClass = initializingObjectClass;
+}
 #endif
 
-    inline Heap* WeakSet::heap() const
-    {
-        return &m_vm->heap;
-    }
+inline Heap* WeakSet::heap() const
+{
+    return &m_vm->heap;
+}
 
 #if ENABLE(JIT)
-    extern "C" void sanitizeStackForVMImpl(VM*);
+extern "C" void sanitizeStackForVMImpl(VM*);
 #endif
 
-    void sanitizeStackForVM(VM*);
-    void logSanitizeStack(VM*);
+void sanitizeStackForVM(VM*);
+void logSanitizeStack(VM*);
 
 } // namespace JSC