Comment #17 on issue 2741 by [email protected]: max_opt_count is
implemented using the wrong kind of limit
http://code.google.com/p/v8/issues/detail?id=2741
OK, amazingly I have a patch that actually works to prove my point.
Index: objects.cc
===================================================================
--- objects.cc (revision 15397)
+++ objects.cc (working copy)
@@ -9820,18 +9820,20 @@
void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
- code()->ClearInlineCaches();
- set_ic_age(new_ic_age);
- if (code()->kind() == Code::FUNCTION) {
- code()->set_profiler_ticks(0);
- if (optimization_disabled() &&
- opt_count() >= FLAG_max_opt_count) {
- // Re-enable optimizations if they were disabled due to opt_count
limit.
- set_optimization_disabled(false);
- code()->set_optimizable(true);
+ if (code()->ic_state() != PREMONOMORPHIC) {
+ code()->ClearInlineCaches();
+ set_ic_age(new_ic_age);
+ if (code()->kind() == Code::FUNCTION) {
+ code()->set_profiler_ticks(0);
+ if (optimization_disabled() &&
+ opt_count() >= FLAG_max_opt_count) {
+ // Re-enable optimizations if they were disabled due to opt_count
limit.
+ set_optimization_disabled(false);
+ code()->set_optimizable(true);
+ }
+ set_opt_count(0);
+ set_deopt_count(0);
}
- set_opt_count(0);
- set_deopt_count(0);
}
}
Its basically a 1-liner but indentation and that closing brace make it seem
larger than it is. But it does what I was intending and preventing useless
clearing of unchanging caches etc, albeit not exactly as I'd prefer since
the function calling this one should be testing for the ic_state() instead
of inside this call which becomes redundant if the state is PREMONOMORPHIC.
As my testing suggests it basically makes the --max_opt_count flag from
being abused while not letting an un-optimizable stub be constantly
re-compiled without need. Also I don't see regressions of speed on my end
and most things stay the same or increase, pdf.js and CodeLoad increase in
their benchmark score.
And in chrome://tracing Octane and many benchmarks show less time in the
compiler, less scheduled compilation time, and less time in the GC.
Hopefully this patch makes someones day :)
Attachments:
Issue-2741-objects.cc.patch 1.2 KB
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.