| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 reinterpret_cast<RawObject*>(RawObject::FromAddr(addr)); | 511 reinterpret_cast<RawObject*>(RawObject::FromAddr(addr)); |
| 512 uword tags = 0; | 512 uword tags = 0; |
| 513 tags = RawObject::SizeTag::update(leftover_size, tags); | 513 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 514 tags = RawObject::ClassIdTag::update(kInstanceCid, tags); | 514 tags = RawObject::ClassIdTag::update(kInstanceCid, tags); |
| 515 raw->ptr()->tags_ = tags; | 515 raw->ptr()->tags_ = tags; |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 | 520 |
| 521 RawClass* Object::CreateAndRegisterInterface(const char* cname, | |
| 522 const Script& script, | |
| 523 const Library& lib) { | |
| 524 const String& name = String::Handle(Symbols::New(cname)); | |
| 525 const Class& cls = Class::Handle( | |
| 526 Class::NewInterface(name, script, Scanner::kDummyTokenIndex)); | |
| 527 lib.AddClass(cls); | |
| 528 return cls.raw(); | |
| 529 } | |
| 530 | |
| 531 | |
| 532 void Object::RegisterClass(const Class& cls, | 521 void Object::RegisterClass(const Class& cls, |
| 533 const String& name, | 522 const String& name, |
| 534 const Library& lib) { | 523 const Library& lib) { |
| 535 ASSERT(name.Length() > 0); | 524 ASSERT(name.Length() > 0); |
| 536 ASSERT(name.CharAt(0) != '_'); | 525 ASSERT(name.CharAt(0) != '_'); |
| 537 cls.set_name(name); | 526 cls.set_name(name); |
| 538 lib.AddClass(cls); | 527 lib.AddClass(cls); |
| 539 } | 528 } |
| 540 | 529 |
| 541 | 530 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 type = Type::NewNonParameterizedType(cls); | 873 type = Type::NewNonParameterizedType(cls); |
| 885 object_store->set_double_type(type); | 874 object_store->set_double_type(type); |
| 886 | 875 |
| 887 name = Symbols::New("String"); | 876 name = Symbols::New("String"); |
| 888 cls = Class::New<Instance>(name, script, Scanner::kDummyTokenIndex); | 877 cls = Class::New<Instance>(name, script, Scanner::kDummyTokenIndex); |
| 889 RegisterClass(cls, name, core_lib); | 878 RegisterClass(cls, name, core_lib); |
| 890 pending_classes.Add(cls, Heap::kOld); | 879 pending_classes.Add(cls, Heap::kOld); |
| 891 type = Type::NewNonParameterizedType(cls); | 880 type = Type::NewNonParameterizedType(cls); |
| 892 object_store->set_string_type(type); | 881 object_store->set_string_type(type); |
| 893 | 882 |
| 894 cls = CreateAndRegisterInterface("List", script, core_lib); | 883 name = Symbols::New("List"); |
| 884 cls = Class::New<Instance>(name, script, Scanner::kDummyTokenIndex); |
| 885 RegisterClass(cls, name, core_lib); |
| 895 pending_classes.Add(cls, Heap::kOld); | 886 pending_classes.Add(cls, Heap::kOld); |
| 896 object_store->set_list_class(cls); | 887 object_store->set_list_class(cls); |
| 897 | 888 |
| 898 cls = object_store->bool_class(); | 889 cls = object_store->bool_class(); |
| 899 type = Type::NewNonParameterizedType(cls); | 890 type = Type::NewNonParameterizedType(cls); |
| 900 object_store->set_bool_type(type); | 891 object_store->set_bool_type(type); |
| 901 | 892 |
| 902 cls = object_store->smi_class(); | 893 cls = object_store->smi_class(); |
| 903 type = Type::NewNonParameterizedType(cls); | 894 type = Type::NewNonParameterizedType(cls); |
| 904 object_store->set_smi_type(type); | 895 object_store->set_smi_type(type); |
| (...skipping 11300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12205 } | 12196 } |
| 12206 return result.raw(); | 12197 return result.raw(); |
| 12207 } | 12198 } |
| 12208 | 12199 |
| 12209 | 12200 |
| 12210 const char* WeakProperty::ToCString() const { | 12201 const char* WeakProperty::ToCString() const { |
| 12211 return "_WeakProperty"; | 12202 return "_WeakProperty"; |
| 12212 } | 12203 } |
| 12213 | 12204 |
| 12214 } // namespace dart | 12205 } // namespace dart |
| OLD | NEW |