"Not optimized: Bad value context for arguments value"
October 17, 2015 ยท View on GitHub
Adding a property to one function, but not all functions, causes Not optimized flag on function containing Function.prototype.apply.
Cause
"V8 only recognizes monomorphic .apply call-sites" - @mraleph
Example
See example.js
Fixes
- Don't attach properties to functions
- Copy arguments to an array. See https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358
- Provide a monomorphic .apply call-site (see
fix.js)
Test in node
node --trace_opt --trace_deopt example.js | grep "failed to optimize dispatch"
Test in browser
jspm install
http-server # open http://localhost:8080/