-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stack Arguments Optimization with presence of Formals.
Premise: Whenever there is a use of "arguments" object in a function, we are supposed to create a Heap arguments object on the stack - so that both the formals and arguments element access can access a common memory. The creation of this "heap arguments" object on the stack is currently optimized(not created) away in the jitted code, when there are no formals present in the function (but not in the presence of formals). This change enables "heap arguments" object to be optimized away during the presence of formals. This PR contains the following changes Dead Store of ArgIns (when the formals are not being used in the body of the function ) PropertyId Array is moved from the Bytecode's auxiliary data to the function body itself. ¿ Layout change of all opcode that currently explicitly uses Property Id Array as one of its source operand. ¿ Byte code cache has been regenerated for Intl and Promise. ¿ Refactoring of all code that reads property id array of formals from auxiliary data. LdPropId is no more accompanied with LdHeapArguments instruction. Removal of Heap arguments creation in the jitted code, when the function has formals. Removal of Scope object creation upon heap arguments optimization. During javascript stack walking, we no more use the existing heap arguments object on the frame. Instead we create a copy of the heap arguments object and give it to the .caller. This makes us not to worry about other functions changing the formals value, interrupting the stack arguments optimization. -TEST instr at the beginning of the LdElem Fast path is also removed. Field copy prop is disabled for arguments property (to avoid foo.arguments being field copy-proped) Functioning of Heap Arguments Optimization with Formals. We track several Instructions to facilitate this optimization in the forward and backward pass, along with the help from the front end. Parse: We disable this optimization, when there are any write to formals. We also disable this optimization, when we have any non-local references inside nested functions, deferred nested functions, and presence of any nested functions. ForwardPass: Track Scope object in LdHeapArgs (all versions of this opcode) Track Formals array in LdSlotArr Track Formals in LdSlot. Trace Stack Sym for formals in inlinee. Insert BailOnStackArgsOutOfActualsRange on LdElemI_A, when optimization is turned on. DeadStorePass: We are sure at this point, whether we will be doing the Stack arguments optimization for formals or not. Insert ArgIns for formals at the beginning of the function. Replace LdSlot with Ld_A with the tracked stack syms for formals. Dead store all scope object related instrs (we are sure that only formals use scope object). Remove BailOnStackArgsOutOfActualsRange, depending on whether the optimization is still turned on or not. Perf Impact: This change improves node.js - Specifically acme-benchmark(~16.3%) and tcpSlowPerf (~18.36%). Speedometer benchmark - gets an overall 12 % improvement (Specifically 30% in react test) This also has impact in real-world websites. IE Perf Lab: http://ieperf-web-01/perfresults/Comparison?testRunId=419859&baseRunId=419858&lab=IEPERF&getRelatedRunData=false&priorities=0,1&categories=failures,warnings,improvements,no-change&search= More than 95% websites show that they get benefited from this optimization [Trace was collected using web crawler]. Other benchmarks look flat.
- Loading branch information
1 parent
f0a9fa7
commit 91e0e91
Showing
73 changed files
with
11,995 additions
and
10,541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.