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: http://svn.webkit.org/repository/webkit/trunk@185370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
50 files changed