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()):
(JSC::FunctionBodyNode::overrideName):
- profiler/LegacyProfiler.cpp:
(JSC::createCallIdentifierFromFunctionImp):
- runtime/ArrayPrototype.cpp:
- runtime/JSFunction.cpp:
(JSC::JSFunction::deleteProperty):
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):