Unexpected "Out of memory" error for "x".repeat(-1)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jul 2016 03:13:11 +0000 (03:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jul 2016 03:13:11 +0000 (03:13 +0000)
commita3607c62e01f790fd32fe22996da3626e8d5716c
treec11cae08e06fb0b565f01f9a68b37c665c3adccb
parent51f6dd18b19789975122445a68dedb3ba233b3d6
Unexpected "Out of memory" error for "x".repeat(-1)
https://bugs.webkit.org/show_bug.cgi?id=159529

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-07-07
Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

* builtins/StringPrototype.js:
(globalPrivate.repeatSlowPath):
(repeat):
Move the @toInteger and range checking to the always path,
since the spec does say it should always happen. Also remove
the duplication of the fast path here.

* runtime/StringPrototype.cpp:
(JSC::repeatCharacter):
Remove unused function.

(JSC::stringProtoFuncRepeatCharacter):
ASSERT if given a negative number. This is a private function
only used internally.

* tests/stress/string-repeat-edge-cases.js:
(shouldThrow):
Update expected error message.

LayoutTests:

Extended test coverage for:

  - function properties
  - fast path with invalid counts
  - observable side effects for fast path which were wrong before

* js/script-tests/string-repeat.js:
* js/string-repeat-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/script-tests/string-repeat.js
LayoutTests/js/string-repeat-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/StringPrototype.js
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/tests/stress/string-repeat-edge-cases.js