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

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

Issue 8503034: Add type check tracing (--trace_type_checks). Inline type checks with class types that have only ... (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
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 (type_class() == Type::Handle(Type::StringInterface()).type_class()); 1797 (type_class() == Type::Handle(Type::StringInterface()).type_class());
1798 } 1798 }
1799 1799
1800 1800
1801 bool Type::IsFunctionInterface() const { 1801 bool Type::IsFunctionInterface() const {
1802 return HasResolvedTypeClass() && 1802 return HasResolvedTypeClass() &&
1803 (type_class() == Type::Handle(Type::FunctionInterface()).type_class()); 1803 (type_class() == Type::Handle(Type::FunctionInterface()).type_class());
1804 } 1804 }
1805 1805
1806 1806
1807 bool Type::IsListInterface() const {
1808 return HasResolvedTypeClass() &&
1809 (type_class() == Type::Handle(Type::ListInterface()).type_class());
1810 }
1811
1812
1807 bool Type::IsMoreSpecificThan(const Type& other) const { 1813 bool Type::IsMoreSpecificThan(const Type& other) const {
1808 ASSERT(IsFinalized()); 1814 ASSERT(IsFinalized());
1809 ASSERT(other.IsFinalized()); 1815 ASSERT(other.IsFinalized());
1810 // Type parameters cannot be handled by Class::IsMoreSpecificThan(). 1816 // Type parameters cannot be handled by Class::IsMoreSpecificThan().
1811 if (IsTypeParameter() || other.IsTypeParameter()) { 1817 if (IsTypeParameter() || other.IsTypeParameter()) {
1812 return IsTypeParameter() && other.IsTypeParameter() && 1818 return IsTypeParameter() && other.IsTypeParameter() &&
1813 (Index() == other.Index()); 1819 (Index() == other.Index());
1814 } 1820 }
1815 const Class& cls = Class::Handle(type_class()); 1821 const Class& cls = Class::Handle(type_class());
1816 return cls.IsMoreSpecificThan(TypeArguments::Handle(arguments()), 1822 return cls.IsMoreSpecificThan(TypeArguments::Handle(arguments()),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 RawType* Type::StringInterface() { 1890 RawType* Type::StringInterface() {
1885 return Isolate::Current()->object_store()->string_interface(); 1891 return Isolate::Current()->object_store()->string_interface();
1886 } 1892 }
1887 1893
1888 1894
1889 RawType* Type::FunctionInterface() { 1895 RawType* Type::FunctionInterface() {
1890 return Isolate::Current()->object_store()->function_interface(); 1896 return Isolate::Current()->object_store()->function_interface();
1891 } 1897 }
1892 1898
1893 1899
1900 RawType* Type::ListInterface() {
1901 return Isolate::Current()->object_store()->list_interface();
1902 }
1903
1904
1894 RawType* Type::NewRawType(const Class& type_class) { 1905 RawType* Type::NewRawType(const Class& type_class) {
1895 const TypeArguments& type_arguments = 1906 const TypeArguments& type_arguments =
1896 TypeArguments::Handle(type_class.type_parameter_extends()); 1907 TypeArguments::Handle(type_class.type_parameter_extends());
1897 return NewParameterizedType(Object::Handle(type_class.raw()), type_arguments); 1908 return NewParameterizedType(Object::Handle(type_class.raw()), type_arguments);
1898 } 1909 }
1899 1910
1900 1911
1901 RawType* Type::NewNonParameterizedType(const Class& type_class) { 1912 RawType* Type::NewNonParameterizedType(const Class& type_class) {
1902 ASSERT(!type_class.HasTypeArguments()); 1913 ASSERT(!type_class.HasTypeArguments());
1903 const TypeArguments& no_type_arguments = TypeArguments::Handle(); 1914 const TypeArguments& no_type_arguments = TypeArguments::Handle();
(...skipping 5040 matching lines...) Expand 10 before | Expand all | Expand 10 after
6944 const String& str = String::Handle(pattern()); 6955 const String& str = String::Handle(pattern());
6945 const char* format = "JSRegExp: pattern=%s flags=%s"; 6956 const char* format = "JSRegExp: pattern=%s flags=%s";
6946 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 6957 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
6947 char* chars = reinterpret_cast<char*>( 6958 char* chars = reinterpret_cast<char*>(
6948 Isolate::Current()->current_zone()->Allocate(len + 1)); 6959 Isolate::Current()->current_zone()->Allocate(len + 1));
6949 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 6960 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
6950 return chars; 6961 return chars;
6951 } 6962 }
6952 6963
6953 } // namespace dart 6964 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698