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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 // No fields, functions, or super type for the OneFieldClass. | 246 // No fields, functions, or super type for the OneFieldClass. |
247 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); | 247 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); |
248 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); | 248 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); |
249 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); | 249 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); |
250 ClassFinalizer::FinalizeTypesInClass(one_field_class); | 250 ClassFinalizer::FinalizeTypesInClass(one_field_class); |
251 | 251 |
252 const Array& one_fields = Array::Handle(Array::New(1)); | 252 const Array& one_fields = Array::Handle(Array::New(1)); |
253 const String& field_name = String::Handle(Symbols::New("the_field")); | 253 const String& field_name = String::Handle(Symbols::New("the_field")); |
254 const Field& field = Field::Handle( | 254 const Field& field = Field::Handle( |
255 Field::New(field_name, false, false, false, one_field_class, 0)); | 255 Field::New(field_name, false, false, false, false, one_field_class, 0)); |
256 one_fields.SetAt(0, field); | 256 one_fields.SetAt(0, field); |
257 one_field_class.SetFields(one_fields); | 257 one_field_class.SetFields(one_fields); |
258 one_field_class.Finalize(); | 258 one_field_class.Finalize(); |
259 intptr_t header_size = sizeof(RawObject); | 259 intptr_t header_size = sizeof(RawObject); |
260 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), | 260 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
261 one_field_class.instance_size()); | 261 one_field_class.instance_size()); |
262 EXPECT_EQ(header_size, field.Offset()); | 262 EXPECT_EQ(header_size, field.Offset()); |
263 EXPECT(!one_field_class.is_implemented()); | 263 EXPECT(!one_field_class.is_implemented()); |
264 one_field_class.set_is_implemented(); | 264 one_field_class.set_is_implemented(); |
265 EXPECT(one_field_class.is_implemented()); | 265 EXPECT(one_field_class.is_implemented()); |
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 const Class& cls = Class::Handle( | 2734 const Class& cls = Class::Handle( |
2735 CreateDummyClass(class_name, Script::Handle())); | 2735 CreateDummyClass(class_name, Script::Handle())); |
2736 return cls.raw(); | 2736 return cls.raw(); |
2737 } | 2737 } |
2738 | 2738 |
2739 | 2739 |
2740 static RawField* CreateTestField(const char* name) { | 2740 static RawField* CreateTestField(const char* name) { |
2741 const Class& cls = Class::Handle(CreateTestClass("global:")); | 2741 const Class& cls = Class::Handle(CreateTestClass("global:")); |
2742 const String& field_name = String::Handle(Symbols::New(name)); | 2742 const String& field_name = String::Handle(Symbols::New(name)); |
2743 const Field& field = | 2743 const Field& field = |
2744 Field::Handle(Field::New(field_name, true, false, false, cls, 0)); | 2744 Field::Handle(Field::New(field_name, true, false, false, false, cls, 0)); |
2745 return field.raw(); | 2745 return field.raw(); |
2746 } | 2746 } |
2747 | 2747 |
2748 | 2748 |
2749 TEST_CASE(ClassDictionaryIterator) { | 2749 TEST_CASE(ClassDictionaryIterator) { |
2750 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); | 2750 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); |
2751 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); | 2751 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); |
2752 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); | 2752 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); |
2753 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); | 2753 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); |
2754 String& url = String::ZoneHandle(String::New("SBB")); | 2754 String& url = String::ZoneHandle(String::New("SBB")); |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 EXPECT_VALID(h_result); | 4105 EXPECT_VALID(h_result); |
4106 Integer& result = Integer::Handle(); | 4106 Integer& result = Integer::Handle(); |
4107 result ^= Api::UnwrapHandle(h_result); | 4107 result ^= Api::UnwrapHandle(h_result); |
4108 String& foo = String::Handle(String::New("foo")); | 4108 String& foo = String::Handle(String::New("foo")); |
4109 Integer& expected = Integer::Handle(); | 4109 Integer& expected = Integer::Handle(); |
4110 expected ^= foo.HashCode(); | 4110 expected ^= foo.HashCode(); |
4111 EXPECT(result.IsIdenticalTo(expected)); | 4111 EXPECT(result.IsIdenticalTo(expected)); |
4112 } | 4112 } |
4113 | 4113 |
4114 } // namespace dart | 4114 } // namespace dart |
OLD | NEW |