[JSC] Implement trimStart and trimEnd
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jan 2018 12:06:24 +0000 (12:06 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jan 2018 12:06:24 +0000 (12:06 +0000)
commit8f5aa5f719378610a67e6da3742a3ecb870f3a0a
treeb3d1f2b41ecd25e9ba95c01088705cb4d688c0af
parenta1f7c995c7ae443c15c44a9b9859b74ff27c59a4
[JSC] Implement trimStart and trimEnd
https://bugs.webkit.org/show_bug.cgi?id=182233

Reviewed by Mark Lam.

JSTests:

* stress/trim.js: Added.
(shouldBe):
(startTest):
(endTest):
(trimTest):

Source/JavaScriptCore:

String.prototype.{trimStart,trimEnd} are now stage 3[1].
String.prototype.{trimLeft,trimRight} are alias to these functions.

We rename these functions to trimStart and trimEnd, and put them as
trimLeft and trimRight too.

[1]: https://tc39.github.io/proposal-string-left-right-trim/

* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::trimString):
(JSC::stringProtoFuncTrim):
(JSC::stringProtoFuncTrimStart):
(JSC::stringProtoFuncTrimEnd):
(JSC::stringProtoFuncTrimLeft): Deleted.
(JSC::stringProtoFuncTrimRight): Deleted.

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-getOwnPropertyNames.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/trim.js [new file with mode: 0644]
LayoutTests/ChangeLog
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/StringPrototype.cpp