| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 entry_ = other_fragment.entry(); | 55 entry_ = other_fragment.entry(); |
| 56 exit_ = other_fragment.exit(); | 56 exit_ = other_fragment.exit(); |
| 57 } else { | 57 } else { |
| 58 exit()->set_next(other_fragment.entry()); | 58 exit()->set_next(other_fragment.entry()); |
| 59 exit_ = other_fragment.exit(); | 59 exit_ = other_fragment.exit(); |
| 60 } | 60 } |
| 61 temp_index_ = other_fragment.temp_index(); | 61 temp_index_ = other_fragment.temp_index(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 UseVal* EffectGraphVisitor::Bind(Computation* computation) { | 65 Value* EffectGraphVisitor::Bind(Computation* computation) { |
| 66 ASSERT(is_open()); | 66 ASSERT(is_open()); |
| 67 DeallocateTempIndex(computation->InputCount()); | 67 DeallocateTempIndex(computation->InputCount()); |
| 68 BindInstr* bind_instr = new BindInstr(BindInstr::kUsed, computation); | 68 BindInstr* bind_instr = new BindInstr(BindInstr::kUsed, computation); |
| 69 bind_instr->set_temp_index(AllocateTempIndex()); | 69 bind_instr->set_temp_index(AllocateTempIndex()); |
| 70 if (is_empty()) { | 70 if (is_empty()) { |
| 71 entry_ = bind_instr; | 71 entry_ = bind_instr; |
| 72 } else { | 72 } else { |
| 73 exit()->set_next(bind_instr); | 73 exit()->set_next(bind_instr); |
| 74 } | 74 } |
| 75 exit_ = bind_instr; | 75 exit_ = bind_instr; |
| 76 return new UseVal(bind_instr); | 76 return new Value(bind_instr); |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 void EffectGraphVisitor::Do(Computation* computation) { | 80 void EffectGraphVisitor::Do(Computation* computation) { |
| 81 ASSERT(is_open()); | 81 ASSERT(is_open()); |
| 82 DeallocateTempIndex(computation->InputCount()); | 82 DeallocateTempIndex(computation->InputCount()); |
| 83 BindInstr* do_instr = new BindInstr(BindInstr::kUnused, computation); | 83 BindInstr* do_instr = new BindInstr(BindInstr::kUnused, computation); |
| 84 if (is_empty()) { | 84 if (is_empty()) { |
| 85 entry_ = do_instr; | 85 entry_ = do_instr; |
| 86 } else { | 86 } else { |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 // t1 = ExtractConstructorInstantiator(t1); | 1681 // t1 = ExtractConstructorInstantiator(t1); |
| 1682 // t_n <- t2 | 1682 // t_n <- t2 |
| 1683 // t_n+1 <- t1 | 1683 // t_n+1 <- t1 |
| 1684 // Use expression_temp_var and node->allocated_object_var() locals to keep | 1684 // Use expression_temp_var and node->allocated_object_var() locals to keep |
| 1685 // intermediate results around (t1 and t2 above). | 1685 // intermediate results around (t1 and t2 above). |
| 1686 ASSERT(owner()->parsed_function().expression_temp_var() != NULL); | 1686 ASSERT(owner()->parsed_function().expression_temp_var() != NULL); |
| 1687 const LocalVariable& t1 = *owner()->parsed_function().expression_temp_var(); | 1687 const LocalVariable& t1 = *owner()->parsed_function().expression_temp_var(); |
| 1688 const LocalVariable& t2 = node->allocated_object_var(); | 1688 const LocalVariable& t2 = node->allocated_object_var(); |
| 1689 Value* instantiator_type_arguments = BuildInstantiatorTypeArguments( | 1689 Value* instantiator_type_arguments = BuildInstantiatorTypeArguments( |
| 1690 node->token_pos(), NULL); | 1690 node->token_pos(), NULL); |
| 1691 ASSERT(instantiator_type_arguments->IsUse()); | |
| 1692 Value* stored_instantiator = | 1691 Value* stored_instantiator = |
| 1693 Bind(BuildStoreLocal(t1, instantiator_type_arguments)); | 1692 Bind(BuildStoreLocal(t1, instantiator_type_arguments)); |
| 1694 // t1: instantiator type arguments. | 1693 // t1: instantiator type arguments. |
| 1695 | 1694 |
| 1696 Value* extract_type_arguments = Bind( | 1695 Value* extract_type_arguments = Bind( |
| 1697 new ExtractConstructorTypeArgumentsComp( | 1696 new ExtractConstructorTypeArgumentsComp( |
| 1698 node->token_pos(), | 1697 node->token_pos(), |
| 1699 owner()->try_index(), | 1698 owner()->try_index(), |
| 1700 node->type_arguments(), | 1699 node->type_arguments(), |
| 1701 stored_instantiator)); | 1700 stored_instantiator)); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2418 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2420 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2419 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2421 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2420 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2422 const Error& error = Error::Handle( | 2421 const Error& error = Error::Handle( |
| 2423 LanguageError::New(String::Handle(String::New(chars)))); | 2422 LanguageError::New(String::Handle(String::New(chars)))); |
| 2424 Isolate::Current()->long_jump_base()->Jump(1, error); | 2423 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2425 } | 2424 } |
| 2426 | 2425 |
| 2427 | 2426 |
| 2428 } // namespace dart | 2427 } // namespace dart |
| OLD | NEW |