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

Unified Diff: runtime/vm/kernel_binary.cc

Issue 2778693002: [kernel] Don't use kernel ast nodes as keys (Closed)
Patch Set: Created 3 years, 9 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
Index: runtime/vm/kernel_binary.cc
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index d78612c410c2d0cad0710851a1d580e5e32bebe0..ff8e0faa7fa4dc50f09f381dbf816886128d5869 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -501,6 +501,8 @@ class Reader {
return name;
}
+ int64_t offset() { return offset_; }
+
private:
const uint8_t* buffer_;
int64_t size_;
@@ -806,6 +808,7 @@ Field* Field::ReadFrom(Reader* reader) {
Tag tag = reader->ReadTag();
ASSERT(tag == kField);
+ kernelFileOffset_ = reader->offset();
reader->ReadDefiningCanonicalNameReference(this);
position_ = reader->ReadPosition(false);
end_position_ = reader->ReadPosition(false);
@@ -1387,7 +1390,7 @@ AwaitExpression* AwaitExpression::ReadFrom(Reader* reader) {
FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
VariableScope<ReaderHelper> parameters(reader->helper());
- FunctionExpression* expr = new FunctionExpression();
+ FunctionExpression* expr = new FunctionExpression(reader->offset());
expr->function_ = FunctionNode::ReadFrom(reader);
return expr;
}
@@ -1398,7 +1401,7 @@ Let* Let::ReadFrom(Reader* reader) {
VariableScope<ReaderHelper> vars(reader->helper());
PositionScope scope(reader);
- Let* let = new Let();
+ Let* let = new Let(reader->offset());
let->variable_ = VariableDeclaration::ReadFromImpl(reader);
let->body_ = Expression::ReadFrom(reader);
let->position_ = reader->min_position();
@@ -1478,7 +1481,7 @@ Block* Block::ReadFromImpl(Reader* reader) {
PositionScope scope(reader);
VariableScope<ReaderHelper> vars(reader->helper());
- Block* block = new Block();
+ Block* block = new Block(reader->offset());
block->statements().ReadFromStatic<Statement>(reader);
block->position_ = reader->min_position();
block->end_position_ = reader->max_position();
@@ -1544,7 +1547,7 @@ ForStatement* ForStatement::ReadFrom(Reader* reader) {
VariableScope<ReaderHelper> vars(reader->helper());
PositionScope scope(reader);
- ForStatement* forstmt = new ForStatement();
+ ForStatement* forstmt = new ForStatement(reader->offset());
forstmt->variables_.ReadFromStatic<VariableDeclarationImpl>(reader);
forstmt->condition_ = reader->ReadOptional<Expression>();
forstmt->updates_.ReadFromStatic<Expression>(reader);
@@ -1561,7 +1564,7 @@ ForInStatement* ForInStatement::ReadFrom(Reader* reader, bool is_async) {
VariableScope<ReaderHelper> vars(reader->helper());
PositionScope scope(reader);
- ForInStatement* forinstmt = new ForInStatement();
+ ForInStatement* forinstmt = new ForInStatement(reader->offset());
forinstmt->is_async_ = is_async;
forinstmt->position_ = reader->ReadPosition();
forinstmt->variable_ = VariableDeclaration::ReadFromImpl(reader);
@@ -1655,7 +1658,7 @@ Catch* Catch::ReadFrom(Reader* reader) {
VariableScope<ReaderHelper> vars(reader->helper());
PositionScope scope(reader);
- Catch* c = new Catch();
+ Catch* c = new Catch(reader->offset());
c->guard_ = DartType::ReadFrom(reader);
c->exception_ =
reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>();
@@ -1701,7 +1704,7 @@ VariableDeclaration* VariableDeclaration::ReadFromImpl(Reader* reader) {
TRACE_READ_OFFSET();
PositionScope scope(reader);
- VariableDeclaration* decl = new VariableDeclaration();
+ VariableDeclaration* decl = new VariableDeclaration(reader->offset());
decl->position_ = reader->ReadPosition();
decl->equals_position_ = reader->ReadPosition();
decl->flags_ = reader->ReadFlags();
@@ -1723,7 +1726,7 @@ VariableDeclaration* VariableDeclaration::ReadFromImpl(Reader* reader) {
FunctionDeclaration* FunctionDeclaration::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
- FunctionDeclaration* decl = new FunctionDeclaration();
+ FunctionDeclaration* decl = new FunctionDeclaration(reader->offset());
decl->position_ = reader->ReadPosition();
decl->variable_ = VariableDeclaration::ReadFromImpl(reader);
VariableScope<ReaderHelper> parameters(reader->helper());
@@ -1905,7 +1908,7 @@ FunctionNode* FunctionNode::ReadFrom(Reader* reader) {
TRACE_READ_OFFSET();
TypeParameterScope<ReaderHelper> scope(reader->helper());
- FunctionNode* function = new FunctionNode();
+ FunctionNode* function = new FunctionNode(reader->offset());
function->position_ = reader->ReadPosition();
function->end_position_ = reader->ReadPosition();
function->async_marker_ =

Powered by Google App Engine
This is Rietveld 408576698