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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 342 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
343 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); | 343 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); |
344 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 344 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) { | 348 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) { |
349 i::FLAG_turbo_deoptimization = true; | 349 i::FLAG_turbo_deoptimization = true; |
350 i::FLAG_concurrent_recompilation = false; | 350 i::FLAG_concurrent_recompilation = false; |
351 AllowNativesSyntaxNoInlining options; | 351 AllowNativesSyntaxNoInlining options; |
352 v8::Isolate* isolate = v8::Isolate::New(); | 352 v8::Isolate::CreateParams create_params; |
| 353 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 354 v8::Isolate* isolate = v8::Isolate::New(create_params); |
353 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 355 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
354 isolate->Enter(); | 356 isolate->Enter(); |
355 { | 357 { |
356 LocalContext env(isolate); | 358 LocalContext env(isolate); |
357 v8::HandleScope scope(env->GetIsolate()); | 359 v8::HandleScope scope(env->GetIsolate()); |
358 | 360 |
359 const char* f_source = "function f(x, y) { return x + y; };"; | 361 const char* f_source = "function f(x, y) { return x + y; };"; |
360 | 362 |
361 { | 363 { |
362 // Compile function f and collect to type feedback to insert binary op | 364 // Compile function f and collect to type feedback to insert binary op |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 CompileRun("deopt = true;" | 446 CompileRun("deopt = true;" |
445 "var result = f(7, new X());"); | 447 "var result = f(7, new X());"); |
446 NonIncrementalGC(i_isolate); | 448 NonIncrementalGC(i_isolate); |
447 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 449 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
448 } | 450 } |
449 | 451 |
450 | 452 |
451 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADD) { | 453 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADD) { |
452 i::FLAG_turbo_deoptimization = true; | 454 i::FLAG_turbo_deoptimization = true; |
453 i::FLAG_concurrent_recompilation = false; | 455 i::FLAG_concurrent_recompilation = false; |
454 v8::Isolate* isolate = v8::Isolate::New(); | 456 v8::Isolate::CreateParams create_params; |
| 457 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 458 v8::Isolate* isolate = v8::Isolate::New(create_params); |
455 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 459 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
456 isolate->Enter(); | 460 isolate->Enter(); |
457 { | 461 { |
458 LocalContext env(isolate); | 462 LocalContext env(isolate); |
459 v8::HandleScope scope(env->GetIsolate()); | 463 v8::HandleScope scope(env->GetIsolate()); |
460 | 464 |
461 TestDeoptimizeBinaryOpHelper(&env, "+"); | 465 TestDeoptimizeBinaryOpHelper(&env, "+"); |
462 | 466 |
463 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 467 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
464 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value()); | 468 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value()); |
465 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 469 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
466 } | 470 } |
467 isolate->Exit(); | 471 isolate->Exit(); |
468 isolate->Dispose(); | 472 isolate->Dispose(); |
469 } | 473 } |
470 | 474 |
471 | 475 |
472 UNINITIALIZED_TEST(DeoptimizeBinaryOperationSUB) { | 476 UNINITIALIZED_TEST(DeoptimizeBinaryOperationSUB) { |
473 i::FLAG_turbo_deoptimization = true; | 477 i::FLAG_turbo_deoptimization = true; |
474 i::FLAG_concurrent_recompilation = false; | 478 i::FLAG_concurrent_recompilation = false; |
475 v8::Isolate* isolate = v8::Isolate::New(); | 479 v8::Isolate::CreateParams create_params; |
| 480 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 481 v8::Isolate* isolate = v8::Isolate::New(create_params); |
476 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 482 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
477 isolate->Enter(); | 483 isolate->Enter(); |
478 { | 484 { |
479 LocalContext env(isolate); | 485 LocalContext env(isolate); |
480 v8::HandleScope scope(env->GetIsolate()); | 486 v8::HandleScope scope(env->GetIsolate()); |
481 | 487 |
482 TestDeoptimizeBinaryOpHelper(&env, "-"); | 488 TestDeoptimizeBinaryOpHelper(&env, "-"); |
483 | 489 |
484 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 490 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
485 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value()); | 491 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value()); |
486 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 492 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
487 } | 493 } |
488 isolate->Exit(); | 494 isolate->Exit(); |
489 isolate->Dispose(); | 495 isolate->Dispose(); |
490 } | 496 } |
491 | 497 |
492 | 498 |
493 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMUL) { | 499 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMUL) { |
494 i::FLAG_turbo_deoptimization = true; | 500 i::FLAG_turbo_deoptimization = true; |
495 i::FLAG_concurrent_recompilation = false; | 501 i::FLAG_concurrent_recompilation = false; |
496 v8::Isolate* isolate = v8::Isolate::New(); | 502 v8::Isolate::CreateParams create_params; |
| 503 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 504 v8::Isolate* isolate = v8::Isolate::New(create_params); |
497 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 505 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
498 isolate->Enter(); | 506 isolate->Enter(); |
499 { | 507 { |
500 LocalContext env(isolate); | 508 LocalContext env(isolate); |
501 v8::HandleScope scope(env->GetIsolate()); | 509 v8::HandleScope scope(env->GetIsolate()); |
502 | 510 |
503 TestDeoptimizeBinaryOpHelper(&env, "*"); | 511 TestDeoptimizeBinaryOpHelper(&env, "*"); |
504 | 512 |
505 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 513 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
506 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value()); | 514 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value()); |
507 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 515 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
508 } | 516 } |
509 isolate->Exit(); | 517 isolate->Exit(); |
510 isolate->Dispose(); | 518 isolate->Dispose(); |
511 } | 519 } |
512 | 520 |
513 | 521 |
514 UNINITIALIZED_TEST(DeoptimizeBinaryOperationDIV) { | 522 UNINITIALIZED_TEST(DeoptimizeBinaryOperationDIV) { |
515 i::FLAG_turbo_deoptimization = true; | 523 i::FLAG_turbo_deoptimization = true; |
516 i::FLAG_concurrent_recompilation = false; | 524 i::FLAG_concurrent_recompilation = false; |
517 v8::Isolate* isolate = v8::Isolate::New(); | 525 v8::Isolate::CreateParams create_params; |
| 526 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 527 v8::Isolate* isolate = v8::Isolate::New(create_params); |
518 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 528 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
519 isolate->Enter(); | 529 isolate->Enter(); |
520 { | 530 { |
521 LocalContext env(isolate); | 531 LocalContext env(isolate); |
522 v8::HandleScope scope(env->GetIsolate()); | 532 v8::HandleScope scope(env->GetIsolate()); |
523 | 533 |
524 TestDeoptimizeBinaryOpHelper(&env, "/"); | 534 TestDeoptimizeBinaryOpHelper(&env, "/"); |
525 | 535 |
526 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 536 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
527 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value()); | 537 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value()); |
528 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 538 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
529 } | 539 } |
530 isolate->Exit(); | 540 isolate->Exit(); |
531 isolate->Dispose(); | 541 isolate->Dispose(); |
532 } | 542 } |
533 | 543 |
534 | 544 |
535 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMOD) { | 545 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMOD) { |
536 i::FLAG_turbo_deoptimization = true; | 546 i::FLAG_turbo_deoptimization = true; |
537 i::FLAG_concurrent_recompilation = false; | 547 i::FLAG_concurrent_recompilation = false; |
538 v8::Isolate* isolate = v8::Isolate::New(); | 548 v8::Isolate::CreateParams create_params; |
| 549 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 550 v8::Isolate* isolate = v8::Isolate::New(create_params); |
539 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 551 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
540 isolate->Enter(); | 552 isolate->Enter(); |
541 { | 553 { |
542 LocalContext env(isolate); | 554 LocalContext env(isolate); |
543 v8::HandleScope scope(env->GetIsolate()); | 555 v8::HandleScope scope(env->GetIsolate()); |
544 | 556 |
545 TestDeoptimizeBinaryOpHelper(&env, "%"); | 557 TestDeoptimizeBinaryOpHelper(&env, "%"); |
546 | 558 |
547 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 559 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
548 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value()); | 560 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value()); |
549 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 561 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
550 } | 562 } |
551 isolate->Exit(); | 563 isolate->Exit(); |
552 isolate->Dispose(); | 564 isolate->Dispose(); |
553 } | 565 } |
554 | 566 |
555 | 567 |
556 UNINITIALIZED_TEST(DeoptimizeCompare) { | 568 UNINITIALIZED_TEST(DeoptimizeCompare) { |
557 i::FLAG_turbo_deoptimization = true; | 569 i::FLAG_turbo_deoptimization = true; |
558 i::FLAG_concurrent_recompilation = false; | 570 i::FLAG_concurrent_recompilation = false; |
559 v8::Isolate* isolate = v8::Isolate::New(); | 571 v8::Isolate::CreateParams create_params; |
| 572 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 573 v8::Isolate* isolate = v8::Isolate::New(create_params); |
560 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 574 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
561 isolate->Enter(); | 575 isolate->Enter(); |
562 { | 576 { |
563 LocalContext env(isolate); | 577 LocalContext env(isolate); |
564 v8::HandleScope scope(env->GetIsolate()); | 578 v8::HandleScope scope(env->GetIsolate()); |
565 | 579 |
566 const char* f_source = "function f(x, y) { return x < y; };"; | 580 const char* f_source = "function f(x, y) { return x < y; };"; |
567 | 581 |
568 { | 582 { |
569 AllowNativesSyntaxNoInlining options; | 583 AllowNativesSyntaxNoInlining options; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 618 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
605 } | 619 } |
606 isolate->Exit(); | 620 isolate->Exit(); |
607 isolate->Dispose(); | 621 isolate->Dispose(); |
608 } | 622 } |
609 | 623 |
610 | 624 |
611 UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) { | 625 UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) { |
612 i::FLAG_turbo_deoptimization = true; | 626 i::FLAG_turbo_deoptimization = true; |
613 i::FLAG_concurrent_recompilation = false; | 627 i::FLAG_concurrent_recompilation = false; |
614 v8::Isolate* isolate = v8::Isolate::New(); | 628 v8::Isolate::CreateParams create_params; |
| 629 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 630 v8::Isolate* isolate = v8::Isolate::New(create_params); |
615 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 631 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
616 isolate->Enter(); | 632 isolate->Enter(); |
617 { | 633 { |
618 LocalContext env(isolate); | 634 LocalContext env(isolate); |
619 v8::HandleScope scope(env->GetIsolate()); | 635 v8::HandleScope scope(env->GetIsolate()); |
620 | 636 |
621 // Functions to generate load/store/keyed load/keyed store IC calls. | 637 // Functions to generate load/store/keyed load/keyed store IC calls. |
622 const char* f1_source = "function f1(x) { return x.y; };"; | 638 const char* f1_source = "function f1(x) { return x.y; };"; |
623 const char* g1_source = "function g1(x) { x.y = 1; };"; | 639 const char* g1_source = "function g1(x) { x.y = 1; };"; |
624 const char* f2_source = "function f2(x, y) { return x[y]; };"; | 640 const char* f2_source = "function f2(x, y) { return x[y]; };"; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 711 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
696 } | 712 } |
697 isolate->Exit(); | 713 isolate->Exit(); |
698 isolate->Dispose(); | 714 isolate->Dispose(); |
699 } | 715 } |
700 | 716 |
701 | 717 |
702 UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) { | 718 UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) { |
703 i::FLAG_turbo_deoptimization = true; | 719 i::FLAG_turbo_deoptimization = true; |
704 i::FLAG_concurrent_recompilation = false; | 720 i::FLAG_concurrent_recompilation = false; |
705 v8::Isolate* isolate = v8::Isolate::New(); | 721 v8::Isolate::CreateParams create_params; |
| 722 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 723 v8::Isolate* isolate = v8::Isolate::New(create_params); |
706 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 724 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
707 isolate->Enter(); | 725 isolate->Enter(); |
708 { | 726 { |
709 LocalContext env(isolate); | 727 LocalContext env(isolate); |
710 v8::HandleScope scope(env->GetIsolate()); | 728 v8::HandleScope scope(env->GetIsolate()); |
711 | 729 |
712 // Functions to generate load/store/keyed load/keyed store IC calls. | 730 // Functions to generate load/store/keyed load/keyed store IC calls. |
713 const char* f1_source = "function f1(x) { return x.y; };"; | 731 const char* f1_source = "function f1(x) { return x.y; };"; |
714 const char* g1_source = "function g1(x) { x.y = 1; };"; | 732 const char* g1_source = "function g1(x) { x.y = 1; };"; |
715 const char* f2_source = "function f2(x, y) { return x[y]; };"; | 733 const char* f2_source = "function f2(x, y) { return x[y]; };"; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 800 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
783 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 801 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
784 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 802 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
785 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 803 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
786 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 804 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
787 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 805 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
788 } | 806 } |
789 isolate->Exit(); | 807 isolate->Exit(); |
790 isolate->Dispose(); | 808 isolate->Dispose(); |
791 } | 809 } |
OLD | NEW |