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 #include "vm/code_descriptors.h" | 5 #include "vm/code_descriptors.h" |
6 | 6 |
7 #include "vm/log.h" | 7 #include "vm/log.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 FlushBuffer(); | 308 FlushBuffer(); |
309 } | 309 } |
310 intptr_t length = stream_.bytes_written(); | 310 intptr_t length = stream_.bytes_written(); |
311 const CodeSourceMap& map = CodeSourceMap::Handle(CodeSourceMap::New(length)); | 311 const CodeSourceMap& map = CodeSourceMap::Handle(CodeSourceMap::New(length)); |
312 NoSafepointScope no_safepoint; | 312 NoSafepointScope no_safepoint; |
313 memmove(map.Data(), buffer_, length); | 313 memmove(map.Data(), buffer_, length); |
314 return map.raw(); | 314 return map.raw(); |
315 } | 315 } |
316 | 316 |
317 | 317 |
| 318 void CodeSourceMapBuilder::WriteChangePosition(TokenPosition pos) { |
| 319 stream_.Write<uint8_t>(kChangePosition); |
| 320 if (FLAG_precompiled_mode) { |
| 321 intptr_t line = -1; |
| 322 intptr_t inline_id = buffered_inline_id_stack_.Last(); |
| 323 if (inline_id < inline_id_to_function_.length()) { |
| 324 const Function* function = inline_id_to_function_[inline_id]; |
| 325 Script& script = Script::Handle(function->script()); |
| 326 line = script.GetTokenLineUsingLineStarts(pos); |
| 327 } |
| 328 stream_.Write<int32_t>(static_cast<int32_t>(line)); |
| 329 } else { |
| 330 stream_.Write<int32_t>(static_cast<int32_t>(pos.value())); |
| 331 } |
| 332 written_token_pos_stack_.Last() = pos; |
| 333 } |
| 334 |
| 335 |
318 void CodeSourceMapReader::GetInlinedFunctionsAt( | 336 void CodeSourceMapReader::GetInlinedFunctionsAt( |
319 int32_t pc_offset, | 337 int32_t pc_offset, |
320 GrowableArray<const Function*>* function_stack, | 338 GrowableArray<const Function*>* function_stack, |
321 GrowableArray<TokenPosition>* token_positions) { | 339 GrowableArray<TokenPosition>* token_positions) { |
322 function_stack->Clear(); | 340 function_stack->Clear(); |
323 token_positions->Clear(); | 341 token_positions->Clear(); |
324 | 342 |
325 NoSafepointScope no_safepoint; | 343 NoSafepointScope no_safepoint; |
326 ReadStream stream(map_.Data(), map_.Length()); | 344 ReadStream stream(map_.Data(), map_.Length()); |
327 | 345 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 break; | 541 break; |
524 } | 542 } |
525 default: | 543 default: |
526 UNREACHABLE(); | 544 UNREACHABLE(); |
527 } | 545 } |
528 } | 546 } |
529 THR_Print("}\n"); | 547 THR_Print("}\n"); |
530 } | 548 } |
531 | 549 |
532 } // namespace dart | 550 } // namespace dart |
OLD | NEW |