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

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

Issue 2931813002: [kernel] Stream kernel_reader (Closed)
Patch Set: Feedback Created 3 years, 6 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
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | runtime/vm/kernel_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #include "vm/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/longjump.h" 8 #include "vm/longjump.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 ProcedureHelper procedure_helper(builder_); 340 ProcedureHelper procedure_helper(builder_);
341 procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction); 341 procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction);
342 if (builder_->ReadTag() == kSomething) { 342 if (builder_->ReadTag() == kSomething) {
343 VisitFunctionNode(); 343 VisitFunctionNode();
344 } 344 }
345 } 345 }
346 346
347 void StreamingScopeBuilder::VisitField() { 347 void StreamingScopeBuilder::VisitField() {
348 FieldHelper field_helper(builder_); 348 FieldHelper field_helper(builder_);
349 field_helper.ReadUntilExcluding(FieldHelper::kType); 349 field_helper.ReadUntilExcluding(FieldHelper::kType);
350 VisitDartType(); // read type. 350 VisitDartType(); // read type.
351 Tag tag = builder_->ReadTag(); // read initializer (part 1). 351 Tag tag = builder_->ReadTag(); // read initializer (part 1).
352 if (tag == kSomething) { 352 if (tag == kSomething) {
353 VisitExpression(); // read initializer (part 2). 353 VisitExpression(); // read initializer (part 2).
354 } 354 }
355 } 355 }
356 356
357 void StreamingScopeBuilder::VisitFunctionNode() { 357 void StreamingScopeBuilder::VisitFunctionNode() {
358 FunctionNodeHelper function_node_helper(builder_); 358 FunctionNodeHelper function_node_helper(builder_);
359 function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters); 359 function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters);
360 360
361 intptr_t list_length = 361 intptr_t list_length =
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 // factory constructor function. 1077 // factory constructor function.
1078 HandleSpecialLoad(&result_->type_arguments_variable, 1078 HandleSpecialLoad(&result_->type_arguments_variable,
1079 Symbols::TypeArgumentsParameter()); 1079 Symbols::TypeArgumentsParameter());
1080 } else { 1080 } else {
1081 // The type argument vector is stored on the instance object. We therefore 1081 // The type argument vector is stored on the instance object. We therefore
1082 // need to capture `this`. 1082 // need to capture `this`.
1083 HandleSpecialLoad(&result_->this_variable, Symbols::This()); 1083 HandleSpecialLoad(&result_->this_variable, Symbols::This());
1084 } 1084 }
1085 1085
1086 builder_->ReadUInt(); // read index for parameter. 1086 builder_->ReadUInt(); // read index for parameter.
1087 builder_->ReadUInt(); // read binary offset. 1087 builder_->ReadUInt(); // read list binary offset.
1088 builder_->ReadUInt(); // read index in list.
1088 builder_->SkipOptionalDartType(); // read bound bound. 1089 builder_->SkipOptionalDartType(); // read bound bound.
1089 } 1090 }
1090 1091
1091 void StreamingScopeBuilder::HandleLocalFunction(intptr_t parent_kernel_offset) { 1092 void StreamingScopeBuilder::HandleLocalFunction(intptr_t parent_kernel_offset) {
1092 // "Peek" ahead into the function node 1093 // "Peek" ahead into the function node
1093 intptr_t offset = builder_->ReaderOffset(); 1094 intptr_t offset = builder_->ReaderOffset();
1094 1095
1095 FunctionNodeHelper function_node_helper(builder_); 1096 FunctionNodeHelper function_node_helper(builder_);
1096 function_node_helper.ReadUntilExcluding( 1097 function_node_helper.ReadUntilExcluding(
1097 FunctionNodeHelper::kPositionalParameters); 1098 FunctionNodeHelper::kPositionalParameters);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 for (intptr_t i = 0; i < list_length; ++i) { 1150 for (intptr_t i = 0; i < list_length; ++i) {
1150 AddVariableDeclarationParameter(pos++); // read ith named parameter. 1151 AddVariableDeclarationParameter(pos++); // read ith named parameter.
1151 } 1152 }
1152 } 1153 }
1153 1154
1154 void StreamingScopeBuilder::AddVariableDeclarationParameter(intptr_t pos) { 1155 void StreamingScopeBuilder::AddVariableDeclarationParameter(intptr_t pos) {
1155 intptr_t kernel_offset = builder_->ReaderOffset(); // no tag. 1156 intptr_t kernel_offset = builder_->ReaderOffset(); // no tag.
1156 VariableDeclarationHelper helper(builder_); 1157 VariableDeclarationHelper helper(builder_);
1157 helper.ReadUntilExcluding(VariableDeclarationHelper::kType); 1158 helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
1158 String& name = H.DartSymbol(helper.name_index_); 1159 String& name = H.DartSymbol(helper.name_index_);
1159 AbstractType& type = T.BuildVariableType(); // read type. 1160 AbstractType& type = T.BuildVariableType(); // read type.
1160 helper.SetJustRead(VariableDeclarationHelper::kType); 1161 helper.SetJustRead(VariableDeclarationHelper::kType);
1161 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); 1162 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
1162 1163
1163 LocalVariable* variable = 1164 LocalVariable* variable =
1164 MakeVariable(helper.position_, helper.position_, name, type); 1165 MakeVariable(helper.position_, helper.position_, name, type);
1165 if (helper.IsFinal()) { 1166 if (helper.IsFinal()) {
1166 variable->set_is_final(); 1167 variable->set_is_final();
1167 } 1168 }
1168 if (variable->name().raw() == Symbols::IteratorParameter().raw()) { 1169 if (variable->name().raw() == Symbols::IteratorParameter().raw()) {
1169 variable->set_is_forced_stack(); 1170 variable->set_is_forced_stack();
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 signature_type ^= 1551 signature_type ^=
1551 ClassFinalizer::FinalizeType(*active_class_->klass, signature_type); 1552 ClassFinalizer::FinalizeType(*active_class_->klass, signature_type);
1552 // Do not refer to signature_function anymore, since it may have been 1553 // Do not refer to signature_function anymore, since it may have been
1553 // replaced during canonicalization. 1554 // replaced during canonicalization.
1554 signature_function = Function::null(); 1555 signature_function = Function::null();
1555 } 1556 }
1556 1557
1557 result_ = signature_type.raw(); 1558 result_ = signature_type.raw();
1558 } 1559 }
1559 1560
1560 intptr_t StreamingDartTypeTranslator::FindTypeParameterIndex(
1561 intptr_t parameters_offset,
1562 intptr_t parameters_count,
1563 intptr_t look_for) {
1564 AlternativeReadingScope alt(builder_->reader_, parameters_offset);
1565 for (intptr_t i = 0; i < parameters_count; ++i) {
1566 if (look_for == builder_->ReaderOffset()) {
1567 return i;
1568 }
1569 builder_->SkipStringReference(); // read string index (name).
1570 builder_->SkipDartType(); // read dart type.
1571 }
1572 return -1;
1573 }
1574
1575 void StreamingDartTypeTranslator::BuildTypeParameterType() { 1561 void StreamingDartTypeTranslator::BuildTypeParameterType() {
1576 builder_->ReadUInt(); // read parameter index. 1562 builder_->ReadUInt(); // read parameter index.
1577 intptr_t binary_offset = builder_->ReadUInt(); // read binary offset. 1563 intptr_t binary_offset = builder_->ReadUInt(); // read lists binary offset.
1564 intptr_t list_index = builder_->ReadUInt(); // read index in list.
1578 builder_->SkipOptionalDartType(); // read bound. 1565 builder_->SkipOptionalDartType(); // read bound.
1579 1566
1580 if (binary_offset == 0) { 1567 ASSERT(binary_offset > 0);
1581 // TODO(jensj): This doesn't appear to actually happen.
1582 UNIMPLEMENTED();
1583 return;
1584 }
1585 1568
1586 for (TypeParameterScope* scope = type_parameter_scope_; scope != NULL; 1569 for (TypeParameterScope* scope = type_parameter_scope_; scope != NULL;
1587 scope = scope->outer()) { 1570 scope = scope->outer()) {
1588 const intptr_t index = FindTypeParameterIndex( 1571 if (scope->parameters_offset() == binary_offset) {
1589 scope->parameters_offset(), scope->parameters_count(), binary_offset);
1590 if (index >= 0) {
1591 result_ ^= dart::Type::DynamicType(); 1572 result_ ^= dart::Type::DynamicType();
1592 return; 1573 return;
1593 } 1574 }
1594 } 1575 }
1595 1576
1596 if (active_class_->member_is_procedure) { 1577 if (active_class_->member_is_procedure) {
1597 if (active_class_->member_type_parameters > 0) { 1578 if (active_class_->member_type_parameters > 0) {
1598 // 1579 //
1599 // WARNING: This is a little hackish: 1580 // WARNING: This is a little hackish:
1600 // 1581 //
1601 // We have a static factory constructor. The kernel IR gives the factory 1582 // We have a static factory constructor. The kernel IR gives the factory
1602 // constructor function it's own type parameters (which are equal in name 1583 // constructor function it's own type parameters (which are equal in name
1603 // and number to the ones of the enclosing class). 1584 // and number to the ones of the enclosing class).
1604 // I.e., 1585 // I.e.,
1605 // 1586 //
1606 // class A<T> { 1587 // class A<T> {
1607 // factory A.x() { return new B<T>(); } 1588 // factory A.x() { return new B<T>(); }
1608 // } 1589 // }
1609 // 1590 //
1610 // is basically translated to this: 1591 // is basically translated to this:
1611 // 1592 //
1612 // class A<T> { 1593 // class A<T> {
1613 // static A.x<T'>() { return new B<T'>(); } 1594 // static A.x<T'>() { return new B<T'>(); }
1614 // } 1595 // }
1615 // 1596 //
1616 const intptr_t index = FindTypeParameterIndex( 1597 if (active_class_->member_type_parameters_offset_start == binary_offset) {
1617 active_class_->member_type_parameters_offset_start,
1618 active_class_->member_type_parameters, binary_offset);
1619 if (index >= 0) {
1620 if (active_class_->member_is_factory_procedure) { 1598 if (active_class_->member_is_factory_procedure) {
1621 // The index of the type parameter in [parameters] is 1599 // The index of the type parameter in [parameters] is
1622 // the same index into the `klass->type_parameters()` array. 1600 // the same index into the `klass->type_parameters()` array.
1623 result_ ^= dart::TypeArguments::Handle( 1601 result_ ^= dart::TypeArguments::Handle(
1624 Z, active_class_->klass->type_parameters()) 1602 Z, active_class_->klass->type_parameters())
1625 .TypeAt(index); 1603 .TypeAt(list_index);
1626 } else { 1604 } else {
1627 result_ ^= dart::Type::DynamicType(); 1605 result_ ^= dart::Type::DynamicType();
1628 } 1606 }
1629 return; 1607 return;
1630 } 1608 }
1631 } 1609 }
1632 } 1610 }
1633 1611
1634 const intptr_t index = FindTypeParameterIndex( 1612 if (active_class_->class_type_parameters_offset_start == binary_offset) {
1635 active_class_->class_type_parameters_offset_start,
1636 active_class_->class_type_parameters, binary_offset);
1637 if (index >= 0) {
1638 // The index of the type parameter in [parameters] is 1613 // The index of the type parameter in [parameters] is
1639 // the same index into the `klass->type_parameters()` array. 1614 // the same index into the `klass->type_parameters()` array.
1640 result_ ^= 1615 result_ ^=
1641 dart::TypeArguments::Handle(Z, active_class_->klass->type_parameters()) 1616 dart::TypeArguments::Handle(Z, active_class_->klass->type_parameters())
1642 .TypeAt(index); 1617 .TypeAt(list_index);
1643 return; 1618 return;
1644 } 1619 }
1645 1620
1646 UNREACHABLE(); 1621 UNREACHABLE();
1647 } 1622 }
1648 1623
1649 const TypeArguments& StreamingDartTypeTranslator::BuildTypeArguments( 1624 const TypeArguments& StreamingDartTypeTranslator::BuildTypeArguments(
1650 intptr_t length) { 1625 intptr_t length) {
1651 bool only_dynamic = true; 1626 bool only_dynamic = true;
1652 intptr_t offset = builder_->ReaderOffset(); 1627 intptr_t offset = builder_->ReaderOffset();
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 // List of named. 2685 // List of named.
2711 list_length = ReadListLength(); // read list length. 2686 list_length = ReadListLength(); // read list length.
2712 ASSERT(num_optional_parameters == list_length); 2687 ASSERT(num_optional_parameters == list_length);
2713 ASSERT(!parsed_function()->function().HasOptionalPositionalParameters()); 2688 ASSERT(!parsed_function()->function().HasOptionalPositionalParameters());
2714 for (intptr_t i = 0; i < list_length; ++i) { 2689 for (intptr_t i = 0; i < list_length; ++i) {
2715 Instance* default_value; 2690 Instance* default_value;
2716 2691
2717 // Read ith variable declaration 2692 // Read ith variable declaration
2718 VariableDeclarationHelper helper(this); 2693 VariableDeclarationHelper helper(this);
2719 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); 2694 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
2720 Tag tag = ReadTag(); // read (first part of) initializer. 2695 Tag tag = ReadTag(); // read (first part of) initializer.
2721 if (tag == kSomething) { 2696 if (tag == kSomething) {
2722 // this will (potentially) read the initializer, 2697 // this will (potentially) read the initializer,
2723 // but reset the position. 2698 // but reset the position.
2724 default_value = 2699 default_value =
2725 &constant_evaluator_.EvaluateExpression(ReaderOffset()); 2700 &constant_evaluator_.EvaluateExpression(ReaderOffset());
2726 SkipExpression(); // read (actual) initializer. 2701 SkipExpression(); // read (actual) initializer.
2727 } else { 2702 } else {
2728 default_value = &Instance::ZoneHandle(Z, Instance::null()); 2703 default_value = &Instance::ZoneHandle(Z, Instance::null());
2729 } 2704 }
2730 default_values->Add(default_value); 2705 default_values->Add(default_value);
2731 } 2706 }
2732 } else { 2707 } else {
2733 // List of positional. 2708 // List of positional.
2734 intptr_t list_length = ReadListLength(); // read list length. 2709 intptr_t list_length = ReadListLength(); // read list length.
2735 ASSERT(list_length == function_node_helper.required_parameter_count_ + 2710 ASSERT(list_length == function_node_helper.required_parameter_count_ +
2736 num_optional_parameters); 2711 num_optional_parameters);
2737 ASSERT(parsed_function()->function().HasOptionalPositionalParameters()); 2712 ASSERT(parsed_function()->function().HasOptionalPositionalParameters());
2738 for (intptr_t i = 0; i < function_node_helper.required_parameter_count_; 2713 for (intptr_t i = 0; i < function_node_helper.required_parameter_count_;
2739 ++i) { 2714 ++i) {
2740 SkipVariableDeclaration(); // read ith variable declaration. 2715 SkipVariableDeclaration(); // read ith variable declaration.
2741 } 2716 }
2742 for (intptr_t i = 0; i < num_optional_parameters; ++i) { 2717 for (intptr_t i = 0; i < num_optional_parameters; ++i) {
2743 Instance* default_value; 2718 Instance* default_value;
2744 2719
2745 // Read ith variable declaration 2720 // Read ith variable declaration
2746 VariableDeclarationHelper helper(this); 2721 VariableDeclarationHelper helper(this);
2747 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); 2722 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
2748 Tag tag = ReadTag(); // read (first part of) initializer. 2723 Tag tag = ReadTag(); // read (first part of) initializer.
2749 if (tag == kSomething) { 2724 if (tag == kSomething) {
2750 // this will (potentially) read the initializer, 2725 // this will (potentially) read the initializer,
2751 // but reset the position. 2726 // but reset the position.
2752 default_value = 2727 default_value =
2753 &constant_evaluator_.EvaluateExpression(ReaderOffset()); 2728 &constant_evaluator_.EvaluateExpression(ReaderOffset());
2754 SkipExpression(); // read (actual) initializer. 2729 SkipExpression(); // read (actual) initializer.
2755 } else { 2730 } else {
2756 default_value = &Instance::ZoneHandle(Z, Instance::null()); 2731 default_value = &Instance::ZoneHandle(Z, Instance::null());
2757 } 2732 }
2758 default_values->Add(default_value); 2733 default_values->Add(default_value);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 // } 2893 // }
2919 // 2894 //
2920 // (This is strictly speaking not what one should do in terms of the 2895 // (This is strictly speaking not what one should do in terms of the
2921 // specification but that is how it is currently implemented.) 2896 // specification but that is how it is currently implemented.)
2922 LocalVariable* variable = LookupVariable(ReaderOffset()); 2897 LocalVariable* variable = LookupVariable(ReaderOffset());
2923 2898
2924 // Variable declaration 2899 // Variable declaration
2925 VariableDeclarationHelper helper(this); 2900 VariableDeclarationHelper helper(this);
2926 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); 2901 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
2927 ASSERT(!helper.IsConst()); 2902 ASSERT(!helper.IsConst());
2928 Tag tag = ReadTag(); // read (first part of) initializer. 2903 Tag tag = ReadTag(); // read (first part of) initializer.
2929 if (tag != kSomething) { 2904 if (tag != kSomething) {
2930 UNREACHABLE(); 2905 UNREACHABLE();
2931 } 2906 }
2932 2907
2933 instructions += BuildExpression(); // read initializer. 2908 instructions += BuildExpression(); // read initializer.
2934 instructions += StoreLocal(TokenPosition::kNoSource, variable); 2909 instructions += StoreLocal(TokenPosition::kNoSource, variable);
2935 instructions += Drop(); 2910 instructions += Drop();
2936 break; 2911 break;
2937 } 2912 }
2938 default: 2913 default:
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3691 StringIndex name_index = ReadStringReference(); // read name index. 3666 StringIndex name_index = ReadStringReference(); // read name index.
3692 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') { 3667 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
3693 NameIndex library_reference = 3668 NameIndex library_reference =
3694 ReadCanonicalNameReference(); // read library index. 3669 ReadCanonicalNameReference(); // read library index.
3695 return H.DartGetterName(library_reference, name_index); 3670 return H.DartGetterName(library_reference, name_index);
3696 } else { 3671 } else {
3697 return H.DartGetterName(NameIndex(), name_index); 3672 return H.DartGetterName(NameIndex(), name_index);
3698 } 3673 }
3699 } 3674 }
3700 3675
3676 const dart::String& StreamingFlowGraphBuilder::ReadNameAsFieldName() {
3677 StringIndex name_index = ReadStringReference(); // read name index.
3678 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
3679 NameIndex library_reference =
3680 ReadCanonicalNameReference(); // read library index.
3681 return H.DartFieldName(library_reference, name_index);
3682 } else {
3683 return H.DartFieldName(NameIndex(), name_index);
3684 }
3685 }
3686
3701 void StreamingFlowGraphBuilder::SkipStringReference() { 3687 void StreamingFlowGraphBuilder::SkipStringReference() {
3702 ReadUInt(); 3688 ReadUInt();
3703 } 3689 }
3704 3690
3705 void StreamingFlowGraphBuilder::SkipCanonicalNameReference() { 3691 void StreamingFlowGraphBuilder::SkipCanonicalNameReference() {
3706 ReadUInt(); 3692 ReadUInt();
3707 } 3693 }
3708 3694
3709 void StreamingFlowGraphBuilder::SkipDartType() { 3695 void StreamingFlowGraphBuilder::SkipDartType() {
3710 Tag tag = ReadTag(); 3696 Tag tag = ReadTag();
(...skipping 11 matching lines...) Expand all
3722 SkipInterfaceType(true); 3708 SkipInterfaceType(true);
3723 return; 3709 return;
3724 case kFunctionType: 3710 case kFunctionType:
3725 SkipFunctionType(false); 3711 SkipFunctionType(false);
3726 return; 3712 return;
3727 case kSimpleFunctionType: 3713 case kSimpleFunctionType:
3728 SkipFunctionType(true); 3714 SkipFunctionType(true);
3729 return; 3715 return;
3730 case kTypeParameterType: 3716 case kTypeParameterType:
3731 ReadUInt(); // read index for parameter. 3717 ReadUInt(); // read index for parameter.
3732 ReadUInt(); // read binary offset. 3718 ReadUInt(); // read list binary offset.
3719 ReadUInt(); // read index in list.
3733 SkipOptionalDartType(); // read bound bound. 3720 SkipOptionalDartType(); // read bound bound.
3734 return; 3721 return;
3735 default: 3722 default:
3736 UNREACHABLE(); 3723 UNREACHABLE();
3737 } 3724 }
3738 } 3725 }
3739 3726
3740 void StreamingFlowGraphBuilder::SkipOptionalDartType() { 3727 void StreamingFlowGraphBuilder::SkipOptionalDartType() {
3741 Tag tag = ReadTag(); // read tag. 3728 Tag tag = ReadTag(); // read tag.
3742 if (tag == kNothing) { 3729 if (tag == kNothing) {
(...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6448 JoinEntryInstr* after_try = BuildJoinEntry(); 6435 JoinEntryInstr* after_try = BuildJoinEntry();
6449 6436
6450 intptr_t offset = ReaderOffset(); 6437 intptr_t offset = ReaderOffset();
6451 SkipStatement(); // temporarily read body. 6438 SkipStatement(); // temporarily read body.
6452 intptr_t finalizer_offset = ReaderOffset(); 6439 intptr_t finalizer_offset = ReaderOffset();
6453 SetOffset(offset); 6440 SetOffset(offset);
6454 6441
6455 // Fill in the body of the try. 6442 // Fill in the body of the try.
6456 try_depth_inc(); 6443 try_depth_inc();
6457 { 6444 {
6458 TryFinallyBlock tfb(flow_graph_builder_, NULL, finalizer_offset); 6445 TryFinallyBlock tfb(flow_graph_builder_, finalizer_offset);
6459 TryCatchBlock tcb(flow_graph_builder_, try_handler_index); 6446 TryCatchBlock tcb(flow_graph_builder_, try_handler_index);
6460 try_body += BuildStatement(); // read body. 6447 try_body += BuildStatement(); // read body.
6461 } 6448 }
6462 try_depth_dec(); 6449 try_depth_dec();
6463 6450
6464 if (try_body.is_open()) { 6451 if (try_body.is_open()) {
6465 // Please note: The try index will be on level out of this block, 6452 // Please note: The try index will be on level out of this block,
6466 // thereby ensuring if there's an exception in the finally block we 6453 // thereby ensuring if there's an exception in the finally block we
6467 // won't run it twice. 6454 // won't run it twice.
6468 JoinEntryInstr* finally_entry = BuildJoinEntry(); 6455 JoinEntryInstr* finally_entry = BuildJoinEntry();
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
6872 ReadListLength(); // read list length. 6859 ReadListLength(); // read list length.
6873 ASSERT(named_parameters_count_check == named_parameters_count); 6860 ASSERT(named_parameters_count_check == named_parameters_count);
6874 } 6861 }
6875 6862
6876 // Read ith variable declaration. 6863 // Read ith variable declaration.
6877 VariableDeclarationHelper helper(this); 6864 VariableDeclarationHelper helper(this);
6878 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); 6865 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
6879 param_descriptor.SetAt(entry_start + Parser::kParameterIsFinalOffset, 6866 param_descriptor.SetAt(entry_start + Parser::kParameterIsFinalOffset,
6880 helper.IsFinal() ? Bool::True() : Bool::False()); 6867 helper.IsFinal() ? Bool::True() : Bool::False());
6881 6868
6882 Tag tag = ReadTag(); // read (first part of) initializer. 6869 Tag tag = ReadTag(); // read (first part of) initializer.
6883 if (tag == kSomething) { 6870 if (tag == kSomething) {
6884 // this will (potentially) read the initializer, but reset the position. 6871 // this will (potentially) read the initializer, but reset the position.
6885 Instance& constant = 6872 Instance& constant =
6886 constant_evaluator_.EvaluateExpression(ReaderOffset()); 6873 constant_evaluator_.EvaluateExpression(ReaderOffset());
6887 SkipExpression(); // read (actual) initializer. 6874 SkipExpression(); // read (actual) initializer.
6888 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset, 6875 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset,
6889 constant); 6876 constant);
6890 } else { 6877 } else {
6891 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset, 6878 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset,
6892 Object::null_instance()); 6879 Object::null_instance());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6928 metadata_values.SetAt(i, value); 6915 metadata_values.SetAt(i, value);
6929 } 6916 }
6930 6917
6931 return metadata_values.raw(); 6918 return metadata_values.raw();
6932 } 6919 }
6933 6920
6934 } // namespace kernel 6921 } // namespace kernel
6935 } // namespace dart 6922 } // namespace dart
6936 6923
6937 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6924 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | runtime/vm/kernel_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698