Ignore:
Timestamp:
Feb 14, 2014, 3:29:31 PM (11 years ago)
Author:
[email protected]
Message:

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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp

    r163844 r164139  
    177177    const String& name = getCalculatedDisplayName(exec, function);
    178178    JSFunction* jsFunction = jsDynamicCast<JSFunction*>(function);
    179     if (jsFunction && !jsFunction->isHostFunction())
     179    if (jsFunction && !jsFunction->isHostOrBuiltinFunction())
    180180        return CallIdentifier(name.isEmpty() ? ASCIILiteral(AnonymousFunction) : name, jsFunction->jsExecutable()->sourceURL(), jsFunction->jsExecutable()->lineNo(), jsFunction->jsExecutable()->startColumn());
    181181    return CallIdentifier(name.isEmpty() ? ASCIILiteral(AnonymousFunction) : name, defaultSourceURL, defaultLineNumber, defaultColumnNumber);
Note: See TracChangeset for help on using the changeset viewer.