Introduce getter definition into static hash tables and use it for getters in RegExp...
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2015 18:42:46 +0000 (18:42 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2015 18:42:46 +0000 (18:42 +0000)
commit6e52a06ead8c42118929e9f586cd9d7de58ac1a2
treea86b275dca46b40a4f0e81a8d54617d11bb020ff
parent9c349f134af36acc5956ae2b39cf66d234a61135
Introduce getter definition into static hash tables and use it for getters in RegExp.prototype.
https://bugs.webkit.org/show_bug.cgi?id=145705

Reviewed by Darin Adler.

Source/JavaScriptCore:

In this patch, we introduce Accessor type into property tables.
With Accessor type, create_hash_table creates a static getter property.
This getter property is reified as the same to the static functions.

In the mean time, we only support getter because `putEntry` and `lookupPut`
only work with null setter currently. However, in the spec, there's
no need to add static setter properties. So we will add it if it becomes
necessary in the future.

And at the same time, this patch fixes the issue 145738. Before this patch,
`putEntry` in `JSObject::deleteProperty` adds `undefined` property if
`isValidOffset(...)` is false (deleted). As the result, deleting twice
revives the property with `undefined` value.

If the static functions are reified and the entry is
`BuiltinOrFunctionOrAccessor`, there's no need to execute `putEntry` with
static hash table entry. They should be handled in the normal structure's
looking up because they should be already reified. So added guard for this.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* create_hash_table:
* runtime/JSObject.cpp:
(JSC::getClassPropertyNames):
(JSC::JSObject::put):
(JSC::JSObject::deleteProperty):
(JSC::JSObject::reifyStaticFunctionsForDelete):
* runtime/Lookup.cpp:
(JSC::reifyStaticAccessor):
(JSC::setUpStaticFunctionSlot):
* runtime/Lookup.h:
(JSC::HashTableValue::propertyGetter):
(JSC::HashTableValue::propertyPutter):
(JSC::HashTableValue::accessorGetter):
(JSC::HashTableValue::accessorSetter):
(JSC::getStaticPropertySlot):
(JSC::getStaticValueSlot):
(JSC::putEntry):
(JSC::reifyStaticProperties):
* runtime/PropertySlot.h:
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::getOwnPropertySlot):
(JSC::regExpObjectGlobal): Deleted.
(JSC::regExpObjectIgnoreCase): Deleted.
(JSC::regExpObjectMultiline): Deleted.
(JSC::appendLineTerminatorEscape<LChar>): Deleted.
(JSC::appendLineTerminatorEscape<UChar>): Deleted.
(JSC::regExpObjectSourceInternal): Deleted.
(JSC::regExpObjectSource): Deleted.
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::getOwnPropertySlot):
(JSC::regExpProtoGetterGlobal):
(JSC::regExpProtoGetterIgnoreCase):
(JSC::regExpProtoGetterMultiline):
(JSC::appendLineTerminatorEscape<LChar>):
(JSC::appendLineTerminatorEscape<UChar>):
(JSC::regExpProtoGetterSourceInternal):
(JSC::regExpProtoGetterSource):
* tests/stress/static-function-delete.js: Added.
(shouldBe):
* tests/stress/static-function-put.js: Added.
(shouldBe):
* tests/stress/static-getter-delete.js: Added.
(shouldBe):
(shouldThrow):
* tests/stress/static-getter-descriptors.js: Added.
(shouldBe):
* tests/stress/static-getter-enumeration.js: Added.
(shouldBe):
* tests/stress/static-getter-get.js: Added.
(shouldBe):
* tests/stress/static-getter-in-names.js: Added.
(shouldBe):
* tests/stress/static-getter-names.js: Added.
(shouldBe):
* tests/stress/static-getter-put.js: Added.
(shouldBe):
(shouldThrow):

LayoutTests:

Adjust RegExp.prototype and instance's getter layout.
This is a breaking change from ES5.
So ES5 conformance tests like sputnik is needed to be fixed.

* ietestcenter/Javascript/15.2.3.3-4-212-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-213-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-214-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-215-expected.txt:
* ietestcenter/Javascript/TestCases/15.2.3.3-4-212.js:
(ES5Harness.registerTest):
* ietestcenter/Javascript/TestCases/15.2.3.3-4-213.js:
(ES5Harness.registerTest):
* ietestcenter/Javascript/TestCases/15.2.3.3-4-214.js:
(ES5Harness.registerTest):
* ietestcenter/Javascript/TestCases/15.2.3.3-4-215.js:
(ES5Harness.registerTest):
* js/Object-getOwnPropertyNames-expected.txt:
* js/dom/getOwnPropertyDescriptor-expected.txt:
* js/mozilla/strict/15.10.7-expected.txt:
* js/mozilla/strict/script-tests/15.10.7.js:
* js/pic/cached-named-property-getter.html:
* js/resources/getOwnPropertyDescriptor.js:
(.get descriptorShouldBe):
* js/script-tests/Object-getOwnPropertyNames.js:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A10.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A8.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A9.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A10.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A8.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A9.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A10.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A8.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A9.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A10.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A8.html:
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A9.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
50 files changed:
LayoutTests/ChangeLog
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-212-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-213-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-214-expected.txt
LayoutTests/ietestcenter/Javascript/15.2.3.3-4-215-expected.txt
LayoutTests/ietestcenter/Javascript/TestCases/15.2.3.3-4-212.js
LayoutTests/ietestcenter/Javascript/TestCases/15.2.3.3-4-213.js
LayoutTests/ietestcenter/Javascript/TestCases/15.2.3.3-4-214.js
LayoutTests/ietestcenter/Javascript/TestCases/15.2.3.3-4-215.js
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt
LayoutTests/js/mozilla/strict/15.10.7-expected.txt
LayoutTests/js/mozilla/strict/script-tests/15.10.7.js
LayoutTests/js/pic/cached-named-property-getter.html
LayoutTests/js/resources/getOwnPropertyDescriptor.js
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A10.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A8.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.1_source/S15.10.7.1_A9.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A10.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A8.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.2_global/S15.10.7.2_A9.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A10.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A8.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.3_ignoreCase/S15.10.7.3_A9.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A10.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A8.html
LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.7/15.10.7.4_multiline/S15.10.7.4_A9.html
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/create_hash_table
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/Lookup.cpp
Source/JavaScriptCore/runtime/Lookup.h
Source/JavaScriptCore/runtime/PropertySlot.h
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/RegExpPrototype.cpp
Source/JavaScriptCore/tests/stress/static-function-delete.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-function-put.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-delete.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-descriptors.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-enumeration.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-get.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-in-names.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-names.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/static-getter-put.js [new file with mode: 0644]