OLD | NEW |
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 RUNTIME_VM_CODE_DESCRIPTORS_H_ | 5 #ifndef RUNTIME_VM_CODE_DESCRIPTORS_H_ |
6 #define RUNTIME_VM_CODE_DESCRIPTORS_H_ | 6 #define RUNTIME_VM_CODE_DESCRIPTORS_H_ |
7 | 7 |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/datastream.h" | 10 #include "vm/datastream.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void BeginCodeSourceRange(int32_t pc_offset); | 234 void BeginCodeSourceRange(int32_t pc_offset); |
235 void EndCodeSourceRange(int32_t pc_offset, TokenPosition pos); | 235 void EndCodeSourceRange(int32_t pc_offset, TokenPosition pos); |
236 void NoteDescriptor(RawPcDescriptors::Kind kind, | 236 void NoteDescriptor(RawPcDescriptors::Kind kind, |
237 int32_t pc_offset, | 237 int32_t pc_offset, |
238 TokenPosition pos); | 238 TokenPosition pos); |
239 | 239 |
240 RawArray* InliningIdToFunction(); | 240 RawArray* InliningIdToFunction(); |
241 RawCodeSourceMap* Finalize(); | 241 RawCodeSourceMap* Finalize(); |
242 | 242 |
243 private: | 243 private: |
| 244 intptr_t GetFunctionId(intptr_t inline_id); |
| 245 |
244 void BufferChangePosition(TokenPosition pos) { | 246 void BufferChangePosition(TokenPosition pos) { |
245 buffered_token_pos_stack_.Last() = pos; | 247 buffered_token_pos_stack_.Last() = pos; |
246 } | 248 } |
247 void WriteChangePosition(TokenPosition pos); | 249 void WriteChangePosition(TokenPosition pos); |
248 void BufferAdvancePC(int32_t distance) { buffered_pc_offset_ += distance; } | 250 void BufferAdvancePC(int32_t distance) { buffered_pc_offset_ += distance; } |
249 void WriteAdvancePC(int32_t distance) { | 251 void WriteAdvancePC(int32_t distance) { |
250 stream_.Write<uint8_t>(kAdvancePC); | 252 stream_.Write<uint8_t>(kAdvancePC); |
251 stream_.Write<int32_t>(distance); | 253 stream_.Write<int32_t>(distance); |
252 written_pc_offset_ += distance; | 254 written_pc_offset_ += distance; |
253 } | 255 } |
254 void BufferPush(intptr_t inline_id) { | 256 void BufferPush(intptr_t inline_id) { |
255 buffered_inline_id_stack_.Add(inline_id); | 257 buffered_inline_id_stack_.Add(inline_id); |
256 buffered_token_pos_stack_.Add(kInitialPosition); | 258 buffered_token_pos_stack_.Add(kInitialPosition); |
257 } | 259 } |
258 void WritePush(intptr_t inline_id) { | 260 void WritePush(intptr_t inline_id) { |
259 stream_.Write<uint8_t>(kPushFunction); | 261 stream_.Write<uint8_t>(kPushFunction); |
260 stream_.Write<int32_t>(inline_id); | 262 stream_.Write<int32_t>(GetFunctionId(inline_id)); |
261 written_inline_id_stack_.Add(inline_id); | 263 written_inline_id_stack_.Add(inline_id); |
262 written_token_pos_stack_.Add(kInitialPosition); | 264 written_token_pos_stack_.Add(kInitialPosition); |
263 } | 265 } |
264 void BufferPop() { | 266 void BufferPop() { |
265 buffered_inline_id_stack_.RemoveLast(); | 267 buffered_inline_id_stack_.RemoveLast(); |
266 buffered_token_pos_stack_.RemoveLast(); | 268 buffered_token_pos_stack_.RemoveLast(); |
267 } | 269 } |
268 void WritePop() { | 270 void WritePop() { |
269 stream_.Write<uint8_t>(kPopFunction); | 271 stream_.Write<uint8_t>(kPopFunction); |
270 written_inline_id_stack_.RemoveLast(); | 272 written_inline_id_stack_.RemoveLast(); |
(...skipping 17 matching lines...) Expand all Loading... |
288 GrowableArray<TokenPosition> buffered_token_pos_stack_; | 290 GrowableArray<TokenPosition> buffered_token_pos_stack_; |
289 | 291 |
290 intptr_t written_pc_offset_; | 292 intptr_t written_pc_offset_; |
291 GrowableArray<intptr_t> written_inline_id_stack_; | 293 GrowableArray<intptr_t> written_inline_id_stack_; |
292 GrowableArray<TokenPosition> written_token_pos_stack_; | 294 GrowableArray<TokenPosition> written_token_pos_stack_; |
293 | 295 |
294 const GrowableArray<intptr_t>& caller_inline_id_; | 296 const GrowableArray<intptr_t>& caller_inline_id_; |
295 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; | 297 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; |
296 const GrowableArray<const Function*>& inline_id_to_function_; | 298 const GrowableArray<const Function*>& inline_id_to_function_; |
297 | 299 |
| 300 const GrowableObjectArray& inlined_functions_; |
| 301 |
298 uint8_t* buffer_; | 302 uint8_t* buffer_; |
299 WriteStream stream_; | 303 WriteStream stream_; |
300 | 304 |
301 const bool stack_traces_only_; | 305 const bool stack_traces_only_; |
302 | 306 |
303 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); | 307 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); |
304 }; | 308 }; |
305 | 309 |
306 | 310 |
307 class CodeSourceMapReader : public ValueObject { | 311 class CodeSourceMapReader : public ValueObject { |
(...skipping 14 matching lines...) Expand all Loading... |
322 const CodeSourceMap& map_; | 326 const CodeSourceMap& map_; |
323 const Array& functions_; | 327 const Array& functions_; |
324 const Function& root_; | 328 const Function& root_; |
325 | 329 |
326 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapReader); | 330 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapReader); |
327 }; | 331 }; |
328 | 332 |
329 } // namespace dart | 333 } // namespace dart |
330 | 334 |
331 #endif // RUNTIME_VM_CODE_DESCRIPTORS_H_ | 335 #endif // RUNTIME_VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |