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

Side by Side Diff: runtime/vm/kernel_binary.cc

Issue 2778693002: [kernel] Don't use kernel ast nodes as keys (Closed)
Patch Set: Address comments Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 #if !defined(DART_PRECOMPILED_RUNTIME) 4 #if !defined(DART_PRECOMPILED_RUNTIME)
5 5
6 #include "platform/globals.h" 6 #include "platform/globals.h"
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/kernel.h" 9 #include "vm/kernel.h"
10 #include "vm/kernel_to_il.h" 10 #include "vm/kernel_to_il.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 MallocGrowableArray<CanonicalName*> canonical_names_; 321 MallocGrowableArray<CanonicalName*> canonical_names_;
322 BlockStack<VariableDeclaration> scope_; 322 BlockStack<VariableDeclaration> scope_;
323 BlockStack<TypeParameter> type_parameters_; 323 BlockStack<TypeParameter> type_parameters_;
324 BlockStack<SwitchCase> switch_cases_; 324 BlockStack<SwitchCase> switch_cases_;
325 BlockStack<LabeledStatement>* labels_; 325 BlockStack<LabeledStatement>* labels_;
326 }; 326 };
327 327
328 328
329 class Reader { 329 class Reader {
330 public: 330 public:
331 Reader(const uint8_t* buffer, int64_t size) 331 Reader(const uint8_t* buffer, intptr_t size)
332 : buffer_(buffer), size_(size), offset_(0) {} 332 : buffer_(buffer), size_(size), offset_(0) {}
333 333
334 uint32_t ReadUInt32() { 334 uint32_t ReadUInt32() {
335 ASSERT(offset_ + 4 <= size_); 335 ASSERT(offset_ + 4 <= size_);
336 336
337 uint32_t value = (buffer_[offset_ + 0] << 24) | 337 uint32_t value = (buffer_[offset_ + 0] << 24) |
338 (buffer_[offset_ + 1] << 16) | 338 (buffer_[offset_ + 1] << 16) |
339 (buffer_[offset_ + 2] << 8) | (buffer_[offset_ + 3] << 0); 339 (buffer_[offset_ + 2] << 8) | (buffer_[offset_ + 3] << 0);
340 offset_ += 4; 340 offset_ += 4;
341 return value; 341 return value;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 return name; 494 return name;
495 } 495 }
496 496
497 CanonicalName* ReadDefiningCanonicalNameReference(LinkedNode* node_to_link) { 497 CanonicalName* ReadDefiningCanonicalNameReference(LinkedNode* node_to_link) {
498 CanonicalName* name = ReadCanonicalNameReference(); 498 CanonicalName* name = ReadCanonicalNameReference();
499 ASSERT(name != NULL); 499 ASSERT(name != NULL);
500 name->BindTo(node_to_link); 500 name->BindTo(node_to_link);
501 return name; 501 return name;
502 } 502 }
503 503
504 intptr_t offset() { return offset_; }
505
504 private: 506 private:
505 const uint8_t* buffer_; 507 const uint8_t* buffer_;
506 int64_t size_; 508 intptr_t size_;
507 int64_t offset_; 509 intptr_t offset_;
508 ReaderHelper builder_; 510 ReaderHelper builder_;
509 TokenPosition max_position_; 511 TokenPosition max_position_;
510 TokenPosition min_position_; 512 TokenPosition min_position_;
511 intptr_t current_script_id_; 513 intptr_t current_script_id_;
512 514
513 friend class PositionScope; 515 friend class PositionScope;
514 }; 516 };
515 517
516 518
517 // A helper class that resets the readers min and max positions both upon 519 // A helper class that resets the readers min and max positions both upon
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 TRACE_READ_OFFSET(); 631 TRACE_READ_OFFSET();
630 return String::ReadFromImpl(reader); 632 return String::ReadFromImpl(reader);
631 } 633 }
632 }; 634 };
633 635
634 636
635 class VariableDeclarationImpl { 637 class VariableDeclarationImpl {
636 public: 638 public:
637 static VariableDeclaration* ReadFrom(Reader* reader) { 639 static VariableDeclaration* ReadFrom(Reader* reader) {
638 TRACE_READ_OFFSET(); 640 TRACE_READ_OFFSET();
639 return VariableDeclaration::ReadFromImpl(reader); 641 return VariableDeclaration::ReadFromImpl(reader, false);
640 } 642 }
641 }; 643 };
642 644
643 645
644 String* String::ReadFrom(Reader* reader) { 646 String* String::ReadFrom(Reader* reader) {
645 TRACE_READ_OFFSET(); 647 TRACE_READ_OFFSET();
646 return Reference::ReadStringFrom(reader); 648 return Reference::ReadStringFrom(reader);
647 } 649 }
648 650
649 651
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 798
797 799
798 String* Reference::ReadStringFrom(Reader* reader) { 800 String* Reference::ReadStringFrom(Reader* reader) {
799 int index = reader->ReadUInt(); 801 int index = reader->ReadUInt();
800 return reader->helper()->program()->string_table().strings()[index]; 802 return reader->helper()->program()->string_table().strings()[index];
801 } 803 }
802 804
803 805
804 Field* Field::ReadFrom(Reader* reader) { 806 Field* Field::ReadFrom(Reader* reader) {
805 TRACE_READ_OFFSET(); 807 TRACE_READ_OFFSET();
808 kernel_offset_ = reader->offset(); // Notice the ReadTag() below.
806 Tag tag = reader->ReadTag(); 809 Tag tag = reader->ReadTag();
807 ASSERT(tag == kField); 810 ASSERT(tag == kField);
808 811
809 reader->ReadDefiningCanonicalNameReference(this); 812 reader->ReadDefiningCanonicalNameReference(this);
810 position_ = reader->ReadPosition(false); 813 position_ = reader->ReadPosition(false);
811 end_position_ = reader->ReadPosition(false); 814 end_position_ = reader->ReadPosition(false);
812 flags_ = reader->ReadFlags(); 815 flags_ = reader->ReadFlags();
813 name_ = Name::ReadFrom(reader); 816 name_ = Name::ReadFrom(reader);
814 source_uri_index_ = reader->ReadUInt(); 817 source_uri_index_ = reader->ReadUInt();
815 reader->set_current_script_id(source_uri_index_); 818 reader->set_current_script_id(source_uri_index_);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 RedirectingInitializer* init = new RedirectingInitializer(); 916 RedirectingInitializer* init = new RedirectingInitializer();
914 init->target_reference_ = Reference::ReadMemberFrom(reader); 917 init->target_reference_ = Reference::ReadMemberFrom(reader);
915 init->arguments_ = Arguments::ReadFrom(reader); 918 init->arguments_ = Arguments::ReadFrom(reader);
916 return init; 919 return init;
917 } 920 }
918 921
919 922
920 LocalInitializer* LocalInitializer::ReadFromImpl(Reader* reader) { 923 LocalInitializer* LocalInitializer::ReadFromImpl(Reader* reader) {
921 TRACE_READ_OFFSET(); 924 TRACE_READ_OFFSET();
922 LocalInitializer* init = new LocalInitializer(); 925 LocalInitializer* init = new LocalInitializer();
923 init->variable_ = VariableDeclaration::ReadFromImpl(reader); 926 init->variable_ = VariableDeclaration::ReadFromImpl(reader, false);
924 return init; 927 return init;
925 } 928 }
926 929
927 930
928 Expression* Expression::ReadFrom(Reader* reader) { 931 Expression* Expression::ReadFrom(Reader* reader) {
929 TRACE_READ_OFFSET(); 932 TRACE_READ_OFFSET();
930 uint8_t payload = 0; 933 uint8_t payload = 0;
931 Tag tag = reader->ReadTag(&payload); 934 Tag tag = reader->ReadTag(&payload);
932 switch (tag) { 935 switch (tag) {
933 case kInvalidExpression: 936 case kInvalidExpression:
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 AwaitExpression* await = new AwaitExpression(); 1384 AwaitExpression* await = new AwaitExpression();
1382 await->operand_ = Expression::ReadFrom(reader); 1385 await->operand_ = Expression::ReadFrom(reader);
1383 return await; 1386 return await;
1384 } 1387 }
1385 1388
1386 1389
1387 FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) { 1390 FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) {
1388 TRACE_READ_OFFSET(); 1391 TRACE_READ_OFFSET();
1389 VariableScope<ReaderHelper> parameters(reader->helper()); 1392 VariableScope<ReaderHelper> parameters(reader->helper());
1390 FunctionExpression* expr = new FunctionExpression(); 1393 FunctionExpression* expr = new FunctionExpression();
1394 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1391 expr->function_ = FunctionNode::ReadFrom(reader); 1395 expr->function_ = FunctionNode::ReadFrom(reader);
1392 return expr; 1396 return expr;
1393 } 1397 }
1394 1398
1395 1399
1396 Let* Let::ReadFrom(Reader* reader) { 1400 Let* Let::ReadFrom(Reader* reader) {
1397 TRACE_READ_OFFSET(); 1401 TRACE_READ_OFFSET();
1398 VariableScope<ReaderHelper> vars(reader->helper()); 1402 VariableScope<ReaderHelper> vars(reader->helper());
1399 PositionScope scope(reader); 1403 PositionScope scope(reader);
1400 1404
1401 Let* let = new Let(); 1405 Let* let = new Let();
1402 let->variable_ = VariableDeclaration::ReadFromImpl(reader); 1406 let->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1407 let->variable_ = VariableDeclaration::ReadFromImpl(reader, false);
1403 let->body_ = Expression::ReadFrom(reader); 1408 let->body_ = Expression::ReadFrom(reader);
1404 let->position_ = reader->min_position(); 1409 let->position_ = reader->min_position();
1405 let->end_position_ = reader->max_position(); 1410 let->end_position_ = reader->max_position();
1406 1411
1407 return let; 1412 return let;
1408 } 1413 }
1409 1414
1410 1415
1411 Statement* Statement::ReadFrom(Reader* reader) { 1416 Statement* Statement::ReadFrom(Reader* reader) {
1412 TRACE_READ_OFFSET(); 1417 TRACE_READ_OFFSET();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return IfStatement::ReadFrom(reader); 1449 return IfStatement::ReadFrom(reader);
1445 case kReturnStatement: 1450 case kReturnStatement:
1446 return ReturnStatement::ReadFrom(reader); 1451 return ReturnStatement::ReadFrom(reader);
1447 case kTryCatch: 1452 case kTryCatch:
1448 return TryCatch::ReadFrom(reader); 1453 return TryCatch::ReadFrom(reader);
1449 case kTryFinally: 1454 case kTryFinally:
1450 return TryFinally::ReadFrom(reader); 1455 return TryFinally::ReadFrom(reader);
1451 case kYieldStatement: 1456 case kYieldStatement:
1452 return YieldStatement::ReadFrom(reader); 1457 return YieldStatement::ReadFrom(reader);
1453 case kVariableDeclaration: 1458 case kVariableDeclaration:
1454 return VariableDeclaration::ReadFromImpl(reader); 1459 return VariableDeclaration::ReadFromImpl(reader, true);
1455 case kFunctionDeclaration: 1460 case kFunctionDeclaration:
1456 return FunctionDeclaration::ReadFrom(reader); 1461 return FunctionDeclaration::ReadFrom(reader);
1457 default: 1462 default:
1458 UNREACHABLE(); 1463 UNREACHABLE();
1459 } 1464 }
1460 return NULL; 1465 return NULL;
1461 } 1466 }
1462 1467
1463 1468
1464 InvalidStatement* InvalidStatement::ReadFrom(Reader* reader) { 1469 InvalidStatement* InvalidStatement::ReadFrom(Reader* reader) {
1465 TRACE_READ_OFFSET(); 1470 TRACE_READ_OFFSET();
1466 return new InvalidStatement(); 1471 return new InvalidStatement();
1467 } 1472 }
1468 1473
1469 1474
1470 ExpressionStatement* ExpressionStatement::ReadFrom(Reader* reader) { 1475 ExpressionStatement* ExpressionStatement::ReadFrom(Reader* reader) {
1471 TRACE_READ_OFFSET(); 1476 TRACE_READ_OFFSET();
1472 return new ExpressionStatement(Expression::ReadFrom(reader)); 1477 return new ExpressionStatement(Expression::ReadFrom(reader));
1473 } 1478 }
1474 1479
1475 1480
1476 Block* Block::ReadFromImpl(Reader* reader) { 1481 Block* Block::ReadFromImpl(Reader* reader) {
1477 TRACE_READ_OFFSET(); 1482 TRACE_READ_OFFSET();
1478 PositionScope scope(reader); 1483 PositionScope scope(reader);
1479 1484
1480 VariableScope<ReaderHelper> vars(reader->helper()); 1485 VariableScope<ReaderHelper> vars(reader->helper());
1481 Block* block = new Block(); 1486 Block* block = new Block();
1487 block->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1482 block->statements().ReadFromStatic<Statement>(reader); 1488 block->statements().ReadFromStatic<Statement>(reader);
1483 block->position_ = reader->min_position(); 1489 block->position_ = reader->min_position();
1484 block->end_position_ = reader->max_position(); 1490 block->end_position_ = reader->max_position();
1485 1491
1486 return block; 1492 return block;
1487 } 1493 }
1488 1494
1489 1495
1490 EmptyStatement* EmptyStatement::ReadFrom(Reader* reader) { 1496 EmptyStatement* EmptyStatement::ReadFrom(Reader* reader) {
1491 TRACE_READ_OFFSET(); 1497 TRACE_READ_OFFSET();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 return dostmt; 1544 return dostmt;
1539 } 1545 }
1540 1546
1541 1547
1542 ForStatement* ForStatement::ReadFrom(Reader* reader) { 1548 ForStatement* ForStatement::ReadFrom(Reader* reader) {
1543 TRACE_READ_OFFSET(); 1549 TRACE_READ_OFFSET();
1544 VariableScope<ReaderHelper> vars(reader->helper()); 1550 VariableScope<ReaderHelper> vars(reader->helper());
1545 PositionScope scope(reader); 1551 PositionScope scope(reader);
1546 1552
1547 ForStatement* forstmt = new ForStatement(); 1553 ForStatement* forstmt = new ForStatement();
1554 forstmt->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1548 forstmt->variables_.ReadFromStatic<VariableDeclarationImpl>(reader); 1555 forstmt->variables_.ReadFromStatic<VariableDeclarationImpl>(reader);
1549 forstmt->condition_ = reader->ReadOptional<Expression>(); 1556 forstmt->condition_ = reader->ReadOptional<Expression>();
1550 forstmt->updates_.ReadFromStatic<Expression>(reader); 1557 forstmt->updates_.ReadFromStatic<Expression>(reader);
1551 forstmt->body_ = Statement::ReadFrom(reader); 1558 forstmt->body_ = Statement::ReadFrom(reader);
1552 forstmt->end_position_ = reader->max_position(); 1559 forstmt->end_position_ = reader->max_position();
1553 forstmt->position_ = reader->min_position(); 1560 forstmt->position_ = reader->min_position();
1554 1561
1555 return forstmt; 1562 return forstmt;
1556 } 1563 }
1557 1564
1558 1565
1559 ForInStatement* ForInStatement::ReadFrom(Reader* reader, bool is_async) { 1566 ForInStatement* ForInStatement::ReadFrom(Reader* reader, bool is_async) {
1560 TRACE_READ_OFFSET(); 1567 TRACE_READ_OFFSET();
1561 VariableScope<ReaderHelper> vars(reader->helper()); 1568 VariableScope<ReaderHelper> vars(reader->helper());
1562 PositionScope scope(reader); 1569 PositionScope scope(reader);
1563 1570
1564 ForInStatement* forinstmt = new ForInStatement(); 1571 ForInStatement* forinstmt = new ForInStatement();
1572 forinstmt->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1565 forinstmt->is_async_ = is_async; 1573 forinstmt->is_async_ = is_async;
1566 forinstmt->position_ = reader->ReadPosition(); 1574 forinstmt->position_ = reader->ReadPosition();
1567 forinstmt->variable_ = VariableDeclaration::ReadFromImpl(reader); 1575 forinstmt->variable_ = VariableDeclaration::ReadFromImpl(reader, false);
1568 forinstmt->iterable_ = Expression::ReadFrom(reader); 1576 forinstmt->iterable_ = Expression::ReadFrom(reader);
1569 forinstmt->body_ = Statement::ReadFrom(reader); 1577 forinstmt->body_ = Statement::ReadFrom(reader);
1570 forinstmt->end_position_ = reader->max_position(); 1578 forinstmt->end_position_ = reader->max_position();
1571 if (!forinstmt->position_.IsReal()) { 1579 if (!forinstmt->position_.IsReal()) {
1572 forinstmt->position_ = reader->min_position(); 1580 forinstmt->position_ = reader->min_position();
1573 } 1581 }
1574 forinstmt->variable_->set_end_position(forinstmt->position_); 1582 forinstmt->variable_->set_end_position(forinstmt->position_);
1575 1583
1576 return forinstmt; 1584 return forinstmt;
1577 } 1585 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 return tc; 1657 return tc;
1650 } 1658 }
1651 1659
1652 1660
1653 Catch* Catch::ReadFrom(Reader* reader) { 1661 Catch* Catch::ReadFrom(Reader* reader) {
1654 TRACE_READ_OFFSET(); 1662 TRACE_READ_OFFSET();
1655 VariableScope<ReaderHelper> vars(reader->helper()); 1663 VariableScope<ReaderHelper> vars(reader->helper());
1656 PositionScope scope(reader); 1664 PositionScope scope(reader);
1657 1665
1658 Catch* c = new Catch(); 1666 Catch* c = new Catch();
1667 c->kernel_offset_ = reader->offset(); // Catch has no tag.
1659 c->guard_ = DartType::ReadFrom(reader); 1668 c->guard_ = DartType::ReadFrom(reader);
1660 c->exception_ = 1669 c->exception_ =
1661 reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>(); 1670 reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>();
1662 c->stack_trace_ = 1671 c->stack_trace_ =
1663 reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>(); 1672 reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>();
1664 c->body_ = Statement::ReadFrom(reader); 1673 c->body_ = Statement::ReadFrom(reader);
1665 c->end_position_ = reader->max_position(); 1674 c->end_position_ = reader->max_position();
1666 c->position_ = reader->min_position(); 1675 c->position_ = reader->min_position();
1667 1676
1668 return c; 1677 return c;
(...skipping 17 matching lines...) Expand all
1686 stmt->flags_ = reader->ReadByte(); 1695 stmt->flags_ = reader->ReadByte();
1687 stmt->expression_ = Expression::ReadFrom(reader); 1696 stmt->expression_ = Expression::ReadFrom(reader);
1688 return stmt; 1697 return stmt;
1689 } 1698 }
1690 1699
1691 1700
1692 VariableDeclaration* VariableDeclaration::ReadFrom(Reader* reader) { 1701 VariableDeclaration* VariableDeclaration::ReadFrom(Reader* reader) {
1693 TRACE_READ_OFFSET(); 1702 TRACE_READ_OFFSET();
1694 Tag tag = reader->ReadTag(); 1703 Tag tag = reader->ReadTag();
1695 ASSERT(tag == kVariableDeclaration); 1704 ASSERT(tag == kVariableDeclaration);
1696 return VariableDeclaration::ReadFromImpl(reader); 1705 return VariableDeclaration::ReadFromImpl(reader, true);
1697 } 1706 }
1698 1707
1699 1708
1700 VariableDeclaration* VariableDeclaration::ReadFromImpl(Reader* reader) { 1709 VariableDeclaration* VariableDeclaration::ReadFromImpl(Reader* reader,
1710 bool read_tag) {
1701 TRACE_READ_OFFSET(); 1711 TRACE_READ_OFFSET();
1702 PositionScope scope(reader); 1712 PositionScope scope(reader);
1703 1713
1704 VariableDeclaration* decl = new VariableDeclaration(); 1714 VariableDeclaration* decl = new VariableDeclaration();
1715 // -1 or -0 depending on whether there's a tag or not.
1716 decl->kernel_offset_ = reader->offset() - (read_tag ? 1 : 0);
1705 decl->position_ = reader->ReadPosition(); 1717 decl->position_ = reader->ReadPosition();
1706 decl->equals_position_ = reader->ReadPosition(); 1718 decl->equals_position_ = reader->ReadPosition();
1707 decl->flags_ = reader->ReadFlags(); 1719 decl->flags_ = reader->ReadFlags();
1708 decl->name_ = Reference::ReadStringFrom(reader); 1720 decl->name_ = Reference::ReadStringFrom(reader);
1709 decl->type_ = DartType::ReadFrom(reader); 1721 decl->type_ = DartType::ReadFrom(reader);
1710 decl->inferred_value_ = reader->ReadOptional<InferredValue>(); 1722 decl->inferred_value_ = reader->ReadOptional<InferredValue>();
1711 decl->initializer_ = reader->ReadOptional<Expression>(); 1723 decl->initializer_ = reader->ReadOptional<Expression>();
1712 1724
1713 // Go to next token position so it ends *after* the last potentially 1725 // Go to next token position so it ends *after* the last potentially
1714 // debuggable position in the initializer. 1726 // debuggable position in the initializer.
1715 TokenPosition position = reader->max_position(); 1727 TokenPosition position = reader->max_position();
1716 if (position.IsReal()) position.Next(); 1728 if (position.IsReal()) position.Next();
1717 decl->end_position_ = position; 1729 decl->end_position_ = position;
1718 reader->helper()->variables().Push(decl); 1730 reader->helper()->variables().Push(decl);
1719 1731
1720 return decl; 1732 return decl;
1721 } 1733 }
1722 1734
1723 1735
1724 FunctionDeclaration* FunctionDeclaration::ReadFrom(Reader* reader) { 1736 FunctionDeclaration* FunctionDeclaration::ReadFrom(Reader* reader) {
1725 TRACE_READ_OFFSET(); 1737 TRACE_READ_OFFSET();
1726 FunctionDeclaration* decl = new FunctionDeclaration(); 1738 FunctionDeclaration* decl = new FunctionDeclaration();
1739 decl->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1727 decl->position_ = reader->ReadPosition(); 1740 decl->position_ = reader->ReadPosition();
1728 decl->variable_ = VariableDeclaration::ReadFromImpl(reader); 1741 decl->variable_ = VariableDeclaration::ReadFromImpl(reader, false);
1729 VariableScope<ReaderHelper> parameters(reader->helper()); 1742 VariableScope<ReaderHelper> parameters(reader->helper());
1730 decl->function_ = FunctionNode::ReadFrom(reader); 1743 decl->function_ = FunctionNode::ReadFrom(reader);
1731 return decl; 1744 return decl;
1732 } 1745 }
1733 1746
1734 1747
1735 Name* Name::ReadFrom(Reader* reader) { 1748 Name* Name::ReadFrom(Reader* reader) {
1736 String* string = Reference::ReadStringFrom(reader); 1749 String* string = Reference::ReadStringFrom(reader);
1737 if (string->size() >= 1 && string->buffer()[0] == '_') { 1750 if (string->size() >= 1 && string->buffer()[0] == '_') {
1738 CanonicalName* library_reference = reader->ReadCanonicalNameReference(); 1751 CanonicalName* library_reference = reader->ReadCanonicalNameReference();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 1912
1900 return program; 1913 return program;
1901 } 1914 }
1902 1915
1903 1916
1904 FunctionNode* FunctionNode::ReadFrom(Reader* reader) { 1917 FunctionNode* FunctionNode::ReadFrom(Reader* reader) {
1905 TRACE_READ_OFFSET(); 1918 TRACE_READ_OFFSET();
1906 TypeParameterScope<ReaderHelper> scope(reader->helper()); 1919 TypeParameterScope<ReaderHelper> scope(reader->helper());
1907 1920
1908 FunctionNode* function = new FunctionNode(); 1921 FunctionNode* function = new FunctionNode();
1922 function->kernel_offset_ = reader->offset(); // FunctionNode has no tag.
1909 function->position_ = reader->ReadPosition(); 1923 function->position_ = reader->ReadPosition();
1910 function->end_position_ = reader->ReadPosition(); 1924 function->end_position_ = reader->ReadPosition();
1911 function->async_marker_ = 1925 function->async_marker_ =
1912 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); 1926 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte());
1913 function->dart_async_marker_ = 1927 function->dart_async_marker_ =
1914 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); 1928 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte());
1915 function->type_parameters().ReadFrom(reader); 1929 function->type_parameters().ReadFrom(reader);
1916 function->required_parameter_count_ = reader->ReadUInt(); 1930 function->required_parameter_count_ = reader->ReadUInt();
1917 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>( 1931 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>(
1918 reader); 1932 reader);
(...skipping 22 matching lines...) Expand all
1941 1955
1942 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 1956 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
1943 intptr_t buffer_length) { 1957 intptr_t buffer_length) {
1944 kernel::Reader reader(buffer, buffer_length); 1958 kernel::Reader reader(buffer, buffer_length);
1945 return kernel::Program::ReadFrom(&reader); 1959 return kernel::Program::ReadFrom(&reader);
1946 } 1960 }
1947 1961
1948 1962
1949 } // namespace dart 1963 } // namespace dart
1950 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1964 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_to_il.h » ('j') | runtime/vm/kernel_to_il.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698