Bug 55736 - Implement seal/freeze/preventExtensions for normal object types.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 22:34:48 +0000 (22:34 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 22:34:48 +0000 (22:34 +0000)
commit8ebf4bd5253f3754ba67e12276d55a65bd2869f0
tree836af3e1e20897ceb63f747f4311bcbc4724ce03
parentb4a56e9eee08dbc0a3e612d052fa212bc537a642
Bug 55736 - Implement seal/freeze/preventExtensions for normal object types.
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: https://svn.webkit.org/repository/webkit/trunk@80378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
130 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/fast/js/preventExtensions-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/preventExtensions.html [new file with mode: 0644]
LayoutTests/fast/js/script-tests/Object-getOwnPropertyNames.js
LayoutTests/fast/js/script-tests/preventExtensions.js [new file with mode: 0644]
LayoutTests/ietestcenter/Javascript/15.2.3.10-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.10-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.10-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.10-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-10-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-11-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-12-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-13-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-14-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-15-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-16-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-17-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-18-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-19-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-20-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-21-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-22-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-23-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-24-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-25-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-26-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-27-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-3-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-4-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-5-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-6-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-7-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-8-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.11-4-9-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-10-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-11-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-12-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-13-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-14-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-15-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-16-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-17-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-18-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-19-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-20-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-21-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-22-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-23-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-24-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-25-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-26-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-27-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-3-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-4-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-5-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-6-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-7-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-8-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.12-3-9-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-0-3-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-10-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-11-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-12-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-13-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-14-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-15-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-16-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-17-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-18-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-19-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-20-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-21-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-3-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-4-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-5-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-6-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-7-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-8-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.13-2-9-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.14-2-4-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.14-2-5-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.14-2-6-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-20-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-21-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-22-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-23-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-24-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-25-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.4-4-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.6-4-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.8-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.8-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.8-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.9-0-1-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.9-0-2-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.9-1-expected.txt
Source/JavaScriptCore/Android.mk
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/DerivedSources.pro
Source/JavaScriptCore/GNUmakefile.am
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/interpreter/CallFrame.h
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/JSGlobalData.cpp
Source/JavaScriptCore/runtime/JSGlobalData.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.h
Source/JavaScriptCore/runtime/Structure.cpp
Source/JavaScriptCore/runtime/Structure.h