Bug 193764 - Template Literal GC'ed Against Specs
Summary: Template Literal GC'ed Against Specs
Status: RESOLVED DUPLICATE of bug 190756
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2019-01-24 01:29 PST by Andrea Giammarchi
Modified: 2019-02-04 14:42 PST (History)
3 users (show)

See Also:

the alert shown on Safari Technology Preview (446.81 KB, image/png)
2019-01-24 01:29 PST, Andrea Giammarchi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Giammarchi 2019-01-24 01:29:36 PST
Created attachment 360000 [details]
the alert shown on Safari Technology Preview

Accordingly with Note 2 of ECMAScript Language Specification:

Each TemplateLiteral in the program code of a realm is associated with a unique template object that is used in the evaluation of tagged Templates (
The template objects are frozen and the same template object is used each time a specific tagged Template is evaluated.
Whether template objects are created lazily upon first evaluation of the TemplateLiteral or eagerly prior to first evaluation is an implementation choice that is not observable to ECMAScript code.

However, as you can easily test on this code pen https://codepen.io/WebReflection/pen/OdVrqN?editors=0010 , you will see an alert, at some point, demonstrating that the template literal has been collected and recreated, hence it's both not unique and also observable in terms of GC operation.

This happens in both latest Safari on macOS Mojave, and Safari Technology Preview, and it makes code relying on uniqueness of template literals incapable of performing well in Safari ('cause templates needs to be transformed per their value instead of their unique reference).

Please provide an ETA so I can also evaluate if I should penalize safari performance in various libraries based on that part of the specifications.
Comment 1 Ryosuke Niwa 2019-02-04 14:42:35 PST

*** This bug has been marked as a duplicate of bug 190756 ***