Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 body_exit->SetSuccessor(join); | 128 body_exit->SetSuccessor(join); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // 3. Set the exit to the graph to be the false successor of the test, a | 131 // 3. Set the exit to the graph to be the false successor of the test, a |
| 132 // fresh target node | 132 // fresh target node |
| 133 exit_ = *test_fragment.false_successor_address() = new TargetEntryInstr(); | 133 exit_ = *test_fragment.false_successor_address() = new TargetEntryInstr(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 // Stores current context into the 'variable' | 137 // Stores current context into the 'variable' |
| 138 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable, | 138 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) { |
| 139 intptr_t start_index) { | 139 BindInstr* context = new BindInstr(temp_index(), new CurrentContextComp()); |
| 140 AddInstruction(new BindInstr(start_index, new CurrentContextComp())); | 140 AddInstruction(context); |
| 141 StoreLocalComp* store_context = new StoreLocalComp( | 141 StoreLocalComp* store_context = |
| 142 variable, | 142 new StoreLocalComp(variable, new UseVal(context), |
| 143 new TempVal(start_index), | 143 owner()->context_level()); |
| 144 owner()->context_level()); | |
| 145 AddInstruction(new DoInstr(store_context)); | 144 AddInstruction(new DoInstr(store_context)); |
| 146 } | 145 } |
| 147 | 146 |
| 148 | 147 |
| 149 // Loads context saved in 'context_variable' into the current context. | 148 // Loads context saved in 'context_variable' into the current context. |
| 150 void EffectGraphVisitor::BuildLoadContext( | 149 void EffectGraphVisitor::BuildLoadContext(const LocalVariable& variable) { |
| 151 const LocalVariable& variable, intptr_t start_index) { | 150 BindInstr* load_saved_context = |
| 152 LoadLocalComp* load_saved_context = | 151 new BindInstr(temp_index(), |
| 153 new LoadLocalComp(variable, owner()->context_level()); | 152 new LoadLocalComp(variable, owner()->context_level())); |
| 154 AddInstruction(new BindInstr(start_index, load_saved_context)); | 153 AddInstruction(load_saved_context); |
| 155 StoreContextComp* store_context = | 154 DoInstr* store_context = |
| 156 new StoreContextComp(new TempVal(start_index)); | 155 new DoInstr(new StoreContextComp(new UseVal(load_saved_context))); |
| 157 AddInstruction(new DoInstr(store_context)); | 156 AddInstruction(store_context); |
| 158 } | 157 } |
| 159 | 158 |
| 160 | 159 |
| 161 | 160 |
| 162 void TestGraphVisitor::ReturnValue(Value* value) { | 161 void TestGraphVisitor::ReturnValue(Value* value) { |
| 163 if (FLAG_enable_type_checks) { | 162 if (FLAG_enable_type_checks) { |
| 164 AssertBooleanComp* assert_boolean = | 163 BindInstr* assert_boolean = |
| 165 new AssertBooleanComp(condition_node_id(), | 164 new BindInstr(temp_index(), |
| 166 condition_token_index(), | 165 new AssertBooleanComp(condition_node_id(), |
| 167 owner()->try_index(), | 166 condition_token_index(), |
| 168 value); | 167 owner()->try_index(), |
| 169 AddInstruction(new BindInstr(temp_index(), assert_boolean)); | 168 value)); |
| 170 value = new TempVal(temp_index()); | 169 AddInstruction(assert_boolean); |
| 170 value = new UseVal(assert_boolean); | |
| 171 } | 171 } |
| 172 BranchInstr* branch = new BranchInstr(value); | 172 BranchInstr* branch = new BranchInstr(value); |
| 173 AddInstruction(branch); | 173 AddInstruction(branch); |
| 174 CloseFragment(); | 174 CloseFragment(); |
| 175 true_successor_address_ = branch->true_successor_address(); | 175 true_successor_address_ = branch->true_successor_address(); |
| 176 false_successor_address_ = branch->false_successor_address(); | 176 false_successor_address_ = branch->false_successor_address(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 void ArgumentGraphVisitor::ReturnValue(Value* value) { | 180 void ArgumentGraphVisitor::ReturnValue(Value* value) { |
| 181 value_ = value; | 181 value_ = value; |
| 182 if (value->IsConstant()) { | 182 if (value->IsConstant()) { |
| 183 AddInstruction(new BindInstr(temp_index(), value)); | 183 BindInstr* defn = new BindInstr(temp_index(), value); |
| 184 value_ = new TempVal(AllocateTempIndex()); | 184 AddInstruction(defn); |
| 185 value_ = new UseVal(defn); | |
| 186 AllocateTempIndex(); | |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 | 189 |
| 188 | 190 |
| 189 void EffectGraphVisitor::Bailout(const char* reason) { | 191 void EffectGraphVisitor::Bailout(const char* reason) { |
| 190 owner()->Bailout(reason); | 192 owner()->Bailout(reason); |
| 191 } | 193 } |
| 192 | 194 |
| 193 | 195 |
| 194 // <Statement> ::= Return { value: <Expression> | 196 // <Statement> ::= Return { value: <Expression> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 dst_type, | 228 dst_type, |
| 227 dst_name, | 229 dst_name, |
| 228 temp_index()); | 230 temp_index()); |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 | 233 |
| 232 intptr_t current_context_level = owner()->context_level(); | 234 intptr_t current_context_level = owner()->context_level(); |
| 233 ASSERT(current_context_level >= 0); | 235 ASSERT(current_context_level >= 0); |
| 234 if (owner()->parsed_function().saved_context_var() != NULL) { | 236 if (owner()->parsed_function().saved_context_var() != NULL) { |
| 235 // CTX on entry was saved, but not linked as context parent. | 237 // CTX on entry was saved, but not linked as context parent. |
| 236 BuildLoadContext(*owner()->parsed_function().saved_context_var(), 0); | 238 BuildLoadContext(*owner()->parsed_function().saved_context_var()); |
| 237 } else { | 239 } else { |
| 238 while (current_context_level-- > 0) { | 240 while (current_context_level-- > 0) { |
| 239 UnchainContext(); | 241 UnchainContext(); |
| 240 } | 242 } |
| 241 } | 243 } |
| 242 | 244 |
| 243 | |
| 244 AddInstruction( | 245 AddInstruction( |
| 245 new ReturnInstr(node->id(), node->token_index(), return_value)); | 246 new ReturnInstr(node->id(), node->token_index(), return_value)); |
| 246 CloseFragment(); | 247 CloseFragment(); |
| 247 } | 248 } |
| 248 | 249 |
| 249 | 250 |
| 250 // <Expression> ::= Literal { literal: Instance } | 251 // <Expression> ::= Literal { literal: Instance } |
| 251 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { | 252 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { |
| 252 return; | 253 return; |
| 253 } | 254 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 if (CanSkipTypeCheck(value, dst_type)) { | 552 if (CanSkipTypeCheck(value, dst_type)) { |
| 552 return value; | 553 return value; |
| 553 } | 554 } |
| 554 | 555 |
| 555 // Build the type check computation. | 556 // Build the type check computation. |
| 556 Value* instantiator_type_arguments = NULL; | 557 Value* instantiator_type_arguments = NULL; |
| 557 if (!dst_type.IsInstantiated()) { | 558 if (!dst_type.IsInstantiated()) { |
| 558 instantiator_type_arguments = | 559 instantiator_type_arguments = |
| 559 BuildInstantiatorTypeArguments(token_index, start_index + 1); | 560 BuildInstantiatorTypeArguments(token_index, start_index + 1); |
| 560 } | 561 } |
| 561 AssertAssignableComp* assert_assignable = | 562 BindInstr* assert_assignable = |
| 562 new AssertAssignableComp(node_id, | 563 new BindInstr(start_index, |
| 563 token_index, | 564 new AssertAssignableComp(node_id, |
| 564 owner()->try_index(), | 565 token_index, |
| 565 value, | 566 owner()->try_index(), |
| 566 instantiator_type_arguments, | 567 value, |
| 567 dst_type, | 568 instantiator_type_arguments, |
| 568 dst_name); | 569 dst_type, |
| 569 AddInstruction(new BindInstr(start_index, assert_assignable)); | 570 dst_name)); |
| 570 return new TempVal(start_index); | 571 AddInstruction(assert_assignable); |
| 572 return new UseVal(assert_assignable); | |
| 571 } | 573 } |
| 572 | 574 |
| 573 | 575 |
| 574 void EffectGraphVisitor::BuildInstanceOf(ComparisonNode* node) { | 576 void EffectGraphVisitor::BuildInstanceOf(ComparisonNode* node) { |
| 575 ASSERT(Token::IsInstanceofOperator(node->kind())); | 577 ASSERT(Token::IsInstanceofOperator(node->kind())); |
| 576 EffectGraphVisitor for_left_value(owner(), temp_index()); | 578 EffectGraphVisitor for_left_value(owner(), temp_index()); |
| 577 node->left()->Visit(&for_left_value); | 579 node->left()->Visit(&for_left_value); |
| 578 Append(for_left_value); | 580 Append(for_left_value); |
| 579 } | 581 } |
| 580 | 582 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 Append(for_left_value); | 679 Append(for_left_value); |
| 678 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); | 680 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); |
| 679 node->right()->Visit(&for_right_value); | 681 node->right()->Visit(&for_right_value); |
| 680 Append(for_right_value); | 682 Append(for_right_value); |
| 681 EqualityCompareComp* comp = new EqualityCompareComp( | 683 EqualityCompareComp* comp = new EqualityCompareComp( |
| 682 node->id(), node->token_index(), owner()->try_index(), | 684 node->id(), node->token_index(), owner()->try_index(), |
| 683 for_left_value.value(), for_right_value.value()); | 685 for_left_value.value(), for_right_value.value()); |
| 684 if (node->kind() == Token::kEQ) { | 686 if (node->kind() == Token::kEQ) { |
| 685 ReturnComputation(comp); | 687 ReturnComputation(comp); |
| 686 } else { | 688 } else { |
| 687 AddInstruction(new BindInstr(temp_index(), comp)); | 689 Definition* eq_result = new BindInstr(temp_index(), comp); |
| 688 Value* eq_result = new TempVal(temp_index()); | 690 AddInstruction(eq_result); |
| 689 if (FLAG_enable_type_checks) { | 691 if (FLAG_enable_type_checks) { |
| 690 AssertBooleanComp* assert_boolean = | 692 eq_result = |
| 691 new AssertBooleanComp(node->id(), | 693 new BindInstr(temp_index(), |
| 692 node->token_index(), | 694 new AssertBooleanComp(node->id(), |
| 693 owner()->try_index(), | 695 node->token_index(), |
| 694 eq_result); | 696 owner()->try_index(), |
| 695 AddInstruction(new BindInstr(temp_index(), assert_boolean)); | 697 new UseVal(eq_result))); |
| 696 eq_result = new TempVal(temp_index()); | 698 AddInstruction(eq_result); |
| 697 } | 699 } |
| 698 BooleanNegateComp* negate = new BooleanNegateComp(eq_result); | 700 BooleanNegateComp* negate = new BooleanNegateComp(new UseVal(eq_result)); |
| 699 ReturnComputation(negate); | 701 ReturnComputation(negate); |
| 700 } | 702 } |
| 701 return; | 703 return; |
| 702 } | 704 } |
| 703 | 705 |
| 704 ArgumentGraphVisitor for_left_value(owner(), temp_index()); | 706 ArgumentGraphVisitor for_left_value(owner(), temp_index()); |
| 705 node->left()->Visit(&for_left_value); | 707 node->left()->Visit(&for_left_value); |
| 706 Append(for_left_value); | 708 Append(for_left_value); |
| 707 ArgumentGraphVisitor for_right_value(owner(), for_left_value.temp_index()); | 709 ArgumentGraphVisitor for_right_value(owner(), for_left_value.temp_index()); |
| 708 node->right()->Visit(&for_right_value); | 710 node->right()->Visit(&for_right_value); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 719 | 721 |
| 720 | 722 |
| 721 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 723 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { |
| 722 // "!" cannot be overloaded, therefore do not call operator. | 724 // "!" cannot be overloaded, therefore do not call operator. |
| 723 if (node->kind() == Token::kNOT) { | 725 if (node->kind() == Token::kNOT) { |
| 724 ValueGraphVisitor for_value(owner(), temp_index()); | 726 ValueGraphVisitor for_value(owner(), temp_index()); |
| 725 node->operand()->Visit(&for_value); | 727 node->operand()->Visit(&for_value); |
| 726 Append(for_value); | 728 Append(for_value); |
| 727 Value* value = for_value.value(); | 729 Value* value = for_value.value(); |
| 728 if (FLAG_enable_type_checks) { | 730 if (FLAG_enable_type_checks) { |
| 729 AssertBooleanComp* assert_boolean = | 731 BindInstr* assert_boolean = |
| 730 new AssertBooleanComp(node->operand()->id(), | 732 new BindInstr(temp_index(), |
| 731 node->operand()->token_index(), | 733 new AssertBooleanComp(node->operand()->id(), |
| 732 owner()->try_index(), | 734 node->operand()->token_index(), |
| 733 value); | 735 owner()->try_index(), |
| 734 AddInstruction(new BindInstr(temp_index(), assert_boolean)); | 736 value)); |
| 735 value = new TempVal(temp_index()); | 737 AddInstruction(assert_boolean); |
| 738 value = new UseVal(assert_boolean); | |
| 736 } | 739 } |
| 737 BooleanNegateComp* negate = new BooleanNegateComp(value); | 740 BooleanNegateComp* negate = new BooleanNegateComp(value); |
| 738 ReturnComputation(negate); | 741 ReturnComputation(negate); |
| 739 return; | 742 return; |
| 740 } | 743 } |
| 741 ArgumentGraphVisitor for_value(owner(), temp_index()); | 744 ArgumentGraphVisitor for_value(owner(), temp_index()); |
| 742 node->operand()->Visit(&for_value); | 745 node->operand()->Visit(&for_value); |
| 743 Append(for_value); | 746 Append(for_value); |
| 744 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); | 747 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); |
| 745 arguments->Add(for_value.value()); | 748 arguments->Add(for_value.value()); |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 owner()->parsed_function().function().owner()); | 1664 owner()->parsed_function().function().owner()); |
| 1662 if (instantiator_class.NumTypeParameters() == 0) { | 1665 if (instantiator_class.NumTypeParameters() == 0) { |
| 1663 // The type arguments are compile time constants. | 1666 // The type arguments are compile time constants. |
| 1664 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(); | 1667 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(); |
| 1665 // TODO(regis): Temporary type should be allocated in new gen heap. | 1668 // TODO(regis): Temporary type should be allocated in new gen heap. |
| 1666 Type& type = Type::Handle( | 1669 Type& type = Type::Handle( |
| 1667 Type::New(instantiator_class, type_arguments, token_index)); | 1670 Type::New(instantiator_class, type_arguments, token_index)); |
| 1668 type ^= ClassFinalizer::FinalizeType( | 1671 type ^= ClassFinalizer::FinalizeType( |
| 1669 instantiator_class, type, ClassFinalizer::kFinalizeWellFormed); | 1672 instantiator_class, type, ClassFinalizer::kFinalizeWellFormed); |
| 1670 type_arguments = type.arguments(); | 1673 type_arguments = type.arguments(); |
| 1671 AddInstruction(new BindInstr(start_index, new ConstantVal(type_arguments))); | 1674 BindInstr* args = |
| 1672 return new TempVal(start_index); | 1675 new BindInstr(temp_index(), new ConstantVal(type_arguments)); |
| 1676 AddInstruction(args); | |
| 1677 return new UseVal(args); | |
| 1673 } | 1678 } |
| 1674 ASSERT(owner()->parsed_function().instantiator() != NULL); | 1679 ASSERT(owner()->parsed_function().instantiator() != NULL); |
| 1675 ValueGraphVisitor for_instantiator(owner(), start_index); | 1680 ValueGraphVisitor for_instantiator(owner(), temp_index()); |
|
srdjan
2012/04/24 22:02:18
Why temp_index() instead of start_index, it seems
Kevin Millikin (Google)
2012/04/25 08:50:51
Oops, that's a stray change that crept in here. I
| |
| 1676 owner()->parsed_function().instantiator()->Visit(&for_instantiator); | 1681 owner()->parsed_function().instantiator()->Visit(&for_instantiator); |
| 1677 Append(for_instantiator); | 1682 Append(for_instantiator); |
| 1678 Function& outer_function = | 1683 Function& outer_function = |
| 1679 Function::Handle(owner()->parsed_function().function().raw()); | 1684 Function::Handle(owner()->parsed_function().function().raw()); |
| 1680 while (outer_function.IsLocalFunction()) { | 1685 while (outer_function.IsLocalFunction()) { |
| 1681 outer_function = outer_function.parent_function(); | 1686 outer_function = outer_function.parent_function(); |
| 1682 } | 1687 } |
| 1683 if (outer_function.IsFactory()) { | 1688 if (outer_function.IsFactory()) { |
| 1684 // All OK. | 1689 // All OK. |
| 1685 return for_instantiator.value(); | 1690 return for_instantiator.value(); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2141 Append(for_effect); | 2146 Append(for_effect); |
| 2142 if (!is_open()) { | 2147 if (!is_open()) { |
| 2143 // E.g., because of a JumpNode. | 2148 // E.g., because of a JumpNode. |
| 2144 break; | 2149 break; |
| 2145 } | 2150 } |
| 2146 } | 2151 } |
| 2147 | 2152 |
| 2148 if (is_open()) { | 2153 if (is_open()) { |
| 2149 if (MustSaveRestoreContext(node)) { | 2154 if (MustSaveRestoreContext(node)) { |
| 2150 ASSERT(num_context_variables > 0); | 2155 ASSERT(num_context_variables > 0); |
| 2151 BuildLoadContext(*owner()->parsed_function().saved_context_var(), 0); | 2156 BuildLoadContext(*owner()->parsed_function().saved_context_var()); |
| 2152 } else if (num_context_variables > 0) { | 2157 } else if (num_context_variables > 0) { |
| 2153 UnchainContext(); | 2158 UnchainContext(); |
| 2154 } | 2159 } |
| 2155 } | 2160 } |
| 2156 | 2161 |
| 2157 // No continue on sequence allowed. | 2162 // No continue on sequence allowed. |
| 2158 ASSERT((node->label() == NULL) || | 2163 ASSERT((node->label() == NULL) || |
| 2159 (node->label()->join_for_continue() == NULL)); | 2164 (node->label()->join_for_continue() == NULL)); |
| 2160 // If this node sequence is labeled, a break out of the sequence will have | 2165 // If this node sequence is labeled, a break out of the sequence will have |
| 2161 // taken care of unchaining the context. | 2166 // taken care of unchaining the context. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 2175 } | 2180 } |
| 2176 | 2181 |
| 2177 | 2182 |
| 2178 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | 2183 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { |
| 2179 // NOTE: The implicit variables ':saved_context', ':exception_var' | 2184 // NOTE: The implicit variables ':saved_context', ':exception_var' |
| 2180 // and ':stacktrace_var' can never be captured variables. | 2185 // and ':stacktrace_var' can never be captured variables. |
| 2181 // Restores CTX from local variable ':saved_context'. | 2186 // Restores CTX from local variable ':saved_context'. |
| 2182 CatchEntryComp* catch_entry = new CatchEntryComp(node->exception_var(), | 2187 CatchEntryComp* catch_entry = new CatchEntryComp(node->exception_var(), |
| 2183 node->stacktrace_var()); | 2188 node->stacktrace_var()); |
| 2184 AddInstruction(new DoInstr(catch_entry)); | 2189 AddInstruction(new DoInstr(catch_entry)); |
| 2185 BuildLoadContext(node->context_var(), temp_index()); | 2190 BuildLoadContext(node->context_var()); |
| 2186 | 2191 |
| 2187 EffectGraphVisitor for_catch(owner(), temp_index()); | 2192 EffectGraphVisitor for_catch(owner(), temp_index()); |
| 2188 node->VisitChildren(&for_catch); | 2193 node->VisitChildren(&for_catch); |
| 2189 Append(for_catch); | 2194 Append(for_catch); |
| 2190 } | 2195 } |
| 2191 | 2196 |
| 2192 | 2197 |
| 2193 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | 2198 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { |
| 2194 intptr_t old_try_index = owner()->try_index(); | 2199 intptr_t old_try_index = owner()->try_index(); |
| 2195 intptr_t try_index = owner()->AllocateTryIndex(); | 2200 intptr_t try_index = owner()->AllocateTryIndex(); |
| 2196 owner()->set_try_index(try_index); | 2201 owner()->set_try_index(try_index); |
| 2197 | 2202 |
| 2198 // Preserve CTX into local variable '%saved_context'. | 2203 // Preserve CTX into local variable '%saved_context'. |
| 2199 BuildStoreContext(node->context_var(), temp_index()); | 2204 BuildStoreContext(node->context_var()); |
| 2200 | 2205 |
| 2201 EffectGraphVisitor for_try_block(owner(), temp_index()); | 2206 EffectGraphVisitor for_try_block(owner(), temp_index()); |
| 2202 node->try_block()->Visit(&for_try_block); | 2207 node->try_block()->Visit(&for_try_block); |
| 2203 Append(for_try_block); | 2208 Append(for_try_block); |
| 2204 | 2209 |
| 2205 // We are done generating code for the try block. | 2210 // We are done generating code for the try block. |
| 2206 owner()->set_try_index(old_try_index); | 2211 owner()->set_try_index(old_try_index); |
| 2207 | 2212 |
| 2208 CatchClauseNode* catch_block = node->catch_block(); | 2213 CatchClauseNode* catch_block = node->catch_block(); |
| 2209 if (catch_block != NULL) { | 2214 if (catch_block != NULL) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2275 | 2280 |
| 2276 | 2281 |
| 2277 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | 2282 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { |
| 2278 const intptr_t try_index = owner()->try_index(); | 2283 const intptr_t try_index = owner()->try_index(); |
| 2279 if (try_index >= 0) { | 2284 if (try_index >= 0) { |
| 2280 // We are about to generate code for an inlined finally block. Exceptions | 2285 // We are about to generate code for an inlined finally block. Exceptions |
| 2281 // thrown in this block of code should be treated as though they are | 2286 // thrown in this block of code should be treated as though they are |
| 2282 // thrown not from the current try block but the outer try block if any. | 2287 // thrown not from the current try block but the outer try block if any. |
| 2283 owner()->set_try_index((try_index - 1)); | 2288 owner()->set_try_index((try_index - 1)); |
| 2284 } | 2289 } |
| 2285 BuildLoadContext(node->context_var(), temp_index()); | 2290 BuildLoadContext(node->context_var()); |
| 2286 EffectGraphVisitor for_finally_block(owner(), temp_index()); | 2291 EffectGraphVisitor for_finally_block(owner(), temp_index()); |
| 2287 node->finally_block()->Visit(&for_finally_block); | 2292 node->finally_block()->Visit(&for_finally_block); |
| 2288 Append(for_finally_block); | 2293 Append(for_finally_block); |
| 2289 if (try_index >= 0) { | 2294 if (try_index >= 0) { |
| 2290 owner()->set_try_index(try_index); | 2295 owner()->set_try_index(try_index); |
| 2291 } | 2296 } |
| 2292 } | 2297 } |
| 2293 | 2298 |
| 2294 | 2299 |
| 2295 // Graph printing. | 2300 // Graph printing. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2351 OS::Print("\n"); | 2356 OS::Print("\n"); |
| 2352 } | 2357 } |
| 2353 } | 2358 } |
| 2354 | 2359 |
| 2355 | 2360 |
| 2356 void FlowGraphPrinter::VisitTemp(TempVal* val) { | 2361 void FlowGraphPrinter::VisitTemp(TempVal* val) { |
| 2357 OS::Print("t%d", val->index()); | 2362 OS::Print("t%d", val->index()); |
| 2358 } | 2363 } |
| 2359 | 2364 |
| 2360 | 2365 |
| 2366 void FlowGraphPrinter::VisitUse(UseVal* val) { | |
| 2367 OS::Print("s%d", val->definition()->temp_index()); | |
| 2368 } | |
| 2369 | |
| 2370 | |
| 2361 void FlowGraphPrinter::VisitConstant(ConstantVal* val) { | 2371 void FlowGraphPrinter::VisitConstant(ConstantVal* val) { |
| 2362 OS::Print("#%s", val->value().ToCString()); | 2372 OS::Print("#%s", val->value().ToCString()); |
| 2363 } | 2373 } |
| 2364 | 2374 |
| 2365 | 2375 |
| 2366 void FlowGraphPrinter::VisitAssertAssignable(AssertAssignableComp* comp) { | 2376 void FlowGraphPrinter::VisitAssertAssignable(AssertAssignableComp* comp) { |
| 2367 OS::Print("AssertAssignable("); | 2377 OS::Print("AssertAssignable("); |
| 2368 comp->value()->Accept(this); | 2378 comp->value()->Accept(this); |
| 2369 OS::Print(", %s, '%s'", | 2379 OS::Print(", %s, '%s'", |
| 2370 String::Handle(comp->dst_type().Name()).ToCString(), | 2380 String::Handle(comp->dst_type().Name()).ToCString(), |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2638 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { | 2648 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { |
| 2639 OS::Print("%2d: [target", reverse_index(instr->postorder_number())); | 2649 OS::Print("%2d: [target", reverse_index(instr->postorder_number())); |
| 2640 if (instr->HasTryIndex()) { | 2650 if (instr->HasTryIndex()) { |
| 2641 OS::Print(" catch %d]", instr->try_index()); | 2651 OS::Print(" catch %d]", instr->try_index()); |
| 2642 } else { | 2652 } else { |
| 2643 OS::Print("]"); | 2653 OS::Print("]"); |
| 2644 } | 2654 } |
| 2645 } | 2655 } |
| 2646 | 2656 |
| 2647 | 2657 |
| 2648 void FlowGraphPrinter::VisitPickTemp(PickTempInstr* instr) { | |
| 2649 OS::Print(" t%d <- Pick(t%d)", instr->destination(), instr->source()); | |
| 2650 } | |
| 2651 | |
| 2652 | |
| 2653 void FlowGraphPrinter::VisitTuckTemp(TuckTempInstr* instr) { | |
| 2654 OS::Print(" t%d := t%d", instr->destination(), instr->source()); | |
| 2655 } | |
| 2656 | |
| 2657 | |
| 2658 void FlowGraphPrinter::VisitDo(DoInstr* instr) { | 2658 void FlowGraphPrinter::VisitDo(DoInstr* instr) { |
| 2659 OS::Print(" "); | 2659 OS::Print(" "); |
| 2660 instr->computation()->Accept(this); | 2660 instr->computation()->Accept(this); |
| 2661 } | 2661 } |
| 2662 | 2662 |
| 2663 | 2663 |
| 2664 void FlowGraphPrinter::VisitBind(BindInstr* instr) { | 2664 void FlowGraphPrinter::VisitBind(BindInstr* instr) { |
| 2665 OS::Print(" t%d <- ", instr->temp_index()); | 2665 OS::Print(" t%d <- ", instr->temp_index()); |
| 2666 instr->computation()->Accept(this); | 2666 instr->computation()->Accept(this); |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 | 2669 |
| 2670 void FlowGraphPrinter::VisitPickTemp(PickTempInstr* instr) { | |
| 2671 OS::Print(" t%d <- Pick(t%d)", instr->temp_index(), instr->source()); | |
| 2672 } | |
| 2673 | |
| 2674 | |
| 2675 void FlowGraphPrinter::VisitTuckTemp(TuckTempInstr* instr) { | |
| 2676 OS::Print(" t%d := t%d", instr->destination(), instr->source()); | |
| 2677 } | |
| 2678 | |
| 2679 | |
| 2670 void FlowGraphPrinter::VisitReturn(ReturnInstr* instr) { | 2680 void FlowGraphPrinter::VisitReturn(ReturnInstr* instr) { |
| 2671 OS::Print(" return "); | 2681 OS::Print(" return "); |
| 2672 instr->value()->Accept(this); | 2682 instr->value()->Accept(this); |
| 2673 } | 2683 } |
| 2674 | 2684 |
| 2675 | 2685 |
| 2676 void FlowGraphPrinter::VisitThrow(ThrowInstr* instr) { | 2686 void FlowGraphPrinter::VisitThrow(ThrowInstr* instr) { |
| 2677 OS::Print("Throw("); | 2687 OS::Print("Throw("); |
| 2678 instr->exception()->Accept(this); | 2688 instr->exception()->Accept(this); |
| 2679 OS::Print(")"); | 2689 OS::Print(")"); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2834 char* chars = reinterpret_cast<char*>( | 2844 char* chars = reinterpret_cast<char*>( |
| 2835 Isolate::Current()->current_zone()->Allocate(len)); | 2845 Isolate::Current()->current_zone()->Allocate(len)); |
| 2836 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2846 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2837 const Error& error = Error::Handle( | 2847 const Error& error = Error::Handle( |
| 2838 LanguageError::New(String::Handle(String::New(chars)))); | 2848 LanguageError::New(String::Handle(String::New(chars)))); |
| 2839 Isolate::Current()->long_jump_base()->Jump(1, error); | 2849 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2840 } | 2850 } |
| 2841 | 2851 |
| 2842 | 2852 |
| 2843 } // namespace dart | 2853 } // namespace dart |
| OLD | NEW |