Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: runtime/vm/object.cc

Issue 22819005: Make Null a public class of dart:core. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase on dart2js's putback Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 cls.set_is_type_finalized(); 410 cls.set_is_type_finalized();
411 cls.raw_ptr()->type_arguments_field_offset_in_words_ = 411 cls.raw_ptr()->type_arguments_field_offset_in_words_ =
412 Class::kNoTypeArguments; 412 Class::kNoTypeArguments;
413 cls.raw_ptr()->num_native_fields_ = 0; 413 cls.raw_ptr()->num_native_fields_ = 0;
414 cls.InitEmptyFields(); 414 cls.InitEmptyFields();
415 isolate->RegisterClass(cls); 415 isolate->RegisterClass(cls);
416 } 416 }
417 417
418 // Allocate and initialize the null class. 418 // Allocate and initialize the null class.
419 cls = Class::New<Instance>(kNullCid); 419 cls = Class::New<Instance>(kNullCid);
420 cls.set_is_prefinalized();
421 isolate->object_store()->set_null_class(cls); 420 isolate->object_store()->set_null_class(cls);
regis 2013/08/15 17:27:26 Shouldn't this be done in Object::InitFromSnapshot
rmacnak 2013/08/15 17:56:04 object_class is also created in both Init(Isolate*
422 421
423 // Allocate and initialize the free list element class. 422 // Allocate and initialize the free list element class.
424 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); 423 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement);
425 cls.set_is_finalized(); 424 cls.set_is_finalized();
426 cls.set_is_type_finalized(); 425 cls.set_is_type_finalized();
427 426
428 // Allocate and initialize the sentinel values of Null class. 427 // Allocate and initialize the sentinel values of Null class.
429 { 428 {
430 *sentinel_ ^= 429 *sentinel_ ^=
431 Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld); 430 Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 846
848 // Now that the symbol table is initialized and that the core dictionary as 847 // Now that the symbol table is initialized and that the core dictionary as
849 // well as the core implementation dictionary have been setup, preallocate 848 // well as the core implementation dictionary have been setup, preallocate
850 // remaining classes and register them by name in the dictionaries. 849 // remaining classes and register them by name in the dictionaries.
851 String& name = String::Handle(); 850 String& name = String::Handle();
852 cls = Class::New<Bool>(); 851 cls = Class::New<Bool>();
853 object_store->set_bool_class(cls); 852 object_store->set_bool_class(cls);
854 RegisterClass(cls, Symbols::Bool(), core_lib); 853 RegisterClass(cls, Symbols::Bool(), core_lib);
855 pending_classes.Add(cls, Heap::kOld); 854 pending_classes.Add(cls, Heap::kOld);
856 855
857 // TODO(12364): The class 'Null' is not registered in the class dictionary
858 // because it is not exported by dart:core.
859 cls = Class::New<Instance>(kNullCid); 856 cls = Class::New<Instance>(kNullCid);
857 cls.set_is_prefinalized();
860 object_store->set_null_class(cls); 858 object_store->set_null_class(cls);
861 cls.set_is_prefinalized();
862 RegisterClass(cls, Symbols::Null(), core_lib); 859 RegisterClass(cls, Symbols::Null(), core_lib);
863 pending_classes.Add(cls, Heap::kOld); 860 pending_classes.Add(cls, Heap::kOld);
regis 2013/08/15 17:27:26 Shouldn't this paragraph be moved to after the com
rmacnak 2013/08/15 17:56:04 Moved null and bool down.
864 861
865 cls = object_store->array_class(); // Was allocated above. 862 cls = object_store->array_class(); // Was allocated above.
866 RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib); 863 RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib);
867 pending_classes.Add(cls, Heap::kOld); 864 pending_classes.Add(cls, Heap::kOld);
868 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. 865 // We cannot use NewNonParameterizedType(cls), because Array is parameterized.
869 type ^= Type::New(Object::Handle(cls.raw()), 866 type ^= Type::New(Object::Handle(cls.raw()),
870 TypeArguments::Handle(), 867 TypeArguments::Handle(),
871 Scanner::kDummyTokenIndex); 868 Scanner::kDummyTokenIndex);
872 type.SetIsFinalized(); 869 type.SetIsFinalized();
873 type ^= type.Canonicalize(); 870 type ^= type.Canonicalize();
(...skipping 9587 matching lines...) Expand 10 before | Expand all | Expand 10 after
10461 if (HasResolvedTypeClass()) { 10458 if (HasResolvedTypeClass()) {
10462 return Class::Handle(type_class()).Name(); 10459 return Class::Handle(type_class()).Name();
10463 } else { 10460 } else {
10464 return UnresolvedClass::Handle(unresolved_class()).Name(); 10461 return UnresolvedClass::Handle(unresolved_class()).Name();
10465 } 10462 }
10466 } 10463 }
10467 10464
10468 10465
10469 bool AbstractType::IsNullType() const { 10466 bool AbstractType::IsNullType() const {
10470 return HasResolvedTypeClass() && 10467 return HasResolvedTypeClass() &&
10471 (type_class() == Type::Handle(Type::NullType()).type_class()); 10468 (type_class() == Isolate::Current()->object_store()->null_class());
10472 } 10469 }
10473 10470
10474 10471
10475 bool AbstractType::IsBoolType() const { 10472 bool AbstractType::IsBoolType() const {
10476 return HasResolvedTypeClass() && 10473 return HasResolvedTypeClass() &&
10477 (type_class() == Type::Handle(Type::BoolType()).type_class()); 10474 (type_class() == Isolate::Current()->object_store()->bool_class());
10478 } 10475 }
10479 10476
10480 10477
10481 bool AbstractType::IsIntType() const { 10478 bool AbstractType::IsIntType() const {
10482 return HasResolvedTypeClass() && 10479 return HasResolvedTypeClass() &&
10483 (type_class() == Type::Handle(Type::IntType()).type_class()); 10480 (type_class() == Type::Handle(Type::IntType()).type_class());
10484 } 10481 }
10485 10482
10486 10483
10487 bool AbstractType::IsDoubleType() const { 10484 bool AbstractType::IsDoubleType() const {
(...skipping 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after
14608 } 14605 }
14609 14606
14610 14607
14611 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14608 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14612 stream->OpenObject(); 14609 stream->OpenObject();
14613 stream->CloseObject(); 14610 stream->CloseObject();
14614 } 14611 }
14615 14612
14616 14613
14617 } // namespace dart 14614 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698