Fix minor ES6 compliance issue in RegExp.prototype.toString and optimize performance...
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2015 01:35:08 +0000 (01:35 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2015 01:35:08 +0000 (01:35 +0000)
commitb6a35f52ef041227b3e6dcdc0f75471f6bf143a2
tree59fd693d73f96dab327140a7d942fa0f654a7148
parentea149c7ab5011d62d45094a4be05e9c7c1faf73d
Fix minor ES6 compliance issue in RegExp.prototype.toString and optimize performance a little
https://bugs.webkit.org/show_bug.cgi?id=145935

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

Test: js/regexp-toString.html

* runtime/RegExpPrototype.cpp:
(JSC::getFlags): Avoid memory allocation for the flags string by returning it in a character
buffer instead of constructing a WTF::String for it.
(JSC::regExpProtoFuncToString): Require only that the this value be an object; don't require
that it is actually a regular expression object. This is covered in the ES6 specification.
Also removed comment about the "/(?:)/" trick since that is now the repsonsibility of the
getter for the "source" property. Updated to use getFlags so we do one less memory allocation.
(JSC::regExpProtoGetterFlags): Chagned to use getFlags instead of the old flagsString.

LayoutTests:

* js/regexp-toString-expected.txt: Added.
* js/regexp-toString.html: Added.
* js/script-tests/regexp-toString.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/regexp-toString-expected.txt [new file with mode: 0644]
LayoutTests/js/regexp-toString.html [new file with mode: 0644]
LayoutTests/js/script-tests/regexp-toString.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/RegExpPrototype.cpp