| 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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 } | 1821 } |
| 1822 // In the case of a subtype test, each occurrence of DynamicType in type S is | 1822 // In the case of a subtype test, each occurrence of DynamicType in type S is |
| 1823 // interpreted as the bottom type, a subtype of all types. | 1823 // interpreted as the bottom type, a subtype of all types. |
| 1824 // However, DynamicType is not more specific than any type. | 1824 // However, DynamicType is not more specific than any type. |
| 1825 if (IsDynamicClass()) { | 1825 if (IsDynamicClass()) { |
| 1826 return test_kind == kIsSubtypeOf; | 1826 return test_kind == kIsSubtypeOf; |
| 1827 } | 1827 } |
| 1828 // Check for NullType, which is not a subtype of any type, but is more | 1828 // Check for NullType, which is not a subtype of any type, but is more |
| 1829 // specific than any type. | 1829 // specific than any type. |
| 1830 if (IsNullClass()) { | 1830 if (IsNullClass()) { |
| 1831 return test_kind == kIsMoreSpecificThan; | 1831 // User code cannot refer to class Null, therefore, we can only encounter |
| 1832 // NullType here as the type of the null constant, which must be treated |
| 1833 // separately in 'instance of' checks. Therefore, the NullType can only |
| 1834 // be encountered here during optimizations in 'more specific than' tests. |
| 1835 ASSERT(test_kind == kIsMoreSpecificThan); |
| 1836 return true; |
| 1832 } | 1837 } |
| 1833 // Check for reflexivity. | 1838 // Check for reflexivity. |
| 1834 if (raw() == other.raw()) { | 1839 if (raw() == other.raw()) { |
| 1835 const intptr_t len = NumTypeArguments(); | 1840 const intptr_t len = NumTypeArguments(); |
| 1836 if (len == 0) { | 1841 if (len == 0) { |
| 1837 return true; | 1842 return true; |
| 1838 } | 1843 } |
| 1839 // Since we do not truncate the type argument vector of a subclass (see | 1844 // Since we do not truncate the type argument vector of a subclass (see |
| 1840 // below), we only check a prefix of the proper length. | 1845 // below), we only check a prefix of the proper length. |
| 1841 // Check for covariance. | 1846 // Check for covariance. |
| (...skipping 9371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11213 const char* JSRegExp::ToCString() const { | 11218 const char* JSRegExp::ToCString() const { |
| 11214 const String& str = String::Handle(pattern()); | 11219 const String& str = String::Handle(pattern()); |
| 11215 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11220 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11216 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11221 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11217 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 11222 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 11218 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11223 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11219 return chars; | 11224 return chars; |
| 11220 } | 11225 } |
| 11221 | 11226 |
| 11222 } // namespace dart | 11227 } // namespace dart |
| OLD | NEW |