Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: test/mjsunit/assert-opt-and-deopt.js

Issue 9207002: Add a deoptimization count to each function to limit number of re-compilations. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/x64/deoptimizer-x64.cc ('K') | « src/x64/deoptimizer-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/assert-opt-and-deopt.js
===================================================================
--- test/mjsunit/assert-opt-and-deopt.js (revision 10399)
+++ test/mjsunit/assert-opt-and-deopt.js (working copy)
@@ -34,7 +34,7 @@
* the --allow-natives-syntax flag so far.
*/
function OptTracker() {
- this.opt_counts_ = {};
+ this.deopt_counts_ = {};
}
/**
@@ -55,8 +55,8 @@
* tests are sometimes executed several times in a row, and you want to
* disregard counts from previous runs.
*/
-OptTracker.prototype.CheckpointOptCount = function(func) {
- this.opt_counts_[func] = %GetOptimizationCount(func);
+OptTracker.prototype.CheckpointDeoptCount = function(func) {
+ this.deopt_counts_[func] = %GetDeoptimizationCount(func);
};
OptTracker.prototype.AssertOptCount = function(func, optcount) {
@@ -100,23 +100,24 @@
* @private
*/
OptTracker.prototype.GetOptCount_ = function(func) {
- var raw_count = %GetOptimizationCount(func);
- if (func in this.opt_counts_) {
- var checkpointed_count = this.opt_counts_[func];
- return raw_count - checkpointed_count;
+ var count = this.GetDeoptCount_(func);
+ if (%GetOptimizationStatus(func) == OptTracker.OptimizationState.YES) {
+ count += 1;
}
- return raw_count;
+ return count;
}
+
/**
* @private
*/
OptTracker.prototype.GetDeoptCount_ = function(func) {
- var count = this.GetOptCount_(func);
- if (%GetOptimizationStatus(func) == OptTracker.OptimizationState.YES) {
- count -= 1;
+ var raw_count = %GetDeoptimizationCount(func);
+ if (func in this.deopt_counts_) {
+ var checkpointed_count = this.deopt_counts_[func];
+ return raw_count - checkpointed_count;
}
- return count;
+ return raw_count;
}
/**
@@ -141,7 +142,7 @@
}
var tracker = new OptTracker();
-tracker.CheckpointOptCount(f);
+tracker.CheckpointDeoptCount(f);
tracker.AssertOptCount(f, 0);
tracker.AssertIsOptimized(f, false);
« src/x64/deoptimizer-x64.cc ('K') | « src/x64/deoptimizer-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698