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

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

Issue 9475031: Cleaned up usage of Function::code, since it may be misunderstood that it points to the only Code o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/code_index_table.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_CODE_INDEX_TABLE_H_ 5 #ifndef VM_CODE_INDEX_TABLE_H_
6 #define VM_CODE_INDEX_TABLE_H_ 6 #define VM_CODE_INDEX_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 // Forward declarations. 13 // Forward declarations.
14 class Array; 14 class Array;
15 class Code; 15 class Code;
16 class Function; 16 class Function;
17 class Isolate; 17 class Isolate;
18 class ObjectPointerVisitor; 18 class ObjectPointerVisitor;
19 class RawArray; 19 class RawArray;
20 class RawCode; 20 class RawCode;
21 class RawFunction; 21 class RawFunction;
22 22
23 // This class is used to lookup a Function object given a pc. 23 // This class is used to lookup a Code object given a pc.
24 // This functionality is used while stack walking in order to find the Dart 24 // This functionality is used while stack walking in order to find the Dart
25 // function corresponding to a frame (enables the pc descriptors for 25 // function corresponding to a frame (enables the pc descriptors for
26 // a stack frame to be located). 26 // a stack frame to be located).
27 // Most functions fit within a normal page (PageSpace::KPageSize) but some 27 // Most code objects fit within a normal page (PageSpace::KPageSize) but some
28 // functions may have code which is larger than the size of a normal page. 28 // code objects may be larger than the size of a normal page.
29 // These functions are referred to as large functions in this code and are 29 // These code objects are referred to as "large codes" in this code and are
30 // handled by maintaining separate index lists. 30 // handled by maintaining separate index lists.
31 class CodeIndexTable { 31 class CodeIndexTable {
32 public: 32 public:
33 ~CodeIndexTable(); 33 ~CodeIndexTable();
34 34
35 // Add specified compiled function to the code index table. 35 // Add specified compiled function to the code index table.
36 void AddFunction(const Function& func); 36 void AddCode(const Code& code);
37 37
38 // Lookup code index table to find the function corresponding to the 38 // Lookup code index table to find the code object corresponding to the
39 // specified 'pc'. If there is no corresponding function a null object 39 // specified 'pc'. If there is no corresponding code object a null object
40 // is returned. 40 // is returned.
41 RawFunction* LookupFunction(uword pc) const;
42
43 // Lookup code index table to find corresponding code object.
44 RawCode* LookupCode(uword pc) const; 41 RawCode* LookupCode(uword pc) const;
45 42
46 // Visit all object pointers (support for GC). 43 // Visit all object pointers (support for GC).
47 void VisitObjectPointers(ObjectPointerVisitor* visitor); 44 void VisitObjectPointers(ObjectPointerVisitor* visitor);
48 45
49 // Initialize the code index table for specified isolate. 46 // Initialize the code index table for specified isolate.
50 static void Init(Isolate* isolate); 47 static void Init(Isolate* isolate);
51 48
52 private: 49 private:
53 static const int kInitialSize = 16; 50 static const int kInitialSize = 16;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 111
115 // Constructor. 112 // Constructor.
116 CodeIndexTable(); 113 CodeIndexTable();
117 114
118 // Add code page information to the index table. 115 // Add code page information to the index table.
119 int AddPageIndex(uword page_start); 116 int AddPageIndex(uword page_start);
120 117
121 // Find the index corresponding to the code page in the index table. 118 // Find the index corresponding to the code page in the index table.
122 int FindPageIndex(uword page_start) const; 119 int FindPageIndex(uword page_start) const;
123 120
124 // Add information about a function (entrypoint, size, function object) 121 // Add information about a code object (entrypoint, size, code object)
125 // at the specified index of the index table. 122 // at the specified index of the index table.
126 void AddFunctionToList(int page_index, 123 void AddCodeToList(int page_index,
127 uword entrypoint,
128 intptr_t size,
129 const Function& func);
130
131 // Add information about a large function (entrypoint, size, function object)
132 // to the large function list.
133 void AddLargeFunction(uword entrypoint, intptr_t size, const Function& func);
134
135 // Helper function to add a function to the list.
136 void AddFuncHelper(IndexArray<PcRange>* pc_ranges,
137 const Array& functions,
138 uword entrypoint, 124 uword entrypoint,
139 intptr_t size, 125 intptr_t size,
140 const Function& func); 126 const Code& code);
127
128 // Add information about a large code object (entrypoint, size, code object)
129 // to the large code object list.
130 void AddLargeCode(uword entrypoint, intptr_t size, const Code& code);
131
132 // Helper function to add a code object to the list.
133 void AddCodeHelper(IndexArray<PcRange>* pc_ranges,
134 const Array& codes,
135 uword entrypoint,
136 intptr_t size,
137 const Code& func);
141 138
142 // Lookup code corresponding to the pc in the large functions list 139 // Lookup code corresponding to the pc in the large functions list
143 RawCode* LookupLargeCode(uword pc) const; 140 RawCode* LookupLargeCode(uword pc) const;
144 141
145 // Lookup code corresponding to the pc in the functions list 142 // Lookup code corresponding to the pc in the functions list
146 // present at the specified page index. 143 // present at the specified page index.
147 static RawCode* LookupCodeFromList(IndexArray<PcRange>* pc_ranges, 144 static RawCode* LookupCodeFromList(IndexArray<PcRange>* pc_ranges,
148 const Array& functions, 145 const Array& functions,
149 uword pc, 146 uword pc,
150 bool sorted); 147 bool sorted);
(...skipping 11 matching lines...) Expand all
162 RawArray* code_lists_; // Array of pointers to code lists (arrays). 159 RawArray* code_lists_; // Array of pointers to code lists (arrays).
163 IndexArray<PcRange>* largecode_pc_ranges_; // pc ranges of large codes. 160 IndexArray<PcRange>* largecode_pc_ranges_; // pc ranges of large codes.
164 RawArray* largecode_list_; // Array of pointer to large code objects. 161 RawArray* largecode_list_; // Array of pointer to large code objects.
165 162
166 DISALLOW_COPY_AND_ASSIGN(CodeIndexTable); 163 DISALLOW_COPY_AND_ASSIGN(CodeIndexTable);
167 }; 164 };
168 165
169 } // namespace dart 166 } // namespace dart
170 167
171 #endif // VM_CODE_INDEX_TABLE_H_ 168 #endif // VM_CODE_INDEX_TABLE_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/code_index_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698