OLD | NEW |
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 "};"); | 360 "};"); |
361 CompileRun(f_source); | 361 CompileRun(f_source); |
362 CompileRun("for (var i = 0; i < 5; i++) {" | 362 CompileRun("for (var i = 0; i < 5; i++) {" |
363 " f('a+', new X());" | 363 " f('a+', new X());" |
364 "};"); | 364 "};"); |
365 | 365 |
366 // Compile an optimized version of f. | 366 // Compile an optimized version of f. |
367 i::FLAG_always_opt = true; | 367 i::FLAG_always_opt = true; |
368 CompileRun(f_source); | 368 CompileRun(f_source); |
369 CompileRun("f('a+', new X());"); | 369 CompileRun("f('a+', new X());"); |
370 CHECK(!i::V8::UseCrankshaft() || | 370 CHECK(!i::Isolate::Current()->use_crankshaft() || |
371 GetJSFunction(env->Global(), "f")->IsOptimized()); | 371 GetJSFunction(env->Global(), "f")->IsOptimized()); |
372 | 372 |
373 // Call f and force deoptimization while processing the binary operation. | 373 // Call f and force deoptimization while processing the binary operation. |
374 CompileRun("deopt = true;" | 374 CompileRun("deopt = true;" |
375 "var result = f('a+', new X());"); | 375 "var result = f('a+', new X());"); |
376 } | 376 } |
377 NonIncrementalGC(); | 377 NonIncrementalGC(); |
378 | 378 |
379 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 379 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
380 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 380 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 CompileConstructorWithDeoptimizingValueOf(); | 412 CompileConstructorWithDeoptimizingValueOf(); |
413 CompileRun(f_source); | 413 CompileRun(f_source); |
414 CompileRun("for (var i = 0; i < 5; i++) {" | 414 CompileRun("for (var i = 0; i < 5; i++) {" |
415 " f(8, new X());" | 415 " f(8, new X());" |
416 "};"); | 416 "};"); |
417 | 417 |
418 // Compile an optimized version of f. | 418 // Compile an optimized version of f. |
419 i::FLAG_always_opt = true; | 419 i::FLAG_always_opt = true; |
420 CompileRun(f_source); | 420 CompileRun(f_source); |
421 CompileRun("f(7, new X());"); | 421 CompileRun("f(7, new X());"); |
422 CHECK(!i::V8::UseCrankshaft() || | 422 CHECK(!i::Isolate::Current()->use_crankshaft() || |
423 GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 423 GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
424 | 424 |
425 // Call f and force deoptimization while processing the binary operation. | 425 // Call f and force deoptimization while processing the binary operation. |
426 CompileRun("deopt = true;" | 426 CompileRun("deopt = true;" |
427 "var result = f(7, new X());"); | 427 "var result = f(7, new X());"); |
428 NonIncrementalGC(); | 428 NonIncrementalGC(); |
429 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 429 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
430 } | 430 } |
431 | 431 |
432 | 432 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 "};"); | 510 "};"); |
511 CompileRun(f_source); | 511 CompileRun(f_source); |
512 CompileRun("for (var i = 0; i < 5; i++) {" | 512 CompileRun("for (var i = 0; i < 5; i++) {" |
513 " f('a', new X());" | 513 " f('a', new X());" |
514 "};"); | 514 "};"); |
515 | 515 |
516 // Compile an optimized version of f. | 516 // Compile an optimized version of f. |
517 i::FLAG_always_opt = true; | 517 i::FLAG_always_opt = true; |
518 CompileRun(f_source); | 518 CompileRun(f_source); |
519 CompileRun("f('a', new X());"); | 519 CompileRun("f('a', new X());"); |
520 CHECK(!i::V8::UseCrankshaft() || | 520 CHECK(!i::Isolate::Current()->use_crankshaft() || |
521 GetJSFunction(env->Global(), "f")->IsOptimized()); | 521 GetJSFunction(env->Global(), "f")->IsOptimized()); |
522 | 522 |
523 // Call f and force deoptimization while processing the comparison. | 523 // Call f and force deoptimization while processing the comparison. |
524 CompileRun("deopt = true;" | 524 CompileRun("deopt = true;" |
525 "var result = f('a', new X());"); | 525 "var result = f('a', new X());"); |
526 } | 526 } |
527 NonIncrementalGC(); | 527 NonIncrementalGC(); |
528 | 528 |
529 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 529 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
530 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 530 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // Compile an optimized version of the functions. | 580 // Compile an optimized version of the functions. |
581 i::FLAG_always_opt = true; | 581 i::FLAG_always_opt = true; |
582 CompileRun(f1_source); | 582 CompileRun(f1_source); |
583 CompileRun(g1_source); | 583 CompileRun(g1_source); |
584 CompileRun(f2_source); | 584 CompileRun(f2_source); |
585 CompileRun(g2_source); | 585 CompileRun(g2_source); |
586 CompileRun("f1(new X());"); | 586 CompileRun("f1(new X());"); |
587 CompileRun("g1(new X());"); | 587 CompileRun("g1(new X());"); |
588 CompileRun("f2(new X(), 'z');"); | 588 CompileRun("f2(new X(), 'z');"); |
589 CompileRun("g2(new X(), 'z');"); | 589 CompileRun("g2(new X(), 'z');"); |
590 if (i::V8::UseCrankshaft()) { | 590 if (i::Isolate::Current()->use_crankshaft()) { |
591 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); | 591 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); |
592 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); | 592 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); |
593 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); | 593 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); |
594 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); | 594 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); |
595 } | 595 } |
596 | 596 |
597 // Call functions and force deoptimization while processing the ics. | 597 // Call functions and force deoptimization while processing the ics. |
598 CompileRun("deopt = true;" | 598 CompileRun("deopt = true;" |
599 "var result = f1(new X());" | 599 "var result = f1(new X());" |
600 "g1(new X());" | 600 "g1(new X());" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // Compile an optimized version of the functions. | 664 // Compile an optimized version of the functions. |
665 i::FLAG_always_opt = true; | 665 i::FLAG_always_opt = true; |
666 CompileRun(f1_source); | 666 CompileRun(f1_source); |
667 CompileRun(g1_source); | 667 CompileRun(g1_source); |
668 CompileRun(f2_source); | 668 CompileRun(f2_source); |
669 CompileRun(g2_source); | 669 CompileRun(g2_source); |
670 CompileRun("f1(new X());"); | 670 CompileRun("f1(new X());"); |
671 CompileRun("g1(new X());"); | 671 CompileRun("g1(new X());"); |
672 CompileRun("f2(new X(), 'z');"); | 672 CompileRun("f2(new X(), 'z');"); |
673 CompileRun("g2(new X(), 'z');"); | 673 CompileRun("g2(new X(), 'z');"); |
674 if (i::V8::UseCrankshaft()) { | 674 if (i::Isolate::Current()->use_crankshaft()) { |
675 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); | 675 CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized()); |
676 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); | 676 CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized()); |
677 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); | 677 CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized()); |
678 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); | 678 CHECK(GetJSFunction(env->Global(), "g2")->IsOptimized()); |
679 } | 679 } |
680 | 680 |
681 // Call functions and force deoptimization while processing the ics. | 681 // Call functions and force deoptimization while processing the ics. |
682 CompileRun("deopt = true;" | 682 CompileRun("deopt = true;" |
683 "var result = f1(new X());"); | 683 "var result = f1(new X());"); |
684 } | 684 } |
685 NonIncrementalGC(); | 685 NonIncrementalGC(); |
686 | 686 |
687 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 687 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
688 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 688 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
689 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 689 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
690 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 690 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
691 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 691 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
692 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 692 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
693 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); | 693 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
694 } | 694 } |
OLD | NEW |