Closed Bug 571475 Opened 14 years ago Closed 6 years ago

Use of rest arguments, arguments object, and apply in builtin should be avoided

Categories

(Tamarin Graveyard :: Library, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
Q1 12 - Brannan

People

(Reporter: lhansen, Unassigned)

References

Details

(Whiteboard: PACMAN)

Now that we have rest arg optimization (see bug #569321) it is possible to avoid allocating the rest arguments array or the arguments object, and code should avoid capturing that object just to pass it to apply.  Instead, it is possible to create internal subroutines that take an appropriate maximum number of arguments, and then structure the front end function like this:

 function f(...rest) {
    switch (rest.length) {
        case 0: return _f(0, undefined, undefined, undefined);
        case 1: return _f(1, rest[0], undefined, undefined);
        ...
    }
  }

where _f is some internal function.  Sometimes the argument count can be omitted in favor of passing a cookie for unsupplied arguments.

There are many uses of 'apply' in the builtins and most are there because of the cliche that captures the rest argument and passes the arguments on.
Depends on: 477139
Depends on: 573456
Flags: flashplayer-bug-
Blocks: 645018
Flags: flashplayer-qrb+
Flags: flashplayer-injection-
Target Milestone: Q3 11 - Serrano → Q1 12 - Brannan
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.