Index: runtime/vm/kernel_binary.cc |
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc |
index 1ad1089271dbab25317a288c28345d7b11f4c208..35944ded99b40d0826b916b715959cbc4a636c55 100644 |
--- a/runtime/vm/kernel_binary.cc |
+++ b/runtime/vm/kernel_binary.cc |
@@ -133,8 +133,7 @@ String* String::ReadFrom(Reader* reader) { |
String* String::ReadFromImpl(Reader* reader) { |
TRACE_READ_OFFSET(); |
uint32_t bytes = reader->ReadUInt(); |
- String* string = new String(reader->Consume(bytes), bytes); |
- return string; |
+ return new String(reader->Consume(bytes), bytes); |
} |
void StringTable::ReadFrom(Reader* reader) { |
@@ -522,6 +521,7 @@ InvalidExpression* InvalidExpression::ReadFrom(Reader* reader) { |
VariableGet* VariableGet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
VariableGet* get = new VariableGet(); |
+ get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
get->position_ = reader->ReadPosition(); |
get->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt()); |
reader->ReadOptional<DartType>(); // Unused promoted type. |
@@ -532,6 +532,7 @@ VariableGet* VariableGet::ReadFrom(Reader* reader) { |
VariableGet* VariableGet::ReadFrom(Reader* reader, uint8_t payload) { |
TRACE_READ_OFFSET(); |
VariableGet* get = new VariableGet(); |
+ get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
get->position_ = reader->ReadPosition(); |
get->variable_ = reader->helper()->variables().Lookup(payload); |
return get; |
@@ -541,6 +542,7 @@ VariableGet* VariableGet::ReadFrom(Reader* reader, uint8_t payload) { |
VariableSet* VariableSet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
VariableSet* set = new VariableSet(); |
+ set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
set->position_ = reader->ReadPosition(); |
set->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt()); |
set->expression_ = Expression::ReadFrom(reader); |
@@ -551,6 +553,7 @@ VariableSet* VariableSet::ReadFrom(Reader* reader) { |
VariableSet* VariableSet::ReadFrom(Reader* reader, uint8_t payload) { |
TRACE_READ_OFFSET(); |
VariableSet* set = new VariableSet(); |
+ set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
set->variable_ = reader->helper()->variables().Lookup(payload); |
set->position_ = reader->ReadPosition(); |
set->expression_ = Expression::ReadFrom(reader); |
@@ -561,6 +564,7 @@ VariableSet* VariableSet::ReadFrom(Reader* reader, uint8_t payload) { |
PropertyGet* PropertyGet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
PropertyGet* get = new PropertyGet(); |
+ get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
get->position_ = reader->ReadPosition(); |
get->receiver_ = Expression::ReadFrom(reader); |
get->name_ = Name::ReadFrom(reader); |
@@ -572,6 +576,7 @@ PropertyGet* PropertyGet::ReadFrom(Reader* reader) { |
PropertySet* PropertySet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
PropertySet* set = new PropertySet(); |
+ set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
set->position_ = reader->ReadPosition(); |
set->receiver_ = Expression::ReadFrom(reader); |
set->name_ = Name::ReadFrom(reader); |
@@ -584,6 +589,7 @@ PropertySet* PropertySet::ReadFrom(Reader* reader) { |
DirectPropertyGet* DirectPropertyGet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
DirectPropertyGet* get = new DirectPropertyGet(); |
+ get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
get->position_ = reader->ReadPosition(); |
get->receiver_ = Expression::ReadFrom(reader); |
get->target_reference_ = Reference::ReadMemberFrom(reader); |
@@ -594,6 +600,7 @@ DirectPropertyGet* DirectPropertyGet::ReadFrom(Reader* reader) { |
DirectPropertySet* DirectPropertySet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
DirectPropertySet* set = new DirectPropertySet(); |
+ set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
set->position_ = reader->ReadPosition(); |
set->receiver_ = Expression::ReadFrom(reader); |
set->target_reference_ = Reference::ReadMemberFrom(reader); |
@@ -605,6 +612,7 @@ DirectPropertySet* DirectPropertySet::ReadFrom(Reader* reader) { |
StaticGet* StaticGet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
StaticGet* get = new StaticGet(); |
+ get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
get->position_ = reader->ReadPosition(); |
get->target_reference_ = Reference::ReadMemberFrom(reader); |
return get; |
@@ -614,6 +622,7 @@ StaticGet* StaticGet::ReadFrom(Reader* reader) { |
StaticSet* StaticSet::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
StaticSet* set = new StaticSet(); |
+ set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
set->position_ = reader->ReadPosition(); |
set->target_reference_ = Reference::ReadMemberFrom(reader); |
set->expression_ = Expression::ReadFrom(reader); |
@@ -642,6 +651,7 @@ NamedExpression* NamedExpression::ReadFrom(Reader* reader) { |
MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
MethodInvocation* invocation = new MethodInvocation(); |
+ invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
invocation->position_ = reader->ReadPosition(); |
invocation->receiver_ = Expression::ReadFrom(reader); |
invocation->name_ = Name::ReadFrom(reader); |
@@ -655,6 +665,7 @@ MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) { |
DirectMethodInvocation* DirectMethodInvocation::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
DirectMethodInvocation* invocation = new DirectMethodInvocation(); |
+ invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
invocation->receiver_ = Expression::ReadFrom(reader); |
invocation->target_reference_ = Reference::ReadMemberFrom(reader); |
invocation->arguments_ = Arguments::ReadFrom(reader); |
@@ -665,6 +676,7 @@ DirectMethodInvocation* DirectMethodInvocation::ReadFrom(Reader* reader) { |
StaticInvocation* StaticInvocation::ReadFrom(Reader* reader, bool is_const) { |
TRACE_READ_OFFSET(); |
StaticInvocation* invocation = new StaticInvocation(); |
+ invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
invocation->is_const_ = is_const; |
invocation->position_ = reader->ReadPosition(); |
invocation->procedure_reference_ = Reference::ReadMemberFrom(reader); |
@@ -677,6 +689,7 @@ ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader, |
bool is_const) { |
TRACE_READ_OFFSET(); |
ConstructorInvocation* invocation = new ConstructorInvocation(); |
+ invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
invocation->is_const_ = is_const; |
invocation->position_ = reader->ReadPosition(); |
invocation->target_reference_ = Reference::ReadMemberFrom(reader); |
@@ -688,6 +701,7 @@ ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader, |
Not* Not::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
Not* n = new Not(); |
+ n->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
n->expression_ = Expression::ReadFrom(reader); |
return n; |
} |
@@ -696,6 +710,7 @@ Not* Not::ReadFrom(Reader* reader) { |
LogicalExpression* LogicalExpression::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
LogicalExpression* expr = new LogicalExpression(); |
+ expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
expr->left_ = Expression::ReadFrom(reader); |
expr->operator_ = static_cast<Operator>(reader->ReadByte()); |
expr->right_ = Expression::ReadFrom(reader); |
@@ -706,6 +721,7 @@ LogicalExpression* LogicalExpression::ReadFrom(Reader* reader) { |
ConditionalExpression* ConditionalExpression::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
ConditionalExpression* expr = new ConditionalExpression(); |
+ expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
expr->condition_ = Expression::ReadFrom(reader); |
expr->then_ = Expression::ReadFrom(reader); |
expr->otherwise_ = Expression::ReadFrom(reader); |
@@ -717,6 +733,7 @@ ConditionalExpression* ConditionalExpression::ReadFrom(Reader* reader) { |
StringConcatenation* StringConcatenation::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
StringConcatenation* concat = new StringConcatenation(); |
+ concat->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
concat->position_ = reader->ReadPosition(); |
concat->expressions_.ReadFromStatic<Expression>(reader); |
return concat; |
@@ -726,6 +743,7 @@ StringConcatenation* StringConcatenation::ReadFrom(Reader* reader) { |
IsExpression* IsExpression::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
IsExpression* expr = new IsExpression(); |
+ expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
expr->position_ = reader->ReadPosition(); |
expr->operand_ = Expression::ReadFrom(reader); |
expr->type_ = DartType::ReadFrom(reader); |
@@ -736,6 +754,7 @@ IsExpression* IsExpression::ReadFrom(Reader* reader) { |
AsExpression* AsExpression::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
AsExpression* expr = new AsExpression(); |
+ expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
expr->position_ = reader->ReadPosition(); |
expr->operand_ = Expression::ReadFrom(reader); |
expr->type_ = DartType::ReadFrom(reader); |
@@ -754,7 +773,10 @@ StringLiteral* StringLiteral::ReadFrom(Reader* reader) { |
BigintLiteral* BigintLiteral::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
- return new BigintLiteral(Reference::ReadStringFrom(reader)); |
+ intptr_t offset = reader->offset() - 1; // -1 to include tag byte. |
+ BigintLiteral* lit = new BigintLiteral(Reference::ReadStringFrom(reader)); |
+ lit->kernel_offset_ = offset; |
+ return lit; |
} |
@@ -780,6 +802,7 @@ IntLiteral* IntLiteral::ReadFrom(Reader* reader, uint8_t payload) { |
DoubleLiteral* DoubleLiteral::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
DoubleLiteral* literal = new DoubleLiteral(); |
+ literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
literal->value_ = Reference::ReadStringFrom(reader); |
return literal; |
} |
@@ -805,6 +828,7 @@ NullLiteral* NullLiteral::ReadFrom(Reader* reader) { |
SymbolLiteral* SymbolLiteral::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
SymbolLiteral* lit = new SymbolLiteral(); |
+ lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
lit->value_ = Reference::ReadStringFrom(reader); |
return lit; |
} |
@@ -813,6 +837,7 @@ SymbolLiteral* SymbolLiteral::ReadFrom(Reader* reader) { |
TypeLiteral* TypeLiteral::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
TypeLiteral* literal = new TypeLiteral(); |
+ literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
literal->type_ = DartType::ReadFrom(reader); |
return literal; |
} |
@@ -838,6 +863,7 @@ Rethrow* Rethrow::ReadFrom(Reader* reader) { |
Throw* Throw::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
Throw* t = new Throw(); |
+ t->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
t->position_ = reader->ReadPosition(); |
t->expression_ = Expression::ReadFrom(reader); |
return t; |
@@ -847,6 +873,7 @@ Throw* Throw::ReadFrom(Reader* reader) { |
ListLiteral* ListLiteral::ReadFrom(Reader* reader, bool is_const) { |
TRACE_READ_OFFSET(); |
ListLiteral* literal = new ListLiteral(); |
+ literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
literal->is_const_ = is_const; |
literal->position_ = reader->ReadPosition(); |
literal->type_ = DartType::ReadFrom(reader); |
@@ -858,6 +885,7 @@ ListLiteral* ListLiteral::ReadFrom(Reader* reader, bool is_const) { |
MapLiteral* MapLiteral::ReadFrom(Reader* reader, bool is_const) { |
TRACE_READ_OFFSET(); |
MapLiteral* literal = new MapLiteral(); |
+ literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
literal->is_const_ = is_const; |
literal->position_ = reader->ReadPosition(); |
literal->key_type_ = DartType::ReadFrom(reader); |
@@ -878,6 +906,7 @@ MapEntry* MapEntry::ReadFrom(Reader* reader) { |
AwaitExpression* AwaitExpression::ReadFrom(Reader* reader) { |
TRACE_READ_OFFSET(); |
AwaitExpression* await = new AwaitExpression(); |
+ await->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. |
await->operand_ = Expression::ReadFrom(reader); |
return await; |
} |
@@ -1241,12 +1270,12 @@ FunctionDeclaration* FunctionDeclaration::ReadFrom(Reader* reader) { |
Name* Name::ReadFrom(Reader* reader) { |
- String* string = Reference::ReadStringFrom(reader); |
- if (string->size() >= 1 && string->buffer()[0] == '_') { |
+ String* name = Reference::ReadStringFrom(reader); |
+ if (name->size() >= 1 && name->buffer()[0] == '_') { |
CanonicalName* library_reference = reader->ReadCanonicalNameReference(); |
- return new Name(string, library_reference); |
+ return new Name(name, library_reference); |
} else { |
- return new Name(string, NULL); |
+ return new Name(name, NULL); |
} |
} |