Implement a few more Array prototype functions in JS
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 23:29:31 +0000 (23:29 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 23:29:31 +0000 (23:29 +0000)
commite7cf929f947dd3bfd6076595992c863be14c54b6
tree146ef4bb285065d81170a83c5353bf7babc2495e
parentf404bba9d45f2a2f9cba9690a40df649c1dd5a2b
Implement a few more Array prototype functions in JS
https://bugs.webkit.org/show_bug.cgi?id=128788

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

Remove a pile of awful C++, and rewrite in simple JS.

Needed to make a few other changes to get fully builtins
behavior to more accurately match a host function's.

* builtins/Array.prototype.js:
(every):
(forEach):
(filter):
(map):
(some):
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::BuiltinExecutables):
(JSC::BuiltinExecutables::createBuiltinExecutable):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitPutByVal):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitExpressionInfo):
* interpreter/Interpreter.cpp:
(JSC::GetStackTraceFunctor::operator()):
* parser/Nodes.h:
(JSC::FunctionBodyNode::overrideName):
* profiler/LegacyProfiler.cpp:
(JSC::createCallIdentifierFromFunctionImp):
* runtime/ArrayPrototype.cpp:
* runtime/JSFunction.cpp:
(JSC::JSFunction::deleteProperty):
* runtime/JSFunction.h:

Source/WebCore:

Minor change to ensure that the inspector is treating builtins
as host functions.

Tests: js/regress/array-prototype-filter.html
       js/regress/array-prototype-forEach.html
       js/regress/array-prototype-map.html
       js/regress/array-prototype-some.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForEventListener):
  Make sure we treat builtins as regular host functions

LayoutTests:

Add performance tests, and update a couple of profiler tests as
we unavoidably show the call out to some of the builtin methods.

* fast/profiler/built-in-function-calls-anonymous-expected.txt:
* fast/profiler/built-in-function-calls-user-defined-function-expected.txt:
* js/dom/array-foreach-expected.txt:
* js/dom/array-prototype-properties-expected.txt:
* js/dom/array-some-expected.txt:
* js/regress/array-prototype-filter-expected.txt: Added.
* js/regress/array-prototype-filter.html: Added.
* js/regress/array-prototype-forEach-expected.txt: Added.
* js/regress/array-prototype-forEach.html: Added.
* js/regress/array-prototype-map-expected.txt: Added.
* js/regress/array-prototype-map.html: Added.
* js/regress/array-prototype-some-expected.txt: Added.
* js/regress/array-prototype-some.html: Added.
* js/regress/script-tests/array-prototype-filter.js: Added.
(test1):
(test2):
(test3):
* js/regress/script-tests/array-prototype-forEach.js: Added.
(test1):
(test2):
(test3):
* js/regress/script-tests/array-prototype-map.js: Added.
(test1):
(test2):
(test3):
* js/regress/script-tests/array-prototype-some.js: Added.
(test1):
(test2):
(test3):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164139 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 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/inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt
LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all.html
LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt
LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught.html
LayoutTests/js/dom/array-foreach-expected.txt
LayoutTests/js/dom/array-prototype-properties-expected.txt
LayoutTests/js/dom/array-some-expected.txt
LayoutTests/js/regress/array-prototype-filter-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-filter.html [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-forEach-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-forEach.html [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-map-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-map.html [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-some-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/array-prototype-some.html [new file with mode: 0644]
LayoutTests/js/regress/script-tests/array-prototype-filter.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/array-prototype-forEach.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/array-prototype-map.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/array-prototype-some.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/Array.prototype.js
Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/parser/Nodes.h
Source/JavaScriptCore/profiler/LegacyProfiler.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/JSFunction.cpp
Source/JavaScriptCore/runtime/JSFunction.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp