Bug 153046 - The StringFromCharCode DFG intrinsic should support untyped operands.
Summary: The StringFromCharCode DFG intrinsic should support untyped operands.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks: 153019
  Show dependency treegraph
 
Reported: 2016-01-12 16:04 PST by Mark Lam
Modified: 2016-01-13 15:30 PST (History)
6 users (show)

See Also:


Attachments
proposed patch. (11.51 KB, patch)
2016-01-12 16:21 PST, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff
x86_64 benchmark result. (66.04 KB, text/plain)
2016-01-13 10:09 PST, Mark Lam
no flags Details
x86 benchmark results. (65.79 KB, text/plain)
2016-01-13 10:10 PST, Mark Lam
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2016-01-12 16:04:58 PST
The current StringFromCharCode DFG intrinsic assumes that its operand charCode must be an Int32.  This results in 26000+ BadType OSR exits in the LongSpider crypto-aes benchmark.  With support for Untyped operands, the number of OSR exits drops to 202.
Comment 1 Mark Lam 2016-01-12 16:21:34 PST
Created attachment 268828 [details]
proposed patch.

The patch passes the JSC tests.  However, still need to run benchmarks on them.
Comment 2 Mark Lam 2016-01-13 10:09:48 PST
Created attachment 268872 [details]
x86_64 benchmark result.
Comment 3 Mark Lam 2016-01-13 10:10:25 PST
Created attachment 268873 [details]
x86 benchmark results.
Comment 4 Mark Lam 2016-01-13 10:28:26 PST
The benchmarks shows that perf is neutral with this patch.  All of the differences are due to noise (does not repeat on retry) except for one: ftl-polymorphic-StringFromCharCode which I just added for this patch:

   ftl-polymorphic-StringFromCharCode               246.9686+-17.4090    ^    207.8919+-11.0696       ^ definitely 1.1880x faster

This is only for 64 bit x86_64 though.  It does not manifest on x86 because there appears to be a bug on 32-bit where the StringFromCharCode intrinsic is not recognized and therefore not deployed: https://bugs.webkit.org/show_bug.cgi?id=153066.

This patch is ready for a review.
Comment 5 Geoffrey Garen 2016-01-13 14:43:12 PST
Comment on attachment 268828 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=268828&action=review

r=me

> Source/JavaScriptCore/dfg/DFGOperations.cpp:1316
> +EncodedJSValue JIT_OPERATION operationStringFromValueCharCode(ExecState* exec, EncodedJSValue encodedValue)

I would call this operationStringFromCharCodeUntyped.

If we have to do this in more cases, we should create an operationToUInt32 instead.
Comment 6 Mark Lam 2016-01-13 15:30:16 PST
Thanks for the review.  Landed in r194996: <http://trac.webkit.org/r194996>.