1// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
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.
4#if !defined(DART_PRECOMPILED_RUNTIME) && \
5 (!defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER))
6
7#include "vm/code_comments.h"
8
9namespace dart {
10
11const Code::Comments& CreateCommentsFrom(compiler::Assembler* assembler) {
12 const auto& comments = assembler->comments();
13 Code::Comments& result = Code::Comments::New(comments.length());
14
15 for (intptr_t i = 0; i < comments.length(); i++) {
16 result.SetPCOffsetAt(i, comments[i]->pc_offset());
17 result.SetCommentAt(i, comments[i]->comment());
18 }
19
20 return result;
21}
22
23} // namespace dart
24#endif // !defined(DART_PRECOMPILED_RUNTIME) && \
25 // (!defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER))
26