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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2640 | 2640 |
| 2641 | 2641 |
| 2642 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { | 2642 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { |
| 2643 // PrimaryNodes are temporary during parsing. | 2643 // PrimaryNodes are temporary during parsing. |
| 2644 UNREACHABLE(); | 2644 UNREACHABLE(); |
| 2645 } | 2645 } |
| 2646 | 2646 |
| 2647 | 2647 |
| 2648 // <Expression> ::= LoadLocal { local: LocalVariable } | 2648 // <Expression> ::= LoadLocal { local: LocalVariable } |
| 2649 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 2649 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 2650 if (node->HasPseudo()) { | 2650 // Nothing to do. |
| 2651 EffectGraphVisitor for_pseudo(owner(), temp_index()); | |
| 2652 node->pseudo()->Visit(&for_pseudo); | |
| 2653 Append(for_pseudo); | |
| 2654 } | |
| 2655 } | 2651 } |
| 2656 | 2652 |
| 2657 | 2653 |
| 2658 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 2654 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 2659 EffectGraphVisitor::VisitLoadLocalNode(node); | |
| 2660 Definition* load = BuildLoadLocal(node->local()); | 2655 Definition* load = BuildLoadLocal(node->local()); |
| 2661 ReturnDefinition(load); | 2656 ReturnDefinition(load); |
| 2662 } | 2657 } |
| 2663 | 2658 |
| 2664 | 2659 |
| 2665 // <Expression> ::= StoreLocal { local: LocalVariable | 2660 // <Expression> ::= StoreLocal { local: LocalVariable |
| 2666 // value: <Expression> } | 2661 // value: <Expression> } |
| 2667 void EffectGraphVisitor::HandleStoreLocal(StoreLocalNode* node, | 2662 void EffectGraphVisitor::HandleStoreLocal(StoreLocalNode* node, |
| 2668 bool result_is_needed) { | 2663 bool result_is_needed) { |
| 2669 ValueGraphVisitor for_value(owner(), temp_index()); | 2664 ValueGraphVisitor for_value(owner(), temp_index()); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3140 AddInstruction( | 3135 AddInstruction( |
| 3141 new CatchEntryInstr(node->exception_var(), node->stacktrace_var())); | 3136 new CatchEntryInstr(node->exception_var(), node->stacktrace_var())); |
| 3142 BuildLoadContext(node->context_var()); | 3137 BuildLoadContext(node->context_var()); |
| 3143 | 3138 |
| 3144 EffectGraphVisitor for_catch(owner(), temp_index()); | 3139 EffectGraphVisitor for_catch(owner(), temp_index()); |
| 3145 node->VisitChildren(&for_catch); | 3140 node->VisitChildren(&for_catch); |
| 3146 Append(for_catch); | 3141 Append(for_catch); |
| 3147 } | 3142 } |
| 3148 | 3143 |
| 3149 | 3144 |
| 3145 void EffectGraphVisitor::VisitCommaNode(CommaNode* node) { | |
| 3146 EffectGraphVisitor for_effect_first(owner(), temp_index()); | |
|
Kevin Millikin (Google)
2013/05/28 09:13:26
Here and below: a loop over the children if you su
| |
| 3147 node->first()->Visit(&for_effect_first); | |
| 3148 Append(for_effect_first); | |
| 3149 | |
| 3150 EffectGraphVisitor for_effect_second(owner(), temp_index()); | |
| 3151 node->second()->Visit(&for_effect_second); | |
| 3152 Append(for_effect_second); | |
| 3153 } | |
| 3154 | |
| 3155 | |
| 3156 void ValueGraphVisitor::VisitCommaNode(CommaNode* node) { | |
| 3157 EffectGraphVisitor for_effect(owner(), temp_index()); | |
| 3158 node->first()->Visit(&for_effect); | |
| 3159 Append(for_effect); | |
| 3160 | |
| 3161 ValueGraphVisitor for_value(owner(), temp_index()); | |
| 3162 node->second()->Visit(&for_value); | |
| 3163 Append(for_value); | |
| 3164 ReturnValue(for_value.value()); | |
| 3165 } | |
| 3166 | |
| 3167 | |
| 3150 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | 3168 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { |
| 3151 InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)"); | 3169 InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)"); |
| 3152 intptr_t old_try_index = owner()->try_index(); | 3170 intptr_t old_try_index = owner()->try_index(); |
| 3153 intptr_t try_index = owner()->AllocateTryIndex(); | 3171 intptr_t try_index = owner()->AllocateTryIndex(); |
| 3154 owner()->set_try_index(try_index); | 3172 owner()->set_try_index(try_index); |
| 3155 | 3173 |
| 3156 // Preserve CTX into local variable '%saved_context'. | 3174 // Preserve CTX into local variable '%saved_context'. |
| 3157 BuildStoreContext(node->context_var()); | 3175 BuildStoreContext(node->context_var()); |
| 3158 | 3176 |
| 3159 EffectGraphVisitor for_try_block(owner(), temp_index()); | 3177 EffectGraphVisitor for_try_block(owner(), temp_index()); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3441 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3459 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3442 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3460 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3443 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3461 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3444 const Error& error = Error::Handle( | 3462 const Error& error = Error::Handle( |
| 3445 LanguageError::New(String::Handle(String::New(chars)))); | 3463 LanguageError::New(String::Handle(String::New(chars)))); |
| 3446 Isolate::Current()->long_jump_base()->Jump(1, error); | 3464 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3447 } | 3465 } |
| 3448 | 3466 |
| 3449 | 3467 |
| 3450 } // namespace dart | 3468 } // namespace dart |
| OLD | NEW |