Array.prototype methods must use ToLength
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2015 19:51:46 +0000 (19:51 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2015 19:51:46 +0000 (19:51 +0000)
commitb303d25500fcb89a66b342d7cefc92a7ed8825b7
tree0e9dc51d0f75b1043ea4848ada1e61b24f0bd8c8
parent02e6069c07a0da9e05e0a0a8f082f9c6ddd18cba
Array.prototype methods must use ToLength
https://bugs.webkit.org/show_bug.cgi?id=144128

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength

This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining.
These implementations are located in GlobalObject.js.
And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually.

* builtins/Array.prototype.js:
(every):
(forEach):
(filter):
(map):
(some):
(fill):
(find):
(findIndex):
(includes):
* builtins/ArrayConstructor.js:
(from):
* builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js.
(ToInteger):
(ToLength):
* builtins/StringConstructor.js:
(raw):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObjectFunctions.h:

LayoutTests:

* fast/profiler/built-in-function-calls-anonymous-expected.txt:
* fast/profiler/built-in-function-calls-user-defined-function-expected.txt:
* js/array-every-expected.txt:
* js/array-fill-expected.txt:
* js/array-filter-expected.txt:
* js/array-find-expected.txt:
* js/array-findIndex-expected.txt:
* js/array-functions-non-arrays-expected.txt:
* js/array-includes-expected.txt:
* js/script-tests/array-every.js:
(throwError):
* js/script-tests/array-fill.js:
(throwError):
* js/script-tests/array-filter.js:
(throwError):
* js/script-tests/array-find.js:
(throwError):
* js/script-tests/array-findIndex.js:
(toObject):
(throwError):
* js/script-tests/array-functions-non-arrays.js:
(throwError):
* js/script-tests/array-includes.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt
LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt
LayoutTests/js/array-every-expected.txt
LayoutTests/js/array-fill-expected.txt
LayoutTests/js/array-filter-expected.txt
LayoutTests/js/array-find-expected.txt
LayoutTests/js/array-findIndex-expected.txt
LayoutTests/js/array-functions-non-arrays-expected.txt
LayoutTests/js/array-includes-expected.txt
LayoutTests/js/script-tests/array-every.js
LayoutTests/js/script-tests/array-fill.js
LayoutTests/js/script-tests/array-filter.js
LayoutTests/js/script-tests/array-find.js
LayoutTests/js/script-tests/array-findIndex.js
LayoutTests/js/script-tests/array-functions-non-arrays.js
LayoutTests/js/script-tests/array-includes.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/Array.prototype.js
Source/JavaScriptCore/builtins/ArrayConstructor.js
Source/JavaScriptCore/builtins/GlobalObject.js [new file with mode: 0644]
Source/JavaScriptCore/builtins/StringConstructor.js
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h