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

Side by Side Diff: test/cctest/test-deoptimization.cc

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Set optimize_in_parallel to false by default. Created 8 years, 7 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
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-heap.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 "X.prototype.toString = function () {" 354 "X.prototype.toString = function () {"
355 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'an X'" 355 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'an X'"
356 "};"); 356 "};");
357 CompileRun(f_source); 357 CompileRun(f_source);
358 CompileRun("for (var i = 0; i < 5; i++) {" 358 CompileRun("for (var i = 0; i < 5; i++) {"
359 " f('a+', new X());" 359 " f('a+', new X());"
360 "};"); 360 "};");
361 361
362 // Compile an optimized version of f. 362 // Compile an optimized version of f.
363 i::FLAG_always_opt = true; 363 i::FLAG_always_opt = true;
364 i::FLAG_optimize_in_parallel = false;
364 CompileRun(f_source); 365 CompileRun(f_source);
365 CompileRun("f('a+', new X());"); 366 CompileRun("f('a+', new X());");
366 CHECK(!i::V8::UseCrankshaft() || 367 CHECK(!i::V8::UseCrankshaft() ||
367 GetJSFunction(env->Global(), "f")->IsOptimized()); 368 GetJSFunction(env->Global(), "f")->IsOptimized());
368 369
369 // Call f and force deoptimization while processing the binary operation. 370 // Call f and force deoptimization while processing the binary operation.
370 CompileRun("deopt = true;" 371 CompileRun("deopt = true;"
371 "var result = f('a+', new X());"); 372 "var result = f('a+', new X());");
372 } 373 }
373 NonIncrementalGC(); 374 NonIncrementalGC();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // call in the optimized code. 407 // call in the optimized code.
407 i::FLAG_prepare_always_opt = true; 408 i::FLAG_prepare_always_opt = true;
408 CompileConstructorWithDeoptimizingValueOf(); 409 CompileConstructorWithDeoptimizingValueOf();
409 CompileRun(f_source); 410 CompileRun(f_source);
410 CompileRun("for (var i = 0; i < 5; i++) {" 411 CompileRun("for (var i = 0; i < 5; i++) {"
411 " f(8, new X());" 412 " f(8, new X());"
412 "};"); 413 "};");
413 414
414 // Compile an optimized version of f. 415 // Compile an optimized version of f.
415 i::FLAG_always_opt = true; 416 i::FLAG_always_opt = true;
417 // Be deterministic.
418 i::FLAG_optimize_in_parallel = false;
416 CompileRun(f_source); 419 CompileRun(f_source);
417 CompileRun("f(7, new X());"); 420 CompileRun("f(7, new X());");
418 CHECK(!i::V8::UseCrankshaft() || 421 CHECK(!i::V8::UseCrankshaft() ||
419 GetJSFunction((*env)->Global(), "f")->IsOptimized()); 422 GetJSFunction((*env)->Global(), "f")->IsOptimized());
420 423
421 // Call f and force deoptimization while processing the binary operation. 424 // Call f and force deoptimization while processing the binary operation.
422 CompileRun("deopt = true;" 425 CompileRun("deopt = true;"
423 "var result = f(7, new X());"); 426 "var result = f(7, new X());");
424 NonIncrementalGC(); 427 NonIncrementalGC();
425 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); 428 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 "X.prototype.toString = function () {" 507 "X.prototype.toString = function () {"
505 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'b'" 508 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'b'"
506 "};"); 509 "};");
507 CompileRun(f_source); 510 CompileRun(f_source);
508 CompileRun("for (var i = 0; i < 5; i++) {" 511 CompileRun("for (var i = 0; i < 5; i++) {"
509 " f('a', new X());" 512 " f('a', new X());"
510 "};"); 513 "};");
511 514
512 // Compile an optimized version of f. 515 // Compile an optimized version of f.
513 i::FLAG_always_opt = true; 516 i::FLAG_always_opt = true;
517 // Be deterministic.
518 i::FLAG_optimize_in_parallel = false;
519
514 CompileRun(f_source); 520 CompileRun(f_source);
515 CompileRun("f('a', new X());"); 521 CompileRun("f('a', new X());");
516 CHECK(!i::V8::UseCrankshaft() || 522 CHECK(!i::V8::UseCrankshaft() ||
517 GetJSFunction(env->Global(), "f")->IsOptimized()); 523 GetJSFunction(env->Global(), "f")->IsOptimized());
518 524
519 // Call f and force deoptimization while processing the comparison. 525 // Call f and force deoptimization while processing the comparison.
520 CompileRun("deopt = true;" 526 CompileRun("deopt = true;"
521 "var result = f('a', new X());"); 527 "var result = f('a', new X());");
522 } 528 }
523 NonIncrementalGC(); 529 NonIncrementalGC();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 CompileRun(g2_source); 574 CompileRun(g2_source);
569 CompileRun("for (var i = 0; i < 5; i++) {" 575 CompileRun("for (var i = 0; i < 5; i++) {"
570 " f1(new X());" 576 " f1(new X());"
571 " g1(new X());" 577 " g1(new X());"
572 " f2(new X(), 'z');" 578 " f2(new X(), 'z');"
573 " g2(new X(), 'z');" 579 " g2(new X(), 'z');"
574 "};"); 580 "};");
575 581
576 // Compile an optimized version of the functions. 582 // Compile an optimized version of the functions.
577 i::FLAG_always_opt = true; 583 i::FLAG_always_opt = true;
584 // Be deterministic.
585 i::FLAG_optimize_in_parallel = false;
578 CompileRun(f1_source); 586 CompileRun(f1_source);
579 CompileRun(g1_source); 587 CompileRun(g1_source);
580 CompileRun(f2_source); 588 CompileRun(f2_source);
581 CompileRun(g2_source); 589 CompileRun(g2_source);
582 CompileRun("f1(new X());"); 590 CompileRun("f1(new X());");
583 CompileRun("g1(new X());"); 591 CompileRun("g1(new X());");
584 CompileRun("f2(new X(), 'z');"); 592 CompileRun("f2(new X(), 'z');");
585 CompileRun("g2(new X(), 'z');"); 593 CompileRun("g2(new X(), 'z');");
586 if (i::V8::UseCrankshaft()) { 594 if (i::V8::UseCrankshaft()) {
587 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); 595 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 CompileRun(g2_source); 660 CompileRun(g2_source);
653 CompileRun("for (var i = 0; i < 5; i++) {" 661 CompileRun("for (var i = 0; i < 5; i++) {"
654 " f1(new X());" 662 " f1(new X());"
655 " g1(new X());" 663 " g1(new X());"
656 " f2(new X(), 'z');" 664 " f2(new X(), 'z');"
657 " g2(new X(), 'z');" 665 " g2(new X(), 'z');"
658 "};"); 666 "};");
659 667
660 // Compile an optimized version of the functions. 668 // Compile an optimized version of the functions.
661 i::FLAG_always_opt = true; 669 i::FLAG_always_opt = true;
670 // Be deterministic.
671 i::FLAG_optimize_in_parallel = false;
672
662 CompileRun(f1_source); 673 CompileRun(f1_source);
663 CompileRun(g1_source); 674 CompileRun(g1_source);
664 CompileRun(f2_source); 675 CompileRun(f2_source);
665 CompileRun(g2_source); 676 CompileRun(g2_source);
666 CompileRun("f1(new X());"); 677 CompileRun("f1(new X());");
667 CompileRun("g1(new X());"); 678 CompileRun("g1(new X());");
668 CompileRun("f2(new X(), 'z');"); 679 CompileRun("f2(new X(), 'z');");
669 CompileRun("g2(new X(), 'z');"); 680 CompileRun("g2(new X(), 'z');");
670 if (i::V8::UseCrankshaft()) { 681 if (i::V8::UseCrankshaft()) {
671 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); 682 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized());
672 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); 683 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized());
673 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); 684 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized());
674 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); 685 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized());
675 } 686 }
676 687
677 // Call functions and force deoptimization while processing the ics. 688 // Call functions and force deoptimization while processing the ics.
678 CompileRun("deopt = true;" 689 CompileRun("deopt = true;"
679 "var result = f1(new X());"); 690 "var result = f1(new X());");
680 } 691 }
681 NonIncrementalGC(); 692 NonIncrementalGC();
682 693
683 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); 694 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
684 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); 695 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
685 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); 696 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized());
686 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); 697 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized());
687 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 698 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
688 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); 699 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
689 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); 700 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current()));
690 } 701 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698