Closed Bug 1687229 Opened 4 years ago Closed 4 years ago

Optimise Object.prototype.toString in CacheIR and Warp

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(4 files)

No description provided.

Bug 1277801 missed to remove the class-name fallback from ObjectClassToString().

With the class-name fallback removed, ObjectClassToString() no longer allocates,
so we can also change it to an ABI call.

With the class-name fallback removed, we can also change GetBuiltinTag{Fast,Slow}
to directly return "[object Object]".

Depends on D102132

As a further simplification, GetBuiltinTagSlow() can additionally be changed
to return a JSString* instead of using an out-param.

Depends on D102133

Changes js::ObjectClassToString() to return nullptr to mean that the object
has a @@toStringTag property or is a proxy.

MObjectClassToString had to be changed as follows:

  • Needs to be marked as a "guard" instruction, so we don't incorrectly optimise
    it away when we should instead bail out, e.g. when the object is a proxy.
  • The alias-set has to record that js::ObjectClassToString() performs a lookup
    for @@toStringTag.
  • Additionally added an override for possiblyCalls() to notify LICM that this
    instruction always performs a call.

Depends on D102134

Pushed by abutkovits@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/62dffeb550fc Part 1: Remove class-name fallback from ObjectClassToString and change it to an ABI call. r=jandem https://hg.mozilla.org/integration/autoland/rev/b7e31120abe3 Part 2: Directly return '[object Object]' in GetBuiltinTag{Fast,Slow}. r=jandem https://hg.mozilla.org/integration/autoland/rev/74a016fe3ce6 Part 3: Return a string from GetBuiltinTagSlow. r=jandem https://hg.mozilla.org/integration/autoland/rev/2ab1ab05fa2a Part 4: Optimise Object.prototype.toString in CacheIR and Warp. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: