Ignore:
Timestamp:
Aug 16, 2013, 10:50:48 PM (12 years ago)
Author:
[email protected]
Message:

DFG should optimize typedArray.byteLength
https://bugs.webkit.org/show_bug.cgi?id=119909

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

This adds typedArray.byteLength inlining to the DFG, and does so without changing
the IR: byteLength is turned into GetArrayLength followed by BitLShift. This is
legal since the byteLength of a typed array cannot exceed
numeric_limits<int32_t>::max().

  • bytecode/SpeculatedType.cpp:

(JSC::typedArrayTypeFromSpeculation):

  • bytecode/SpeculatedType.h:
  • dfg/DFGArrayMode.cpp:

(JSC::DFG::toArrayType):

  • dfg/DFGArrayMode.h:
  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::attemptToMakeGetArrayLength):
(JSC::DFG::FixupPhase::attemptToMakeGetByteLength):
(JSC::DFG::FixupPhase::convertToGetArrayLength):
(JSC::DFG::FixupPhase::prependGetArrayLength):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::constantRegisterForConstant):
(JSC::DFG::Graph::convertToConstant):

  • runtime/TypedArrayType.h:

(JSC::logElementSize):
(JSC::elementSize):

LayoutTests:

Reviewed by Oliver Hunt.

Convert two of the tyepd array tests to use byteLength instead of length.
These tests show speed-ups around 2.5x-5x.

  • fast/js/regress/Int16Array-bubble-sort-with-byteLength-expected.txt: Added.
  • fast/js/regress/Int16Array-bubble-sort-with-byteLength.html: Added.
  • fast/js/regress/Int8Array-load-with-byteLength-expected.txt: Added.
  • fast/js/regress/Int8Array-load-with-byteLength.html: Added.
  • fast/js/regress/script-tests/Int16Array-bubble-sort-with-byteLength.js: Added.

(bubbleSort):
(myRandom):
(validateSort):

  • fast/js/regress/script-tests/Int8Array-load-with-byteLength.js: Added.

(adler32):

File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.