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

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

Issue 11190036: Fix optimization of %: replace IC call even if not optimizable. (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_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 InsertBefore(call, 646 InsertBefore(call,
647 new CheckSmiInstr(left->Copy(), call->deopt_id()), 647 new CheckSmiInstr(left->Copy(), call->deopt_id()),
648 call->env(), 648 call->env(),
649 Definition::kEffect); 649 Definition::kEffect);
650 ConstantInstr* c = new ConstantInstr(Smi::Handle(Smi::New(value - 1))); 650 ConstantInstr* c = new ConstantInstr(Smi::Handle(Smi::New(value - 1)));
651 InsertBefore(call, c, NULL, Definition::kValue); 651 InsertBefore(call, c, NULL, Definition::kValue);
652 BinarySmiOpInstr* bin_op = 652 BinarySmiOpInstr* bin_op =
653 new BinarySmiOpInstr(Token::kBIT_AND, call, left, new Value(c)); 653 new BinarySmiOpInstr(Token::kBIT_AND, call, left, new Value(c));
654 call->ReplaceWith(bin_op, current_iterator()); 654 call->ReplaceWith(bin_op, current_iterator());
655 RemovePushArguments(call); 655 RemovePushArguments(call);
656 } else {
657 // Did not replace.
658 return false;
656 } 659 }
657 } else { 660 } else {
658 ASSERT(operands_type == kSmiCid); 661 ASSERT(operands_type == kSmiCid);
659 Value* left = call->ArgumentAt(0)->value(); 662 Value* left = call->ArgumentAt(0)->value();
660 Value* right = call->ArgumentAt(1)->value(); 663 Value* right = call->ArgumentAt(1)->value();
661 // Insert two smi checks and attach a copy of the original 664 // Insert two smi checks and attach a copy of the original
662 // environment because the smi operation can still deoptimize. 665 // environment because the smi operation can still deoptimize.
663 InsertBefore(call, 666 InsertBefore(call,
664 new CheckSmiInstr(left->Copy(), call->deopt_id()), 667 new CheckSmiInstr(left->Copy(), call->deopt_id()),
665 call->env(), 668 call->env(),
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 3338
3336 if (FLAG_trace_constant_propagation) { 3339 if (FLAG_trace_constant_propagation) {
3337 OS::Print("\n==== After constant propagation ====\n"); 3340 OS::Print("\n==== After constant propagation ====\n");
3338 FlowGraphPrinter printer(*graph_); 3341 FlowGraphPrinter printer(*graph_);
3339 printer.PrintBlocks(); 3342 printer.PrintBlocks();
3340 } 3343 }
3341 } 3344 }
3342 3345
3343 3346
3344 } // namespace dart 3347 } // 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