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

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

Issue 1376443002: Refactored interface of FeedbackVectorSpec and friends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 2 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/interpreter/test-bytecode-generator.cc ('k') | test/cctest/test-feedback-vector.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/execution.h" 7 #include "src/execution.h"
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/interpreter/bytecode-array-builder.h" 9 #include "src/interpreter/bytecode-array-builder.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(15)); 546 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(15));
547 } 547 }
548 548
549 549
550 TEST(InterpreterLoadNamedProperty) { 550 TEST(InterpreterLoadNamedProperty) {
551 HandleAndZoneScope handles; 551 HandleAndZoneScope handles;
552 i::Isolate* isolate = handles.main_isolate(); 552 i::Isolate* isolate = handles.main_isolate();
553 i::Factory* factory = isolate->factory(); 553 i::Factory* factory = isolate->factory();
554 554
555 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC}; 555 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC};
556 i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds); 556 i::StaticFeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
557 Handle<i::TypeFeedbackVector> vector = 557 Handle<i::TypeFeedbackVector> vector =
558 factory->NewTypeFeedbackVector(&feedback_spec); 558 factory->NewTypeFeedbackVector(&feedback_spec);
559 559
560 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); 560 Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
561 name = factory->string_table()->LookupString(isolate, name); 561 name = factory->string_table()->LookupString(isolate, name);
562 562
563 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); 563 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
564 builder.set_locals_count(0); 564 builder.set_locals_count(0);
565 builder.set_parameter_count(1); 565 builder.set_parameter_count(1);
566 builder.LoadLiteral(name) 566 builder.LoadLiteral(name)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 601 }
602 602
603 603
604 TEST(InterpreterLoadKeyedProperty) { 604 TEST(InterpreterLoadKeyedProperty) {
605 HandleAndZoneScope handles; 605 HandleAndZoneScope handles;
606 i::Isolate* isolate = handles.main_isolate(); 606 i::Isolate* isolate = handles.main_isolate();
607 i::Factory* factory = isolate->factory(); 607 i::Factory* factory = isolate->factory();
608 608
609 i::FeedbackVectorSlotKind ic_kinds[] = { 609 i::FeedbackVectorSlotKind ic_kinds[] = {
610 i::FeedbackVectorSlotKind::KEYED_LOAD_IC}; 610 i::FeedbackVectorSlotKind::KEYED_LOAD_IC};
611 i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds); 611 i::StaticFeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
612 Handle<i::TypeFeedbackVector> vector = 612 Handle<i::TypeFeedbackVector> vector =
613 factory->NewTypeFeedbackVector(&feedback_spec); 613 factory->NewTypeFeedbackVector(&feedback_spec);
614 614
615 Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); 615 Handle<i::String> key = factory->NewStringFromAsciiChecked("key");
616 key = factory->string_table()->LookupString(isolate, key); 616 key = factory->string_table()->LookupString(isolate, key);
617 617
618 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); 618 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
619 builder.set_locals_count(1); 619 builder.set_locals_count(1);
620 builder.set_parameter_count(1); 620 builder.set_parameter_count(1);
621 builder.LoadLiteral(key) 621 builder.LoadLiteral(key)
(...skipping 21 matching lines...) Expand all
643 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); 643 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789));
644 } 644 }
645 645
646 646
647 TEST(InterpreterStoreNamedProperty) { 647 TEST(InterpreterStoreNamedProperty) {
648 HandleAndZoneScope handles; 648 HandleAndZoneScope handles;
649 i::Isolate* isolate = handles.main_isolate(); 649 i::Isolate* isolate = handles.main_isolate();
650 i::Factory* factory = isolate->factory(); 650 i::Factory* factory = isolate->factory();
651 651
652 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC}; 652 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC};
653 i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds); 653 i::StaticFeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
654 Handle<i::TypeFeedbackVector> vector = 654 Handle<i::TypeFeedbackVector> vector =
655 factory->NewTypeFeedbackVector(&feedback_spec); 655 factory->NewTypeFeedbackVector(&feedback_spec);
656 656
657 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); 657 Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
658 name = factory->string_table()->LookupString(isolate, name); 658 name = factory->string_table()->LookupString(isolate, name);
659 659
660 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); 660 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
661 builder.set_locals_count(1); 661 builder.set_locals_count(1);
662 builder.set_parameter_count(1); 662 builder.set_parameter_count(1);
663 builder.LoadLiteral(name) 663 builder.LoadLiteral(name)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 704 }
705 705
706 706
707 TEST(InterpreterStoreKeyedProperty) { 707 TEST(InterpreterStoreKeyedProperty) {
708 HandleAndZoneScope handles; 708 HandleAndZoneScope handles;
709 i::Isolate* isolate = handles.main_isolate(); 709 i::Isolate* isolate = handles.main_isolate();
710 i::Factory* factory = isolate->factory(); 710 i::Factory* factory = isolate->factory();
711 711
712 i::FeedbackVectorSlotKind ic_kinds[] = { 712 i::FeedbackVectorSlotKind ic_kinds[] = {
713 i::FeedbackVectorSlotKind::KEYED_STORE_IC}; 713 i::FeedbackVectorSlotKind::KEYED_STORE_IC};
714 i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds); 714 i::StaticFeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
715 Handle<i::TypeFeedbackVector> vector = 715 Handle<i::TypeFeedbackVector> vector =
716 factory->NewTypeFeedbackVector(&feedback_spec); 716 factory->NewTypeFeedbackVector(&feedback_spec);
717 717
718 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); 718 Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
719 name = factory->string_table()->LookupString(isolate, name); 719 name = factory->string_table()->LookupString(isolate, name);
720 720
721 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); 721 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
722 builder.set_locals_count(1); 722 builder.set_locals_count(1);
723 builder.set_parameter_count(1); 723 builder.set_parameter_count(1);
724 builder.LoadLiteral(name) 724 builder.LoadLiteral(name)
(...skipping 26 matching lines...) Expand all
751 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); 751 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999));
752 } 752 }
753 753
754 754
755 TEST(InterpreterCall) { 755 TEST(InterpreterCall) {
756 HandleAndZoneScope handles; 756 HandleAndZoneScope handles;
757 i::Isolate* isolate = handles.main_isolate(); 757 i::Isolate* isolate = handles.main_isolate();
758 i::Factory* factory = isolate->factory(); 758 i::Factory* factory = isolate->factory();
759 759
760 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC}; 760 i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC};
761 i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds); 761 i::StaticFeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
762 Handle<i::TypeFeedbackVector> vector = 762 Handle<i::TypeFeedbackVector> vector =
763 factory->NewTypeFeedbackVector(&feedback_spec); 763 factory->NewTypeFeedbackVector(&feedback_spec);
764 764
765 Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); 765 Handle<i::String> name = factory->NewStringFromAsciiChecked("func");
766 name = factory->string_table()->LookupString(isolate, name); 766 name = factory->string_table()->LookupString(isolate, name);
767 767
768 // Check with no args. 768 // Check with no args.
769 { 769 {
770 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); 770 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
771 builder.set_locals_count(1); 771 builder.set_locals_count(1);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 .Bind(&done) 969 .Bind(&done)
970 .Bind(&done1) 970 .Bind(&done1)
971 .Return(); 971 .Return();
972 972
973 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); 973 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
974 InterpreterTester tester(handles.main_isolate(), bytecode_array); 974 InterpreterTester tester(handles.main_isolate(), bytecode_array);
975 auto callable = tester.GetCallable<>(); 975 auto callable = tester.GetCallable<>();
976 Handle<Object> return_value = callable().ToHandleChecked(); 976 Handle<Object> return_value = callable().ToHandleChecked();
977 CHECK_EQ(Smi::cast(*return_value)->value(), 7); 977 CHECK_EQ(Smi::cast(*return_value)->value(), 7);
978 } 978 }
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698