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

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

Issue 10407019: Extend assembler with ability to produce comments for the generated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 ASSERT((index >=0) && (index < Length())); 2136 ASSERT((index >=0) && (index < Length()));
2137 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 2137 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
2138 return &raw_ptr()->data_[data_index]; 2138 return &raw_ptr()->data_[data_index];
2139 } 2139 }
2140 2140
2141 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); 2141 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object);
2142 friend class Class; 2142 friend class Class;
2143 }; 2143 };
2144 2144
2145 2145
2146 class CodeComments : public ValueObject {
srdjan 2012/05/17 17:22:08 Please move CodeComments inside class Code.
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2147 public:
2148 enum {
2149 kPCEntry = 0,
2150 kCommentEntry,
2151 kNumberOfEntries
2152 };
srdjan 2012/05/17 17:22:08 name the enum, and why do you need it?
srdjan 2012/05/17 17:22:08 name the enum, and why do you need it?
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Discussed offline. Moved enum to private section.
2153
2154 static CodeComments New(int count);
srdjan 2012/05/17 17:22:08 Memory sizes are in intptr_t.
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2155
2156 intptr_t Length();
2157
2158 intptr_t PCAt(int idx);
srdjan 2012/05/17 17:22:08 Is it PC or PCOffset?
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2159 void SetPCAt(int idx, intptr_t pc);
srdjan 2012/05/17 17:22:08 pc_offset?
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2160
2161 const String& CommentAt(int idx);
srdjan 2012/05/17 17:22:08 const?
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2162 void SetCommentAt(int idx, const String& comment);
2163
2164 private:
2165 explicit CodeComments(RawArray* comments);
2166 CodeComments();
srdjan 2012/05/17 17:22:08 Remove this constructor once it becomes ZoneObject
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
2167
2168 const Array& comments_;
2169
2170 friend class Code;
srdjan 2012/05/17 17:22:08 Remove this once moved inside class Code, I guess.
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Moving one class into another does not make these
2171 };
2172
2173
2146 class Code : public Object { 2174 class Code : public Object {
2147 public: 2175 public:
2148 RawInstructions* instructions() const { return raw_ptr()->instructions_; } 2176 RawInstructions* instructions() const { return raw_ptr()->instructions_; }
2149 static intptr_t instructions_offset() { 2177 static intptr_t instructions_offset() {
2150 return OFFSET_OF(RawCode, instructions_); 2178 return OFFSET_OF(RawCode, instructions_);
2151 } 2179 }
2152 intptr_t pointer_offsets_length() const { 2180 intptr_t pointer_offsets_length() const {
2153 return raw_ptr()->pointer_offsets_length_; 2181 return raw_ptr()->pointer_offsets_length_;
2154 } 2182 }
2155 bool is_optimized() const { 2183 bool is_optimized() const {
(...skipping 17 matching lines...) Expand all
2173 void set_pc_descriptors(const PcDescriptors& descriptors) const { 2201 void set_pc_descriptors(const PcDescriptors& descriptors) const {
2174 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); 2202 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw());
2175 } 2203 }
2176 2204
2177 RawArray* stackmaps() const { 2205 RawArray* stackmaps() const {
2178 return raw_ptr()->stackmaps_; 2206 return raw_ptr()->stackmaps_;
2179 } 2207 }
2180 void set_stackmaps(const Array& maps) const; 2208 void set_stackmaps(const Array& maps) const;
2181 RawStackmap* GetStackmap(uword pc, Array* stackmaps, Stackmap* map) const; 2209 RawStackmap* GetStackmap(uword pc, Array* stackmaps, Stackmap* map) const;
2182 2210
2211 CodeComments comments() const;
srdjan 2012/05/17 17:22:08 const CodeComments&
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done. However both Code::Comments::New and Code::c
Ivan Posva 2012/05/22 22:40:02 Maybe the real solution should be that the code co
2212 void set_comments(const CodeComments& comments) const;
2213
2183 RawLocalVarDescriptors* var_descriptors() const { 2214 RawLocalVarDescriptors* var_descriptors() const {
2184 return raw_ptr()->var_descriptors_; 2215 return raw_ptr()->var_descriptors_;
2185 } 2216 }
2186 void set_var_descriptors(const LocalVarDescriptors& value) const { 2217 void set_var_descriptors(const LocalVarDescriptors& value) const {
2187 StorePointer(&raw_ptr()->var_descriptors_, value.raw()); 2218 StorePointer(&raw_ptr()->var_descriptors_, value.raw());
2188 } 2219 }
2189 2220
2190 RawExceptionHandlers* exception_handlers() const { 2221 RawExceptionHandlers* exception_handlers() const {
2191 return raw_ptr()->exception_handlers_; 2222 return raw_ptr()->exception_handlers_;
2192 } 2223 }
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4916 } 4947 }
4917 4948
4918 4949
4919 intptr_t Stackmap::SizeInBits() const { 4950 intptr_t Stackmap::SizeInBits() const {
4920 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 4951 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
4921 } 4952 }
4922 4953
4923 } // namespace dart 4954 } // namespace dart
4924 4955
4925 #endif // VM_OBJECT_H_ 4956 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698