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

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

Issue 10399051: First shot at static type propagation and type test elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months 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) 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 816
817 // The name of this type's class, i.e. without the type argument names of this 817 // The name of this type's class, i.e. without the type argument names of this
818 // type. 818 // type.
819 RawString* ClassName() const; 819 RawString* ClassName() const;
820 820
821 // Check if this type represents the 'Dynamic' type. 821 // Check if this type represents the 'Dynamic' type.
822 bool IsDynamicType() const { 822 bool IsDynamicType() const {
823 return HasResolvedTypeClass() && (type_class() == Object::dynamic_class()); 823 return HasResolvedTypeClass() && (type_class() == Object::dynamic_class());
824 } 824 }
825 825
826 // Check if this type represents the 'Null' type.
827 bool IsNullType() const {
828 return HasResolvedTypeClass() && (type_class() == Object::null_class());
829 }
830
826 // Check if this type represents the 'void' type. 831 // Check if this type represents the 'void' type.
827 bool IsVoidType() const { 832 bool IsVoidType() const {
828 return HasResolvedTypeClass() && (type_class() == Object::void_class()); 833 return HasResolvedTypeClass() && (type_class() == Object::void_class());
829 } 834 }
830 835
831 bool IsObjectType() const { 836 bool IsObjectType() const {
832 return HasResolvedTypeClass() && 837 return HasResolvedTypeClass() &&
833 Class::Handle(type_class()).IsObjectClass(); 838 Class::Handle(type_class()).IsObjectClass();
834 } 839 }
835 840
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 if (is_static()) { 1300 if (is_static()) {
1296 return false; 1301 return false;
1297 } 1302 }
1298 switch (kind()) { 1303 switch (kind()) {
1299 case RawFunction::kFunction: 1304 case RawFunction::kFunction:
1300 case RawFunction::kGetterFunction: 1305 case RawFunction::kGetterFunction:
1301 case RawFunction::kSetterFunction: 1306 case RawFunction::kSetterFunction:
1302 case RawFunction::kImplicitGetter: 1307 case RawFunction::kImplicitGetter:
1303 case RawFunction::kImplicitSetter: 1308 case RawFunction::kImplicitSetter:
1304 return true; 1309 return true;
1310 case RawFunction::kClosureFunction:
1305 case RawFunction::kConstructor: 1311 case RawFunction::kConstructor:
1306 case RawFunction::kConstImplicitGetter: 1312 case RawFunction::kConstImplicitGetter:
1307 case RawFunction::kAbstract: 1313 case RawFunction::kAbstract:
1308 return false; 1314 return false;
1309 default: 1315 default:
1310 UNREACHABLE(); 1316 UNREACHABLE();
1311 return false; 1317 return false;
1312 } 1318 }
1313 } 1319 }
1314 bool IsStaticFunction() const { 1320 bool IsStaticFunction() const {
1315 if (!is_static()) { 1321 if (!is_static()) {
1316 return false; 1322 return false;
1317 } 1323 }
1318 switch (kind()) { 1324 switch (kind()) {
1319 case RawFunction::kFunction: 1325 case RawFunction::kFunction:
1320 case RawFunction::kGetterFunction: 1326 case RawFunction::kGetterFunction:
1321 case RawFunction::kSetterFunction: 1327 case RawFunction::kSetterFunction:
1322 case RawFunction::kImplicitGetter: 1328 case RawFunction::kImplicitGetter:
1323 case RawFunction::kImplicitSetter: 1329 case RawFunction::kImplicitSetter:
1324 case RawFunction::kConstImplicitGetter: 1330 case RawFunction::kConstImplicitGetter:
1325 return true; 1331 return true;
1332 case RawFunction::kClosureFunction:
1326 case RawFunction::kConstructor: 1333 case RawFunction::kConstructor:
1327 return false; 1334 return false;
1328 default: 1335 default:
1329 UNREACHABLE(); 1336 UNREACHABLE();
1330 return false; 1337 return false;
1331 } 1338 }
1332 } 1339 }
1333 bool IsInFactoryScope() const; 1340 bool IsInFactoryScope() const;
1334 1341
1335 intptr_t token_index() const { return raw_ptr()->token_index_; } 1342 intptr_t token_index() const { return raw_ptr()->token_index_; }
(...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4909 } 4916 }
4910 4917
4911 4918
4912 intptr_t Stackmap::SizeInBits() const { 4919 intptr_t Stackmap::SizeInBits() const {
4913 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 4920 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
4914 } 4921 }
4915 4922
4916 } // namespace dart 4923 } // namespace dart
4917 4924
4918 #endif // VM_OBJECT_H_ 4925 #endif // VM_OBJECT_H_
OLDNEW
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698