| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 5 #include "vm/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 class_name = String::NewSymbol("OneFieldClass"); | 165 class_name = String::NewSymbol("OneFieldClass"); |
| 166 const Class& one_field_class = Class::Handle(Class::New(class_name, script)); | 166 const Class& one_field_class = Class::Handle(Class::New(class_name, script)); |
| 167 | 167 |
| 168 // No functions and no super class for the OneFieldClass. | 168 // No functions and no super class for the OneFieldClass. |
| 169 const Array& one_fields = Array::Handle(Array::New(1)); | 169 const Array& one_fields = Array::Handle(Array::New(1)); |
| 170 const String& field_name = String::Handle(String::NewSymbol("the_field")); | 170 const String& field_name = String::Handle(String::NewSymbol("the_field")); |
| 171 const Field& field = Field::Handle(Field::New(field_name, false, false, 0)); | 171 const Field& field = Field::Handle(Field::New(field_name, false, false, 0)); |
| 172 one_fields.SetAt(0, field); | 172 one_fields.SetAt(0, field); |
| 173 one_field_class.SetFields(one_fields); | 173 one_field_class.SetFields(one_fields); |
| 174 one_field_class.Finalize(); | 174 one_field_class.Finalize(); |
| 175 EXPECT_EQ(2*kWordSize, one_field_class.instance_size()); | 175 intptr_t header_size = sizeof(RawObject); |
| 176 EXPECT_EQ(kWordSize, field.Offset()); | 176 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
| 177 one_field_class.instance_size()); |
| 178 EXPECT_EQ(header_size, field.Offset()); |
| 177 } | 179 } |
| 178 | 180 |
| 179 | 181 |
| 180 TEST_CASE(Interface) { | 182 TEST_CASE(Interface) { |
| 181 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); | 183 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); |
| 182 Script& script = Script::Handle(); | 184 Script& script = Script::Handle(); |
| 183 const Class& factory_class = Class::Handle(Class::New(class_name, script)); | 185 const Class& factory_class = Class::Handle(Class::New(class_name, script)); |
| 184 const Array& no_fields = Array::Handle(Array::Empty()); | 186 const Array& no_fields = Array::Handle(Array::Empty()); |
| 185 // Finalizes the class. | 187 // Finalizes the class. |
| 186 factory_class.SetFields(no_fields); | 188 factory_class.SetFields(no_fields); |
| (...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 cls = iterator.GetNextClass(); | 2257 cls = iterator.GetNextClass(); |
| 2256 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); | 2258 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); |
| 2257 count++; | 2259 count++; |
| 2258 } | 2260 } |
| 2259 ASSERT(count == 2); | 2261 ASSERT(count == 2); |
| 2260 } | 2262 } |
| 2261 | 2263 |
| 2262 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2264 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 2263 | 2265 |
| 2264 } // namespace dart | 2266 } // namespace dart |
| OLD | NEW |