| 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/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 Instance& instance = Instance::Handle(Instance::New(empty_class)); | 171 Instance& instance = Instance::Handle(Instance::New(empty_class)); |
| 172 EXPECT_EQ(empty_class.raw(), instance.clazz()); | 172 EXPECT_EQ(empty_class.raw(), instance.clazz()); |
| 173 | 173 |
| 174 class_name = Symbols::New("OneFieldClass"); | 174 class_name = Symbols::New("OneFieldClass"); |
| 175 const Class& one_field_class = | 175 const Class& one_field_class = |
| 176 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); | 176 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); |
| 177 | 177 |
| 178 // No functions and no super class for the OneFieldClass. | 178 // No functions and no super class for the OneFieldClass. |
| 179 const Array& one_fields = Array::Handle(Array::New(1)); | 179 const Array& one_fields = Array::Handle(Array::New(1)); |
| 180 const String& field_name = String::Handle(Symbols::New("the_field")); | 180 const String& field_name = String::Handle(Symbols::New("the_field")); |
| 181 const Field& field = Field::Handle(Field::New(field_name, false, false, 0)); | 181 const Field& field = |
| 182 Field::Handle(Field::New(field_name, false, false, false, 0)); |
| 182 one_fields.SetAt(0, field); | 183 one_fields.SetAt(0, field); |
| 183 one_field_class.SetFields(one_fields); | 184 one_field_class.SetFields(one_fields); |
| 184 one_field_class.Finalize(); | 185 one_field_class.Finalize(); |
| 185 intptr_t header_size = sizeof(RawObject); | 186 intptr_t header_size = sizeof(RawObject); |
| 186 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), | 187 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
| 187 one_field_class.instance_size()); | 188 one_field_class.instance_size()); |
| 188 EXPECT_EQ(header_size, field.Offset()); | 189 EXPECT_EQ(header_size, field.Offset()); |
| 189 } | 190 } |
| 190 | 191 |
| 191 | 192 |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 const String& class_name = String::Handle(Symbols::New(name)); | 2539 const String& class_name = String::Handle(Symbols::New(name)); |
| 2539 const Class& cls = Class::Handle( | 2540 const Class& cls = Class::Handle( |
| 2540 Class::New(class_name, Script::Handle(), Scanner::kDummyTokenIndex)); | 2541 Class::New(class_name, Script::Handle(), Scanner::kDummyTokenIndex)); |
| 2541 return cls.raw(); | 2542 return cls.raw(); |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 | 2545 |
| 2545 static RawField* CreateTestField(const char* name) { | 2546 static RawField* CreateTestField(const char* name) { |
| 2546 const Class& cls = Class::Handle(CreateTestClass("global:")); | 2547 const Class& cls = Class::Handle(CreateTestClass("global:")); |
| 2547 const String& field_name = String::Handle(Symbols::New(name)); | 2548 const String& field_name = String::Handle(Symbols::New(name)); |
| 2548 const Field& field = Field::Handle(Field::New(field_name, true, false, 0)); | 2549 const Field& field = |
| 2550 Field::Handle(Field::New(field_name, true, false, false, 0)); |
| 2549 field.set_owner(cls); | 2551 field.set_owner(cls); |
| 2550 return field.raw(); | 2552 return field.raw(); |
| 2551 } | 2553 } |
| 2552 | 2554 |
| 2553 | 2555 |
| 2554 TEST_CASE(ClassDictionaryIterator) { | 2556 TEST_CASE(ClassDictionaryIterator) { |
| 2555 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); | 2557 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); |
| 2556 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); | 2558 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); |
| 2557 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); | 2559 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); |
| 2558 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); | 2560 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 // Named double-private constructor mismatch. | 2782 // Named double-private constructor mismatch. |
| 2781 mangled_name = OneByteString::New("foo@12345.named@12345"); | 2783 mangled_name = OneByteString::New("foo@12345.named@12345"); |
| 2782 bare_name = OneByteString::New("foo.name"); | 2784 bare_name = OneByteString::New("foo.name"); |
| 2783 EXPECT(!mangled_name.EqualsIgnoringPrivateKey(bare_name)); | 2785 EXPECT(!mangled_name.EqualsIgnoringPrivateKey(bare_name)); |
| 2784 } | 2786 } |
| 2785 | 2787 |
| 2786 | 2788 |
| 2787 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2789 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 2788 | 2790 |
| 2789 } // namespace dart | 2791 } // namespace dart |
| OLD | NEW |