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

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

Issue 16888013: Revert "Initial implementation of on-stack replacement (OSR)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_allocator.cc » ('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) 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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 644 }
645 } 645 }
646 } 646 }
647 } 647 }
648 } 648 }
649 649
650 650
651 void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis, 651 void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
652 VariableLivenessAnalysis* variable_liveness, 652 VariableLivenessAnalysis* variable_liveness,
653 ZoneGrowableArray<Definition*>* inlining_parameters) { 653 ZoneGrowableArray<Definition*>* inlining_parameters) {
654 GraphEntryInstr* entry = graph_entry(); 654 if (!FLAG_optimize_try_catch && (graph_entry_->SuccessorCount() > 1)) {
655 if (!FLAG_optimize_try_catch && (entry->SuccessorCount() > 1)) {
656 Bailout("Catch-entry support in SSA."); 655 Bailout("Catch-entry support in SSA.");
657 } 656 }
658 657
659 // Initial renaming environment. 658 // Initial renaming environment.
660 GrowableArray<Definition*> env(variable_count()); 659 GrowableArray<Definition*> env(variable_count());
661 660
662 // Add global constants to the initial definitions. 661 // Add global constants to the initial definitions.
663 constant_null_ = GetConstant(Object::ZoneHandle()); 662 constant_null_ = GetConstant(Object::ZoneHandle());
664 663
665 // Add parameters to the initial definitions and renaming environment. 664 // Add parameters to the initial definitions and renaming environment.
666 if (inlining_parameters != NULL) { 665 if (inlining_parameters != NULL) {
667 // Use known parameters. 666 // Use known parameters.
668 ASSERT(parameter_count() == inlining_parameters->length()); 667 ASSERT(parameter_count() == inlining_parameters->length());
669 for (intptr_t i = 0; i < parameter_count(); ++i) { 668 for (intptr_t i = 0; i < parameter_count(); ++i) {
670 Definition* defn = (*inlining_parameters)[i]; 669 Definition* defn = (*inlining_parameters)[i];
671 defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. 670 defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
672 AddToInitialDefinitions(defn); 671 AddToInitialDefinitions(defn);
673 env.Add(defn); 672 env.Add(defn);
674 } 673 }
675 } else { 674 } else {
676 // Create new parameters. For functions compiled for OSR, the locals 675 // Create new parameters.
677 // are unknown and so treated like parameters. 676 for (intptr_t i = 0; i < parameter_count(); ++i) {
678 intptr_t count = IsCompiledForOsr() ? variable_count() : parameter_count(); 677 ParameterInstr* param = new ParameterInstr(i, graph_entry_);
679 for (intptr_t i = 0; i < count; ++i) {
680 ParameterInstr* param = new ParameterInstr(i, entry);
681 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. 678 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
682 AddToInitialDefinitions(param); 679 AddToInitialDefinitions(param);
683 env.Add(param); 680 env.Add(param);
684 } 681 }
685 } 682 }
686 683
687 // Initialize all locals with #null in the renaming environment. For OSR, 684 // Initialize all locals with #null in the renaming environment.
688 // the locals have already been handled as parameters. 685 for (intptr_t i = parameter_count(); i < variable_count(); ++i) {
689 if (!IsCompiledForOsr()) { 686 env.Add(constant_null());
690 for (intptr_t i = parameter_count(); i < variable_count(); ++i) {
691 env.Add(constant_null());
692 }
693 } 687 }
694 688
695 if (entry->SuccessorCount() > 1) { 689 if (graph_entry_->SuccessorCount() > 1) {
696 // Functions with try-catch have a fixed area of stack slots reserved 690 // Functions with try-catch have a fixed area of stack slots reserved
697 // so that all local variables are stored at a known location when 691 // so that all local variables are stored at a known location when
698 // on entry to the catch. 692 // on entry to the catch.
699 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); 693 graph_entry_->set_fixed_slot_count(
694 num_stack_locals() + num_copied_params());
700 } 695 }
701 RenameRecursive(entry, &env, live_phis, variable_liveness); 696 RenameRecursive(graph_entry_, &env, live_phis, variable_liveness);
702 } 697 }
703 698
704 699
705 void FlowGraph::AttachEnvironment(Instruction* instr, 700 void FlowGraph::AttachEnvironment(Instruction* instr,
706 GrowableArray<Definition*>* env) { 701 GrowableArray<Definition*>* env) {
707 Environment* deopt_env = 702 Environment* deopt_env =
708 Environment::From(*env, 703 Environment::From(*env,
709 num_non_copied_params_, 704 num_non_copied_params_,
710 parsed_function_.function()); 705 parsed_function_.function());
711 instr->SetEnvironment(deopt_env); 706 instr->SetEnvironment(deopt_env);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 } 1135 }
1141 1136
1142 1137
1143 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1138 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1144 BlockEntryInstr* to) const { 1139 BlockEntryInstr* to) const {
1145 return available_at_[to->postorder_number()]->Contains( 1140 return available_at_[to->postorder_number()]->Contains(
1146 from->postorder_number()); 1141 from->postorder_number());
1147 } 1142 }
1148 1143
1149 } // namespace dart 1144 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698