Chromium Code Reviews| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 cls.set_is_type_finalized(); | 406 cls.set_is_type_finalized(); |
| 407 cls.raw_ptr()->type_arguments_field_offset_in_words_ = | 407 cls.raw_ptr()->type_arguments_field_offset_in_words_ = |
| 408 Class::kNoTypeArguments; | 408 Class::kNoTypeArguments; |
| 409 cls.raw_ptr()->num_native_fields_ = 0; | 409 cls.raw_ptr()->num_native_fields_ = 0; |
| 410 cls.InitEmptyFields(); | 410 cls.InitEmptyFields(); |
| 411 isolate->RegisterClass(cls); | 411 isolate->RegisterClass(cls); |
| 412 } | 412 } |
| 413 | 413 |
| 414 // Allocate and initialize the null class. | 414 // Allocate and initialize the null class. |
| 415 cls = Class::New<Instance>(kNullCid); | 415 cls = Class::New<Instance>(kNullCid); |
| 416 cls.set_is_finalized(); | 416 cls.set_is_prefinalized(); |
| 417 cls.set_is_type_finalized(); | |
| 418 isolate->object_store()->set_null_class(cls); | 417 isolate->object_store()->set_null_class(cls); |
| 419 | 418 |
| 420 // Allocate and initialize the free list element class. | 419 // Allocate and initialize the free list element class. |
| 421 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); | 420 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); |
| 422 cls.set_is_finalized(); | 421 cls.set_is_finalized(); |
| 423 cls.set_is_type_finalized(); | 422 cls.set_is_type_finalized(); |
| 424 | 423 |
| 425 // Allocate and initialize the sentinel values of Null class. | 424 // Allocate and initialize the sentinel values of Null class. |
| 426 { | 425 { |
| 427 *sentinel_ ^= | 426 *sentinel_ ^= |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 // Now that the symbol table is initialized and that the core dictionary as | 833 // Now that the symbol table is initialized and that the core dictionary as |
| 835 // well as the core implementation dictionary have been setup, preallocate | 834 // well as the core implementation dictionary have been setup, preallocate |
| 836 // remaining classes and register them by name in the dictionaries. | 835 // remaining classes and register them by name in the dictionaries. |
| 837 String& name = String::Handle(); | 836 String& name = String::Handle(); |
| 838 cls = Class::New<Bool>(); | 837 cls = Class::New<Bool>(); |
| 839 object_store->set_bool_class(cls); | 838 object_store->set_bool_class(cls); |
| 840 RegisterClass(cls, Symbols::Bool(), core_lib); | 839 RegisterClass(cls, Symbols::Bool(), core_lib); |
| 841 pending_classes.Add(cls, Heap::kOld); | 840 pending_classes.Add(cls, Heap::kOld); |
| 842 | 841 |
| 843 cls = Class::New<Instance>(kNullCid); | 842 cls = Class::New<Instance>(kNullCid); |
| 844 cls.set_name(Symbols::Null()); | |
| 845 // We immediately mark Null as finalized because it has no corresponding | |
| 846 // source. | |
| 847 cls.set_is_finalized(); | |
| 848 cls.set_is_type_finalized(); | |
| 849 object_store->set_null_class(cls); | 843 object_store->set_null_class(cls); |
| 850 cls.set_library(core_lib); // A sort of fiction for the mirrors. | 844 cls.set_is_prefinalized(); |
| 851 // When/if we promote Null to an ordinary class, it should be added to the | 845 RegisterClass(cls, Symbols::Null(), core_lib); |
| 852 // core library, given source and added to the list of classes pending | 846 pending_classes.Add(cls, Heap::kOld); |
| 853 // finalization. | |
| 854 // RegisterClass(cls, Symbols::Null(), core_lib); | |
| 855 // pending_classes.Add(cls, Heap::kOld); | |
| 856 | 847 |
| 857 cls = object_store->array_class(); // Was allocated above. | 848 cls = object_store->array_class(); // Was allocated above. |
| 858 RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib); | 849 RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib); |
| 859 pending_classes.Add(cls, Heap::kOld); | 850 pending_classes.Add(cls, Heap::kOld); |
| 860 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. | 851 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. |
| 861 type ^= Type::New(Object::Handle(cls.raw()), | 852 type ^= Type::New(Object::Handle(cls.raw()), |
| 862 TypeArguments::Handle(), | 853 TypeArguments::Handle(), |
| 863 Scanner::kDummyTokenIndex); | 854 Scanner::kDummyTokenIndex); |
| 864 type.SetIsFinalized(); | 855 type.SetIsFinalized(); |
| 865 type ^= type.Canonicalize(); | 856 type ^= type.Canonicalize(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1105 object_store->set_bool_type(type); | 1096 object_store->set_bool_type(type); |
| 1106 | 1097 |
| 1107 cls = object_store->smi_class(); | 1098 cls = object_store->smi_class(); |
| 1108 type = Type::NewNonParameterizedType(cls); | 1099 type = Type::NewNonParameterizedType(cls); |
| 1109 object_store->set_smi_type(type); | 1100 object_store->set_smi_type(type); |
| 1110 | 1101 |
| 1111 cls = object_store->mint_class(); | 1102 cls = object_store->mint_class(); |
| 1112 type = Type::NewNonParameterizedType(cls); | 1103 type = Type::NewNonParameterizedType(cls); |
| 1113 object_store->set_mint_type(type); | 1104 object_store->set_mint_type(type); |
| 1114 | 1105 |
| 1115 // The class 'Null' is not register in the class dictionary because it is not | 1106 // The class 'Null' is not register in the class dictionary because it is not |
|
Florian Schneider
2013/08/14 12:22:12
Not from your code: This comment about the Null c
rmacnak
2013/08/14 16:25:30
This will be cleaned up in https://chromiumcoderev
Lasse Reichstein Nielsen
2013/08/15 12:24:44
Leaving it untouched.
| |
| 1116 // The classes 'void' and 'dynamic' are phoney classes to make type checking | 1107 // The classes 'void' and 'dynamic' are phoney classes to make type checking |
| 1117 // more regular; they live in the VM isolate. The class 'void' is not | 1108 // more regular; they live in the VM isolate. The class 'void' is not |
| 1118 // registered in the class dictionary because its name is a reserved word. | 1109 // registered in the class dictionary because its name is a reserved word. |
| 1119 // The class 'dynamic' is registered in the class dictionary because its name | 1110 // The class 'dynamic' is registered in the class dictionary because its name |
| 1120 // is a built-in identifier (this is wrong). | 1111 // is a built-in identifier (this is wrong). |
| 1121 // The corresponding types are stored in the object store. | 1112 // The corresponding types are stored in the object store. |
| 1122 cls = object_store->null_class(); | 1113 cls = object_store->null_class(); |
| 1123 type = Type::NewNonParameterizedType(cls); | 1114 type = Type::NewNonParameterizedType(cls); |
| 1124 object_store->set_null_type(type); | 1115 object_store->set_null_type(type); |
| 1125 | 1116 |
| (...skipping 13484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14610 } | 14601 } |
| 14611 | 14602 |
| 14612 | 14603 |
| 14613 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14604 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14614 stream->OpenObject(); | 14605 stream->OpenObject(); |
| 14615 stream->CloseObject(); | 14606 stream->CloseObject(); |
| 14616 } | 14607 } |
| 14617 | 14608 |
| 14618 | 14609 |
| 14619 } // namespace dart | 14610 } // namespace dart |
| OLD | NEW |