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

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

Issue 11225028: Avoid creating unnecessary environments during SSA renaming. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 (*env)[i] = phi; 516 (*env)[i] = phi;
517 phi->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. 517 phi->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
518 } 518 }
519 } 519 }
520 } 520 }
521 } 521 }
522 522
523 // 2. Process normal instructions. 523 // 2. Process normal instructions.
524 for (ForwardInstructionIterator it(block_entry); !it.Done(); it.Advance()) { 524 for (ForwardInstructionIterator it(block_entry); !it.Done(); it.Advance()) {
525 Instruction* current = it.Current(); 525 Instruction* current = it.Current();
526 // Attach current environment to the instruction. First, each instruction 526 // Attach current environment to the instructions that can deoptimize and
527 // gets a full copy of the environment. Later we optimize this by 527 // at goto instructions. Optimizations like LICM expect an environment at
528 // eliminating unnecessary environments. 528 // gotos.
529 // TODO(zerny): Avoid creating unnecessary environments. Note that some 529 if (current->CanDeoptimize() || current->IsGoto()) {
530 // optimizations need deoptimization info for non-deoptable instructions, 530 current->set_env(Environment::From(*env,
531 // eg, LICM on GOTOs. 531 num_non_copied_params_,
532 current->set_env(Environment::From(*env, 532 parsed_function_.function()));
533 num_non_copied_params_, 533 }
534 parsed_function_.function()));
535 if (current->CanDeoptimize()) { 534 if (current->CanDeoptimize()) {
536 current->env()->set_deopt_id(current->deopt_id()); 535 current->env()->set_deopt_id(current->deopt_id());
537 } 536 }
538 537
539 // 2a. Handle uses: 538 // 2a. Handle uses:
540 // Update expression stack environment for each use. 539 // Update expression stack environment for each use.
541 // For each use of a LoadLocal or StoreLocal: Replace it with the value 540 // For each use of a LoadLocal or StoreLocal: Replace it with the value
542 // from the environment. 541 // from the environment.
543 for (intptr_t i = current->InputCount() - 1; i >= 0; --i) { 542 for (intptr_t i = current->InputCount() - 1; i >= 0; --i) {
544 Value* v = current->InputAt(i); 543 Value* v = current->InputAt(i);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 !it.Done(); 907 !it.Done();
909 it.Advance()) { 908 it.Advance()) {
910 ++size; 909 ++size;
911 } 910 }
912 } 911 }
913 return size; 912 return size;
914 } 913 }
915 914
916 915
917 } // namespace dart 916 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698