You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems in addition to the precautions mentioned here there is another one:
Never use a direct function call with arguments[i] (i.e. arguments[i]()); use an intermediate variable instead (i.e. const arg = arguments[i]; arg();).
This case is valid even for a function call in a dead code, without an actual function call in the runtime.
Code to confirm the precaution:
'use strict';functionmainFuncGood(){constarg0=arguments[0];if(0===1)arg0();}functionmainFuncBad(){if(0===1)arguments[0]();// must be op, simple `if (false)` will not do for bailout}functionparamFunc(){}for(leti=0;i<1e3;i++)mainFuncGood(paramFunc);for(leti=0;i<1e3;i++)mainFuncBad(paramFunc);
node --trace_opt --trace_deopt test.js
[marking 000002685E5E0B51 <JS Function mainFuncGood (SharedFunctionInfo 000003ED2AE67B21)> for optimized recompilation, reason: small function, ICs with typeinfo: 2/3 (66%), generic ICs: 0/3 (0%)]
[compiling method 000002685E5E0B51 <JS Function mainFuncGood (SharedFunctionInfo 000003ED2AE67B21)> using Crankshaft]
[optimizing 000002685E5E0B51 <JS Function mainFuncGood (SharedFunctionInfo 000003ED2AE67B21)> - took 0.147, 0.121, 0.053 ms]
[completed optimizing 000002685E5E0B51 <JS Function mainFuncGood (SharedFunctionInfo 000003ED2AE67B21)>]
[marking 000002685E5E0B99 <JS Function mainFuncBad (SharedFunctionInfo 000003ED2AE67BE1)> for optimized recompilation, reason: small function, ICs with typeinfo: 1/3 (33%), generic ICs: 0/3 (0%)]
[compiling method 000002685E5E0B99 <JS Function mainFuncBad (SharedFunctionInfo 000003ED2AE67BE1)> using Crankshaft]
[disabled optimization for 000003ED2AE67BE1 <SharedFunctionInfo mainFuncBad>, reason: Bad value context for arguments value]
The text was updated successfully, but these errors were encountered:
I've tried to reduce the case reported in this comment.
It seems in addition to the precautions mentioned here there is another one:
arguments[i]
(i.e.arguments[i]()
); use an intermediate variable instead (i.e.const arg = arguments[i]; arg();
).This case is valid even for a function call in a dead code, without an actual function call in the runtime.
Code to confirm the precaution:
The text was updated successfully, but these errors were encountered: