OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // TODO(zra): Remove when tests are ready to enable. | 5 // TODO(zra): Remove when tests are ready to enable. |
6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2744 | 2744 |
2745 TEST_CASE(ICData) { | 2745 TEST_CASE(ICData) { |
2746 Function& function = Function::Handle(GetDummyTarget("Bern")); | 2746 Function& function = Function::Handle(GetDummyTarget("Bern")); |
2747 const intptr_t id = 12; | 2747 const intptr_t id = 12; |
2748 const intptr_t num_args_tested = 1; | 2748 const intptr_t num_args_tested = 1; |
2749 const String& target_name = String::Handle(String::New("Thun")); | 2749 const String& target_name = String::Handle(String::New("Thun")); |
2750 const Array& args_descriptor = | 2750 const Array& args_descriptor = |
2751 Array::Handle(ArgumentsDescriptor::New(1, Object::null_array())); | 2751 Array::Handle(ArgumentsDescriptor::New(1, Object::null_array())); |
2752 ICData& o1 = ICData::Handle(); | 2752 ICData& o1 = ICData::Handle(); |
2753 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested); | 2753 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested); |
2754 EXPECT_EQ(1, o1.num_args_tested()); | 2754 EXPECT_EQ(1, o1.NumArgsTested()); |
2755 EXPECT_EQ(id, o1.deopt_id()); | 2755 EXPECT_EQ(id, o1.deopt_id()); |
2756 EXPECT_EQ(function.raw(), o1.function()); | 2756 EXPECT_EQ(function.raw(), o1.owner()); |
2757 EXPECT_EQ(0, o1.NumberOfChecks()); | 2757 EXPECT_EQ(0, o1.NumberOfChecks()); |
2758 EXPECT_EQ(target_name.raw(), o1.target_name()); | 2758 EXPECT_EQ(target_name.raw(), o1.target_name()); |
2759 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor()); | 2759 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor()); |
2760 | 2760 |
2761 const Function& target1 = Function::Handle(GetDummyTarget("Thun")); | 2761 const Function& target1 = Function::Handle(GetDummyTarget("Thun")); |
2762 o1.AddReceiverCheck(kSmiCid, target1); | 2762 o1.AddReceiverCheck(kSmiCid, target1); |
2763 EXPECT_EQ(1, o1.NumberOfChecks()); | 2763 EXPECT_EQ(1, o1.NumberOfChecks()); |
2764 intptr_t test_class_id = -1; | 2764 intptr_t test_class_id = -1; |
2765 Function& test_target = Function::Handle(); | 2765 Function& test_target = Function::Handle(); |
2766 o1.GetOneClassCheckAt(0, &test_class_id, &test_target); | 2766 o1.GetOneClassCheckAt(0, &test_class_id, &test_target); |
2767 EXPECT_EQ(kSmiCid, test_class_id); | 2767 EXPECT_EQ(kSmiCid, test_class_id); |
2768 EXPECT_EQ(target1.raw(), test_target.raw()); | 2768 EXPECT_EQ(target1.raw(), test_target.raw()); |
2769 EXPECT_EQ(kSmiCid, o1.GetCidAt(0)); | 2769 EXPECT_EQ(kSmiCid, o1.GetCidAt(0)); |
2770 GrowableArray<intptr_t> test_class_ids; | 2770 GrowableArray<intptr_t> test_class_ids; |
2771 o1.GetCheckAt(0, &test_class_ids, &test_target); | 2771 o1.GetCheckAt(0, &test_class_ids, &test_target); |
2772 EXPECT_EQ(1, test_class_ids.length()); | 2772 EXPECT_EQ(1, test_class_ids.length()); |
2773 EXPECT_EQ(kSmiCid, test_class_ids[0]); | 2773 EXPECT_EQ(kSmiCid, test_class_ids[0]); |
2774 EXPECT_EQ(target1.raw(), test_target.raw()); | 2774 EXPECT_EQ(target1.raw(), test_target.raw()); |
2775 | 2775 |
2776 const Function& target2 = Function::Handle(GetDummyTarget("Thun")); | 2776 const Function& target2 = Function::Handle(GetDummyTarget("Thun")); |
2777 o1.AddReceiverCheck(kDoubleCid, target2); | 2777 o1.AddReceiverCheck(kDoubleCid, target2); |
2778 EXPECT_EQ(2, o1.NumberOfChecks()); | 2778 EXPECT_EQ(2, o1.NumberOfChecks()); |
2779 o1.GetOneClassCheckAt(1, &test_class_id, &test_target); | 2779 o1.GetOneClassCheckAt(1, &test_class_id, &test_target); |
2780 EXPECT_EQ(kDoubleCid, test_class_id); | 2780 EXPECT_EQ(kDoubleCid, test_class_id); |
2781 EXPECT_EQ(target2.raw(), test_target.raw()); | 2781 EXPECT_EQ(target2.raw(), test_target.raw()); |
2782 EXPECT_EQ(kDoubleCid, o1.GetCidAt(1)); | 2782 EXPECT_EQ(kDoubleCid, o1.GetCidAt(1)); |
2783 | 2783 |
2784 ICData& o2 = ICData::Handle(); | 2784 ICData& o2 = ICData::Handle(); |
2785 o2 = ICData::New(function, target_name, args_descriptor, 57, 2); | 2785 o2 = ICData::New(function, target_name, args_descriptor, 57, 2); |
2786 EXPECT_EQ(2, o2.num_args_tested()); | 2786 EXPECT_EQ(2, o2.NumArgsTested()); |
2787 EXPECT_EQ(57, o2.deopt_id()); | 2787 EXPECT_EQ(57, o2.deopt_id()); |
2788 EXPECT_EQ(function.raw(), o2.function()); | 2788 EXPECT_EQ(function.raw(), o2.owner()); |
2789 EXPECT_EQ(0, o2.NumberOfChecks()); | 2789 EXPECT_EQ(0, o2.NumberOfChecks()); |
2790 GrowableArray<intptr_t> classes; | 2790 GrowableArray<intptr_t> classes; |
2791 classes.Add(kSmiCid); | 2791 classes.Add(kSmiCid); |
2792 classes.Add(kSmiCid); | 2792 classes.Add(kSmiCid); |
2793 o2.AddCheck(classes, target1); | 2793 o2.AddCheck(classes, target1); |
2794 EXPECT_EQ(1, o2.NumberOfChecks()); | 2794 EXPECT_EQ(1, o2.NumberOfChecks()); |
2795 o2.GetCheckAt(0, &test_class_ids, &test_target); | 2795 o2.GetCheckAt(0, &test_class_ids, &test_target); |
2796 EXPECT_EQ(2, test_class_ids.length()); | 2796 EXPECT_EQ(2, test_class_ids.length()); |
2797 EXPECT_EQ(kSmiCid, test_class_ids[0]); | 2797 EXPECT_EQ(kSmiCid, test_class_ids[0]); |
2798 EXPECT_EQ(kSmiCid, test_class_ids[1]); | 2798 EXPECT_EQ(kSmiCid, test_class_ids[1]); |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4023 TEST_CASE(PrintToJSONStream) { | 4023 TEST_CASE(PrintToJSONStream) { |
4024 Heap* heap = Isolate::Current()->heap(); | 4024 Heap* heap = Isolate::Current()->heap(); |
4025 heap->CollectAllGarbage(); | 4025 heap->CollectAllGarbage(); |
4026 JSONTypeVerifier verifier; | 4026 JSONTypeVerifier verifier; |
4027 heap->IterateObjects(&verifier); | 4027 heap->IterateObjects(&verifier); |
4028 } | 4028 } |
4029 | 4029 |
4030 #endif // !defined(TARGET_ARCH_ARM64) | 4030 #endif // !defined(TARGET_ARCH_ARM64) |
4031 | 4031 |
4032 } // namespace dart | 4032 } // namespace dart |
OLD | NEW |