Closed Bug 933277 Opened 11 years ago Closed 3 years ago

Optimize creation of new typed objects, particularly non-scalars

Categories

(Core :: JavaScript Engine: JIT, defect, P5)

x86
Linux
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: nmatsakis, Assigned: nmatsakis)

References

Details

We do not currently optimize code like:

    var PointType = new StructType({x: uint8, y: uint8});
    new PointType({x: 22, y: 44})

I plan to optimize this over the course of a couple of bugs. This particular bug is for performing the first step of the optimization, which is to detect constructs like "new TypeObject(expr)" and have IonBuilder produce MIR which perform two distinct steps (allocate, initialize):

       var N = NewTypedObject(TypeObject);
       ConvertAndCopy(N, expr, TypeObject); // self-hosted function found in TypedObject.js

This by itself is only a very slight optimization. It avoids the trip into C++ code and instead allocates the object inline. Implementing this is mildly non-trivial because we must obtain a template object. Since TypeObject is a native this requires modifying the baseline compiler (at least it looks that way now; I may try a different approach).
Assignee: nobody → nmatsakis
Blocks: 933293
Depends on: 933760
Assuming p5 because this is typed objects. (Niko, still working on this?)
Priority: -- → P5

No longer valid, typed object can't be created from JavaScript code anymore.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.