| 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 10936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10947 | 10947 |
| 10948 | 10948 |
| 10949 void Namespace::set_metadata_field(const Field& value) const { | 10949 void Namespace::set_metadata_field(const Field& value) const { |
| 10950 StorePointer(&raw_ptr()->metadata_field_, value.raw()); | 10950 StorePointer(&raw_ptr()->metadata_field_, value.raw()); |
| 10951 } | 10951 } |
| 10952 | 10952 |
| 10953 | 10953 |
| 10954 void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { | 10954 void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { |
| 10955 ASSERT(Field::Handle(metadata_field()).IsNull()); | 10955 ASSERT(Field::Handle(metadata_field()).IsNull()); |
| 10956 Field& field = Field::Handle(Field::NewTopLevel(Symbols::TopLevel(), | 10956 Field& field = Field::Handle(Field::NewTopLevel(Symbols::TopLevel(), |
| 10957 false, // is_final | 10957 false, // is_final |
| 10958 false, // is_const | 10958 false, // is_const |
| 10959 owner, | 10959 owner, |
| 10960 token_pos)); | 10960 token_pos)); |
| 10961 field.set_is_reflectable(false); | 10961 field.set_is_reflectable(false); |
| 10962 field.SetFieldType(Object::dynamic_type()); | 10962 field.SetFieldType(Object::dynamic_type()); |
| 10963 field.SetStaticValue(Array::empty_array(), true); | 10963 field.SetStaticValue(Array::empty_array(), true); |
| 10964 set_metadata_field(field); | 10964 set_metadata_field(field); |
| 10965 } | 10965 } |
| 10966 | 10966 |
| 10967 | 10967 |
| 10968 RawObject* Namespace::GetMetadata() const { | 10968 RawObject* Namespace::GetMetadata() const { |
| 10969 Field& field = Field::Handle(metadata_field()); | 10969 Field& field = Field::Handle(metadata_field()); |
| 10970 if (field.IsNull()) { | 10970 if (field.IsNull()) { |
| (...skipping 5556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16527 } | 16527 } |
| 16528 Thread* thread = Thread::Current(); | 16528 Thread* thread = Thread::Current(); |
| 16529 Zone* zone = thread->zone(); | 16529 Zone* zone = thread->zone(); |
| 16530 Isolate* isolate = thread->isolate(); | 16530 Isolate* isolate = thread->isolate(); |
| 16531 AbstractType& type = Type::Handle(zone); | 16531 AbstractType& type = Type::Handle(zone); |
| 16532 const Class& cls = Class::Handle(zone, type_class()); | 16532 const Class& cls = Class::Handle(zone, type_class()); |
| 16533 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { | 16533 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { |
| 16534 return Object::dynamic_type().raw(); | 16534 return Object::dynamic_type().raw(); |
| 16535 } | 16535 } |
| 16536 // Fast canonical lookup/registry for simple types. | 16536 // Fast canonical lookup/registry for simple types. |
| 16537 if (!cls.IsGeneric() && !cls.IsClosureClass()) { | 16537 if (!cls.IsGeneric() && !cls.IsClosureClass() && !cls.IsTypedefClass()) { |
| 16538 ASSERT(!IsFunctionType() || cls.IsTypedefClass()); | 16538 ASSERT(!IsFunctionType()); |
| 16539 type = cls.CanonicalType(); | 16539 type = cls.CanonicalType(); |
| 16540 if (type.IsNull()) { | 16540 if (type.IsNull()) { |
| 16541 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); | 16541 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); |
| 16542 // Canonicalize the type arguments of the supertype, if any. | 16542 // Canonicalize the type arguments of the supertype, if any. |
| 16543 TypeArguments& type_args = TypeArguments::Handle(zone, arguments()); | 16543 TypeArguments& type_args = TypeArguments::Handle(zone, arguments()); |
| 16544 type_args = type_args.Canonicalize(trail); | 16544 type_args = type_args.Canonicalize(trail); |
| 16545 if (IsCanonical()) { | 16545 if (IsCanonical()) { |
| 16546 // Canonicalizing type_args canonicalized this type. | 16546 // Canonicalizing type_args canonicalized this type. |
| 16547 ASSERT(IsRecursive()); | 16547 ASSERT(IsRecursive()); |
| 16548 return this->raw(); | 16548 return this->raw(); |
| (...skipping 5504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22053 return UserTag::null(); | 22053 return UserTag::null(); |
| 22054 } | 22054 } |
| 22055 | 22055 |
| 22056 | 22056 |
| 22057 const char* UserTag::ToCString() const { | 22057 const char* UserTag::ToCString() const { |
| 22058 const String& tag_label = String::Handle(label()); | 22058 const String& tag_label = String::Handle(label()); |
| 22059 return tag_label.ToCString(); | 22059 return tag_label.ToCString(); |
| 22060 } | 22060 } |
| 22061 | 22061 |
| 22062 } // namespace dart | 22062 } // namespace dart |
| OLD | NEW |