| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 | 1906 |
| 1907 bool AbstractType::IsBeingFinalized() const { | 1907 bool AbstractType::IsBeingFinalized() const { |
| 1908 // AbstractType is an abstract class. | 1908 // AbstractType is an abstract class. |
| 1909 UNREACHABLE(); | 1909 UNREACHABLE(); |
| 1910 return false; | 1910 return false; |
| 1911 } | 1911 } |
| 1912 | 1912 |
| 1913 | 1913 |
| 1914 bool AbstractType::IsMalformed() const { |
| 1915 // AbstractType is an abstract class. |
| 1916 UNREACHABLE(); |
| 1917 return false; |
| 1918 } |
| 1919 |
| 1920 |
| 1921 RawError* AbstractType::malformed_error() const { |
| 1922 // AbstractType is an abstract class. |
| 1923 UNREACHABLE(); |
| 1924 return Error::null(); |
| 1925 } |
| 1926 |
| 1927 |
| 1928 void AbstractType::set_malformed_error(const Error& value) const { |
| 1929 // AbstractType is an abstract class. |
| 1930 UNREACHABLE(); |
| 1931 } |
| 1932 |
| 1933 |
| 1914 bool AbstractType::Equals(const AbstractType& other) const { | 1934 bool AbstractType::Equals(const AbstractType& other) const { |
| 1915 // AbstractType is an abstract class. | 1935 // AbstractType is an abstract class. |
| 1916 UNREACHABLE(); | 1936 UNREACHABLE(); |
| 1917 return false; | 1937 return false; |
| 1918 } | 1938 } |
| 1919 | 1939 |
| 1920 | 1940 |
| 1921 RawAbstractType* AbstractType::InstantiateFrom( | 1941 RawAbstractType* AbstractType::InstantiateFrom( |
| 1922 const AbstractTypeArguments& instantiator_type_arguments) const { | 1942 const AbstractTypeArguments& instantiator_type_arguments) const { |
| 1923 // AbstractType is an abstract class. | 1943 // AbstractType is an abstract class. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 set_type_state(RawType::kFinalized); | 2220 set_type_state(RawType::kFinalized); |
| 2201 } | 2221 } |
| 2202 | 2222 |
| 2203 | 2223 |
| 2204 void Type::set_is_being_finalized() const { | 2224 void Type::set_is_being_finalized() const { |
| 2205 ASSERT(!IsFinalized() && !IsBeingFinalized()); | 2225 ASSERT(!IsFinalized() && !IsBeingFinalized()); |
| 2206 set_type_state(RawType::kBeingFinalized); | 2226 set_type_state(RawType::kBeingFinalized); |
| 2207 } | 2227 } |
| 2208 | 2228 |
| 2209 | 2229 |
| 2230 bool Type::IsMalformed() const { |
| 2231 return raw_ptr()->malformed_error_ != Error::null(); |
| 2232 } |
| 2233 |
| 2234 |
| 2235 void Type::set_malformed_error(const Error& value) const { |
| 2236 StorePointer(&raw_ptr()->malformed_error_, value.raw()); |
| 2237 } |
| 2238 |
| 2239 |
| 2240 RawError* Type::malformed_error() const { |
| 2241 ASSERT(IsMalformed()); |
| 2242 return raw_ptr()->malformed_error_; |
| 2243 } |
| 2244 |
| 2245 |
| 2210 bool Type::IsResolved() const { | 2246 bool Type::IsResolved() const { |
| 2211 if (IsFinalized()) { | 2247 if (IsFinalized()) { |
| 2212 return true; | 2248 return true; |
| 2213 } | 2249 } |
| 2214 if (!HasResolvedTypeClass()) { | 2250 if (!HasResolvedTypeClass()) { |
| 2215 return false; | 2251 return false; |
| 2216 } | 2252 } |
| 2217 const AbstractTypeArguments& args = | 2253 const AbstractTypeArguments& args = |
| 2218 AbstractTypeArguments::Handle(arguments()); | 2254 AbstractTypeArguments::Handle(arguments()); |
| 2219 return args.IsNull() || args.IsResolved(); | 2255 return args.IsNull() || args.IsResolved(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 instantiated_type.set_is_finalized(); | 2307 instantiated_type.set_is_finalized(); |
| 2272 return instantiated_type.raw(); | 2308 return instantiated_type.raw(); |
| 2273 } | 2309 } |
| 2274 | 2310 |
| 2275 | 2311 |
| 2276 bool Type::Equals(const AbstractType& other) const { | 2312 bool Type::Equals(const AbstractType& other) const { |
| 2277 ASSERT(IsFinalized() && other.IsFinalized()); | 2313 ASSERT(IsFinalized() && other.IsFinalized()); |
| 2278 if (raw() == other.raw()) { | 2314 if (raw() == other.raw()) { |
| 2279 return true; | 2315 return true; |
| 2280 } | 2316 } |
| 2281 if (!other.IsType()) { | 2317 if (IsMalformed() || !other.IsType() || other.IsMalformed()) { |
| 2282 return false; | 2318 return false; |
| 2283 } | 2319 } |
| 2284 Type& other_parameterized_type = Type::Handle(); | 2320 Type& other_parameterized_type = Type::Handle(); |
| 2285 other_parameterized_type ^= other.raw(); | 2321 other_parameterized_type ^= other.raw(); |
| 2286 if (type_class() != other_parameterized_type.type_class()) { | 2322 if (type_class() != other_parameterized_type.type_class()) { |
| 2287 return false; | 2323 return false; |
| 2288 } | 2324 } |
| 2289 return AbstractTypeArguments::AreEqual( | 2325 return AbstractTypeArguments::AreEqual( |
| 2290 AbstractTypeArguments::Handle(arguments()), | 2326 AbstractTypeArguments::Handle(arguments()), |
| 2291 AbstractTypeArguments::Handle(other.arguments())); | 2327 AbstractTypeArguments::Handle(other.arguments())); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 | 2693 |
| 2658 | 2694 |
| 2659 bool AbstractTypeArguments::IsDynamicTypes(intptr_t len) const { | 2695 bool AbstractTypeArguments::IsDynamicTypes(intptr_t len) const { |
| 2660 ASSERT(Length() >= len); | 2696 ASSERT(Length() >= len); |
| 2661 AbstractType& type = AbstractType::Handle(); | 2697 AbstractType& type = AbstractType::Handle(); |
| 2662 Class& type_class = Class::Handle(); | 2698 Class& type_class = Class::Handle(); |
| 2663 for (intptr_t i = 0; i < len; i++) { | 2699 for (intptr_t i = 0; i < len; i++) { |
| 2664 type = TypeAt(i); | 2700 type = TypeAt(i); |
| 2665 ASSERT(!type.IsNull()); | 2701 ASSERT(!type.IsNull()); |
| 2666 if (!type.HasResolvedTypeClass()) { | 2702 if (!type.HasResolvedTypeClass()) { |
| 2667 ASSERT(type.IsTypeParameter()); | 2703 ASSERT(type.IsTypeParameter() || type.IsMalformed()); |
| 2668 return false; | 2704 return false; |
| 2669 } | 2705 } |
| 2670 type_class = type.type_class(); | 2706 type_class = type.type_class(); |
| 2671 if (!type_class.IsDynamicClass()) { | 2707 if (!type_class.IsDynamicClass()) { |
| 2672 return false; | 2708 return false; |
| 2673 } | 2709 } |
| 2674 } | 2710 } |
| 2675 return true; | 2711 return true; |
| 2676 } | 2712 } |
| 2677 | 2713 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3459 const Script& script = Script::Handle(owner_class.script()); | 3495 const Script& script = Script::Handle(owner_class.script()); |
| 3460 signature_class = Class::NewSignatureClass(signature, | 3496 signature_class = Class::NewSignatureClass(signature, |
| 3461 closure_function, | 3497 closure_function, |
| 3462 script); | 3498 script); |
| 3463 library.AddClass(signature_class); | 3499 library.AddClass(signature_class); |
| 3464 } else { | 3500 } else { |
| 3465 closure_function.set_signature_class(signature_class); | 3501 closure_function.set_signature_class(signature_class); |
| 3466 } | 3502 } |
| 3467 const Type& signature_type = Type::Handle(signature_class.SignatureType()); | 3503 const Type& signature_type = Type::Handle(signature_class.SignatureType()); |
| 3468 if (!signature_type.IsFinalized()) { | 3504 if (!signature_type.IsFinalized()) { |
| 3469 ClassFinalizer::FinalizeType(signature_class, signature_type); | 3505 ClassFinalizer::FinalizeType( |
| 3506 signature_class, signature_type, ClassFinalizer::kFinalize); |
| 3470 } | 3507 } |
| 3471 ASSERT(closure_function.signature_class() == signature_class.raw()); | 3508 ASSERT(closure_function.signature_class() == signature_class.raw()); |
| 3472 set_implicit_closure_function(closure_function); | 3509 set_implicit_closure_function(closure_function); |
| 3473 ASSERT(closure_function.IsImplicitClosureFunction()); | 3510 ASSERT(closure_function.IsImplicitClosureFunction()); |
| 3474 return closure_function.raw(); | 3511 return closure_function.raw(); |
| 3475 } | 3512 } |
| 3476 | 3513 |
| 3477 | 3514 |
| 3478 template<typename T> | 3515 template<typename T> |
| 3479 static RawArray* NewArray(const GrowableArray<T*>& objs) { | 3516 static RawArray* NewArray(const GrowableArray<T*>& objs) { |
| (...skipping 4886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8366 result.set_num_args_tested(num_args_tested); | 8403 result.set_num_args_tested(num_args_tested); |
| 8367 // Number of array elements in one test entry (num_args_tested + 1) | 8404 // Number of array elements in one test entry (num_args_tested + 1) |
| 8368 intptr_t len = num_args_tested + 1; | 8405 intptr_t len = num_args_tested + 1; |
| 8369 // IC data array must be null terminated (sentinel entry). | 8406 // IC data array must be null terminated (sentinel entry). |
| 8370 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 8407 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 8371 result.set_ic_data(ic_data); | 8408 result.set_ic_data(ic_data); |
| 8372 return result.raw(); | 8409 return result.raw(); |
| 8373 } | 8410 } |
| 8374 | 8411 |
| 8375 } // namespace dart | 8412 } // namespace dart |
| OLD | NEW |