| 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 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 ASSERT(!IsNull()); | 3986 ASSERT(!IsNull()); |
| 3987 return Smi::Value(raw_ptr()->length_); | 3987 return Smi::Value(raw_ptr()->length_); |
| 3988 } | 3988 } |
| 3989 | 3989 |
| 3990 | 3990 |
| 3991 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { | 3991 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { |
| 3992 return *TypeAddr(index); | 3992 return *TypeAddr(index); |
| 3993 } | 3993 } |
| 3994 | 3994 |
| 3995 | 3995 |
| 3996 void TypeArguments::set_type_at(intptr_t index, |
| 3997 const AbstractType& value) const { |
| 3998 StorePointer(TypeAddr(index), value.raw()); |
| 3999 } |
| 4000 |
| 4001 |
| 3996 void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const { | 4002 void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const { |
| 3997 const AbstractType& type_arg = AbstractType::Handle(TypeAt(index)); | 4003 const AbstractType& type_arg = AbstractType::Handle(TypeAt(index)); |
| 3998 if (type_arg.IsTypeRef()) { | 4004 if (type_arg.IsTypeRef()) { |
| 3999 if (value.raw() != type_arg.raw()) { | 4005 if (value.raw() != type_arg.raw()) { |
| 4000 TypeRef::Cast(type_arg).set_type(value); | 4006 TypeRef::Cast(type_arg).set_type(value); |
| 4001 } | 4007 } |
| 4002 } else { | 4008 } else { |
| 4003 StorePointer(TypeAddr(index), value.raw()); | 4009 set_type_at(index, value); |
| 4004 } | 4010 } |
| 4005 } | 4011 } |
| 4006 | 4012 |
| 4007 | 4013 |
| 4008 bool TypeArguments::IsResolved() const { | 4014 bool TypeArguments::IsResolved() const { |
| 4009 AbstractType& type = AbstractType::Handle(); | 4015 AbstractType& type = AbstractType::Handle(); |
| 4010 const intptr_t num_types = Length(); | 4016 const intptr_t num_types = Length(); |
| 4011 for (intptr_t i = 0; i < num_types; i++) { | 4017 for (intptr_t i = 0; i < num_types; i++) { |
| 4012 type = TypeAt(i); | 4018 type = TypeAt(i); |
| 4013 if (!type.IsResolved()) { | 4019 if (!type.IsResolved()) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4199 | 4205 |
| 4200 | 4206 |
| 4201 RawTypeArguments* TypeArguments::InstantiateAndCanonicalizeFrom( | 4207 RawTypeArguments* TypeArguments::InstantiateAndCanonicalizeFrom( |
| 4202 const TypeArguments& instantiator_type_arguments, | 4208 const TypeArguments& instantiator_type_arguments, |
| 4203 Error* bound_error) const { | 4209 Error* bound_error) const { |
| 4204 ASSERT(!IsInstantiated()); | 4210 ASSERT(!IsInstantiated()); |
| 4205 ASSERT(instantiator_type_arguments.IsNull() || | 4211 ASSERT(instantiator_type_arguments.IsNull() || |
| 4206 instantiator_type_arguments.IsCanonical()); | 4212 instantiator_type_arguments.IsCanonical()); |
| 4207 // Lookup instantiator and, if found, return paired instantiated result. | 4213 // Lookup instantiator and, if found, return paired instantiated result. |
| 4208 Array& prior_instantiations = Array::Handle(instantiations()); | 4214 Array& prior_instantiations = Array::Handle(instantiations()); |
| 4209 ASSERT(!prior_instantiations.IsNull()); | 4215 ASSERT(!prior_instantiations.IsNull() && prior_instantiations.IsArray()); |
| 4210 intptr_t length = prior_instantiations.Length(); | 4216 intptr_t length = prior_instantiations.Length(); |
| 4211 intptr_t index = 0; | 4217 intptr_t index = 0; |
| 4212 while (index < length) { | 4218 while (index < length) { |
| 4213 if (prior_instantiations.At(index) == instantiator_type_arguments.raw()) { | 4219 if (prior_instantiations.At(index) == instantiator_type_arguments.raw()) { |
| 4214 return TypeArguments::RawCast(prior_instantiations.At(index + 1)); | 4220 return TypeArguments::RawCast(prior_instantiations.At(index + 1)); |
| 4215 } | 4221 } |
| 4216 if (prior_instantiations.At(index) == Smi::New(StubCode::kNoInstantiator)) { | 4222 if (prior_instantiations.At(index) == Smi::New(StubCode::kNoInstantiator)) { |
| 4217 break; | 4223 break; |
| 4218 } | 4224 } |
| 4219 index += 2; | 4225 index += 2; |
| (...skipping 13116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17336 return "_MirrorReference"; | 17342 return "_MirrorReference"; |
| 17337 } | 17343 } |
| 17338 | 17344 |
| 17339 | 17345 |
| 17340 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17346 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 17341 Instance::PrintToJSONStream(stream, ref); | 17347 Instance::PrintToJSONStream(stream, ref); |
| 17342 } | 17348 } |
| 17343 | 17349 |
| 17344 | 17350 |
| 17345 } // namespace dart | 17351 } // namespace dart |
| OLD | NEW |