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

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

Issue 1157003003: Add TypedData instance kinds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 6779 matching lines...) Expand 10 before | Expand all | Expand 10 after
6790 intptr_t Length() const { 6790 intptr_t Length() const {
6791 ASSERT(!IsNull()); 6791 ASSERT(!IsNull());
6792 return Smi::Value(raw_ptr()->length_); 6792 return Smi::Value(raw_ptr()->length_);
6793 } 6793 }
6794 6794
6795 intptr_t ElementSizeInBytes() const { 6795 intptr_t ElementSizeInBytes() const {
6796 intptr_t cid = raw()->GetClassId(); 6796 intptr_t cid = raw()->GetClassId();
6797 return ElementSizeInBytes(cid); 6797 return ElementSizeInBytes(cid);
6798 } 6798 }
6799 6799
6800 const char* ElementTypeName() const {
6801 switch (ElementType()) {
6802 #define V(name) case k##name##Element: return #name;
6803 CLASS_LIST_TYPED_DATA(V)
6804 #undef V
6805 }
6806 UNREACHABLE();
6807 return "UnknownTypedDataElementType";
6808 }
6800 6809
6801 TypedDataElementType ElementType() const { 6810 TypedDataElementType ElementType() const {
6802 intptr_t cid = raw()->GetClassId(); 6811 intptr_t cid = raw()->GetClassId();
6803 return ElementType(cid); 6812 return ElementType(cid);
6804 } 6813 }
6805 6814
6806 intptr_t LengthInBytes() const { 6815 intptr_t LengthInBytes() const {
6807 intptr_t cid = raw()->GetClassId(); 6816 intptr_t cid = raw()->GetClassId();
6808 return (ElementSizeInBytes(cid) * Length()); 6817 return (ElementSizeInBytes(cid) * Length());
6809 } 6818 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
6966 intptr_t Length() const { 6975 intptr_t Length() const {
6967 ASSERT(!IsNull()); 6976 ASSERT(!IsNull());
6968 return Smi::Value(raw_ptr()->length_); 6977 return Smi::Value(raw_ptr()->length_);
6969 } 6978 }
6970 6979
6971 intptr_t ElementSizeInBytes() const { 6980 intptr_t ElementSizeInBytes() const {
6972 intptr_t cid = raw()->GetClassId(); 6981 intptr_t cid = raw()->GetClassId();
6973 return ElementSizeInBytes(cid); 6982 return ElementSizeInBytes(cid);
6974 } 6983 }
6975 6984
6985 const char* ElementTypeName() const {
6986 switch (ElementType()) {
6987 #define V(name) case k##name##Element: return #name;
6988 CLASS_LIST_TYPED_DATA(V)
6989 #undef V
6990 }
6991 UNREACHABLE();
6992 return "UnknownTypedDataElementType";
6993 }
6994
6976 TypedDataElementType ElementType() const { 6995 TypedDataElementType ElementType() const {
6977 intptr_t cid = raw()->GetClassId(); 6996 intptr_t cid = raw()->GetClassId();
6978 return ElementType(cid); 6997 return ElementType(cid);
6979 } 6998 }
6980 6999
6981 intptr_t LengthInBytes() const { 7000 intptr_t LengthInBytes() const {
6982 intptr_t cid = raw()->GetClassId(); 7001 intptr_t cid = raw()->GetClassId();
6983 return (ElementSizeInBytes(cid) * Length()); 7002 return (ElementSizeInBytes(cid) * Length());
6984 } 7003 }
6985 7004
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
7848 7867
7849 7868
7850 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7869 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7851 intptr_t index) { 7870 intptr_t index) {
7852 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7871 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7853 } 7872 }
7854 7873
7855 } // namespace dart 7874 } // namespace dart
7856 7875
7857 #endif // VM_OBJECT_H_ 7876 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698