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

Unified Diff: runtime/vm/kernel_binary.cc

Issue 2517953002: Revert "Merge of source position information from kernel-sdk." (Closed)
Patch Set: Created 4 years, 1 month 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 a870dd920ccab24cbe0adef4e8ccb9b67a0b34b4..350690d6b474d252ce97590143f3066a0ecbae9f 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -355,13 +355,6 @@ class Reader {
}
}
- TokenPosition ReadPosition() {
- intptr_t value = ReadUInt();
- // Position is saved as unsigned,
- // but actually ranges from -1 and up (thus the -1)
- return TokenPosition(value - 1);
- }
-
intptr_t ReadListLength() { return ReadUInt(); }
uint8_t ReadByte() { return buffer_[offset_++]; }
@@ -557,11 +550,6 @@ class Writer {
offset_ += length;
}
- void WritePosition(TokenPosition position) {
- intptr_t value = position.value() + 1;
- WriteUInt(value);
- }
-
template <typename T>
void WriteOptional(T* object) {
if (object == NULL) {
@@ -806,8 +794,8 @@ void StringTable::WriteTo(Writer* writer) {
}
-void LineStartingTable::ReadFrom(Reader* reader) {
- size_ = reader->helper()->program()->source_uri_table().strings().length();
+void LineStartingTable::ReadFrom(Reader* reader, intptr_t length) {
+ size_ = length;
values_ = new intptr_t*[size_];
for (intptr_t i = 0; i < size_; ++i) {
intptr_t line_count = reader->ReadUInt();
@@ -815,9 +803,9 @@ void LineStartingTable::ReadFrom(Reader* reader) {
line_starts[0] = 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;
- previous_line_start = line_start;
+ intptr_t lineStart = reader->ReadUInt() + previous_line_start;
+ line_starts[j + 1] = lineStart;
+ previous_line_start = lineStart;
}
values_[i] = line_starts;
}
@@ -846,7 +834,7 @@ Library* Library::ReadFrom(Reader* reader) {
ASSERT(flags == 0); // external libraries not supported
name_ = Reference::ReadStringFrom(reader);
import_uri_ = Reference::ReadStringFrom(reader);
- source_uri_index_ = reader->ReadUInt();
+ reader->ReadUInt();
int num_classes = reader->ReadUInt();
classes().EnsureInitialized(num_classes);
@@ -872,7 +860,7 @@ void Library::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
name_->WriteTo(writer);
import_uri_->WriteTo(writer);
- writer->WriteUInt(source_uri_index_);
+ writer->WriteUInt(0);
writer->WriteUInt(classes_.length());
for (int i = 0; i < classes_.length(); i++) {
@@ -895,7 +883,7 @@ Class* Class::ReadFrom(Reader* reader) {
is_abstract_ = reader->ReadBool();
name_ = Reference::ReadStringFrom(reader);
- source_uri_index_ = reader->ReadUInt();
+ reader->ReadUInt();
annotations_.ReadFromStatic<Expression>(reader);
return this;
@@ -906,7 +894,7 @@ void Class::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteBool(is_abstract_);
name_->WriteTo(writer);
- writer->WriteUInt(source_uri_index_);
+ writer->WriteUInt(0);
annotations_.WriteTo(writer);
}
@@ -1140,10 +1128,10 @@ Field* Field::ReadFrom(Reader* reader) {
Tag tag = reader->ReadTag();
ASSERT(tag == kField);
- position_ = reader->ReadPosition();
+ reader->ReadUInt();
flags_ = reader->ReadFlags();
name_ = Name::ReadFrom(reader);
- source_uri_index_ = reader->ReadUInt();
+ reader->ReadUInt();
annotations_.ReadFromStatic<Expression>(reader);
type_ = DartType::ReadFrom(reader);
inferred_value_ = reader->ReadOptional<InferredValue>();
@@ -1155,10 +1143,10 @@ Field* Field::ReadFrom(Reader* reader) {
void Field::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kField);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
writer->WriteFlags(flags_);
name_->WriteTo(writer);
- writer->WriteUInt(source_uri_index_);
+ writer->WriteUInt(0);
annotations_.WriteTo(writer);
type_->WriteTo(writer);
writer->WriteOptional<InferredValue>(inferred_value_);
@@ -1203,7 +1191,7 @@ Procedure* Procedure::ReadFrom(Reader* reader) {
kind_ = static_cast<ProcedureKind>(reader->ReadByte());
flags_ = reader->ReadFlags();
name_ = Name::ReadFrom(reader);
- source_uri_index_ = reader->ReadUInt();
+ reader->ReadUInt();
annotations_.ReadFromStatic<Expression>(reader);
function_ = reader->ReadOptional<FunctionNode>();
return this;
@@ -1218,7 +1206,7 @@ void Procedure::WriteTo(Writer* writer) {
writer->WriteByte(kind_);
writer->WriteFlags(flags_);
name_->WriteTo(writer);
- writer->WriteUInt(source_uri_index_);
+ writer->WriteUInt(0);
annotations_.WriteTo(writer);
writer->WriteOptional<FunctionNode>(function_);
}
@@ -1501,7 +1489,7 @@ void VariableSet::WriteTo(Writer* writer) {
PropertyGet* PropertyGet::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
PropertyGet* get = new PropertyGet();
- get->position_ = reader->ReadPosition();
+ reader->ReadUInt();
get->receiver_ = Expression::ReadFrom(reader);
get->name_ = Name::ReadFrom(reader);
get->interfaceTarget_ = Reference::ReadMemberFrom(reader, true);
@@ -1512,7 +1500,7 @@ PropertyGet* PropertyGet::ReadFrom(Reader* reader) {
void PropertyGet::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kPropertyGet);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
receiver_->WriteTo(writer);
name_->WriteTo(writer);
Reference::WriteMemberTo(writer, interfaceTarget_, true);
@@ -1522,7 +1510,7 @@ void PropertyGet::WriteTo(Writer* writer) {
PropertySet* PropertySet::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
PropertySet* set = new PropertySet();
- set->position_ = reader->ReadPosition();
+ reader->ReadUInt();
set->receiver_ = Expression::ReadFrom(reader);
set->name_ = Name::ReadFrom(reader);
set->value_ = Expression::ReadFrom(reader);
@@ -1534,7 +1522,7 @@ PropertySet* PropertySet::ReadFrom(Reader* reader) {
void PropertySet::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kPropertySet);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
receiver_->WriteTo(writer);
name_->WriteTo(writer);
value_->WriteTo(writer);
@@ -1581,7 +1569,7 @@ void DirectPropertySet::WriteTo(Writer* writer) {
StaticGet* StaticGet::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
StaticGet* get = new StaticGet();
- get->position_ = reader->ReadPosition();
+ reader->ReadUInt();
get->target_ = Reference::ReadMemberFrom(reader);
return get;
}
@@ -1590,7 +1578,7 @@ StaticGet* StaticGet::ReadFrom(Reader* reader) {
void StaticGet::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kStaticGet);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
Reference::WriteMemberTo(writer, target_);
}
@@ -1648,7 +1636,7 @@ void NamedExpression::WriteTo(Writer* writer) {
MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
MethodInvocation* invocation = new MethodInvocation();
- invocation->position_ = reader->ReadPosition();
+ reader->ReadUInt();
invocation->receiver_ = Expression::ReadFrom(reader);
invocation->name_ = Name::ReadFrom(reader);
invocation->arguments_ = Arguments::ReadFrom(reader);
@@ -1660,7 +1648,7 @@ MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) {
void MethodInvocation::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kMethodInvocation);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
receiver_->WriteTo(writer);
name_->WriteTo(writer);
arguments_->WriteTo(writer);
@@ -1689,19 +1677,19 @@ void DirectMethodInvocation::WriteTo(Writer* writer) {
StaticInvocation* StaticInvocation::ReadFrom(Reader* reader, bool is_const) {
TRACE_READ_OFFSET();
- StaticInvocation* invocation = new StaticInvocation();
- invocation->is_const_ = is_const;
- invocation->position_ = reader->ReadPosition();
- invocation->procedure_ = Procedure::Cast(Reference::ReadMemberFrom(reader));
- invocation->arguments_ = Arguments::ReadFrom(reader);
- return invocation;
+
+ reader->ReadUInt();
+ Member* member = Reference::ReadMemberFrom(reader);
+ Arguments* args = Arguments::ReadFrom(reader);
+
+ return new StaticInvocation(Procedure::Cast(member), args, is_const);
}
void StaticInvocation::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(is_const_ ? kConstStaticInvocation : kStaticInvocation);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
Reference::WriteMemberTo(writer, procedure_);
arguments_->WriteTo(writer);
}
@@ -1712,7 +1700,7 @@ ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader,
TRACE_READ_OFFSET();
ConstructorInvocation* invocation = new ConstructorInvocation();
invocation->is_const_ = is_const;
- invocation->position_ = reader->ReadPosition();
+ reader->ReadUInt();
invocation->target_ = Constructor::Cast(Reference::ReadMemberFrom(reader));
invocation->arguments_ = Arguments::ReadFrom(reader);
return invocation;
@@ -1723,7 +1711,7 @@ void ConstructorInvocation::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(is_const_ ? kConstConstructorInvocation
: kConstructorInvocation);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
Reference::WriteMemberTo(writer, target_);
arguments_->WriteTo(writer);
}
@@ -1986,7 +1974,7 @@ void Rethrow::WriteTo(Writer* writer) {
Throw* Throw::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
Throw* t = new Throw();
- t->position_ = reader->ReadPosition();
+ reader->ReadUInt();
t->expression_ = Expression::ReadFrom(reader);
return t;
}
@@ -1995,7 +1983,7 @@ Throw* Throw::ReadFrom(Reader* reader) {
void Throw::WriteTo(Writer* writer) {
TRACE_WRITE_OFFSET();
writer->WriteTag(kThrow);
- writer->WritePosition(position_);
+ writer->WriteUInt(0);
expression_->WriteTo(writer);
}
@@ -2805,8 +2793,10 @@ Program* Program::ReadFrom(Reader* reader) {
reader->helper()->set_program(program);
program->string_table_.ReadFrom(reader);
- program->source_uri_table_.ReadFrom(reader);
- program->line_starting_table_.ReadFrom(reader);
+ StringTable dummy1;
+ dummy1.ReadFrom(reader);
+ LineStartingTable dummy2;
+ dummy2.ReadFrom(reader, dummy1.strings_.length());
int libraries = reader->ReadUInt();
program->libraries().EnsureInitialized(libraries);
@@ -2830,8 +2820,10 @@ void Program::WriteTo(Writer* writer) {
// NOTE: Currently we don't GC strings and we require that all referenced
// strings in nodes are present in [string_table_].
string_table_.WriteTo(writer);
- source_uri_table_.WriteTo(writer);
- line_starting_table_.WriteTo(writer);
+ StringTable dummy1;
+ dummy1.WriteTo(writer);
+ LineStartingTable dummy2;
+ dummy2.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