Ignore:
Timestamp:
May 19, 2015, 12:51:46 PM (10 years ago)
Author:
Yusuke Suzuki
Message:

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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h

    r184575 r184582  
    5454EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState*);
    5555
    56 // These global functions are only exposed to built-ins with private names e.g. @abs
    57 EncodedJSValue JSC_HOST_CALL globalPrivateFuncAbs(ExecState*);
    58 EncodedJSValue JSC_HOST_CALL globalPrivateFuncFloor(ExecState*);
    59 
    6056static const double mantissaOverflowLowerBound = 9007199254740992.0;
    6157double parseIntOverflow(const LChar*, unsigned length, int radix);
Note: See TracChangeset for help on using the changeset viewer.