• barraclough@apple.com's avatar
    Bug 55736 - Implement seal/freeze/preventExtensions for normal object types. · dd993107
    barraclough@apple.com authored
    Provide basic functionallity from section 15.2.4 of ECMA-262.
    This support will need expanding to cover arrays, too.
    
    Reviewed by Sam Weinig.
    
    Source/JavaScriptCore: 
    
    Shows a 0.5% progression on SunSpidey, this seems to be due to changing
    ObjectConstructor to use a static table.
    
    * DerivedSources.make:
    * JavaScriptCore.exp:
    * interpreter/CallFrame.h:
    (JSC::ExecState::objectConstructorTable):
        Add a static table for ObjectConstructor.
    * runtime/CommonIdentifiers.h:
    * runtime/JSGlobalData.cpp:
    (JSC::JSGlobalData::JSGlobalData):
    (JSC::JSGlobalData::~JSGlobalData):
        Add a static table for ObjectConstructor.
    * runtime/JSGlobalData.h:
    * runtime/JSGlobalObject.cpp:
    (JSC::JSGlobalObject::reset):
        Add a static table for ObjectConstructor.
    * runtime/JSObject.cpp:
    (JSC::JSObject::seal):
    (JSC::JSObject::freeze):
    (JSC::JSObject::preventExtensions):
        Transition the object's structure.
    (JSC::JSObject::defineOwnProperty):
        Check isExtensible.
    * runtime/JSObject.h:
    (JSC::JSObject::isSealed):
    (JSC::JSObject::isFrozen):
    (JSC::JSObject::isExtensible):
        These wrap method on structure.
    (JSC::JSObject::putDirectInternal):
        Check isExtensible.
    * runtime/ObjectConstructor.cpp:
    (JSC::ObjectConstructor::ObjectConstructor):
    (JSC::ObjectConstructor::getOwnPropertySlot):
    (JSC::ObjectConstructor::getOwnPropertyDescriptor):
        Change ObjectConstructor to use a static table.
    (JSC::objectConstructorSeal):
    (JSC::objectConstructorFreeze):
    (JSC::objectConstructorPreventExtensions):
    (JSC::objectConstructorIsSealed):
    (JSC::objectConstructorIsFrozen):
    (JSC::objectConstructorIsExtensible):
        Add new methods on Object.
    * runtime/ObjectConstructor.h:
    (JSC::ObjectConstructor::createStructure):
    * runtime/Structure.cpp:
    (JSC::Structure::Structure):
        init/propagate  m_preventExtensions
    (JSC::Structure::sealTransition):
    (JSC::Structure::freezeTransition):
    (JSC::Structure::preventExtensionsTransition):
        transition the structure, materializing the property map, setting m_preventExtensions & changing attributes.
    (JSC::Structure::isSealed):
    (JSC::Structure::isFrozen):
        check attributes to detect if object is sealed/frozen.
    * runtime/Structure.h:
    (JSC::Structure::isExtensible):
        checks the m_preventExtensions flag.
    
    LayoutTests: 
    
    Update results - many more tests PASS.
    Also adds a new testcase.
    
    * fast/js/Object-getOwnPropertyNames-expected.txt:
    * fast/js/script-tests/Object-getOwnPropertyNames.js:
    * ietestcenter/Javascript/15.2.3.10-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.10-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.10-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.10-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-10-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-11-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-12-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-13-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-14-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-15-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-16-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-17-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-18-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-19-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-20-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-21-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-22-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-23-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-24-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-25-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-26-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-27-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-3-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-4-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-5-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-6-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-7-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-8-expected.txt:
    * ietestcenter/Javascript/15.2.3.11-4-9-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-10-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-11-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-12-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-13-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-14-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-15-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-16-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-17-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-18-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-19-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-20-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-21-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-22-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-23-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-24-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-25-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-26-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-27-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-3-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-4-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-5-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-6-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-7-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-8-expected.txt:
    * ietestcenter/Javascript/15.2.3.12-3-9-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-0-3-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-10-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-11-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-12-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-13-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-14-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-15-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-16-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-17-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-18-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-19-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-20-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-21-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-3-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-4-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-5-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-6-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-7-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-8-expected.txt:
    * ietestcenter/Javascript/15.2.3.13-2-9-expected.txt:
    * ietestcenter/Javascript/15.2.3.14-2-4-expected.txt:
    * ietestcenter/Javascript/15.2.3.14-2-5-expected.txt:
    * ietestcenter/Javascript/15.2.3.14-2-6-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-20-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-21-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-22-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-23-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-24-expected.txt:
    * ietestcenter/Javascript/15.2.3.3-4-25-expected.txt:
    * ietestcenter/Javascript/15.2.3.4-4-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.6-4-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.8-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.8-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.8-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.9-0-1-expected.txt:
    * ietestcenter/Javascript/15.2.3.9-0-2-expected.txt:
    * ietestcenter/Javascript/15.2.3.9-1-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    dd993107
CommonIdentifiers.h 2.87 KB