[ES6] Implement @@search
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Feb 2016 20:46:30 +0000 (20:46 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Feb 2016 20:46:30 +0000 (20:46 +0000)
commit57001ecc5f0830e9c1b7ce57e6c7eecc3337a39f
treef132025f21e31fcab95fbcd77a5fd7dd3f63f9fb
parent6a1412753bc984444d3fb9f8bd4ef8da6bc032d7
[ES6] Implement @@search
https://bugs.webkit.org/show_bug.cgi?id=143889

Reviewed by Darin Adler.

Source/JavaScriptCore:

Implement RegExp.prototype[@@search].
In ES6, String.prototype.search delegates the actual matching to it
instead of executing RegExp matching inside String.prototype.search method itself.
By customizing @@search method, we can change the behavior of String.prototype.search for
derived / customized RegExp object.

* CMakeLists.txt:
* DerivedSources.make:
* builtins/BuiltinNames.h:
(JSC::BuiltinNames::BuiltinNames): Deleted.
* builtins/BuiltinUtils.h:
* builtins/StringPrototype.js:
(search):
* bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* bytecode/BytecodeIntrinsicRegistry.h:
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::finishCreation):
(JSC::regExpProtoFuncSearch):
* runtime/RegExpPrototype.h:
(JSC::RegExpPrototype::create):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::getOwnPropertySlot):
(JSC::StringPrototype::finishCreation): Deleted.
(JSC::stringProtoFuncSearch): Deleted.
* runtime/StringPrototype.h:
* tests/es6.yaml:
* tests/stress/regexp-search.js: Added.
(shouldBe):
(shouldThrow):
(errorKey.toString):
(primitive.of.primitives.shouldThrow):
(testRegExpSearch):
(testSearch):
(testBoth):
(alwaysUnmatch):

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/dom/string-prototype-properties-expected.txt:
* js/regress/script-tests/v8-regexp-search.js: Added.
(runRegExpBenchmark.runBlock0):
(runRegExpBenchmark.runBlock1):
(runRegExpBenchmark):
(runRegExpBenchmark.runBlock3):
(runRegExpBenchmark.runBlock4):
* js/regress/v8-regexp-search-expected.txt: Added.
* js/regress/v8-regexp-search.html: Added.
* js/script-tests/Object-getOwnPropertyNames.js:
* sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/dom/string-prototype-properties-expected.txt
LayoutTests/js/regress/script-tests/v8-regexp-search.js [new file with mode: 0644]
LayoutTests/js/regress/v8-regexp-search-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/v8-regexp-search.html [new file with mode: 0644]
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/builtins/BuiltinNames.h
Source/JavaScriptCore/builtins/BuiltinUtils.h
Source/JavaScriptCore/builtins/StringPrototype.js
Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/RegExpPrototype.cpp
Source/JavaScriptCore/runtime/RegExpPrototype.h
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/StringPrototype.h
Source/JavaScriptCore/tests/es6.yaml
Source/JavaScriptCore/tests/stress/regexp-search.js [new file with mode: 0644]