| 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/bit_vector.h" | 8 #include "vm/bit_vector.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 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 (*env)[i] = new UseVal(phi); | 2625 (*env)[i] = new UseVal(phi); |
| 2626 phi->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. | 2626 phi->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. |
| 2627 } | 2627 } |
| 2628 } | 2628 } |
| 2629 } | 2629 } |
| 2630 } | 2630 } |
| 2631 | 2631 |
| 2632 // 2. Process normal instructions. | 2632 // 2. Process normal instructions. |
| 2633 for (ForwardInstructionIterator it(block_entry); !it.Done(); it.Advance()) { | 2633 for (ForwardInstructionIterator it(block_entry); !it.Done(); it.Advance()) { |
| 2634 Instruction* current = it.Current(); | 2634 Instruction* current = it.Current(); |
| 2635 // Attach current environment to the instruction. | 2635 // Attach current environment to the instruction. First, each instruction |
| 2636 // TODO(fschneider): Currently each instruction gets a full copy of the | 2636 // gets a full copy of the environment. Later we optimize this by |
| 2637 // environment. This should be optimized: Only instructions that can | 2637 // eliminating unnecessary environments. |
| 2638 // deoptimize should have uses of the environment values. | |
| 2639 current->set_env(new Environment(*env, fixed_parameter_count)); | 2638 current->set_env(new Environment(*env, fixed_parameter_count)); |
| 2640 | 2639 |
| 2641 // 2a. Handle uses: | 2640 // 2a. Handle uses: |
| 2642 // Update expression stack environment for each use. | 2641 // Update expression stack environment for each use. |
| 2643 // For each use of a LoadLocal or StoreLocal: Replace it with the value | 2642 // For each use of a LoadLocal or StoreLocal: Replace it with the value |
| 2644 // from the environment. | 2643 // from the environment. |
| 2645 for (intptr_t i = 0; i < current->InputCount(); ++i) { | 2644 for (intptr_t i = 0; i < current->InputCount(); ++i) { |
| 2646 Value* v = current->InputAt(i); | 2645 Value* v = current->InputAt(i); |
| 2647 if (!v->IsUse()) continue; | 2646 if (!v->IsUse()) continue; |
| 2648 // Update expression stack. | 2647 // Update expression stack. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 char* chars = reinterpret_cast<char*>( | 2749 char* chars = reinterpret_cast<char*>( |
| 2751 Isolate::Current()->current_zone()->Allocate(len)); | 2750 Isolate::Current()->current_zone()->Allocate(len)); |
| 2752 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2751 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2753 const Error& error = Error::Handle( | 2752 const Error& error = Error::Handle( |
| 2754 LanguageError::New(String::Handle(String::New(chars)))); | 2753 LanguageError::New(String::Handle(String::New(chars)))); |
| 2755 Isolate::Current()->long_jump_base()->Jump(1, error); | 2754 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2756 } | 2755 } |
| 2757 | 2756 |
| 2758 | 2757 |
| 2759 } // namespace dart | 2758 } // namespace dart |
| OLD | NEW |