Changeset 143171 in webkit


Ignore:
Timestamp:
Feb 18, 2013, 1:25:33 AM (13 years ago)
Author:
fpizlo@apple.com
Message:

Fix indentation of JSGlobalObject.h and JSGlobalObjectFunctions.h

Rubber stamped by Mark Hahnenberg.

  • runtime/JSGlobalObject.h:
  • runtime/JSGlobalObjectFunctions.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r143170 r143171  
     12013-02-18  Filip Pizlo  <fpizlo@apple.com>
     2
     3        Fix indentation of JSGlobalObject.h and JSGlobalObjectFunctions.h
     4
     5        Rubber stamped by Mark Hahnenberg.
     6
     7        * runtime/JSGlobalObject.h:
     8        * runtime/JSGlobalObjectFunctions.h:
     9
    1102013-02-18  Filip Pizlo  <fpizlo@apple.com>
    211
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r143147 r143171  
    4040namespace JSC {
    4141
    42     class ArrayPrototype;
    43     class BooleanPrototype;
    44     class DatePrototype;
    45     class Debugger;
    46     class ErrorConstructor;
    47     class ErrorPrototype;
    48     class EvalCodeBlock;
    49     class EvalExecutable;
    50     class FunctionCodeBlock;
    51     class FunctionExecutable;
    52     class FunctionPrototype;
    53     class GetterSetter;
    54     class GlobalCodeBlock;
    55     class JSStack;
    56     class LLIntOffsetsExtractor;
    57     class NativeErrorConstructor;
    58     class ProgramCodeBlock;
    59     class ProgramExecutable;
    60     class RegExpConstructor;
    61     class RegExpPrototype;
    62     class SourceCode;
    63     struct ActivationStackNode;
    64     struct HashTable;
    65 
    66     typedef Vector<ExecState*, 16> ExecStateStack;
     42class ArrayPrototype;
     43class BooleanPrototype;
     44class DatePrototype;
     45class Debugger;
     46class ErrorConstructor;
     47class ErrorPrototype;
     48class EvalCodeBlock;
     49class EvalExecutable;
     50class FunctionCodeBlock;
     51class FunctionExecutable;
     52class FunctionPrototype;
     53class GetterSetter;
     54class GlobalCodeBlock;
     55class JSStack;
     56class LLIntOffsetsExtractor;
     57class NativeErrorConstructor;
     58class ProgramCodeBlock;
     59class ProgramExecutable;
     60class RegExpConstructor;
     61class RegExpPrototype;
     62class SourceCode;
     63struct ActivationStackNode;
     64struct HashTable;
     65
     66typedef Vector<ExecState*, 16> ExecStateStack;
    6767   
    68     struct GlobalObjectMethodTable {
    69         typedef bool (*AllowsAccessFromFunctionPtr)(const JSGlobalObject*, ExecState*);
    70         AllowsAccessFromFunctionPtr allowsAccessFrom;
    71 
    72         typedef bool (*SupportsProfilingFunctionPtr)(const JSGlobalObject*);
    73         SupportsProfilingFunctionPtr supportsProfiling;
    74 
    75         typedef bool (*SupportsRichSourceInfoFunctionPtr)(const JSGlobalObject*);
    76         SupportsRichSourceInfoFunctionPtr supportsRichSourceInfo;
    77 
    78         typedef bool (*ShouldInterruptScriptFunctionPtr)(const JSGlobalObject*);
    79         ShouldInterruptScriptFunctionPtr shouldInterruptScript;
    80 
    81         typedef bool (*JavaScriptExperimentsEnabledFunctionPtr)(const JSGlobalObject*);
    82         JavaScriptExperimentsEnabledFunctionPtr javaScriptExperimentsEnabled;
     68struct GlobalObjectMethodTable {
     69    typedef bool (*AllowsAccessFromFunctionPtr)(const JSGlobalObject*, ExecState*);
     70    AllowsAccessFromFunctionPtr allowsAccessFrom;
     71
     72    typedef bool (*SupportsProfilingFunctionPtr)(const JSGlobalObject*);
     73    SupportsProfilingFunctionPtr supportsProfiling;
     74
     75    typedef bool (*SupportsRichSourceInfoFunctionPtr)(const JSGlobalObject*);
     76    SupportsRichSourceInfoFunctionPtr supportsRichSourceInfo;
     77
     78    typedef bool (*ShouldInterruptScriptFunctionPtr)(const JSGlobalObject*);
     79    ShouldInterruptScriptFunctionPtr shouldInterruptScript;
     80
     81    typedef bool (*JavaScriptExperimentsEnabledFunctionPtr)(const JSGlobalObject*);
     82    JavaScriptExperimentsEnabledFunctionPtr javaScriptExperimentsEnabled;
     83};
     84
     85class JSGlobalObject : public JSSegmentedVariableObject {
     86private:
     87    typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
     88
     89    struct JSGlobalObjectRareData {
     90        JSGlobalObjectRareData()
     91            : profileGroup(0)
     92        {
     93        }
     94
     95        WeakMapSet weakMaps;
     96        unsigned profileGroup;
    8397    };
    8498
    85     class JSGlobalObject : public JSSegmentedVariableObject {
    86     private:
    87         typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
    88 
    89         struct JSGlobalObjectRareData {
    90             JSGlobalObjectRareData()
    91                 : profileGroup(0)
    92             {
    93             }
    94 
    95             WeakMapSet weakMaps;
    96             unsigned profileGroup;
    97         };
    98 
    99     protected:
    100 
    101         Register m_globalCallFrame[JSStack::CallFrameHeaderSize];
    102 
    103         WriteBarrier<JSObject> m_globalThis;
    104 
    105         WriteBarrier<RegExpConstructor> m_regExpConstructor;
    106         WriteBarrier<ErrorConstructor> m_errorConstructor;
    107         WriteBarrier<NativeErrorConstructor> m_evalErrorConstructor;
    108         WriteBarrier<NativeErrorConstructor> m_rangeErrorConstructor;
    109         WriteBarrier<NativeErrorConstructor> m_referenceErrorConstructor;
    110         WriteBarrier<NativeErrorConstructor> m_syntaxErrorConstructor;
    111         WriteBarrier<NativeErrorConstructor> m_typeErrorConstructor;
    112         WriteBarrier<NativeErrorConstructor> m_URIErrorConstructor;
    113 
    114         WriteBarrier<JSFunction> m_evalFunction;
    115         WriteBarrier<JSFunction> m_callFunction;
    116         WriteBarrier<JSFunction> m_applyFunction;
    117         WriteBarrier<GetterSetter> m_throwTypeErrorGetterSetter;
    118 
    119         WriteBarrier<ObjectPrototype> m_objectPrototype;
    120         WriteBarrier<FunctionPrototype> m_functionPrototype;
    121         WriteBarrier<ArrayPrototype> m_arrayPrototype;
    122         WriteBarrier<BooleanPrototype> m_booleanPrototype;
    123         WriteBarrier<StringPrototype> m_stringPrototype;
    124         WriteBarrier<NumberPrototype> m_numberPrototype;
    125         WriteBarrier<DatePrototype> m_datePrototype;
    126         WriteBarrier<RegExpPrototype> m_regExpPrototype;
    127         WriteBarrier<ErrorPrototype> m_errorPrototype;
    128 
    129         WriteBarrier<Structure> m_withScopeStructure;
    130         WriteBarrier<Structure> m_strictEvalActivationStructure;
    131         WriteBarrier<Structure> m_activationStructure;
    132         WriteBarrier<Structure> m_nameScopeStructure;
    133         WriteBarrier<Structure> m_argumentsStructure;
    134        
    135         // Lists the actual structures used for having these particular indexing shapes.
    136         WriteBarrier<Structure> m_originalArrayStructureForIndexingShape[NumberOfIndexingShapes];
    137         // Lists the structures we should use during allocation for these particular indexing shapes.
    138         WriteBarrier<Structure> m_arrayStructureForIndexingShapeDuringAllocation[NumberOfIndexingShapes];
    139        
    140         WriteBarrier<Structure> m_booleanObjectStructure;
    141         WriteBarrier<Structure> m_callbackConstructorStructure;
    142         WriteBarrier<Structure> m_callbackFunctionStructure;
    143         WriteBarrier<Structure> m_callbackObjectStructure;
    144         WriteBarrier<Structure> m_dateStructure;
    145         WriteBarrier<Structure> m_nullPrototypeObjectStructure;
    146         WriteBarrier<Structure> m_errorStructure;
    147         WriteBarrier<Structure> m_functionStructure;
    148         WriteBarrier<Structure> m_boundFunctionStructure;
    149         WriteBarrier<Structure> m_namedFunctionStructure;
    150         PropertyOffset m_functionNameOffset;
    151         WriteBarrier<Structure> m_numberObjectStructure;
    152         WriteBarrier<Structure> m_privateNameStructure;
    153         WriteBarrier<Structure> m_regExpMatchesArrayStructure;
    154         WriteBarrier<Structure> m_regExpStructure;
    155         WriteBarrier<Structure> m_stringObjectStructure;
    156         WriteBarrier<Structure> m_internalFunctionStructure;
    157        
    158         void* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT.
    159 
    160         Debugger* m_debugger;
    161 
    162         RefPtr<WatchpointSet> m_masqueradesAsUndefinedWatchpoint;
    163         RefPtr<WatchpointSet> m_havingABadTimeWatchpoint;
    164 
    165         OwnPtr<JSGlobalObjectRareData> m_rareData;
    166 
    167         WeakRandom m_weakRandom;
    168 
    169         bool m_evalEnabled;
    170         String m_evalDisabledErrorMessage;
    171         bool m_experimentsEnabled;
    172 
    173         static JS_EXPORTDATA const GlobalObjectMethodTable s_globalObjectMethodTable;
    174         const GlobalObjectMethodTable* m_globalObjectMethodTable;
    175 
    176         void createRareDataIfNeeded()
     99protected:
     100
     101    Register m_globalCallFrame[JSStack::CallFrameHeaderSize];
     102
     103    WriteBarrier<JSObject> m_globalThis;
     104
     105    WriteBarrier<RegExpConstructor> m_regExpConstructor;
     106    WriteBarrier<ErrorConstructor> m_errorConstructor;
     107    WriteBarrier<NativeErrorConstructor> m_evalErrorConstructor;
     108    WriteBarrier<NativeErrorConstructor> m_rangeErrorConstructor;
     109    WriteBarrier<NativeErrorConstructor> m_referenceErrorConstructor;
     110    WriteBarrier<NativeErrorConstructor> m_syntaxErrorConstructor;
     111    WriteBarrier<NativeErrorConstructor> m_typeErrorConstructor;
     112    WriteBarrier<NativeErrorConstructor> m_URIErrorConstructor;
     113
     114    WriteBarrier<JSFunction> m_evalFunction;
     115    WriteBarrier<JSFunction> m_callFunction;
     116    WriteBarrier<JSFunction> m_applyFunction;
     117    WriteBarrier<GetterSetter> m_throwTypeErrorGetterSetter;
     118
     119    WriteBarrier<ObjectPrototype> m_objectPrototype;
     120    WriteBarrier<FunctionPrototype> m_functionPrototype;
     121    WriteBarrier<ArrayPrototype> m_arrayPrototype;
     122    WriteBarrier<BooleanPrototype> m_booleanPrototype;
     123    WriteBarrier<StringPrototype> m_stringPrototype;
     124    WriteBarrier<NumberPrototype> m_numberPrototype;
     125    WriteBarrier<DatePrototype> m_datePrototype;
     126    WriteBarrier<RegExpPrototype> m_regExpPrototype;
     127    WriteBarrier<ErrorPrototype> m_errorPrototype;
     128
     129    WriteBarrier<Structure> m_withScopeStructure;
     130    WriteBarrier<Structure> m_strictEvalActivationStructure;
     131    WriteBarrier<Structure> m_activationStructure;
     132    WriteBarrier<Structure> m_nameScopeStructure;
     133    WriteBarrier<Structure> m_argumentsStructure;
     134       
     135    // Lists the actual structures used for having these particular indexing shapes.
     136    WriteBarrier<Structure> m_originalArrayStructureForIndexingShape[NumberOfIndexingShapes];
     137    // Lists the structures we should use during allocation for these particular indexing shapes.
     138    WriteBarrier<Structure> m_arrayStructureForIndexingShapeDuringAllocation[NumberOfIndexingShapes];
     139       
     140    WriteBarrier<Structure> m_booleanObjectStructure;
     141    WriteBarrier<Structure> m_callbackConstructorStructure;
     142    WriteBarrier<Structure> m_callbackFunctionStructure;
     143    WriteBarrier<Structure> m_callbackObjectStructure;
     144    WriteBarrier<Structure> m_dateStructure;
     145    WriteBarrier<Structure> m_nullPrototypeObjectStructure;
     146    WriteBarrier<Structure> m_errorStructure;
     147    WriteBarrier<Structure> m_functionStructure;
     148    WriteBarrier<Structure> m_boundFunctionStructure;
     149    WriteBarrier<Structure> m_namedFunctionStructure;
     150    PropertyOffset m_functionNameOffset;
     151    WriteBarrier<Structure> m_numberObjectStructure;
     152    WriteBarrier<Structure> m_privateNameStructure;
     153    WriteBarrier<Structure> m_regExpMatchesArrayStructure;
     154    WriteBarrier<Structure> m_regExpStructure;
     155    WriteBarrier<Structure> m_stringObjectStructure;
     156    WriteBarrier<Structure> m_internalFunctionStructure;
     157       
     158    void* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT.
     159
     160    Debugger* m_debugger;
     161
     162    RefPtr<WatchpointSet> m_masqueradesAsUndefinedWatchpoint;
     163    RefPtr<WatchpointSet> m_havingABadTimeWatchpoint;
     164
     165    OwnPtr<JSGlobalObjectRareData> m_rareData;
     166
     167    WeakRandom m_weakRandom;
     168
     169    bool m_evalEnabled;
     170    String m_evalDisabledErrorMessage;
     171    bool m_experimentsEnabled;
     172
     173    static JS_EXPORTDATA const GlobalObjectMethodTable s_globalObjectMethodTable;
     174    const GlobalObjectMethodTable* m_globalObjectMethodTable;
     175
     176    void createRareDataIfNeeded()
     177    {
     178        if (m_rareData)
     179            return;
     180        m_rareData = adoptPtr(new JSGlobalObjectRareData);
     181    }
     182       
     183public:
     184    typedef JSSegmentedVariableObject Base;
     185
     186    static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure)
     187    {
     188        JSGlobalObject* globalObject = new (NotNull, allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
     189        globalObject->finishCreation(globalData);
     190        globalData.heap.addFinalizer(globalObject, destroy);
     191        return globalObject;
     192    }
     193
     194    static JS_EXPORTDATA const ClassInfo s_info;
     195
     196    bool hasDebugger() const { return m_debugger; }
     197    bool hasProfiler() const { return globalObjectMethodTable()->supportsProfiling(this); }
     198
     199    void* m_apiData;
     200
     201protected:
     202    JS_EXPORT_PRIVATE explicit JSGlobalObject(JSGlobalData&, Structure*, const GlobalObjectMethodTable* = 0);
     203
     204    void finishCreation(JSGlobalData& globalData)
     205    {
     206        Base::finishCreation(globalData);
     207        structure()->setGlobalObject(globalData, this);
     208        m_experimentsEnabled = m_globalObjectMethodTable->javaScriptExperimentsEnabled(this);
     209        init(this);
     210    }
     211
     212    void finishCreation(JSGlobalData& globalData, JSObject* thisValue)
     213    {
     214        Base::finishCreation(globalData);
     215        structure()->setGlobalObject(globalData, this);
     216        m_experimentsEnabled = m_globalObjectMethodTable->javaScriptExperimentsEnabled(this);
     217        init(thisValue);
     218    }
     219
     220public:
     221    JS_EXPORT_PRIVATE ~JSGlobalObject();
     222    JS_EXPORT_PRIVATE static void destroy(JSCell*);
     223    // We don't need a destructor because we use a finalizer instead.
     224    static const bool needsDestruction = false;
     225
     226    JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
     227
     228    JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
     229    JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
     230    bool hasOwnPropertyForWrite(ExecState*, PropertyName);
     231    JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
     232
     233    JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
     234
     235    JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes);
     236    JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, PropertyName, JSObject* setterFunc, unsigned attributes);
     237    JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow);
     238
     239    // We use this in the code generator as we perform symbol table
     240    // lookups prior to initializing the properties
     241    bool symbolTableHasProperty(PropertyName);
     242
     243    // The following accessors return pristine values, even if a script
     244    // replaces the global object's associated property.
     245
     246    RegExpConstructor* regExpConstructor() const { return m_regExpConstructor.get(); }
     247
     248    ErrorConstructor* errorConstructor() const { return m_errorConstructor.get(); }
     249    NativeErrorConstructor* evalErrorConstructor() const { return m_evalErrorConstructor.get(); }
     250    NativeErrorConstructor* rangeErrorConstructor() const { return m_rangeErrorConstructor.get(); }
     251    NativeErrorConstructor* referenceErrorConstructor() const { return m_referenceErrorConstructor.get(); }
     252    NativeErrorConstructor* syntaxErrorConstructor() const { return m_syntaxErrorConstructor.get(); }
     253    NativeErrorConstructor* typeErrorConstructor() const { return m_typeErrorConstructor.get(); }
     254    NativeErrorConstructor* URIErrorConstructor() const { return m_URIErrorConstructor.get(); }
     255
     256    JSFunction* evalFunction() const { return m_evalFunction.get(); }
     257    JSFunction* callFunction() const { return m_callFunction.get(); }
     258    JSFunction* applyFunction() const { return m_applyFunction.get(); }
     259    GetterSetter* throwTypeErrorGetterSetter(ExecState* exec)
     260    {
     261        if (!m_throwTypeErrorGetterSetter)
     262            createThrowTypeError(exec);
     263        return m_throwTypeErrorGetterSetter.get();
     264    }
     265
     266    ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); }
     267    FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
     268    ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); }
     269    BooleanPrototype* booleanPrototype() const { return m_booleanPrototype.get(); }
     270    StringPrototype* stringPrototype() const { return m_stringPrototype.get(); }
     271    NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); }
     272    DatePrototype* datePrototype() const { return m_datePrototype.get(); }
     273    RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); }
     274    ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); }
     275
     276    Structure* withScopeStructure() const { return m_withScopeStructure.get(); }
     277    Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); }
     278    Structure* activationStructure() const { return m_activationStructure.get(); }
     279    Structure* nameScopeStructure() const { return m_nameScopeStructure.get(); }
     280    Structure* argumentsStructure() const { return m_argumentsStructure.get(); }
     281    Structure* originalArrayStructureForIndexingType(IndexingType indexingType) const
     282    {
     283        ASSERT(indexingType & IsArray);
     284        return m_originalArrayStructureForIndexingShape[(indexingType & IndexingShapeMask) >> IndexingShapeShift].get();
     285    }
     286    Structure* arrayStructureForIndexingTypeDuringAllocation(IndexingType indexingType) const
     287    {
     288        ASSERT(indexingType & IsArray);
     289        return m_arrayStructureForIndexingShapeDuringAllocation[(indexingType & IndexingShapeMask) >> IndexingShapeShift].get();
     290    }
     291    Structure* arrayStructureForProfileDuringAllocation(ArrayAllocationProfile* profile) const
     292    {
     293        return arrayStructureForIndexingTypeDuringAllocation(ArrayAllocationProfile::selectIndexingTypeFor(profile));
     294    }
     295       
     296    bool isOriginalArrayStructure(Structure* structure)
     297    {
     298        return originalArrayStructureForIndexingType(structure->indexingType() | IsArray) == structure;
     299    }
     300       
     301    Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); }
     302    Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get(); }
     303    Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get(); }
     304    Structure* callbackObjectStructure() const { return m_callbackObjectStructure.get(); }
     305    Structure* dateStructure() const { return m_dateStructure.get(); }
     306    Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); }
     307    Structure* errorStructure() const { return m_errorStructure.get(); }
     308    Structure* functionStructure() const { return m_functionStructure.get(); }
     309    Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get(); }
     310    Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get(); }
     311    PropertyOffset functionNameOffset() const { return m_functionNameOffset; }
     312    Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); }
     313    Structure* privateNameStructure() const { return m_privateNameStructure.get(); }
     314    Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); }
     315    Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); }
     316    Structure* regExpStructure() const { return m_regExpStructure.get(); }
     317    Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
     318
     319    void* actualPointerFor(Special::Pointer pointer)
     320    {
     321        ASSERT(pointer < Special::TableSize);
     322        return m_specialPointers[pointer];
     323    }
     324
     325    WatchpointSet* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint.get(); }
     326    WatchpointSet* havingABadTimeWatchpoint() { return m_havingABadTimeWatchpoint.get(); }
     327       
     328    bool isHavingABadTime() const
     329    {
     330        return m_havingABadTimeWatchpoint->hasBeenInvalidated();
     331    }
     332       
     333    void haveABadTime(JSGlobalData&);
     334       
     335    bool arrayPrototypeChainIsSane();
     336
     337    void setProfileGroup(unsigned value) { createRareDataIfNeeded(); m_rareData->profileGroup = value; }
     338    unsigned profileGroup() const
     339    {
     340        if (!m_rareData)
     341            return 0;
     342        return m_rareData->profileGroup;
     343    }
     344
     345    Debugger* debugger() const { return m_debugger; }
     346    void setDebugger(Debugger* debugger) { m_debugger = debugger; }
     347
     348    const GlobalObjectMethodTable* globalObjectMethodTable() const { return m_globalObjectMethodTable; }
     349
     350    static bool allowsAccessFrom(const JSGlobalObject*, ExecState*) { return true; }
     351    static bool supportsProfiling(const JSGlobalObject*) { return false; }
     352    static bool supportsRichSourceInfo(const JSGlobalObject*) { return true; }
     353
     354    JS_EXPORT_PRIVATE ExecState* globalExec();
     355
     356    static bool shouldInterruptScript(const JSGlobalObject*) { return true; }
     357    static bool javaScriptExperimentsEnabled(const JSGlobalObject*) { return false; }
     358
     359    bool isDynamicScope(bool& requiresDynamicChecks) const;
     360
     361    bool evalEnabled() const { return m_evalEnabled; }
     362    const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; }
     363    void setEvalEnabled(bool enabled, const String& errorMessage = String())
     364    {
     365        m_evalEnabled = enabled;
     366        m_evalDisabledErrorMessage = errorMessage;
     367    }
     368
     369    void resetPrototype(JSGlobalData&, JSValue prototype);
     370
     371    JSGlobalData& globalData() const { return *Heap::heap(this)->globalData(); }
     372    JSObject* globalThis() const;
     373
     374    static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     375    {
     376        return Structure::create(globalData, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
     377    }
     378
     379    void registerWeakMap(OpaqueJSWeakObjectMap* map)
     380    {
     381        createRareDataIfNeeded();
     382        m_rareData->weakMaps.add(map);
     383    }
     384
     385    void unregisterWeakMap(OpaqueJSWeakObjectMap* map)
     386    {
     387        if (m_rareData)
     388            m_rareData->weakMaps.remove(map);
     389    }
     390
     391    double weakRandomNumber() { return m_weakRandom.get(); }
     392    unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
     393
     394    UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
     395    UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*, JSObject** exception);
     396
     397protected:
     398
     399    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
     400
     401    struct GlobalPropertyInfo {
     402        GlobalPropertyInfo(const Identifier& i, JSValue v, unsigned a)
     403            : identifier(i)
     404            , value(v)
     405            , attributes(a)
    177406        {
    178             if (m_rareData)
    179                 return;
    180             m_rareData = adoptPtr(new JSGlobalObjectRareData);
    181407        }
    182        
    183     public:
    184         typedef JSSegmentedVariableObject Base;
    185 
    186         static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure)
    187         {
    188             JSGlobalObject* globalObject = new (NotNull, allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
    189             globalObject->finishCreation(globalData);
    190             globalData.heap.addFinalizer(globalObject, destroy);
    191             return globalObject;
    192         }
    193 
    194         static JS_EXPORTDATA const ClassInfo s_info;
    195 
    196         bool hasDebugger() const { return m_debugger; }
    197         bool hasProfiler() const { return globalObjectMethodTable()->supportsProfiling(this); }
    198 
    199         void* m_apiData;
    200 
    201     protected:
    202         JS_EXPORT_PRIVATE explicit JSGlobalObject(JSGlobalData&, Structure*, const GlobalObjectMethodTable* = 0);
    203 
    204         void finishCreation(JSGlobalData& globalData)
    205         {
    206             Base::finishCreation(globalData);
    207             structure()->setGlobalObject(globalData, this);
    208             m_experimentsEnabled = m_globalObjectMethodTable->javaScriptExperimentsEnabled(this);
    209             init(this);
    210         }
    211 
    212         void finishCreation(JSGlobalData& globalData, JSObject* thisValue)
    213         {
    214             Base::finishCreation(globalData);
    215             structure()->setGlobalObject(globalData, this);
    216             m_experimentsEnabled = m_globalObjectMethodTable->javaScriptExperimentsEnabled(this);
    217             init(thisValue);
    218         }
    219 
    220     public:
    221         JS_EXPORT_PRIVATE ~JSGlobalObject();
    222         JS_EXPORT_PRIVATE static void destroy(JSCell*);
    223         // We don't need a destructor because we use a finalizer instead.
    224         static const bool needsDestruction = false;
    225 
    226         JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
    227 
    228         JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
    229         JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
    230         bool hasOwnPropertyForWrite(ExecState*, PropertyName);
    231         JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
    232 
    233         JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
    234 
    235         JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes);
    236         JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, PropertyName, JSObject* setterFunc, unsigned attributes);
    237         JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow);
    238 
    239         // We use this in the code generator as we perform symbol table
    240         // lookups prior to initializing the properties
    241         bool symbolTableHasProperty(PropertyName);
    242 
    243         // The following accessors return pristine values, even if a script
    244         // replaces the global object's associated property.
    245 
    246         RegExpConstructor* regExpConstructor() const { return m_regExpConstructor.get(); }
    247 
    248         ErrorConstructor* errorConstructor() const { return m_errorConstructor.get(); }
    249         NativeErrorConstructor* evalErrorConstructor() const { return m_evalErrorConstructor.get(); }
    250         NativeErrorConstructor* rangeErrorConstructor() const { return m_rangeErrorConstructor.get(); }
    251         NativeErrorConstructor* referenceErrorConstructor() const { return m_referenceErrorConstructor.get(); }
    252         NativeErrorConstructor* syntaxErrorConstructor() const { return m_syntaxErrorConstructor.get(); }
    253         NativeErrorConstructor* typeErrorConstructor() const { return m_typeErrorConstructor.get(); }
    254         NativeErrorConstructor* URIErrorConstructor() const { return m_URIErrorConstructor.get(); }
    255 
    256         JSFunction* evalFunction() const { return m_evalFunction.get(); }
    257         JSFunction* callFunction() const { return m_callFunction.get(); }
    258         JSFunction* applyFunction() const { return m_applyFunction.get(); }
    259         GetterSetter* throwTypeErrorGetterSetter(ExecState* exec)
    260         {
    261             if (!m_throwTypeErrorGetterSetter)
    262                 createThrowTypeError(exec);
    263             return m_throwTypeErrorGetterSetter.get();
    264         }
    265 
    266         ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); }
    267         FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
    268         ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); }
    269         BooleanPrototype* booleanPrototype() const { return m_booleanPrototype.get(); }
    270         StringPrototype* stringPrototype() const { return m_stringPrototype.get(); }
    271         NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); }
    272         DatePrototype* datePrototype() const { return m_datePrototype.get(); }
    273         RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); }
    274         ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); }
    275 
    276         Structure* withScopeStructure() const { return m_withScopeStructure.get(); }
    277         Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); }
    278         Structure* activationStructure() const { return m_activationStructure.get(); }
    279         Structure* nameScopeStructure() const { return m_nameScopeStructure.get(); }
    280         Structure* argumentsStructure() const { return m_argumentsStructure.get(); }
    281         Structure* originalArrayStructureForIndexingType(IndexingType indexingType) const
    282         {
    283             ASSERT(indexingType & IsArray);
    284             return m_originalArrayStructureForIndexingShape[(indexingType & IndexingShapeMask) >> IndexingShapeShift].get();
    285         }
    286         Structure* arrayStructureForIndexingTypeDuringAllocation(IndexingType indexingType) const
    287         {
    288             ASSERT(indexingType & IsArray);
    289             return m_arrayStructureForIndexingShapeDuringAllocation[(indexingType & IndexingShapeMask) >> IndexingShapeShift].get();
    290         }
    291         Structure* arrayStructureForProfileDuringAllocation(ArrayAllocationProfile* profile) const
    292         {
    293             return arrayStructureForIndexingTypeDuringAllocation(ArrayAllocationProfile::selectIndexingTypeFor(profile));
    294         }
    295        
    296         bool isOriginalArrayStructure(Structure* structure)
    297         {
    298             return originalArrayStructureForIndexingType(structure->indexingType() | IsArray) == structure;
    299         }
    300        
    301         Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); }
    302         Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get(); }
    303         Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get(); }
    304         Structure* callbackObjectStructure() const { return m_callbackObjectStructure.get(); }
    305         Structure* dateStructure() const { return m_dateStructure.get(); }
    306         Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); }
    307         Structure* errorStructure() const { return m_errorStructure.get(); }
    308         Structure* functionStructure() const { return m_functionStructure.get(); }
    309         Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get(); }
    310         Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get(); }
    311         PropertyOffset functionNameOffset() const { return m_functionNameOffset; }
    312         Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); }
    313         Structure* privateNameStructure() const { return m_privateNameStructure.get(); }
    314         Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); }
    315         Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); }
    316         Structure* regExpStructure() const { return m_regExpStructure.get(); }
    317         Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
    318 
    319         void* actualPointerFor(Special::Pointer pointer)
    320         {
    321             ASSERT(pointer < Special::TableSize);
    322             return m_specialPointers[pointer];
    323         }
    324 
    325         WatchpointSet* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint.get(); }
    326         WatchpointSet* havingABadTimeWatchpoint() { return m_havingABadTimeWatchpoint.get(); }
    327        
    328         bool isHavingABadTime() const
    329         {
    330             return m_havingABadTimeWatchpoint->hasBeenInvalidated();
    331         }
    332        
    333         void haveABadTime(JSGlobalData&);
    334        
    335         bool arrayPrototypeChainIsSane();
    336 
    337         void setProfileGroup(unsigned value) { createRareDataIfNeeded(); m_rareData->profileGroup = value; }
    338         unsigned profileGroup() const
    339         {
    340             if (!m_rareData)
    341                 return 0;
    342             return m_rareData->profileGroup;
    343         }
    344 
    345         Debugger* debugger() const { return m_debugger; }
    346         void setDebugger(Debugger* debugger) { m_debugger = debugger; }
    347 
    348         const GlobalObjectMethodTable* globalObjectMethodTable() const { return m_globalObjectMethodTable; }
    349 
    350         static bool allowsAccessFrom(const JSGlobalObject*, ExecState*) { return true; }
    351         static bool supportsProfiling(const JSGlobalObject*) { return false; }
    352         static bool supportsRichSourceInfo(const JSGlobalObject*) { return true; }
    353 
    354         JS_EXPORT_PRIVATE ExecState* globalExec();
    355 
    356         static bool shouldInterruptScript(const JSGlobalObject*) { return true; }
    357         static bool javaScriptExperimentsEnabled(const JSGlobalObject*) { return false; }
    358 
    359         bool isDynamicScope(bool& requiresDynamicChecks) const;
    360 
    361         bool evalEnabled() const { return m_evalEnabled; }
    362         const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; }
    363         void setEvalEnabled(bool enabled, const String& errorMessage = String())
    364         {
    365             m_evalEnabled = enabled;
    366             m_evalDisabledErrorMessage = errorMessage;
    367         }
    368 
    369         void resetPrototype(JSGlobalData&, JSValue prototype);
    370 
    371         JSGlobalData& globalData() const { return *Heap::heap(this)->globalData(); }
    372         JSObject* globalThis() const;
    373 
    374         static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
    375         {
    376             return Structure::create(globalData, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
    377         }
    378 
    379         void registerWeakMap(OpaqueJSWeakObjectMap* map)
    380         {
    381             createRareDataIfNeeded();
    382             m_rareData->weakMaps.add(map);
    383         }
    384 
    385         void unregisterWeakMap(OpaqueJSWeakObjectMap* map)
    386         {
    387             if (m_rareData)
    388                 m_rareData->weakMaps.remove(map);
    389         }
    390 
    391         double weakRandomNumber() { return m_weakRandom.get(); }
    392         unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
    393 
    394         UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
    395         UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*, JSObject** exception);
    396 
    397     protected:
    398 
    399         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
    400 
    401         struct GlobalPropertyInfo {
    402             GlobalPropertyInfo(const Identifier& i, JSValue v, unsigned a)
    403                 : identifier(i)
    404                 , value(v)
    405                 , attributes(a)
    406             {
    407             }
    408 
    409             const Identifier identifier;
    410             JSValue value;
    411             unsigned attributes;
    412         };
    413         JS_EXPORT_PRIVATE void addStaticGlobals(GlobalPropertyInfo*, int count);
    414 
    415         JS_EXPORT_PRIVATE static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*);
    416 
    417         JS_EXPORT_PRIVATE void setGlobalThis(JSGlobalData&, JSObject* globalThis);
    418 
    419     private:
    420         friend class LLIntOffsetsExtractor;
    421        
    422         // FIXME: Fold reset into init.
    423         JS_EXPORT_PRIVATE void init(JSObject* thisValue);
    424         void reset(JSValue prototype);
    425 
    426         void createThrowTypeError(ExecState*);
    427 
    428         JS_EXPORT_PRIVATE static void clearRareData(JSCell*);
     408
     409        const Identifier identifier;
     410        JSValue value;
     411        unsigned attributes;
    429412    };
    430 
    431     JSGlobalObject* asGlobalObject(JSValue);
    432 
    433     inline JSGlobalObject* asGlobalObject(JSValue value)
    434     {
    435         ASSERT(asObject(value)->isGlobalObject());
    436         return jsCast<JSGlobalObject*>(asObject(value));
    437     }
    438 
    439     inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName)
    440     {
    441         PropertySlot slot;
    442         if (Base::getOwnPropertySlot(this, exec, propertyName, slot))
    443             return true;
    444         bool slotIsWriteable;
    445         return symbolTableGet(this, propertyName, slot, slotIsWriteable);
    446     }
    447 
    448     inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName)
    449     {
    450         SymbolTableEntry entry = symbolTable()->inlineGet(propertyName.publicName());
    451         return !entry.isNull();
    452     }
    453 
    454     inline JSGlobalObject* ExecState::dynamicGlobalObject()
    455     {
    456         if (this == lexicalGlobalObject()->globalExec())
    457             return lexicalGlobalObject();
    458 
    459         // For any ExecState that's not a globalExec, the
    460         // dynamic global object must be set since code is running
    461         ASSERT(globalData().dynamicGlobalObject);
    462         return globalData().dynamicGlobalObject;
    463     }
    464 
    465     inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, unsigned initialLength = 0)
    466     {
    467         return ArrayAllocationProfile::updateLastAllocationFor(profile, JSArray::create(exec->globalData(), initialLength >= MIN_SPARSE_ARRAY_INDEX ? globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage) : globalObject->arrayStructureForProfileDuringAllocation(profile), initialLength));
    468     }
    469 
    470     inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, unsigned initialLength = 0)
    471     {
    472         return constructEmptyArray(exec, profile, exec->lexicalGlobalObject(), initialLength);
    473     }
     413    JS_EXPORT_PRIVATE void addStaticGlobals(GlobalPropertyInfo*, int count);
     414
     415    JS_EXPORT_PRIVATE static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*);
     416
     417    JS_EXPORT_PRIVATE void setGlobalThis(JSGlobalData&, JSObject* globalThis);
     418
     419private:
     420    friend class LLIntOffsetsExtractor;
     421       
     422    // FIXME: Fold reset into init.
     423    JS_EXPORT_PRIVATE void init(JSObject* thisValue);
     424    void reset(JSValue prototype);
     425
     426    void createThrowTypeError(ExecState*);
     427
     428    JS_EXPORT_PRIVATE static void clearRareData(JSCell*);
     429};
     430
     431JSGlobalObject* asGlobalObject(JSValue);
     432
     433inline JSGlobalObject* asGlobalObject(JSValue value)
     434{
     435    ASSERT(asObject(value)->isGlobalObject());
     436    return jsCast<JSGlobalObject*>(asObject(value));
     437}
     438
     439inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName)
     440{
     441    PropertySlot slot;
     442    if (Base::getOwnPropertySlot(this, exec, propertyName, slot))
     443        return true;
     444    bool slotIsWriteable;
     445    return symbolTableGet(this, propertyName, slot, slotIsWriteable);
     446}
     447
     448inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName)
     449{
     450    SymbolTableEntry entry = symbolTable()->inlineGet(propertyName.publicName());
     451    return !entry.isNull();
     452}
     453
     454inline JSGlobalObject* ExecState::dynamicGlobalObject()
     455{
     456    if (this == lexicalGlobalObject()->globalExec())
     457        return lexicalGlobalObject();
     458
     459    // For any ExecState that's not a globalExec, the
     460    // dynamic global object must be set since code is running
     461    ASSERT(globalData().dynamicGlobalObject);
     462    return globalData().dynamicGlobalObject;
     463}
     464
     465inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, unsigned initialLength = 0)
     466{
     467    return ArrayAllocationProfile::updateLastAllocationFor(profile, JSArray::create(exec->globalData(), initialLength >= MIN_SPARSE_ARRAY_INDEX ? globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage) : globalObject->arrayStructureForProfileDuringAllocation(profile), initialLength));
     468}
     469
     470inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, unsigned initialLength = 0)
     471{
     472    return constructEmptyArray(exec, profile, exec->lexicalGlobalObject(), initialLength);
     473}
    474474 
    475     inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const ArgList& values)
    476     {
    477         return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, globalObject->arrayStructureForProfileDuringAllocation(profile), values));
    478     }
    479 
    480     inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, const ArgList& values)
    481     {
    482         return constructArray(exec, profile, exec->lexicalGlobalObject(), values);
    483     }
    484 
    485     inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const JSValue* values, unsigned length)
    486     {
    487         return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, globalObject->arrayStructureForProfileDuringAllocation(profile), values, length));
    488     }
    489 
    490     inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, const JSValue* values, unsigned length)
    491     {
    492         return constructArray(exec, profile, exec->lexicalGlobalObject(), values, length);
    493     }
    494 
    495     class DynamicGlobalObjectScope {
    496         WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);
    497     public:
    498         JS_EXPORT_PRIVATE DynamicGlobalObjectScope(JSGlobalData&, JSGlobalObject*);
    499 
    500         ~DynamicGlobalObjectScope()
    501         {
    502             m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
    503         }
    504 
    505     private:
    506         JSGlobalObject*& m_dynamicGlobalObjectSlot;
    507         JSGlobalObject* m_savedDynamicGlobalObject;
    508     };
    509 
    510     inline bool JSGlobalObject::isDynamicScope(bool&) const
    511     {
    512         return true;
    513     }
    514 
    515     inline JSObject* JSScope::globalThis()
    516     {
    517         return globalObject()->globalThis();
    518     }
    519 
    520     inline JSObject* JSGlobalObject::globalThis() const
    521     {
    522         return m_globalThis.get();
    523     }
     475inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const ArgList& values)
     476{
     477    return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, globalObject->arrayStructureForProfileDuringAllocation(profile), values));
     478}
     479
     480inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, const ArgList& values)
     481{
     482    return constructArray(exec, profile, exec->lexicalGlobalObject(), values);
     483}
     484
     485inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const JSValue* values, unsigned length)
     486{
     487    return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, globalObject->arrayStructureForProfileDuringAllocation(profile), values, length));
     488}
     489
     490inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, const JSValue* values, unsigned length)
     491{
     492    return constructArray(exec, profile, exec->lexicalGlobalObject(), values, length);
     493}
     494
     495class DynamicGlobalObjectScope {
     496    WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);
     497public:
     498    JS_EXPORT_PRIVATE DynamicGlobalObjectScope(JSGlobalData&, JSGlobalObject*);
     499
     500    ~DynamicGlobalObjectScope()
     501    {
     502        m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
     503    }
     504
     505private:
     506    JSGlobalObject*& m_dynamicGlobalObjectSlot;
     507    JSGlobalObject* m_savedDynamicGlobalObject;
     508};
     509
     510inline bool JSGlobalObject::isDynamicScope(bool&) const
     511{
     512    return true;
     513}
     514
     515inline JSObject* JSScope::globalThis()
     516{
     517    return globalObject()->globalThis();
     518}
     519
     520inline JSObject* JSGlobalObject::globalThis() const
     521{
     522    return m_globalThis.get();
     523}
    524524
    525525} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h

    r140718 r143171  
    3030namespace JSC {
    3131
    32     class ArgList;
    33     class ExecState;
    34     class JSObject;
     32class ArgList;
     33class ExecState;
     34class JSObject;
    3535
    36     // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
    37     // is a 0.5% reduction.
     36// FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
     37// is a 0.5% reduction.
    3838
    39     EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*);
    40     EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
    41     EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
    42     EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
    43     EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
    44     EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
    45     EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
    46     EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
    47     EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
    48     EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
    49     EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
    50     EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*);
    51     EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);
    52     EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
     39EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*);
     40EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
     41EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
     42EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
     43EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
     44EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
     45EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
     46EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
     47EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
     48EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
     49EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
     50EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*);
     51EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);
     52EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
    5353
    54     static const double mantissaOverflowLowerBound = 9007199254740992.0;
    55     double parseIntOverflow(const LChar*, int length, int radix);
    56     ALWAYS_INLINE double parseIntOverflow(const char* s, int length, int radix) { return parseIntOverflow(reinterpret_cast<const LChar*>(s), length, radix); }
    57     double parseIntOverflow(const UChar*, int length, int radix);
    58     bool isStrWhiteSpace(UChar);
    59     double jsToNumber(const WTF::String&);
     54static const double mantissaOverflowLowerBound = 9007199254740992.0;
     55double parseIntOverflow(const LChar*, int length, int radix);
     56ALWAYS_INLINE double parseIntOverflow(const char* s, int length, int radix) { return parseIntOverflow(reinterpret_cast<const LChar*>(s), length, radix); }
     57double parseIntOverflow(const UChar*, int length, int radix);
     58bool isStrWhiteSpace(UChar);
     59double jsToNumber(const WTF::String&);
    6060
    6161} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.