| 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 } | 1831 } |
| 1832 // In the case of a subtype test, each occurrence of DynamicType in type S is | 1832 // In the case of a subtype test, each occurrence of DynamicType in type S is |
| 1833 // interpreted as the bottom type, a subtype of all types. | 1833 // interpreted as the bottom type, a subtype of all types. |
| 1834 // However, DynamicType is not more specific than any type. | 1834 // However, DynamicType is not more specific than any type. |
| 1835 if (IsDynamicClass()) { | 1835 if (IsDynamicClass()) { |
| 1836 return test_kind == kIsSubtypeOf; | 1836 return test_kind == kIsSubtypeOf; |
| 1837 } | 1837 } |
| 1838 // Check for NullType, which is not a subtype of any type, but is more | 1838 // Check for NullType, which is not a subtype of any type, but is more |
| 1839 // specific than any type. | 1839 // specific than any type. |
| 1840 if (IsNullClass()) { | 1840 if (IsNullClass()) { |
| 1841 return test_kind == kIsMoreSpecificThan; | 1841 // User code cannot refer to class Null, therefore, we can only encounter |
| 1842 // NullType here as the type of the null constant, which must be treated |
| 1843 // separately in 'instance of' checks. Therefore, the NullType can only |
| 1844 // be encountered here during optimizations in 'more specific than' tests. |
| 1845 ASSERT(test_kind == kIsMoreSpecificThan); |
| 1846 return true; |
| 1842 } | 1847 } |
| 1843 // Check for reflexivity. | 1848 // Check for reflexivity. |
| 1844 if (raw() == other.raw()) { | 1849 if (raw() == other.raw()) { |
| 1845 const intptr_t len = NumTypeArguments(); | 1850 const intptr_t len = NumTypeArguments(); |
| 1846 if (len == 0) { | 1851 if (len == 0) { |
| 1847 return true; | 1852 return true; |
| 1848 } | 1853 } |
| 1849 // Since we do not truncate the type argument vector of a subclass (see | 1854 // Since we do not truncate the type argument vector of a subclass (see |
| 1850 // below), we only check a prefix of the proper length. | 1855 // below), we only check a prefix of the proper length. |
| 1851 // Check for covariance. | 1856 // Check for covariance. |
| (...skipping 9372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11224 const char* JSRegExp::ToCString() const { | 11229 const char* JSRegExp::ToCString() const { |
| 11225 const String& str = String::Handle(pattern()); | 11230 const String& str = String::Handle(pattern()); |
| 11226 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11231 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11227 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11232 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11228 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 11233 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 11229 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11234 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11230 return chars; | 11235 return chars; |
| 11231 } | 11236 } |
| 11232 | 11237 |
| 11233 } // namespace dart | 11238 } // namespace dart |
| OLD | NEW |