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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 cls.set_instance_size(Class::InstanceSize()); | 383 cls.set_instance_size(Class::InstanceSize()); |
384 cls.set_next_field_offset(Class::InstanceSize()); | 384 cls.set_next_field_offset(Class::InstanceSize()); |
385 cls.set_id(Class::kClassId); | 385 cls.set_id(Class::kClassId); |
386 cls.raw_ptr()->state_bits_ = 0; | 386 cls.raw_ptr()->state_bits_ = 0; |
387 cls.set_is_finalized(); | 387 cls.set_is_finalized(); |
388 cls.set_is_type_finalized(); | 388 cls.set_is_type_finalized(); |
389 cls.raw_ptr()->type_arguments_field_offset_in_words_ = | 389 cls.raw_ptr()->type_arguments_field_offset_in_words_ = |
390 Class::kNoTypeArguments; | 390 Class::kNoTypeArguments; |
391 cls.raw_ptr()->num_native_fields_ = 0; | 391 cls.raw_ptr()->num_native_fields_ = 0; |
392 cls.InitEmptyFields(); | 392 cls.InitEmptyFields(); |
393 isolate->class_table()->Register(cls); | 393 isolate->RegisterClass(cls); |
394 } | 394 } |
395 | 395 |
396 // Allocate and initialize the null class. | 396 // Allocate and initialize the null class. |
397 cls = Class::New<Instance>(kNullCid); | 397 cls = Class::New<Instance>(kNullCid); |
398 cls.set_is_finalized(); | 398 cls.set_is_finalized(); |
399 cls.set_is_type_finalized(); | 399 cls.set_is_type_finalized(); |
400 null_class_ = cls.raw(); | 400 null_class_ = cls.raw(); |
401 | 401 |
402 // Allocate and initialize the free list element class. | 402 // Allocate and initialize the free list element class. |
403 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); | 403 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 ASSERT((FakeObject::kClassId != kInstanceCid)); | 1461 ASSERT((FakeObject::kClassId != kInstanceCid)); |
1462 result.set_id(FakeObject::kClassId); | 1462 result.set_id(FakeObject::kClassId); |
1463 result.raw_ptr()->state_bits_ = 0; | 1463 result.raw_ptr()->state_bits_ = 0; |
1464 // VM backed classes are almost ready: run checks and resolve class | 1464 // VM backed classes are almost ready: run checks and resolve class |
1465 // references, but do not recompute size. | 1465 // references, but do not recompute size. |
1466 result.set_is_prefinalized(); | 1466 result.set_is_prefinalized(); |
1467 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; | 1467 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
1468 result.raw_ptr()->num_native_fields_ = 0; | 1468 result.raw_ptr()->num_native_fields_ = 0; |
1469 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1469 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
1470 result.InitEmptyFields(); | 1470 result.InitEmptyFields(); |
1471 Isolate::Current()->class_table()->Register(result); | 1471 Isolate::Current()->RegisterClass(result); |
1472 return result.raw(); | 1472 return result.raw(); |
1473 } | 1473 } |
1474 | 1474 |
1475 | 1475 |
1476 // Initialize class fields of type Array with empty array. | 1476 // Initialize class fields of type Array with empty array. |
1477 void Class::InitEmptyFields() { | 1477 void Class::InitEmptyFields() { |
1478 if (Object::empty_array().raw() == Array::null()) { | 1478 if (Object::empty_array().raw() == Array::null()) { |
1479 // The empty array has not been initialized yet. | 1479 // The empty array has not been initialized yet. |
1480 return; | 1480 return; |
1481 } | 1481 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 ASSERT(fake.IsInstance()); | 1872 ASSERT(fake.IsInstance()); |
1873 result.set_handle_vtable(fake.vtable()); | 1873 result.set_handle_vtable(fake.vtable()); |
1874 result.set_instance_size(FakeInstance::InstanceSize()); | 1874 result.set_instance_size(FakeInstance::InstanceSize()); |
1875 result.set_next_field_offset(FakeInstance::InstanceSize()); | 1875 result.set_next_field_offset(FakeInstance::InstanceSize()); |
1876 result.set_id(index); | 1876 result.set_id(index); |
1877 result.raw_ptr()->state_bits_ = 0; | 1877 result.raw_ptr()->state_bits_ = 0; |
1878 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; | 1878 result.raw_ptr()->type_arguments_field_offset_in_words_ = kNoTypeArguments; |
1879 result.raw_ptr()->num_native_fields_ = 0; | 1879 result.raw_ptr()->num_native_fields_ = 0; |
1880 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; | 1880 result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex; |
1881 result.InitEmptyFields(); | 1881 result.InitEmptyFields(); |
1882 Isolate::Current()->class_table()->Register(result); | 1882 Isolate::Current()->RegisterClass(result); |
1883 return result.raw(); | 1883 return result.raw(); |
1884 } | 1884 } |
1885 | 1885 |
1886 | 1886 |
1887 RawClass* Class::New(const String& name, | 1887 RawClass* Class::New(const String& name, |
1888 const Script& script, | 1888 const Script& script, |
1889 intptr_t token_pos) { | 1889 intptr_t token_pos) { |
1890 Class& result = Class::Handle(New<Instance>(kIllegalCid)); | 1890 Class& result = Class::Handle(New<Instance>(kIllegalCid)); |
1891 result.set_name(name); | 1891 result.set_name(name); |
1892 result.set_script(script); | 1892 result.set_script(script); |
(...skipping 11504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13397 space); | 13397 space); |
13398 return reinterpret_cast<RawWeakProperty*>(raw); | 13398 return reinterpret_cast<RawWeakProperty*>(raw); |
13399 } | 13399 } |
13400 | 13400 |
13401 | 13401 |
13402 const char* WeakProperty::ToCString() const { | 13402 const char* WeakProperty::ToCString() const { |
13403 return "_WeakProperty"; | 13403 return "_WeakProperty"; |
13404 } | 13404 } |
13405 | 13405 |
13406 } // namespace dart | 13406 } // namespace dart |
OLD | NEW |