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

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

Issue 1947753002: More efficient identification of dynamic and void types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | 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) 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 5454 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 5465
5466 // Returns a formatted list of occuring types with their URI. 5466 // Returns a formatted list of occuring types with their URI.
5467 virtual RawString* EnumerateURIs() const; 5467 virtual RawString* EnumerateURIs() const;
5468 5468
5469 virtual intptr_t Hash() const; 5469 virtual intptr_t Hash() const;
5470 5470
5471 // The name of this type's class, i.e. without the type argument names of this 5471 // The name of this type's class, i.e. without the type argument names of this
5472 // type. 5472 // type.
5473 RawString* ClassName() const; 5473 RawString* ClassName() const;
5474 5474
5475 // Check if this type represents the 'dynamic' type. 5475 // Check if this type represents the 'dynamic' type or if it is malformed,
5476 bool IsDynamicType() const { 5476 // since a malformed type is mapped to 'dynamic'.
5477 return !IsFunctionType() && 5477 // Call IsMalformed() first, if distinction is required.
5478 HasResolvedTypeClass() && 5478 bool IsDynamicType() const;
5479 (type_class() == Object::dynamic_class()); 5479
5480 } 5480 // Check if this type represents the 'void' type.
5481 bool IsVoidType() const;
5481 5482
5482 // Check if this type represents the 'Null' type. 5483 // Check if this type represents the 'Null' type.
5483 bool IsNullType() const; 5484 bool IsNullType() const;
5484 5485
5485 // Check if this type represents the 'void' type.
5486 bool IsVoidType() const {
5487 return !IsFunctionType() &&
5488 HasResolvedTypeClass() &&
5489 (type_class() == Object::void_class());
5490 }
5491
5492 bool IsObjectType() const { 5486 bool IsObjectType() const {
5493 return !IsFunctionType() && 5487 return !IsFunctionType() &&
5494 HasResolvedTypeClass() && 5488 HasResolvedTypeClass() &&
5495 Class::Handle(type_class()).IsObjectClass(); 5489 Class::Handle(type_class()).IsObjectClass();
5496 } 5490 }
5497 5491
5498 // Check if this type represents the 'bool' type. 5492 // Check if this type represents the 'bool' type.
5499 bool IsBoolType() const; 5493 bool IsBoolType() const;
5500 5494
5501 // Check if this type represents the 'int' type. 5495 // Check if this type represents the 'int' type.
(...skipping 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after
8528 8522
8529 8523
8530 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8524 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8531 intptr_t index) { 8525 intptr_t index) {
8532 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8526 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8533 } 8527 }
8534 8528
8535 } // namespace dart 8529 } // namespace dart
8536 8530
8537 #endif // VM_OBJECT_H_ 8531 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698