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

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

Issue 7778009: Adjust unit test to avoid flakyness when running with the ARM simulator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 NO: 2, 47 NO: 2,
48 ALWAYS: 3, 48 ALWAYS: 3,
49 NEVER: 4 49 NEVER: 4
50 }; 50 };
51 51
52 /** 52 /**
53 * Always call this at the beginning of your test, once for each function 53 * Always call this at the beginning of your test, once for each function
54 * that you later want to track de/optimizations for. It is necessary because 54 * that you later want to track de/optimizations for. It is necessary because
55 * tests are sometimes executed several times in a row, and you want to 55 * tests are sometimes executed several times in a row, and you want to
56 * disregard counts from previous runs. 56 * disregard counts from previous runs.
57 */ 57 */
58 OptTracker.prototype.CheckpointOptCount = function(func) { 58 OptTracker.prototype.CheckpointOptCount = function(func) {
59 this.opt_counts_[func] = %GetOptimizationCount(func); 59 this.opt_counts_[func] = %GetOptimizationCount(func);
60 }; 60 };
61 61
62 OptTracker.prototype.AssertOptCount = function(func, optcount) { 62 OptTracker.prototype.AssertOptCount = function(func, optcount) {
63 if (this.DisableAsserts_(func)) { 63 if (this.DisableAsserts_(func)) {
64 return; 64 return;
65 } 65 }
66 assertEquals(optcount, this.GetOptCount_(func)); 66 assertEquals(optcount, this.GetOptCount_(func));
67 }; 67 };
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 var tracker = new OptTracker(); 143 var tracker = new OptTracker();
144 tracker.CheckpointOptCount(f); 144 tracker.CheckpointOptCount(f);
145 145
146 tracker.AssertOptCount(f, 0); 146 tracker.AssertOptCount(f, 0);
147 tracker.AssertIsOptimized(f, false); 147 tracker.AssertIsOptimized(f, false);
148 tracker.AssertDeoptHappened(f, false); 148 tracker.AssertDeoptHappened(f, false);
149 tracker.AssertDeoptCount(f, 0); 149 tracker.AssertDeoptCount(f, 0);
150 150
151 for (var i = 0; i < 2; i++) f(1); 151 f(1);
152 152
153 tracker.AssertOptCount(f, 0); 153 tracker.AssertOptCount(f, 0);
154 tracker.AssertIsOptimized(f, false); 154 tracker.AssertIsOptimized(f, false);
155 tracker.AssertDeoptHappened(f, false); 155 tracker.AssertDeoptHappened(f, false);
156 tracker.AssertDeoptCount(f, 0); 156 tracker.AssertDeoptCount(f, 0);
157 157
158 %OptimizeFunctionOnNextCall(f); 158 %OptimizeFunctionOnNextCall(f);
159 f(1); 159 f(1);
160 160
161 tracker.AssertOptCount(f, 1); 161 tracker.AssertOptCount(f, 1);
(...skipping 10 matching lines...) Expand all
172 172
173 // Let's trigger optimization for another type. 173 // Let's trigger optimization for another type.
174 for (var i = 0; i < 5; i++) f("a"); 174 for (var i = 0; i < 5; i++) f("a");
175 %OptimizeFunctionOnNextCall(f); 175 %OptimizeFunctionOnNextCall(f);
176 f("b"); 176 f("b");
177 177
178 tracker.AssertOptCount(f, 2); 178 tracker.AssertOptCount(f, 2);
179 tracker.AssertIsOptimized(f, true); 179 tracker.AssertIsOptimized(f, true);
180 tracker.AssertDeoptHappened(f, true); 180 tracker.AssertDeoptHappened(f, true);
181 tracker.AssertDeoptCount(f, 1); 181 tracker.AssertDeoptCount(f, 1);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698