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

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

Issue 2655223003: Revert of [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « test/mjsunit/array-store-and-grow.js ('k') | test/mjsunit/compiler/concurrent-invalidate-transition-map.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/assert-opt-and-deopt.js
diff --git a/test/mjsunit/assert-opt-and-deopt.js b/test/mjsunit/assert-opt-and-deopt.js
index c4f15cec0805b42c72085f3a0ff17455b290ce6b..19502f3354c5c5a2c85b1ca8cb93d64561693b31 100644
--- a/test/mjsunit/assert-opt-and-deopt.js
+++ b/test/mjsunit/assert-opt-and-deopt.js
@@ -44,6 +44,18 @@
}
/**
+ * The possible optimization states of a function. Must be in sync with the
+ * return values of Runtime_GetOptimizationStatus() in runtime.cc!
+ * @enum {int}
+ */
+OptTracker.OptimizationState = {
+ YES: 1,
+ NO: 2,
+ ALWAYS: 3,
+ NEVER: 4
+};
+
+/**
* Always call this at the beginning of your test, once for each function
* that you later want to track de/optimizations for. It is necessary because
* tests are sometimes executed several times in a row, and you want to
@@ -82,10 +94,12 @@
if (this.DisableAsserts_(func)) {
return;
}
- var opt_status = %GetOptimizationStatus(func);
- assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0);
- assertEquals(expect_optimized,
- (opt_status & V8OptimizationStatus.kOptimized) !== 0);
+ var raw_optimized = %GetOptimizationStatus(func);
+ if (expect_optimized) {
+ assertEquals(OptTracker.OptimizationState.YES, raw_optimized);
+ } else {
+ assertEquals(OptTracker.OptimizationState.NO, raw_optimized);
+ }
}
/**
@@ -105,8 +119,7 @@
*/
OptTracker.prototype.GetDeoptCount_ = function(func) {
var count = this.GetOptCount_(func);
- var opt_status = %GetOptimizationStatus(func);
- if ((opt_status & V8OptimizationStatus.kOptimized) !== 0) {
+ if (%GetOptimizationStatus(func) == OptTracker.OptimizationState.YES) {
count -= 1;
}
return count;
@@ -116,9 +129,15 @@
* @private
*/
OptTracker.prototype.DisableAsserts_ = function(func) {
- var opt_status = %GetOptimizationStatus(func);
- return (opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0 ||
- (opt_status & V8OptimizationStatus.kNeverOptimize) !== 0;
+ switch(%GetOptimizationStatus(func)) {
+ case OptTracker.OptimizationState.YES:
+ case OptTracker.OptimizationState.NO:
+ return false;
+ case OptTracker.OptimizationState.ALWAYS:
+ case OptTracker.OptimizationState.NEVER:
+ return true;
+ }
+ return true;
}
// (End of class OptTracker.)
« no previous file with comments | « test/mjsunit/array-store-and-grow.js ('k') | test/mjsunit/compiler/concurrent-invalidate-transition-map.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698