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

Side by Side Diff: test/cctest/compiler/test-run-jsbranches.cc

Issue 661923002: Implement graph trimming in ControlReducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use Deque. Created 6 years, 2 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 | « test/cctest/compiler/test-control-reducer.cc ('k') | test/mjsunit/asm/do-while-false.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 275
276 TEST(NestedForConditional) { 276 TEST(NestedForConditional) {
277 FunctionTester T("(function(a,b) { for (; a > 1; a--) return b ? 1 : 2; })"); 277 FunctionTester T("(function(a,b) { for (; a > 1; a--) return b ? 1 : 2; })");
278 278
279 T.CheckCall(T.Val(1), T.Val(3), T.true_value()); 279 T.CheckCall(T.Val(1), T.Val(3), T.true_value());
280 T.CheckCall(T.Val(2), T.Val(2), T.false_value()); 280 T.CheckCall(T.Val(2), T.Val(2), T.false_value());
281 T.CheckCall(T.undefined(), T.Val(1), T.null()); 281 T.CheckCall(T.undefined(), T.Val(1), T.null());
282 } 282 }
283
284
285 TEST(IfTrue) {
286 FunctionTester T("(function(a,b) { if (true) return a; return b; })");
287
288 T.CheckCall(T.Val(55), T.Val(55), T.Val(11));
289 T.CheckCall(T.Val(666), T.Val(666), T.Val(-444));
290 }
291
292
293 TEST(TernaryTrue) {
294 FunctionTester T("(function(a,b) { return true ? a : b; })");
295
296 T.CheckCall(T.Val(77), T.Val(77), T.Val(11));
297 T.CheckCall(T.Val(111), T.Val(111), T.Val(-444));
298 }
299
300
301 TEST(IfFalse) {
302 FunctionTester T("(function(a,b) { if (false) return a; return b; })");
303
304 T.CheckCall(T.Val(11), T.Val(22), T.Val(11));
305 T.CheckCall(T.Val(-555), T.Val(333), T.Val(-555));
306 }
307
308
309 TEST(TernaryFalse) {
310 FunctionTester T("(function(a,b) { return false ? a : b; })");
311
312 T.CheckCall(T.Val(99), T.Val(33), T.Val(99));
313 T.CheckCall(T.Val(-99), T.Val(-33), T.Val(-99));
314 }
315
316
317 TEST(WhileTrue) {
318 FunctionTester T("(function(a,b) { while (true) return a; return b; })");
319
320 T.CheckCall(T.Val(551), T.Val(551), T.Val(111));
321 T.CheckCall(T.Val(661), T.Val(661), T.Val(-444));
322 }
323
324
325 TEST(WhileFalse) {
326 FunctionTester T("(function(a,b) { while (false) return a; return b; })");
327
328 T.CheckCall(T.Val(115), T.Val(551), T.Val(115));
329 T.CheckCall(T.Val(-445), T.Val(661), T.Val(-445));
330 }
331
332
333 TEST(DoWhileTrue) {
334 FunctionTester T(
335 "(function(a,b) { do { return a; } while (true); return b; })");
336
337 T.CheckCall(T.Val(7551), T.Val(7551), T.Val(7111));
338 T.CheckCall(T.Val(7661), T.Val(7661), T.Val(-7444));
339 }
340
341
342 TEST(DoWhileFalse) {
343 FunctionTester T(
344 "(function(a,b) { do { "
345 "; } while (false); return b; })");
346
347 T.CheckCall(T.Val(8115), T.Val(8551), T.Val(8115));
348 T.CheckCall(T.Val(-8445), T.Val(8661), T.Val(-8445));
349 }
350
351
352 TEST(EmptyFor) {
353 FunctionTester T("(function(a,b) { if (a) for(;;) ; return b; })");
354
355 T.CheckCall(T.Val(8126.1), T.Val(0.0), T.Val(8126.1));
356 T.CheckCall(T.Val(1123.1), T.Val(0.0), T.Val(1123.1));
357 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-control-reducer.cc ('k') | test/mjsunit/asm/do-while-false.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698