BaselineCompiler: Add optimized stub for constructing natives using JSOP_NEW

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: djvj, Assigned: djvj)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Occurrences of "new Array(...)", "new Date(...)", "new Function(...)", etc. are handled by this.
(Assignee)

Updated

5 years ago
Assignee: general → kvijayan
(Assignee)

Comment 1

5 years ago
Created attachment 714246 [details] [diff] [review]
Add constructing call native.

Instead of creating a different stub code for the constructing case for natives, this patch uses the same stubcode for both operations.

There are at least 16 unused bits sitting in between the kind_ field and stubCode_ field on all IC stubs.  This change exposes those bits as a uint16_t "extra_" field open for stub-specific use.

The ICCall_Native stub is modified to use this field to store its isConstructing flag.
Attachment #714246 - Flags: review?(jdemooij)
Comment on attachment 714246 [details] [diff] [review]
Add constructing call native.

Review of attachment 714246 [details] [diff] [review]:
-----------------------------------------------------------------

Exposing the 16 bits for stub-specific use is a good idea. However for Call_Native it seems simpler to follow Call_Scripted and specialize the stub for constructing/non-constructing, then all you need is:

if (constructing)
    masm.storeValue(MagicValue(..), ..);

Avoids a load and branch and especially once we allocate these stubs in IonRuntime the extra stub code will be negligible.
Attachment #714246 - Flags: review?(jdemooij)
(Assignee)

Comment 3

5 years ago
Created attachment 714412 [details] [diff] [review]
Add constructing call to native, try 2.

Removed the extra_ field changes and moved them to bug 841765.

The new implementation creates a separate stubcode for constructing calls, as recommended by review.
Attachment #714246 - Attachment is obsolete: true
Attachment #714412 - Flags: review?(jdemooij)
Comment on attachment 714412 [details] [diff] [review]
Add constructing call to native, try 2.

Review of attachment 714412 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great!
Attachment #714412 - Flags: review?(jdemooij) → review+
(Assignee)

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.