| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Initialization from Class::New<Class>. | 264 // Initialization from Class::New<Class>. |
| 265 // Directly set raw_ to break a circular dependency: SetRaw will attempt | 265 // Directly set raw_ to break a circular dependency: SetRaw will attempt |
| 266 // to lookup class class in the class table where it is not registered yet. | 266 // to lookup class class in the class table where it is not registered yet. |
| 267 cls.raw_ = class_class_; | 267 cls.raw_ = class_class_; |
| 268 cls.set_handle_vtable(fake.vtable()); | 268 cls.set_handle_vtable(fake.vtable()); |
| 269 cls.set_instance_size(Class::InstanceSize()); | 269 cls.set_instance_size(Class::InstanceSize()); |
| 270 cls.set_next_field_offset(Class::InstanceSize()); | 270 cls.set_next_field_offset(Class::InstanceSize()); |
| 271 cls.set_id(Class::kClassId); | 271 cls.set_id(Class::kClassId); |
| 272 cls.raw_ptr()->state_bits_ = 0; | 272 cls.raw_ptr()->state_bits_ = 0; |
| 273 cls.set_is_finalized(); | 273 cls.set_is_finalized(); |
| 274 cls.raw_ptr()->type_arguments_field_offset_ = Class::kNoTypeArguments; | 274 cls.raw_ptr()->type_arguments_field_offset_in_words_ = |
| 275 Class::kNoTypeArguments; |
| 275 cls.raw_ptr()->num_native_fields_ = 0; | 276 cls.raw_ptr()->num_native_fields_ = 0; |
| 276 cls.InitEmptyFields(); | 277 cls.InitEmptyFields(); |
| 277 isolate->class_table()->Register(cls); | 278 isolate->class_table()->Register(cls); |
| 278 } | 279 } |
| 279 | 280 |
| 280 // Allocate and initialize the null class. | 281 // Allocate and initialize the null class. |
| 281 cls = Class::New<Instance>(kNullCid); | 282 cls = Class::New<Instance>(kNullCid); |
| 282 cls.set_is_finalized(); | 283 cls.set_is_finalized(); |
| 283 null_class_ = cls.raw(); | 284 null_class_ = cls.raw(); |
| 284 | 285 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 FakeObject fake; | 1362 FakeObject fake; |
| 1362 result.set_handle_vtable(fake.vtable()); | 1363 result.set_handle_vtable(fake.vtable()); |
| 1363 result.set_instance_size(FakeObject::InstanceSize()); | 1364 result.set_instance_size(FakeObject::InstanceSize()); |
| 1364 result.set_next_field_offset(FakeObject::InstanceSize()); | 1365 result.set_next_field_offset(FakeObject::InstanceSize()); |
| 1365 ASSERT((FakeObject::kClassId != kInstanceCid)); | 1366 ASSERT((FakeObject::kClassId != kInstanceCid)); |
| 1366 result.set_id(FakeObject::kClassId); | 1367 result.set_id(FakeObject::kClassId); |
| 1367 result.raw_ptr()->state_bits_ = 0; | 1368 result.raw_ptr()->state_bits_ = 0; |
| 1368 // VM backed classes are almost ready: run checks and resolve class | 1369 // VM backed classes are almost ready: run checks and resolve class |
| 1369 // references, but do not recompute size. | 1370 // references, but do not recompute size. |
| 1370 result.set_is_prefinalized(); | 1371 result.set_is_prefinalized(); |
| 1371 result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments; | 1372 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
| 1372 result.raw_ptr()->num_native_fields_ = 0; | 1373 result.raw_ptr()->num_native_fields_ = 0; |
| 1373 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1374 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
| 1374 result.InitEmptyFields(); | 1375 result.InitEmptyFields(); |
| 1375 Isolate::Current()->class_table()->Register(result); | 1376 Isolate::Current()->class_table()->Register(result); |
| 1376 return result.raw(); | 1377 return result.raw(); |
| 1377 } | 1378 } |
| 1378 | 1379 |
| 1379 | 1380 |
| 1380 // Initialize class fields of type Array with empty array. | 1381 // Initialize class fields of type Array with empty array. |
| 1381 void Class::InitEmptyFields() { | 1382 void Class::InitEmptyFields() { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 NoGCScope no_gc; | 1748 NoGCScope no_gc; |
| 1748 result ^= raw; | 1749 result ^= raw; |
| 1749 } | 1750 } |
| 1750 FakeInstance fake; | 1751 FakeInstance fake; |
| 1751 ASSERT(fake.IsInstance()); | 1752 ASSERT(fake.IsInstance()); |
| 1752 result.set_handle_vtable(fake.vtable()); | 1753 result.set_handle_vtable(fake.vtable()); |
| 1753 result.set_instance_size(FakeInstance::InstanceSize()); | 1754 result.set_instance_size(FakeInstance::InstanceSize()); |
| 1754 result.set_next_field_offset(FakeInstance::InstanceSize()); | 1755 result.set_next_field_offset(FakeInstance::InstanceSize()); |
| 1755 result.set_id(index); | 1756 result.set_id(index); |
| 1756 result.raw_ptr()->state_bits_ = 0; | 1757 result.raw_ptr()->state_bits_ = 0; |
| 1757 result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments; | 1758 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
| 1758 result.raw_ptr()->num_native_fields_ = 0; | 1759 result.raw_ptr()->num_native_fields_ = 0; |
| 1759 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1760 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
| 1760 result.InitEmptyFields(); | 1761 result.InitEmptyFields(); |
| 1761 Isolate::Current()->class_table()->Register(result); | 1762 Isolate::Current()->class_table()->Register(result); |
| 1762 return result.raw(); | 1763 return result.raw(); |
| 1763 } | 1764 } |
| 1764 | 1765 |
| 1765 | 1766 |
| 1766 template <class FakeInstance> | 1767 template <class FakeInstance> |
| 1767 RawClass* Class::New(const String& name, | 1768 RawClass* Class::New(const String& name, |
| (...skipping 10404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12172 } | 12173 } |
| 12173 return result.raw(); | 12174 return result.raw(); |
| 12174 } | 12175 } |
| 12175 | 12176 |
| 12176 | 12177 |
| 12177 const char* WeakProperty::ToCString() const { | 12178 const char* WeakProperty::ToCString() const { |
| 12178 return "_WeakProperty"; | 12179 return "_WeakProperty"; |
| 12179 } | 12180 } |
| 12180 | 12181 |
| 12181 } // namespace dart | 12182 } // namespace dart |
| OLD | NEW |