| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 "};"); | 364 "};"); |
| 365 CompileRun(f_source); | 365 CompileRun(f_source); |
| 366 CompileRun("for (var i = 0; i < 5; i++) {" | 366 CompileRun("for (var i = 0; i < 5; i++) {" |
| 367 " f('a+', new X());" | 367 " f('a+', new X());" |
| 368 "};"); | 368 "};"); |
| 369 | 369 |
| 370 // Compile an optimized version of f. | 370 // Compile an optimized version of f. |
| 371 i::FLAG_always_opt = true; | 371 i::FLAG_always_opt = true; |
| 372 CompileRun(f_source); | 372 CompileRun(f_source); |
| 373 CompileRun("f('a+', new X());"); | 373 CompileRun("f('a+', new X());"); |
| 374 CHECK(i::FLAG_always_full_compiler || | 374 CHECK(!i::V8::UseCrankshaft() || |
| 375 GetJSFunction(env->Global(), "f")->IsOptimized()); | 375 GetJSFunction(env->Global(), "f")->IsOptimized()); |
| 376 | 376 |
| 377 // Call f and force deoptimization while processing the binary operation. | 377 // Call f and force deoptimization while processing the binary operation. |
| 378 CompileRun("deopt = true;" | 378 CompileRun("deopt = true;" |
| 379 "var result = f('a+', new X());" | 379 "var result = f('a+', new X());" |
| 380 "gc(); gc();"); | 380 "gc(); gc();"); |
| 381 } | 381 } |
| 382 | 382 |
| 383 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 383 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
| 384 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 384 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 CompileConstructorWithDeoptimizingValueOf(); | 416 CompileConstructorWithDeoptimizingValueOf(); |
| 417 CompileRun(f_source); | 417 CompileRun(f_source); |
| 418 CompileRun("for (var i = 0; i < 5; i++) {" | 418 CompileRun("for (var i = 0; i < 5; i++) {" |
| 419 " f(8, new X());" | 419 " f(8, new X());" |
| 420 "};"); | 420 "};"); |
| 421 | 421 |
| 422 // Compile an optimized version of f. | 422 // Compile an optimized version of f. |
| 423 i::FLAG_always_opt = true; | 423 i::FLAG_always_opt = true; |
| 424 CompileRun(f_source); | 424 CompileRun(f_source); |
| 425 CompileRun("f(7, new X());"); | 425 CompileRun("f(7, new X());"); |
| 426 CHECK(i::FLAG_always_full_compiler || | 426 CHECK(!i::V8::UseCrankshaft() || |
| 427 GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 427 GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
| 428 | 428 |
| 429 // Call f and force deoptimization while processing the binary operation. | 429 // Call f and force deoptimization while processing the binary operation. |
| 430 CompileRun("deopt = true;" | 430 CompileRun("deopt = true;" |
| 431 "var result = f(7, new X());" | 431 "var result = f(7, new X());" |
| 432 "gc(); gc();"); | 432 "gc(); gc();"); |
| 433 | 433 |
| 434 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 434 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
| 435 } | 435 } |
| 436 | 436 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 "};"); | 527 "};"); |
| 528 CompileRun(f_source); | 528 CompileRun(f_source); |
| 529 CompileRun("for (var i = 0; i < 5; i++) {" | 529 CompileRun("for (var i = 0; i < 5; i++) {" |
| 530 " f('a', new X());" | 530 " f('a', new X());" |
| 531 "};"); | 531 "};"); |
| 532 | 532 |
| 533 // Compile an optimized version of f. | 533 // Compile an optimized version of f. |
| 534 i::FLAG_always_opt = true; | 534 i::FLAG_always_opt = true; |
| 535 CompileRun(f_source); | 535 CompileRun(f_source); |
| 536 CompileRun("f('a', new X());"); | 536 CompileRun("f('a', new X());"); |
| 537 CHECK(i::FLAG_always_full_compiler || | 537 CHECK(!i::V8::UseCrankshaft() || |
| 538 GetJSFunction(env->Global(), "f")->IsOptimized()); | 538 GetJSFunction(env->Global(), "f")->IsOptimized()); |
| 539 | 539 |
| 540 // Call f and force deoptimization while processing the comparison. | 540 // Call f and force deoptimization while processing the comparison. |
| 541 CompileRun("deopt = true;" | 541 CompileRun("deopt = true;" |
| 542 "var result = f('a', new X());" | 542 "var result = f('a', new X());" |
| 543 "gc(); gc();"); | 543 "gc(); gc();"); |
| 544 } | 544 } |
| 545 | 545 |
| 546 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 546 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
| 547 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 547 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 // Compile an optimized version of the functions. | 599 // Compile an optimized version of the functions. |
| 600 i::FLAG_always_opt = true; | 600 i::FLAG_always_opt = true; |
| 601 CompileRun(f1_source); | 601 CompileRun(f1_source); |
| 602 CompileRun(g1_source); | 602 CompileRun(g1_source); |
| 603 CompileRun(f2_source); | 603 CompileRun(f2_source); |
| 604 CompileRun(g2_source); | 604 CompileRun(g2_source); |
| 605 CompileRun("f1(new X());"); | 605 CompileRun("f1(new X());"); |
| 606 CompileRun("g1(new X());"); | 606 CompileRun("g1(new X());"); |
| 607 CompileRun("f2(new X(), 'z');"); | 607 CompileRun("f2(new X(), 'z');"); |
| 608 CompileRun("g2(new X(), 'z');"); | 608 CompileRun("g2(new X(), 'z');"); |
| 609 if (!i::FLAG_always_full_compiler) { | 609 if (i::V8::UseCrankshaft()) { |
| 610 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); | 610 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); |
| 611 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); | 611 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); |
| 612 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); | 612 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); |
| 613 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); | 613 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); |
| 614 } | 614 } |
| 615 | 615 |
| 616 // Call functions and force deoptimization while processing the ics. | 616 // Call functions and force deoptimization while processing the ics. |
| 617 CompileRun("deopt = true;" | 617 CompileRun("deopt = true;" |
| 618 "var result = f1(new X());" | 618 "var result = f1(new X());" |
| 619 "g1(new X());" | 619 "g1(new X());" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // Compile an optimized version of the functions. | 685 // Compile an optimized version of the functions. |
| 686 i::FLAG_always_opt = true; | 686 i::FLAG_always_opt = true; |
| 687 CompileRun(f1_source); | 687 CompileRun(f1_source); |
| 688 CompileRun(g1_source); | 688 CompileRun(g1_source); |
| 689 CompileRun(f2_source); | 689 CompileRun(f2_source); |
| 690 CompileRun(g2_source); | 690 CompileRun(g2_source); |
| 691 CompileRun("f1(new X());"); | 691 CompileRun("f1(new X());"); |
| 692 CompileRun("g1(new X());"); | 692 CompileRun("g1(new X());"); |
| 693 CompileRun("f2(new X(), 'z');"); | 693 CompileRun("f2(new X(), 'z');"); |
| 694 CompileRun("g2(new X(), 'z');"); | 694 CompileRun("g2(new X(), 'z');"); |
| 695 if (!i::FLAG_always_full_compiler) { | 695 if (i::V8::UseCrankshaft()) { |
| 696 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); | 696 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); |
| 697 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); | 697 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); |
| 698 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); | 698 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); |
| 699 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); | 699 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); |
| 700 } | 700 } |
| 701 | 701 |
| 702 // Call functions and force deoptimization while processing the ics. | 702 // Call functions and force deoptimization while processing the ics. |
| 703 CompileRun("deopt = true;" | 703 CompileRun("deopt = true;" |
| 704 "var result = f1(new X());" | 704 "var result = f1(new X());" |
| 705 "gc(); gc();"); | 705 "gc(); gc();"); |
| 706 } | 706 } |
| 707 | 707 |
| 708 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 708 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
| 709 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 709 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
| 710 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 710 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
| 711 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 711 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
| 712 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 712 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
| 713 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 713 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
| 714 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); | 714 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
| 715 } | 715 } |
| OLD | NEW |