OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" | 5 #include "vm/kernel_binary_flowgraph.h" |
6 | 6 |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
10 | 10 |
(...skipping 7166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7177 SkipBytes(length); | 7177 SkipBytes(length); |
7178 intptr_t line_count = ReadUInt(); | 7178 intptr_t line_count = ReadUInt(); |
7179 for (intptr_t j = 0; j < line_count; ++j) { | 7179 for (intptr_t j = 0; j < line_count; ++j) { |
7180 ReadUInt(); | 7180 ReadUInt(); |
7181 } | 7181 } |
7182 } | 7182 } |
7183 | 7183 |
7184 return String::Handle(String::null()); | 7184 return String::Handle(String::null()); |
7185 } | 7185 } |
7186 | 7186 |
7187 Array& StreamingFlowGraphBuilder::GetLineStartsFor(intptr_t index) { | 7187 TypedData& StreamingFlowGraphBuilder::GetLineStartsFor(intptr_t index) { |
7188 AlternativeReadingScope alt(reader_); | 7188 AlternativeReadingScope alt(reader_); |
7189 SetOffset(reader_->size() - 4); | 7189 SetOffset(reader_->size() - 4); |
7190 intptr_t library_count = reader_->ReadUInt32(); | 7190 intptr_t library_count = reader_->ReadUInt32(); |
7191 SetOffset(reader_->size() - 4 - 4 * library_count - 3 * 4); | 7191 SetOffset(reader_->size() - 4 - 4 * library_count - 3 * 4); |
7192 SetOffset(reader_->ReadUInt32()); // read source table offset. | 7192 SetOffset(reader_->ReadUInt32()); // read source table offset. |
7193 intptr_t size = ReadUInt(); // read source table size. | 7193 intptr_t size = ReadUInt(); // read source table size. |
7194 intptr_t uris_size = 0; | 7194 intptr_t uris_size = 0; |
7195 for (intptr_t i = 0; i < size; ++i) { | 7195 for (intptr_t i = 0; i < size; ++i) { |
7196 uris_size = ReadUInt(); | 7196 uris_size = ReadUInt(); |
7197 } | 7197 } |
7198 SkipBytes(uris_size); | 7198 SkipBytes(uris_size); |
7199 | 7199 |
7200 // Read the source code strings and line starts. | 7200 // Read the source code strings and line starts. |
7201 for (intptr_t i = 0; i < size; ++i) { | 7201 for (intptr_t i = 0; i < size; ++i) { |
7202 intptr_t length = ReadUInt(); | 7202 intptr_t length = ReadUInt(); |
7203 SkipBytes(length); | 7203 SkipBytes(length); |
7204 intptr_t line_count = ReadUInt(); | 7204 intptr_t line_count = ReadUInt(); |
7205 if (i == index) { | 7205 if (i == index) { |
7206 Array& array_object = | 7206 TypedData& line_starts = TypedData::Handle( |
7207 Array::Handle(Z, Array::New(line_count, Heap::kOld)); | 7207 Z, TypedData::New(kTypedDataUint32ArrayCid, line_count, Heap::kOld)); |
7208 Smi& value = Smi::Handle(Z); | |
7209 intptr_t previous_line_start = 0; | 7208 intptr_t previous_line_start = 0; |
7210 for (intptr_t j = 0; j < line_count; ++j) { | 7209 for (intptr_t j = 0; j < line_count; ++j) { |
7211 intptr_t line_start = ReadUInt() + previous_line_start; | 7210 intptr_t line_start = ReadUInt() + previous_line_start; |
7212 value = Smi::New(line_start); | 7211 line_starts.SetUint32(j << 2, line_start); |
7213 array_object.SetAt(j, value); | |
7214 previous_line_start = line_start; | 7212 previous_line_start = line_start; |
7215 } | 7213 } |
7216 return array_object; | 7214 return line_starts; |
7217 } else { | 7215 } else { |
7218 for (intptr_t j = 0; j < line_count; ++j) { | 7216 for (intptr_t j = 0; j < line_count; ++j) { |
7219 ReadUInt(); | 7217 ReadUInt(); |
7220 } | 7218 } |
7221 } | 7219 } |
7222 } | 7220 } |
7223 | 7221 |
7224 return Array::Handle(Array::null()); | 7222 return TypedData::Handle(TypedData::null()); |
7225 } | 7223 } |
7226 | 7224 |
7227 } // namespace kernel | 7225 } // namespace kernel |
7228 } // namespace dart | 7226 } // namespace dart |
7229 | 7227 |
7230 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7228 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |