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

Unified Diff: runtime/vm/kernel_binary.cc

Issue 2587673004: Include source in kernel. (Closed)
Patch Set: Fixed some rebase errors Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary.cc
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index 25b88997b7b66707f4b639afc011446e627fdaa7..f204854505b858a98c02c3ca7e6aa777717f9404 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -828,33 +828,37 @@ void StringTable::WriteTo(Writer* writer) {
}
-void LineStartingTable::ReadFrom(Reader* reader) {
+void SourceTable::ReadFrom(Reader* reader) {
size_ = reader->helper()->program()->source_uri_table().strings().length();
- values_ = new intptr_t*[size_];
+ source_code_ = new String*[size_];
+ line_starts_ = new intptr_t*[size_];
+ line_count_ = new intptr_t[size_];
for (intptr_t i = 0; i < size_; ++i) {
+ source_code_[i] = StringImpl::ReadFrom(reader);
intptr_t line_count = reader->ReadUInt();
- intptr_t* line_starts = new intptr_t[line_count + 1];
- line_starts[0] = line_count;
+ intptr_t* line_starts = new intptr_t[line_count];
+ line_count_[i] = line_count;
intptr_t previous_line_start = 0;
for (intptr_t j = 0; j < line_count; ++j) {
intptr_t line_start = reader->ReadUInt() + previous_line_start;
- line_starts[j + 1] = line_start;
+ line_starts[j] = line_start;
previous_line_start = line_start;
}
- values_[i] = line_starts;
+ line_starts_[i] = line_starts;
}
}
-void LineStartingTable::WriteTo(Writer* writer) {
+void SourceTable::WriteTo(Writer* writer) {
for (intptr_t i = 0; i < size_; ++i) {
- intptr_t* line_starts = values_[i];
- intptr_t line_count = line_starts[0];
+ StringImpl::WriteTo(writer, source_code_[i]);
+ intptr_t* line_starts = line_starts_[i];
+ intptr_t line_count = line_count_[i];
writer->WriteUInt(line_count);
intptr_t previous_line_start = 0;
for (intptr_t j = 0; j < line_count; ++j) {
- intptr_t line_start = line_starts[j + 1];
+ intptr_t line_start = line_starts[j];
writer->WriteUInt(line_start - previous_line_start);
previous_line_start = line_start;
}
@@ -2828,7 +2832,7 @@ Program* Program::ReadFrom(Reader* reader) {
program->string_table_.ReadFrom(reader);
program->source_uri_table_.ReadFrom(reader);
- program->line_starting_table_.ReadFrom(reader);
+ program->source_table_.ReadFrom(reader);
int libraries = reader->ReadUInt();
program->libraries().EnsureInitialized(libraries);
@@ -2853,7 +2857,7 @@ void Program::WriteTo(Writer* writer) {
// strings in nodes are present in [string_table_].
string_table_.WriteTo(writer);
source_uri_table_.WriteTo(writer);
- line_starting_table_.WriteTo(writer);
+ source_table_.WriteTo(writer);
libraries_.WriteTo(writer);
Reference::WriteMemberTo(writer, main_method_);
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698