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

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

Issue 1217323002: Intrinsic version of Object.runtimeType (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: more Created 5 years, 5 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
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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 static intptr_t type_arguments_field_offset_in_words_offset() { 1042 static intptr_t type_arguments_field_offset_in_words_offset() {
1043 return OFFSET_OF(RawClass, type_arguments_field_offset_in_words_); 1043 return OFFSET_OF(RawClass, type_arguments_field_offset_in_words_);
1044 } 1044 }
1045 1045
1046 RawType* CanonicalType() const { 1046 RawType* CanonicalType() const {
1047 if ((NumTypeArguments() == 0) && !IsSignatureClass()) { 1047 if ((NumTypeArguments() == 0) && !IsSignatureClass()) {
1048 return reinterpret_cast<RawType*>(raw_ptr()->canonical_types_); 1048 return reinterpret_cast<RawType*>(raw_ptr()->canonical_types_);
1049 } 1049 }
1050 return reinterpret_cast<RawType*>(Object::null()); 1050 return reinterpret_cast<RawType*>(Object::null());
1051 } 1051 }
1052 static intptr_t canonical_types_offset() {
1053 return OFFSET_OF(RawClass, canonical_types_);
1054 }
1052 1055
1053 // The super type of this class, Object type if not explicitly specified. 1056 // The super type of this class, Object type if not explicitly specified.
1054 // Note that the super type may be bounded, as in this example: 1057 // Note that the super type may be bounded, as in this example:
1055 // class C<T> extends S<T> { }; class S<T extends num> { }; 1058 // class C<T> extends S<T> { }; class S<T extends num> { };
1056 RawAbstractType* super_type() const { return raw_ptr()->super_type_; } 1059 RawAbstractType* super_type() const { return raw_ptr()->super_type_; }
1057 void set_super_type(const AbstractType& value) const; 1060 void set_super_type(const AbstractType& value) const;
1058 static intptr_t super_type_offset() { 1061 static intptr_t super_type_offset() {
1059 return OFFSET_OF(RawClass, super_type_); 1062 return OFFSET_OF(RawClass, super_type_);
1060 } 1063 }
1061 1064
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 // functions_hash_table is in use iff there are at least this many functions. 1438 // functions_hash_table is in use iff there are at least this many functions.
1436 static const intptr_t kFunctionLookupHashTreshold = 16; 1439 static const intptr_t kFunctionLookupHashTreshold = 16;
1437 1440
1438 // Initial value for the cached number of type arguments. 1441 // Initial value for the cached number of type arguments.
1439 static const intptr_t kUnknownNumTypeArguments = -1; 1442 static const intptr_t kUnknownNumTypeArguments = -1;
1440 1443
1441 int16_t num_type_arguments() const { 1444 int16_t num_type_arguments() const {
1442 return raw_ptr()->num_type_arguments_; 1445 return raw_ptr()->num_type_arguments_;
1443 } 1446 }
1444 void set_num_type_arguments(intptr_t value) const; 1447 void set_num_type_arguments(intptr_t value) const;
1448 static intptr_t num_type_arguments_offset() {
1449 return OFFSET_OF(RawClass, num_type_arguments_);
1450 }
1445 1451
1446 int16_t num_own_type_arguments() const { 1452 int16_t num_own_type_arguments() const {
1447 return raw_ptr()->num_own_type_arguments_; 1453 return raw_ptr()->num_own_type_arguments_;
1448 } 1454 }
1449 void set_num_own_type_arguments(intptr_t value) const; 1455 void set_num_own_type_arguments(intptr_t value) const;
1450 1456
1451 // Assigns empty array to all raw class array fields. 1457 // Assigns empty array to all raw class array fields.
1452 void InitEmptyFields(); 1458 void InitEmptyFields();
1453 1459
1454 static RawFunction* CheckFunctionType(const Function& func, MemberKind kind); 1460 static RawFunction* CheckFunctionType(const Function& func, MemberKind kind);
(...skipping 22 matching lines...) Expand all
1477 const TypeArguments& type_arguments, 1483 const TypeArguments& type_arguments,
1478 const Class& other, 1484 const Class& other,
1479 const TypeArguments& other_type_arguments, 1485 const TypeArguments& other_type_arguments,
1480 Error* bound_error); 1486 Error* bound_error);
1481 1487
1482 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); 1488 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object);
1483 friend class AbstractType; 1489 friend class AbstractType;
1484 friend class Instance; 1490 friend class Instance;
1485 friend class Object; 1491 friend class Object;
1486 friend class Type; 1492 friend class Type;
1493 friend class Intrinsifier;
1487 }; 1494 };
1488 1495
1489 1496
1490 // Unresolved class is used for storing unresolved names which will be resolved 1497 // Unresolved class is used for storing unresolved names which will be resolved
1491 // to a class after all classes have been loaded and finalized. 1498 // to a class after all classes have been loaded and finalized.
1492 class UnresolvedClass : public Object { 1499 class UnresolvedClass : public Object {
1493 public: 1500 public:
1494 RawLibraryPrefix* library_prefix() const { 1501 RawLibraryPrefix* library_prefix() const {
1495 return raw_ptr()->library_prefix_; 1502 return raw_ptr()->library_prefix_;
1496 } 1503 }
(...skipping 6486 matching lines...) Expand 10 before | Expand all | Expand 10 after
7983 7990
7984 7991
7985 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7992 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7986 intptr_t index) { 7993 intptr_t index) {
7987 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7994 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7988 } 7995 }
7989 7996
7990 } // namespace dart 7997 } // namespace dart
7991 7998
7992 #endif // VM_OBJECT_H_ 7999 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698