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

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

Issue 8372041: Canonicalize types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 607
608 608
609 void Object::InitFromSnapshot(Isolate* isolate) { 609 void Object::InitFromSnapshot(Isolate* isolate) {
610 TIMERSCOPE(time_bootstrap); 610 TIMERSCOPE(time_bootstrap);
611 ObjectStore* object_store = isolate->object_store(); 611 ObjectStore* object_store = isolate->object_store();
612 612
613 Class& cls = Class::Handle(); 613 Class& cls = Class::Handle();
614 614
615 // Set up empty classes in the object store, these will get 615 // Set up empty classes in the object store, these will get
616 // initialized correctly when we read from the snapshot. 616 // initialized correctly when we read from the snapshot.
617 // This is done do allow bootstrapping of reading classes from 617 // This is done to allow bootstrapping of reading classes from the snapshot.
618 // the snapshot.
619 cls = Class::New<Array>(); 618 cls = Class::New<Array>();
620 object_store->set_array_class(cls); 619 object_store->set_array_class(cls);
621 620
622 Array& empty_array = Array::Handle(); 621 Array& empty_array = Array::Handle();
623 empty_array = Array::New(0); 622 empty_array = Array::New(0);
624 object_store->set_empty_array(empty_array); 623 object_store->set_empty_array(empty_array);
625 624
626 cls = Class::New<ImmutableArray>(); 625 cls = Class::New<ImmutableArray>();
627 object_store->set_immutable_array_class(cls); 626 object_store->set_immutable_array_class(cls);
628 627
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 result.set_instance_size(FakeObject::InstanceSize()); 766 result.set_instance_size(FakeObject::InstanceSize());
768 result.set_next_field_offset(FakeObject::InstanceSize()); 767 result.set_next_field_offset(FakeObject::InstanceSize());
769 result.set_instance_kind(FakeObject::kInstanceKind); 768 result.set_instance_kind(FakeObject::kInstanceKind);
770 result.raw_ptr()->is_const_ = false; 769 result.raw_ptr()->is_const_ = false;
771 result.raw_ptr()->is_interface_ = false; 770 result.raw_ptr()->is_interface_ = false;
772 // VM backed classes are almost ready: run checks and resolve class 771 // VM backed classes are almost ready: run checks and resolve class
773 // references, but do not recompute size. 772 // references, but do not recompute size.
774 result.raw_ptr()->class_state_ = RawClass::kPreFinalized; 773 result.raw_ptr()->class_state_ = RawClass::kPreFinalized;
775 result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments; 774 result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments;
776 result.raw_ptr()->num_constants_ = 0; 775 result.raw_ptr()->num_constants_ = 0;
776 result.raw_ptr()->num_canonical_types_ = 0;
777 result.raw_ptr()->num_native_fields_ = 0; 777 result.raw_ptr()->num_native_fields_ = 0;
778 result.InitEmptyFields(); 778 result.InitEmptyFields();
779 return result.raw(); 779 return result.raw();
780 } 780 }
781 781
782 782
783 // Initialize class fields of type Array with empty array. 783 // Initialize class fields of type Array with empty array.
784 void Class::InitEmptyFields() { 784 void Class::InitEmptyFields() {
785 const Array& empty_array = Array::Handle(Array::Empty()); 785 const Array& empty_array = Array::Handle(Array::Empty());
786 if (empty_array.IsNull()) { 786 if (empty_array.IsNull()) {
787 // The empty array has not been initialized yet. 787 // The empty array has not been initialized yet.
788 return; 788 return;
789 } 789 }
790 StorePointer(&raw_ptr()->interfaces_, empty_array.raw()); 790 StorePointer(&raw_ptr()->interfaces_, empty_array.raw());
791 // TODO(srdjan): Make functions_cache growable and start with a smaller size. 791 // TODO(srdjan): Make functions_cache growable and start with a smaller size.
792 Array& fcache = 792 Array& fcache =
793 Array::Handle(Array::New(FunctionsCache::kNumEntries * 32, Heap::kOld)); 793 Array::Handle(Array::New(FunctionsCache::kNumEntries * 32, Heap::kOld));
794 StorePointer(&raw_ptr()->functions_cache_, fcache.raw()); 794 StorePointer(&raw_ptr()->functions_cache_, fcache.raw());
795 StorePointer(&raw_ptr()->constants_, empty_array.raw()); 795 StorePointer(&raw_ptr()->constants_, empty_array.raw());
796 StorePointer(&raw_ptr()->canonical_types_, empty_array.raw());
796 StorePointer(&raw_ptr()->functions_, empty_array.raw()); 797 StorePointer(&raw_ptr()->functions_, empty_array.raw());
797 StorePointer(&raw_ptr()->fields_, empty_array.raw()); 798 StorePointer(&raw_ptr()->fields_, empty_array.raw());
798 } 799 }
799 800
800 void Class::SetFunctions(const Array& value) const { 801 void Class::SetFunctions(const Array& value) const {
801 ASSERT(!value.IsNull()); 802 ASSERT(!value.IsNull());
802 // Bind all the functions in the array to this class. 803 // Bind all the functions in the array to this class.
803 Function& func = Function::Handle(); 804 Function& func = Function::Handle();
804 intptr_t len = value.Length(); 805 intptr_t len = value.Length();
805 for (intptr_t i = 0; i < len; i++) { 806 for (intptr_t i = 0; i < len; i++) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 result.set_instance_size(FakeInstance::InstanceSize()); 1004 result.set_instance_size(FakeInstance::InstanceSize());
1004 result.set_next_field_offset(FakeInstance::InstanceSize()); 1005 result.set_next_field_offset(FakeInstance::InstanceSize());
1005 result.set_instance_kind(FakeInstance::kInstanceKind); 1006 result.set_instance_kind(FakeInstance::kInstanceKind);
1006 result.set_name(name); 1007 result.set_name(name);
1007 result.set_script(script); 1008 result.set_script(script);
1008 result.raw_ptr()->is_const_ = false; 1009 result.raw_ptr()->is_const_ = false;
1009 result.raw_ptr()->is_interface_ = false; 1010 result.raw_ptr()->is_interface_ = false;
1010 result.raw_ptr()->class_state_ = RawClass::kAllocated; 1011 result.raw_ptr()->class_state_ = RawClass::kAllocated;
1011 result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments; 1012 result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments;
1012 result.raw_ptr()->num_constants_ = 0; 1013 result.raw_ptr()->num_constants_ = 0;
1014 result.raw_ptr()->num_canonical_types_ = 0;
1013 result.raw_ptr()->num_native_fields_ = 0; 1015 result.raw_ptr()->num_native_fields_ = 0;
1014 result.InitEmptyFields(); 1016 result.InitEmptyFields();
1015 return result.raw(); 1017 return result.raw();
1016 } 1018 }
1017 1019
1018 1020
1019 RawClass* Class::New(const String& name, const Script& script) { 1021 RawClass* Class::New(const String& name, const Script& script) {
1020 Class& result = Class::Handle(New<Instance>(name, script)); 1022 Class& result = Class::Handle(New<Instance>(name, script));
1021 return result.raw(); 1023 return result.raw();
1022 } 1024 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 intptr_t Class::num_constants() const { 1205 intptr_t Class::num_constants() const {
1204 return raw_ptr()->num_constants_; 1206 return raw_ptr()->num_constants_;
1205 } 1207 }
1206 1208
1207 1209
1208 void Class::set_num_constants(intptr_t value) const { 1210 void Class::set_num_constants(intptr_t value) const {
1209 raw_ptr()->num_constants_ = value; 1211 raw_ptr()->num_constants_ = value;
1210 } 1212 }
1211 1213
1212 1214
1215 RawArray* Class::canonical_types() const {
1216 return raw_ptr()->canonical_types_;
1217 }
1218
1219 void Class::set_canonical_types(const Array& value) const {
1220 ASSERT(!value.IsNull());
1221 StorePointer(&raw_ptr()->canonical_types_, value.raw());
1222 }
1223
1224
1225 intptr_t Class::num_canonical_types() const {
1226 return raw_ptr()->num_canonical_types_;
1227 }
1228
1229
1230 void Class::set_num_canonical_types(intptr_t value) const {
1231 raw_ptr()->num_canonical_types_ = value;
1232 }
1233
1234
1213 void Class::set_allocation_stub(const Code& value) const { 1235 void Class::set_allocation_stub(const Code& value) const {
1214 ASSERT(!value.IsNull()); 1236 ASSERT(!value.IsNull());
1215 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); 1237 ASSERT(raw_ptr()->allocation_stub_ == Code::null());
1216 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); 1238 StorePointer(&raw_ptr()->allocation_stub_, value.raw());
1217 } 1239 }
1218 1240
1219 1241
1220 bool Class::IsObjectClass() const { 1242 bool Class::IsObjectClass() const {
1221 return raw() == Type::Handle(Type::ObjectType()).type_class(); 1243 return raw() == Type::Handle(Type::ObjectType()).type_class();
1222 } 1244 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 } 1669 }
1648 1670
1649 1671
1650 bool Type::IsBeingFinalized() const { 1672 bool Type::IsBeingFinalized() const {
1651 // Type is an abstract class. 1673 // Type is an abstract class.
1652 UNREACHABLE(); 1674 UNREACHABLE();
1653 return false; 1675 return false;
1654 } 1676 }
1655 1677
1656 1678
1679 bool Type::Equals(const Type& other) const {
1680 // Type is an abstract class.
1681 UNREACHABLE();
1682 return false;
1683 }
1684
1685
1657 RawType* Type::InstantiateFrom( 1686 RawType* Type::InstantiateFrom(
1658 const TypeArguments& instantiator_type_arguments, 1687 const TypeArguments& instantiator_type_arguments,
1659 intptr_t offset) const { 1688 intptr_t offset) const {
1660 // Type is an abstract class. 1689 // Type is an abstract class.
1661 UNREACHABLE(); 1690 UNREACHABLE();
1662 return Type::null(); 1691 return Type::null();
1663 } 1692 }
1664 1693
1665 1694
1695 RawType* Type::Canonicalize() const {
1696 // Type is an abstract class.
1697 UNREACHABLE();
1698 return Type::null();
1699 }
1700
1701
1666 RawString* Type::Name() const { 1702 RawString* Type::Name() const {
1667 // If the type is still being finalized, we may be reporting an error about 1703 // If the type is still being finalized, we may be reporting an error about
1668 // an illformed type, so proceed with caution. 1704 // an illformed type, so proceed with caution.
1669 const TypeArguments& args = TypeArguments::Handle(arguments()); 1705 const TypeArguments& args = TypeArguments::Handle(arguments());
1670 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); 1706 const intptr_t num_args = args.IsNull() ? 0 : args.Length();
1671 String& class_name = String::Handle(); 1707 String& class_name = String::Handle();
1672 intptr_t first_type_param_index; 1708 intptr_t first_type_param_index;
1673 intptr_t num_type_params; // Number of type parameters to print. 1709 intptr_t num_type_params; // Number of type parameters to print.
1674 if (HasResolvedTypeClass()) { 1710 if (HasResolvedTypeClass()) {
1675 const Class& cls = Class::Handle(type_class()); 1711 const Class& cls = Class::Handle(type_class());
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 } 1920 }
1885 1921
1886 1922
1887 RawType* Type::NewNonParameterizedType(const Class& type_class) { 1923 RawType* Type::NewNonParameterizedType(const Class& type_class) {
1888 ASSERT(!type_class.HasTypeArguments()); 1924 ASSERT(!type_class.HasTypeArguments());
1889 const TypeArguments& no_type_arguments = TypeArguments::Handle(); 1925 const TypeArguments& no_type_arguments = TypeArguments::Handle();
1890 ParameterizedType& type = ParameterizedType::Handle(); 1926 ParameterizedType& type = ParameterizedType::Handle();
1891 type ^= ParameterizedType::New( 1927 type ^= ParameterizedType::New(
1892 Object::Handle(type_class.raw()), no_type_arguments); 1928 Object::Handle(type_class.raw()), no_type_arguments);
1893 type.set_is_finalized(); 1929 type.set_is_finalized();
1930 type ^= type.Canonicalize();
1894 return type.raw(); 1931 return type.raw();
1895 } 1932 }
1896 1933
1897 1934
1898 RawType* Type::NewParameterizedType(const Object& clazz, 1935 RawType* Type::NewParameterizedType(const Object& clazz,
1899 const TypeArguments& arguments) { 1936 const TypeArguments& arguments) {
1900 return ParameterizedType::New(clazz, arguments); 1937 return ParameterizedType::New(clazz, arguments);
1901 } 1938 }
1902 1939
1903 1940
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 const Class& cls = Class::Handle(type_class()); 2027 const Class& cls = Class::Handle(type_class());
1991 ParameterizedType& instantiated_type = ParameterizedType::Handle( 2028 ParameterizedType& instantiated_type = ParameterizedType::Handle(
1992 ParameterizedType::New(cls, type_arguments)); 2029 ParameterizedType::New(cls, type_arguments));
1993 ASSERT(type_arguments.IsNull() || 2030 ASSERT(type_arguments.IsNull() ||
1994 (type_arguments.Length() == cls.NumTypeArguments())); 2031 (type_arguments.Length() == cls.NumTypeArguments()));
1995 instantiated_type.set_is_finalized(); 2032 instantiated_type.set_is_finalized();
1996 return instantiated_type.raw(); 2033 return instantiated_type.raw();
1997 } 2034 }
1998 2035
1999 2036
2037 bool ParameterizedType::Equals(const Type& other) const {
2038 ASSERT(IsFinalized() && other.IsFinalized());
2039 if (!other.IsParameterizedType()) {
2040 return false;
2041 }
2042 ParameterizedType& other_parameterized_type = ParameterizedType::Handle();
2043 other_parameterized_type ^= other.raw();
2044 if (type_class() != other_parameterized_type.type_class()) {
2045 return false;
2046 }
2047 return TypeArguments::AreEqual(TypeArguments::Handle(arguments()),
2048 TypeArguments::Handle(other.arguments()));
2049 }
2050
2051
2052 RawType* ParameterizedType::Canonicalize() const {
2053 const Class& cls = Class::Handle(type_class());
2054 Array& canonical_types = Array::Handle(cls.canonical_types());
2055 if (canonical_types.IsNull()) {
srdjan 2011/11/01 20:51:43 Should this be an assert (canonical types is initi
regis 2011/11/01 21:54:50 No, this is more complicated. Classes of the VM is
2056 // Types defined in the VM isolate are canonicalized via the object store.
2057 return this->raw();
2058 }
2059 const intptr_t num_canonical_types = cls.num_canonical_types();
2060 ASSERT(canonical_types.Length() >= num_canonical_types);
2061 // Linear search to see whether this type is already present in the
2062 // list of canonicalized types.
2063 Type& type = Type::Handle();
2064 for (int i = 0; i < num_canonical_types; i++) {
2065 type ^= canonical_types.At(i);
2066 ASSERT(!type.IsNull());
2067 if (this->Equals(type)) {
2068 return type.raw();
2069 }
2070 }
srdjan 2011/11/01 20:51:43 I wonder if you need num_canonical_types variable.
regis 2011/11/01 21:54:50 There is not sentinel ending the array with a null
srdjan 2011/11/01 22:05:14 You do not need a NULL sentinel as you would itera
regis 2011/11/01 22:28:53 Ah, I now see what you mean. Clever! I missed the
2071 // The type needs to be added to the list. Grow the list if it is full.
2072 if (canonical_types.Length() == num_canonical_types) {
2073 const intptr_t kInitialCanonicalTypesLength = 2; // Raw and parameterized.
2074 const intptr_t old_length = canonical_types.Length();
2075 const intptr_t new_length =
2076 (old_length == 0) ? kInitialCanonicalTypesLength : old_length * 2;
srdjan 2011/11/01 20:51:43 The growth (old_length * 2) seems a little excessi
regis 2011/11/01 21:54:50 OK, I now add 2 elements each time the array grows
srdjan 2011/11/01 22:05:14 If you add only one, you can get rid of a field in
regis 2011/11/01 22:28:53 Actually, I think I can still simplify and remove
2077 const Array& new_canonical_types =
2078 Array::Handle(Array::Grow(canonical_types, new_length, Heap::kOld));
2079 cls.set_canonical_types(new_canonical_types);
2080 new_canonical_types.SetAt(num_canonical_types, *this);
2081 } else {
2082 canonical_types.SetAt(num_canonical_types, *this);
2083 }
2084 cls.set_num_canonical_types(num_canonical_types + 1);
2085 return this->raw();
2086 }
2087
2088
2000 void ParameterizedType::set_type_class(const Object& value) const { 2089 void ParameterizedType::set_type_class(const Object& value) const {
2001 ASSERT(!value.IsNull() && (value.IsClass() || value.IsUnresolvedClass())); 2090 ASSERT(!value.IsNull() && (value.IsClass() || value.IsUnresolvedClass()));
2002 StorePointer(&raw_ptr()->type_class_, value.raw()); 2091 StorePointer(&raw_ptr()->type_class_, value.raw());
2003 } 2092 }
2004 2093
2005 2094
2006 void ParameterizedType::set_arguments(const TypeArguments& value) const { 2095 void ParameterizedType::set_arguments(const TypeArguments& value) const {
2007 StorePointer(&raw_ptr()->arguments_, value.raw()); 2096 StorePointer(&raw_ptr()->arguments_, value.raw());
2008 } 2097 }
2009 2098
(...skipping 25 matching lines...) Expand all
2035 state == RawParameterizedType::kFinalized); 2124 state == RawParameterizedType::kFinalized);
2036 raw_ptr()->type_state_ = state; 2125 raw_ptr()->type_state_ = state;
2037 } 2126 }
2038 2127
2039 2128
2040 const char* ParameterizedType::ToCString() const { 2129 const char* ParameterizedType::ToCString() const {
2041 return "ParameterizedType"; 2130 return "ParameterizedType";
2042 } 2131 }
2043 2132
2044 2133
2134 bool TypeParameter::Equals(const Type& other) const {
2135 if (!other.IsTypeParameter()) {
2136 return false;
2137 }
2138 TypeParameter& other_type_parameter = TypeParameter::Handle();
2139 other_type_parameter ^= other.raw();
2140 return Index() == other_type_parameter.Index();
2141 }
2142
2143
2045 void TypeParameter::set_index(intptr_t value) const { 2144 void TypeParameter::set_index(intptr_t value) const {
2046 ASSERT(value >= 0); 2145 ASSERT(value >= 0);
2047 raw_ptr()->index_ = value; 2146 raw_ptr()->index_ = value;
2048 } 2147 }
2049 2148
2050 2149
2051 void TypeParameter::set_name(const String& value) const { 2150 void TypeParameter::set_name(const String& value) const {
2052 ASSERT(value.IsSymbol()); 2151 ASSERT(value.IsSymbol());
2053 StorePointer(&raw_ptr()->name_, value.raw()); 2152 StorePointer(&raw_ptr()->name_, value.raw());
2054 } 2153 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 } 2269 }
2171 2270
2172 2271
2173 bool TypeArguments::IsUninstantiatedIdentity() const { 2272 bool TypeArguments::IsUninstantiatedIdentity() const {
2174 // TypeArguments is an abstract class. 2273 // TypeArguments is an abstract class.
2175 UNREACHABLE(); 2274 UNREACHABLE();
2176 return false; 2275 return false;
2177 } 2276 }
2178 2277
2179 2278
2279 bool TypeArguments::Equals(const TypeArguments& other) const {
2280 // TypeArguments is an abstract class.
2281 UNREACHABLE();
2282 return false;
2283 }
2284
2285
2286 bool TypeArguments::AreEqual(const TypeArguments& arguments,
2287 const TypeArguments& other_arguments) {
2288 if (arguments.IsNull()) {
2289 return (other_arguments.IsNull() ||
2290 other_arguments.IsDynamicTypes(other_arguments.Length()));
2291 }
2292 if (other_arguments.IsNull()) {
2293 return arguments.IsDynamicTypes(arguments.Length());
2294 }
2295 return arguments.Equals(other_arguments);
2296 }
2297
2298
2180 RawTypeArguments* TypeArguments::InstantiateFrom( 2299 RawTypeArguments* TypeArguments::InstantiateFrom(
2181 const TypeArguments& instantiator_type_arguments, 2300 const TypeArguments& instantiator_type_arguments,
2182 intptr_t offset) const { 2301 intptr_t offset) const {
2183 // TypeArguments is an abstract class. 2302 // TypeArguments is an abstract class.
2184 UNREACHABLE(); 2303 UNREACHABLE();
2185 return TypeArguments::null(); 2304 return TypeArguments::null();
2186 } 2305 }
2187 2306
2188 2307
2189 bool TypeArguments::IsDynamicTypes(intptr_t len) const { 2308 bool TypeArguments::IsDynamicTypes(intptr_t len) const {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 for (intptr_t i = 0; i < num_types; i++) { 2415 for (intptr_t i = 0; i < num_types; i++) {
2297 type = TypeAt(i); 2416 type = TypeAt(i);
2298 if (!type.IsTypeParameter() || (type.Index() != i)) { 2417 if (!type.IsTypeParameter() || (type.Index() != i)) {
2299 return false; 2418 return false;
2300 } 2419 }
2301 } 2420 }
2302 return true; 2421 return true;
2303 } 2422 }
2304 2423
2305 2424
2425 bool TypeArray::Equals(const TypeArguments& other) const {
2426 intptr_t num_types = Length();
2427 if (num_types != other.Length()) {
2428 return false;
2429 }
2430 Type& type = Type::Handle();
2431 Type& other_type = Type::Handle();
2432 for (intptr_t i = 0; i < num_types; i++) {
2433 type = TypeAt(i);
2434 other_type = other.TypeAt(i);
2435 if (!type.Equals(other_type)) {
2436 return false;
2437 }
2438 }
2439 return true;
2440 }
2441
2442
2306 RawTypeArguments* TypeArray::InstantiateFrom( 2443 RawTypeArguments* TypeArray::InstantiateFrom(
2307 const TypeArguments& instantiator_type_arguments, 2444 const TypeArguments& instantiator_type_arguments,
2308 intptr_t offset) const { 2445 intptr_t offset) const {
2309 ASSERT(!IsInstantiated()); 2446 ASSERT(!IsInstantiated());
2310 if (instantiator_type_arguments.IsNull()) { 2447 if (instantiator_type_arguments.IsNull()) {
2311 return TypeArguments::null(); 2448 return TypeArguments::null();
2312 } 2449 }
2313 if ((offset == 0) && 2450 if ((offset == 0) &&
2314 !instantiator_type_arguments.IsNull() && 2451 !instantiator_type_arguments.IsNull() &&
2315 IsUninstantiatedIdentity() && 2452 IsUninstantiatedIdentity() &&
(...skipping 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after
6414 bool Array::Equals(const Instance& other) const { 6551 bool Array::Equals(const Instance& other) const {
6415 if (this->raw() == other.raw()) { 6552 if (this->raw() == other.raw()) {
6416 // Both handles point to the same raw instance. 6553 // Both handles point to the same raw instance.
6417 return true; 6554 return true;
6418 } 6555 }
6419 6556
6420 if (!other.IsArray() || other.IsNull()) { 6557 if (!other.IsArray() || other.IsNull()) {
6421 return false; 6558 return false;
6422 } 6559 }
6423 6560
6424 // Must have the same type. 6561 // Must have the same type arguments.
6425 if (GetTypeArguments() != other.GetTypeArguments()) { 6562 if (!TypeArguments::AreEqual(
6563 TypeArguments::Handle(GetTypeArguments()),
6564 TypeArguments::Handle(other.GetTypeArguments()))) {
6426 return false; 6565 return false;
6427 } 6566 }
6428 6567
6429 Array& other_arr = Array::Handle(); 6568 Array& other_arr = Array::Handle();
6430 other_arr ^= other.raw(); 6569 other_arr ^= other.raw();
6431 6570
6432 intptr_t len = this->Length(); 6571 intptr_t len = this->Length();
6433 if (len != other_arr.Length()) { 6572 if (len != other_arr.Length()) {
6434 return false; 6573 return false;
6435 } 6574 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
6810 const String& str = String::Handle(pattern()); 6949 const String& str = String::Handle(pattern());
6811 const char* format = "JSRegExp: pattern=%s flags=%s"; 6950 const char* format = "JSRegExp: pattern=%s flags=%s";
6812 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 6951 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
6813 char* chars = reinterpret_cast<char*>( 6952 char* chars = reinterpret_cast<char*>(
6814 Isolate::Current()->current_zone()->Allocate(len + 1)); 6953 Isolate::Current()->current_zone()->Allocate(len + 1));
6815 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 6954 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
6816 return chars; 6955 return chars;
6817 } 6956 }
6818 6957
6819 } // namespace dart 6958 } // namespace dart
OLDNEW
« runtime/vm/class_finalizer.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698