| 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Initialization from Class::New<Class>. | 266 // Initialization from Class::New<Class>. |
| 267 // Directly set raw_ to break a circular dependency: SetRaw will attempt | 267 // Directly set raw_ to break a circular dependency: SetRaw will attempt |
| 268 // to lookup class class in the class table where it is not registered yet. | 268 // to lookup class class in the class table where it is not registered yet. |
| 269 cls.raw_ = class_class_; | 269 cls.raw_ = class_class_; |
| 270 cls.set_handle_vtable(fake.vtable()); | 270 cls.set_handle_vtable(fake.vtable()); |
| 271 cls.set_instance_size(Class::InstanceSize()); | 271 cls.set_instance_size(Class::InstanceSize()); |
| 272 cls.set_next_field_offset(Class::InstanceSize()); | 272 cls.set_next_field_offset(Class::InstanceSize()); |
| 273 cls.set_id(Class::kClassId); | 273 cls.set_id(Class::kClassId); |
| 274 cls.raw_ptr()->state_bits_ = 0; | 274 cls.raw_ptr()->state_bits_ = 0; |
| 275 cls.set_is_finalized(); | 275 cls.set_is_finalized(); |
| 276 cls.raw_ptr()->type_arguments_field_offset_ = Class::kNoTypeArguments; | 276 cls.raw_ptr()->type_arguments_field_offset_in_words_ = |
| 277 Class::kNoTypeArguments; |
| 277 cls.raw_ptr()->num_native_fields_ = 0; | 278 cls.raw_ptr()->num_native_fields_ = 0; |
| 278 cls.InitEmptyFields(); | 279 cls.InitEmptyFields(); |
| 279 isolate->class_table()->Register(cls); | 280 isolate->class_table()->Register(cls); |
| 280 } | 281 } |
| 281 | 282 |
| 282 // Allocate and initialize the null class. | 283 // Allocate and initialize the null class. |
| 283 cls = Class::New<Instance>(kNullCid); | 284 cls = Class::New<Instance>(kNullCid); |
| 284 cls.set_is_finalized(); | 285 cls.set_is_finalized(); |
| 285 null_class_ = cls.raw(); | 286 null_class_ = cls.raw(); |
| 286 | 287 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 FakeObject fake; | 1364 FakeObject fake; |
| 1364 result.set_handle_vtable(fake.vtable()); | 1365 result.set_handle_vtable(fake.vtable()); |
| 1365 result.set_instance_size(FakeObject::InstanceSize()); | 1366 result.set_instance_size(FakeObject::InstanceSize()); |
| 1366 result.set_next_field_offset(FakeObject::InstanceSize()); | 1367 result.set_next_field_offset(FakeObject::InstanceSize()); |
| 1367 ASSERT((FakeObject::kClassId != kInstanceCid)); | 1368 ASSERT((FakeObject::kClassId != kInstanceCid)); |
| 1368 result.set_id(FakeObject::kClassId); | 1369 result.set_id(FakeObject::kClassId); |
| 1369 result.raw_ptr()->state_bits_ = 0; | 1370 result.raw_ptr()->state_bits_ = 0; |
| 1370 // VM backed classes are almost ready: run checks and resolve class | 1371 // VM backed classes are almost ready: run checks and resolve class |
| 1371 // references, but do not recompute size. | 1372 // references, but do not recompute size. |
| 1372 result.set_is_prefinalized(); | 1373 result.set_is_prefinalized(); |
| 1373 result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments; | 1374 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
| 1374 result.raw_ptr()->num_native_fields_ = 0; | 1375 result.raw_ptr()->num_native_fields_ = 0; |
| 1375 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1376 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
| 1376 result.InitEmptyFields(); | 1377 result.InitEmptyFields(); |
| 1377 Isolate::Current()->class_table()->Register(result); | 1378 Isolate::Current()->class_table()->Register(result); |
| 1378 return result.raw(); | 1379 return result.raw(); |
| 1379 } | 1380 } |
| 1380 | 1381 |
| 1381 | 1382 |
| 1382 // Initialize class fields of type Array with empty array. | 1383 // Initialize class fields of type Array with empty array. |
| 1383 void Class::InitEmptyFields() { | 1384 void Class::InitEmptyFields() { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 NoGCScope no_gc; | 1784 NoGCScope no_gc; |
| 1784 result ^= raw; | 1785 result ^= raw; |
| 1785 } | 1786 } |
| 1786 FakeInstance fake; | 1787 FakeInstance fake; |
| 1787 ASSERT(fake.IsInstance()); | 1788 ASSERT(fake.IsInstance()); |
| 1788 result.set_handle_vtable(fake.vtable()); | 1789 result.set_handle_vtable(fake.vtable()); |
| 1789 result.set_instance_size(FakeInstance::InstanceSize()); | 1790 result.set_instance_size(FakeInstance::InstanceSize()); |
| 1790 result.set_next_field_offset(FakeInstance::InstanceSize()); | 1791 result.set_next_field_offset(FakeInstance::InstanceSize()); |
| 1791 result.set_id(index); | 1792 result.set_id(index); |
| 1792 result.raw_ptr()->state_bits_ = 0; | 1793 result.raw_ptr()->state_bits_ = 0; |
| 1793 result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments; | 1794 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
| 1794 result.raw_ptr()->num_native_fields_ = 0; | 1795 result.raw_ptr()->num_native_fields_ = 0; |
| 1795 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1796 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
| 1796 result.InitEmptyFields(); | 1797 result.InitEmptyFields(); |
| 1797 Isolate::Current()->class_table()->Register(result); | 1798 Isolate::Current()->class_table()->Register(result); |
| 1798 return result.raw(); | 1799 return result.raw(); |
| 1799 } | 1800 } |
| 1800 | 1801 |
| 1801 | 1802 |
| 1802 template <class FakeInstance> | 1803 template <class FakeInstance> |
| 1803 RawClass* Class::New(const String& name, | 1804 RawClass* Class::New(const String& name, |
| (...skipping 10439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12243 } | 12244 } |
| 12244 return result.raw(); | 12245 return result.raw(); |
| 12245 } | 12246 } |
| 12246 | 12247 |
| 12247 | 12248 |
| 12248 const char* WeakProperty::ToCString() const { | 12249 const char* WeakProperty::ToCString() const { |
| 12249 return "_WeakProperty"; | 12250 return "_WeakProperty"; |
| 12250 } | 12251 } |
| 12251 | 12252 |
| 12252 } // namespace dart | 12253 } // namespace dart |
| OLD | NEW |