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

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

Issue 24075002: Expose field data, use class id, and merge all collections into "objects" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | runtime/vm/class_table.cc » ('j') | runtime/vm/object.cc » ('J')
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_CLASS_TABLE_H_ 5 #ifndef VM_CLASS_TABLE_H_
6 #define VM_CLASS_TABLE_H_ 6 #define VM_CLASS_TABLE_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 class Class; 13 class Class;
14 class ObjectPointerVisitor; 14 class ObjectPointerVisitor;
15 class RawClass; 15 class RawClass;
16 class JSONStream;
16 17
17 class ClassTable { 18 class ClassTable {
18 public: 19 public:
19 ClassTable(); 20 ClassTable();
20 ~ClassTable(); 21 ~ClassTable();
21 22
22 RawClass* At(intptr_t index) const { 23 RawClass* At(intptr_t index) const {
23 ASSERT(IsValidIndex(index)); 24 ASSERT(IsValidIndex(index));
24 return table_[index]; 25 return table_[index];
25 } 26 }
26 27
27 intptr_t IsValidIndex(intptr_t index) const { 28 intptr_t IsValidIndex(intptr_t index) const {
28 return (index > 0) && (index < top_); 29 return (index > 0) && (index < top_);
29 } 30 }
30 31
31 bool HasValidClassAt(intptr_t index) const { 32 bool HasValidClassAt(intptr_t index) const {
32 ASSERT(IsValidIndex(index)); 33 ASSERT(IsValidIndex(index));
33 return table_[index] != NULL; 34 return table_[index] != NULL;
34 } 35 }
35 36
36 intptr_t NumCids() const { return top_; } 37 intptr_t NumCids() const { return top_; }
37 38
38 void Register(const Class& cls); 39 void Register(const Class& cls);
39 40
40 void VisitObjectPointers(ObjectPointerVisitor* visitor); 41 void VisitObjectPointers(ObjectPointerVisitor* visitor);
41 42
42 void Print(); 43 void Print();
43 44
45 void PrintToJSONStream(JSONStream* stream);
46
44 static intptr_t table_offset() { 47 static intptr_t table_offset() {
45 return OFFSET_OF(ClassTable, table_); 48 return OFFSET_OF(ClassTable, table_);
46 } 49 }
47 50
48 private: 51 private:
49 static const int initial_capacity_ = 512; 52 static const int initial_capacity_ = 512;
50 static const int capacity_increment_ = 256; 53 static const int capacity_increment_ = 256;
51 54
52 intptr_t top_; 55 intptr_t top_;
53 intptr_t capacity_; 56 intptr_t capacity_;
54 57
55 RawClass** table_; 58 RawClass** table_;
56 59
57 DISALLOW_COPY_AND_ASSIGN(ClassTable); 60 DISALLOW_COPY_AND_ASSIGN(ClassTable);
58 }; 61 };
59 62
60 } // namespace dart 63 } // namespace dart
61 64
62 #endif // VM_CLASS_TABLE_H_ 65 #endif // VM_CLASS_TABLE_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/class_table.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698