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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 532 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
533 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 533 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
534 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue()); | 534 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue()); |
535 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 535 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
536 } | 536 } |
537 | 537 |
538 | 538 |
539 TEST(DeoptimizeLoadICStoreIC) { | 539 TEST(DeoptimizeLoadICStoreIC) { |
540 i::FLAG_concurrent_recompilation = false; | 540 i::FLAG_concurrent_recompilation = false; |
541 i::FLAG_check_elimination = false; | |
542 LocalContext env; | 541 LocalContext env; |
543 v8::HandleScope scope(env->GetIsolate()); | 542 v8::HandleScope scope(env->GetIsolate()); |
544 | 543 |
545 // Functions to generate load/store/keyed load/keyed store IC calls. | 544 // Functions to generate load/store/keyed load/keyed store IC calls. |
546 const char* f1_source = "function f1(x) { return x.y; };"; | 545 const char* f1_source = "function f1(x) { return x.y; };"; |
547 const char* g1_source = "function g1(x) { x.y = 1; };"; | 546 const char* g1_source = "function g1(x) { x.y = 1; };"; |
548 const char* f2_source = "function f2(x, y) { return x[y]; };"; | 547 const char* f2_source = "function f2(x, y) { return x[y]; };"; |
549 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; | 548 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; |
550 | 549 |
551 { | 550 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 "g2(new X(), 'z');"); | 606 "g2(new X(), 'z');"); |
608 } | 607 } |
609 NonIncrementalGC(); | 608 NonIncrementalGC(); |
610 | 609 |
611 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 610 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
612 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 611 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
613 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 612 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
614 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 613 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
615 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value()); | 614 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value()); |
616 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 615 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
617 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | |
618 } | 616 } |
619 | 617 |
620 | 618 |
621 TEST(DeoptimizeLoadICStoreICNested) { | 619 TEST(DeoptimizeLoadICStoreICNested) { |
622 i::FLAG_concurrent_recompilation = false; | 620 i::FLAG_concurrent_recompilation = false; |
623 i::FLAG_check_elimination = false; | |
624 LocalContext env; | 621 LocalContext env; |
625 v8::HandleScope scope(env->GetIsolate()); | 622 v8::HandleScope scope(env->GetIsolate()); |
626 | 623 |
627 // Functions to generate load/store/keyed load/keyed store IC calls. | 624 // Functions to generate load/store/keyed load/keyed store IC calls. |
628 const char* f1_source = "function f1(x) { return x.y; };"; | 625 const char* f1_source = "function f1(x) { return x.y; };"; |
629 const char* g1_source = "function g1(x) { x.y = 1; };"; | 626 const char* g1_source = "function g1(x) { x.y = 1; };"; |
630 const char* f2_source = "function f2(x, y) { return x[y]; };"; | 627 const char* f2_source = "function f2(x, y) { return x[y]; };"; |
631 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; | 628 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; |
632 | 629 |
633 { | 630 { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 "var result = f1(new X());"); | 687 "var result = f1(new X());"); |
691 } | 688 } |
692 NonIncrementalGC(); | 689 NonIncrementalGC(); |
693 | 690 |
694 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 691 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
695 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 692 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
696 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 693 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
697 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 694 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
698 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 695 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
699 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 696 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
700 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | |
701 } | 697 } |
OLD | NEW |