Changeset 99768 in webkit


Ignore:
Timestamp:
Nov 9, 2011, 3:21:56 PM (14 years ago)
Author:
mhahnenberg@apple.com
Message:

De-virtualize JSVariableObject::isDynamicScope
https://bugs.webkit.org/show_bug.cgi?id=71933

Reviewed by Geoffrey Garen.

  • runtime/JSActivation.cpp:
  • runtime/JSActivation.h: Inlined and de-virtualized isDynamicScope

(JSC::JSActivation::isDynamicScope):

  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h: Inlined and de-virtualized isDynamicScope

(JSC::JSGlobalObject::isDynamicScope):

  • runtime/JSStaticScopeObject.cpp:
  • runtime/JSStaticScopeObject.h: Inlined and de-virtualized isDynamicScope

(JSC::JSStaticScopeObject::createStructure): Changed createStructure to use new JSType
(JSC::JSStaticScopeObject::isDynamicScope):

  • runtime/JSType.h: Added new type for JSStaticScopeObject
  • runtime/JSVariableObject.cpp: De-virtualized and added an implementation that checks the

object's type and calls the corresponding implementation.
(JSC::JSVariableObject::isDynamicScope):

  • runtime/JSVariableObject.h:
Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r99767 r99768  
     12011-11-09  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        De-virtualize JSVariableObject::isDynamicScope
     4        https://bugs.webkit.org/show_bug.cgi?id=71933
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * runtime/JSActivation.cpp:
     9        * runtime/JSActivation.h: Inlined and de-virtualized isDynamicScope
     10        (JSC::JSActivation::isDynamicScope):
     11        * runtime/JSGlobalObject.cpp:
     12        * runtime/JSGlobalObject.h: Inlined and de-virtualized isDynamicScope
     13        (JSC::JSGlobalObject::isDynamicScope):
     14        * runtime/JSStaticScopeObject.cpp:
     15        * runtime/JSStaticScopeObject.h: Inlined and de-virtualized isDynamicScope
     16        (JSC::JSStaticScopeObject::createStructure): Changed createStructure to use new JSType
     17        (JSC::JSStaticScopeObject::isDynamicScope):
     18        * runtime/JSType.h: Added new type for JSStaticScopeObject
     19        * runtime/JSVariableObject.cpp: De-virtualized and added an implementation that checks the
     20        object's type and calls the corresponding implementation.
     21        (JSC::JSVariableObject::isDynamicScope):
     22        * runtime/JSVariableObject.h:
     23
    1242011-11-09  Mark Hahnenberg  <mhahnenberg@apple.com>
    225
  • trunk/Source/JavaScriptCore/runtime/JSActivation.cpp

    r99497 r99768  
    210210}
    211211
    212 bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
    213 {
    214     requiresDynamicChecks = m_requiresDynamicChecks;
    215     return false;
    216 }
    217 
    218212JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&)
    219213{
  • trunk/Source/JavaScriptCore/runtime/JSActivation.h

    r99497 r99768  
    109109    }
    110110
     111    inline bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
     112    {
     113        requiresDynamicChecks = m_requiresDynamicChecks;
     114        return false;
     115    }
     116
    111117} // namespace JSC
    112118
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r99754 r99768  
    396396}
    397397
    398 bool JSGlobalObject::isDynamicScope(bool&) const
    399 {
    400     return true;
    401 }
    402 
    403398void JSGlobalObject::resizeRegisters(size_t newSize)
    404399{
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r99767 r99768  
    274274        virtual bool allowsAccessFrom(const JSGlobalObject*) const { return true; }
    275275
    276         virtual bool isDynamicScope(bool& requiresDynamicChecks) const;
     276        bool isDynamicScope(bool& requiresDynamicChecks) const;
    277277
    278278        void setEvalEnabled(bool enabled) { m_evalEnabled = enabled; }
     
    474474    };
    475475
     476    inline bool JSGlobalObject::isDynamicScope(bool&) const
     477    {
     478        return true;
     479    }
     480
    476481} // namespace JSC
    477482
  • trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp

    r99497 r99768  
    8383}
    8484
    85 bool JSStaticScopeObject::isDynamicScope(bool&) const
    86 {
    87     return false;
    88 }
    89 
    9085bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, const Identifier& propertyName, PropertySlot& slot)
    9186{
  • trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.h

    r99497 r99768  
    5050        static void putWithAttributes(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes);
    5151
    52         static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); }
     52        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); }
    5353
    5454        static const ClassInfo s_info;
     
    7373    };
    7474
     75    inline bool JSStaticScopeObject::isDynamicScope(bool&) const
     76    {
     77        return false;
     78    }
     79
    7580}
    7681
  • trunk/Source/JavaScriptCore/runtime/JSType.h

    r98909 r99768  
    5050    GlobalObjectType    = 17,
    5151    ActivationObjectType = 18,
     52    StaticScopeObjectType = 19,
    5253};
    5354
  • trunk/Source/JavaScriptCore/runtime/JSVariableObject.cpp

    r99497 r99768  
    3030#include "JSVariableObject.h"
    3131
     32#include "JSActivation.h"
     33#include "JSGlobalObject.h"
     34#include "JSStaticScopeObject.h"
    3235#include "PropertyNameArray.h"
    3336#include "PropertyDescriptor.h"
     
    7578}
    7679
     80bool JSVariableObject::isDynamicScope(bool& requiresDynamicChecks) const
     81{
     82    switch (structure()->typeInfo().type()) {
     83    case GlobalObjectType:
     84        return static_cast<const JSGlobalObject*>(this)->isDynamicScope(requiresDynamicChecks);
     85    case ActivationObjectType:
     86        return static_cast<const JSActivation*>(this)->isDynamicScope(requiresDynamicChecks);
     87    case StaticScopeObjectType:
     88        return static_cast<const JSStaticScopeObject*>(this)->isDynamicScope(requiresDynamicChecks);
     89    default:
     90        ASSERT_NOT_REACHED();
     91        break;
     92    }
     93
     94    return false;
     95}
     96
    7797} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSVariableObject.h

    r99497 r99768  
    5656        static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
    5757       
    58         virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0;
     58        bool isDynamicScope(bool& requiresDynamicChecks) const;
    5959
    6060        WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; }
Note: See TracChangeset for help on using the changeset viewer.