| 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/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const String& field_name = String::Handle(Symbols::New("the_field")); | 184 const String& field_name = String::Handle(Symbols::New("the_field")); |
| 185 const Field& field = Field::Handle( | 185 const Field& field = Field::Handle( |
| 186 Field::New(field_name, false, false, false, one_field_class, 0)); | 186 Field::New(field_name, false, false, false, one_field_class, 0)); |
| 187 one_fields.SetAt(0, field); | 187 one_fields.SetAt(0, field); |
| 188 one_field_class.SetFields(one_fields); | 188 one_field_class.SetFields(one_fields); |
| 189 one_field_class.Finalize(); | 189 one_field_class.Finalize(); |
| 190 intptr_t header_size = sizeof(RawObject); | 190 intptr_t header_size = sizeof(RawObject); |
| 191 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), | 191 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
| 192 one_field_class.instance_size()); | 192 one_field_class.instance_size()); |
| 193 EXPECT_EQ(header_size, field.Offset()); | 193 EXPECT_EQ(header_size, field.Offset()); |
| 194 EXPECT(!one_field_class.is_implemented()); |
| 195 one_field_class.set_is_implemented(); |
| 196 EXPECT(one_field_class.is_implemented()); |
| 194 } | 197 } |
| 195 | 198 |
| 196 | 199 |
| 197 TEST_CASE(Interface) { | 200 TEST_CASE(Interface) { |
| 198 String& class_name = String::Handle(Symbols::New("EmptyClass")); | 201 String& class_name = String::Handle(Symbols::New("EmptyClass")); |
| 199 Script& script = Script::Handle(); | 202 Script& script = Script::Handle(); |
| 200 const Class& factory_class = | 203 const Class& factory_class = |
| 201 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); | 204 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); |
| 202 const Array& no_fields = Array::Handle(Object::empty_array()); | 205 const Array& no_fields = Array::Handle(Object::empty_array()); |
| 203 // Finalizes the class. | 206 // Finalizes the class. |
| (...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3248 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); | 3251 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); |
| 3249 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); | 3252 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); |
| 3250 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); | 3253 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); |
| 3251 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); | 3254 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); |
| 3252 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); | 3255 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); |
| 3253 } | 3256 } |
| 3254 | 3257 |
| 3255 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3258 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 3256 | 3259 |
| 3257 } // namespace dart | 3260 } // namespace dart |
| OLD | NEW |