Changeset 200177 in webkit


Ignore:
Timestamp:
Apr 27, 2016, 11:54:54 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

The GetterSetter structure needs a globalObject.
https://bugs.webkit.org/show_bug.cgi?id=157120

Reviewed by Filip Pizlo.

In r199170: <http://trac.webkit.org/r199170>, GetterSetter was promoted from
being a JSCell to a JSObject. JSObject methods expect their structure to have a
globalObject. For example, see JSObject::calculatedClassName(). GetterSetter
was previously using a singleton getterSetterStructure owned by the VM. That
singleton getterSetterStructure is not associated with any globalObjects. As a
result, JSObject::calculatedClassName() will run into a null globalObject when it
is called on a GetterSetter object.

This patch removes the VM singleton getterSetterStructure, and instead, creates
a getterSetterStructure for each JSGlobalObject.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGStructureRegistrationPhase.cpp:

(JSC::DFG::StructureRegistrationPhase::run):

  • runtime/GetterSetter.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::functionStructure):
(JSC::JSGlobalObject::boundFunctionStructure):
(JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
(JSC::JSGlobalObject::getterSetterStructure):
(JSC::JSGlobalObject::nativeStdFunctionStructure):
(JSC::JSGlobalObject::namedFunctionStructure):
(JSC::JSGlobalObject::functionNameOffset):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:
Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r200149 r200177  
     12016-04-27  Mark Lam  <mark.lam@apple.com>
     2
     3        The GetterSetter structure needs a globalObject.
     4        https://bugs.webkit.org/show_bug.cgi?id=157120
     5
     6        Reviewed by Filip Pizlo.
     7
     8        In r199170: <http://trac.webkit.org/r199170>, GetterSetter was promoted from
     9        being a JSCell to a JSObject.  JSObject methods expect their structure to have a
     10        globalObject.  For example, see JSObject::calculatedClassName().  GetterSetter
     11        was previously using a singleton getterSetterStructure owned by the VM.  That
     12        singleton getterSetterStructure is not associated with any globalObjects.  As a
     13        result, JSObject::calculatedClassName() will run into a null globalObject when it
     14        is called on a GetterSetter object.
     15
     16        This patch removes the VM singleton getterSetterStructure, and instead, creates
     17        a getterSetterStructure for each JSGlobalObject.
     18
     19        * dfg/DFGAbstractInterpreterInlines.h:
     20        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
     21        * dfg/DFGStructureRegistrationPhase.cpp:
     22        (JSC::DFG::StructureRegistrationPhase::run):
     23        * runtime/GetterSetter.h:
     24        * runtime/JSGlobalObject.cpp:
     25        (JSC::JSGlobalObject::init):
     26        (JSC::JSGlobalObject::visitChildren):
     27        * runtime/JSGlobalObject.h:
     28        (JSC::JSGlobalObject::functionStructure):
     29        (JSC::JSGlobalObject::boundFunctionStructure):
     30        (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
     31        (JSC::JSGlobalObject::getterSetterStructure):
     32        (JSC::JSGlobalObject::nativeStdFunctionStructure):
     33        (JSC::JSGlobalObject::namedFunctionStructure):
     34        (JSC::JSGlobalObject::functionNameOffset):
     35        * runtime/VM.cpp:
     36        (JSC::VM::VM):
     37        * runtime/VM.h:
     38
    1392016-04-27  Keith Miller  <keith_miller@apple.com>
    240
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r200149 r200177  
    23722372        }
    23732373       
    2374         forNode(node).set(m_graph, m_graph.m_vm.getterSetterStructure.get());
     2374        forNode(node).set(m_graph, m_graph.globalObjectFor(node->origin.semantic)->getterSetterStructure());
    23752375        break;
    23762376    }
  • trunk/Source/JavaScriptCore/dfg/DFGStructureRegistrationPhase.cpp

    r199300 r200177  
    6363        registerStructure(m_graph.m_vm.stringStructure.get());
    6464        registerStructure(m_graph.m_vm.symbolStructure.get());
    65         registerStructure(m_graph.m_vm.getterSetterStructure.get());
    6665       
    6766        for (FrozenValue* value : m_graph.m_frozenValues)
     
    9392                    registerStructure(node->transition()->next);
    9493                    break;
    95                    
     94
     95                case GetGetterSetterByOffset:
     96                    registerStructure(m_graph.globalObjectFor(node->origin.semantic)->getterSetterStructure());
     97                    break;
     98
    9699                case MultiGetByOffset:
    97100                    for (const MultiGetByOffsetCase& getCase : node->multiGetByOffsetData().cases)
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.h

    r199170 r200177  
    4747private:
    4848    GetterSetter(VM& vm, JSGlobalObject* globalObject)
    49         : Base(vm, vm.getterSetterStructure.get())
     49        : Base(vm, globalObject->getterSetterStructure())
    5050    {
    5151        m_getter.set(vm, this, globalObject->nullGetterFunction());
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r200149 r200177  
    295295    m_boundSlotBaseFunctionStructure.set(vm, this, JSBoundSlotBaseFunction::createStructure(vm, this, m_functionPrototype.get()));
    296296    m_boundFunctionStructure.set(vm, this, JSBoundFunction::createStructure(vm, this, m_functionPrototype.get()));
     297    m_getterSetterStructure.set(vm, this, GetterSetter::createStructure(vm, this, jsNull()));
    297298    m_nativeStdFunctionStructure.set(vm, this, JSNativeStdFunction::createStructure(vm, this, m_functionPrototype.get()));
    298299    m_namedFunctionStructure.set(vm, this, Structure::addPropertyTransition(vm, m_functionStructure.get(), vm.propertyNames->name, DontDelete | ReadOnly | DontEnum, m_functionNameOffset));
     
    977978    visitor.append(&thisObject->m_boundSlotBaseFunctionStructure);
    978979    visitor.append(&thisObject->m_boundFunctionStructure);
     980    visitor.append(&thisObject->m_getterSetterStructure);
    979981    visitor.append(&thisObject->m_nativeStdFunctionStructure);
    980982    visitor.append(&thisObject->m_namedFunctionStructure);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r200117 r200177  
    274274    WriteBarrier<Structure> m_boundFunctionStructure;
    275275    WriteBarrier<Structure> m_boundSlotBaseFunctionStructure;
     276    WriteBarrier<Structure> m_getterSetterStructure;
    276277    WriteBarrier<Structure> m_nativeStdFunctionStructure;
    277278    WriteBarrier<Structure> m_namedFunctionStructure;
     
    532533    Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get(); }
    533534    Structure* boundSlotBaseFunctionStructure() const { return m_boundSlotBaseFunctionStructure.get(); }
     535    Structure* getterSetterStructure() const { return m_getterSetterStructure.get(); }
    534536    Structure* nativeStdFunctionStructure() const { return m_nativeStdFunctionStructure.get(); }
    535537    Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get(); }
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r199949 r200177  
    218218    stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull()));
    219219    propertyNameEnumeratorStructure.set(*this, JSPropertyNameEnumerator::createStructure(*this, 0, jsNull()));
    220     getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull()));
    221220    customGetterSetterStructure.set(*this, CustomGetterSetter::createStructure(*this, 0, jsNull()));
    222221    scopedArgumentsTableStructure.set(*this, ScopedArgumentsTable::createStructure(*this, 0, jsNull()));
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r200121 r200177  
    289289    Strong<Structure> propertyNameIteratorStructure;
    290290    Strong<Structure> propertyNameEnumeratorStructure;
    291     Strong<Structure> getterSetterStructure;
    292291    Strong<Structure> customGetterSetterStructure;
    293292    Strong<Structure> scopedArgumentsTableStructure;
Note: See TracChangeset for help on using the changeset viewer.