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

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

Issue 140233002: Fix issue 16103 (VM crash): incorrect merging of sin/cos. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | tests/language/arithmetic_test.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 curr_instr, 414 curr_instr,
415 MergedMathInstr::ResultIndexOf(curr_instr->kind()), 415 MergedMathInstr::ResultIndexOf(curr_instr->kind()),
416 kTypedDataFloat64ArrayCid); 416 kTypedDataFloat64ArrayCid);
417 AppendLoadIndexedForMerged( 417 AppendLoadIndexedForMerged(
418 other_op, 418 other_op,
419 MergedMathInstr::ResultIndexOf(other_op->kind()), 419 MergedMathInstr::ResultIndexOf(other_op->kind()),
420 kTypedDataFloat64ArrayCid); 420 kTypedDataFloat64ArrayCid);
421 ZoneGrowableArray<Value*>* args = new ZoneGrowableArray<Value*>(1); 421 ZoneGrowableArray<Value*>* args = new ZoneGrowableArray<Value*>(1);
422 args->Add(new Value(curr_instr->value()->definition())); 422 args->Add(new Value(curr_instr->value()->definition()));
423 423
424 // Replace with TruncDivMod. 424 // Replace with SinCos.
425 MergedMathInstr* div_mod = new MergedMathInstr( 425 MergedMathInstr* sin_cos = new MergedMathInstr(
426 args, 426 args,
427 curr_instr->DeoptimizationTarget(), 427 curr_instr->DeoptimizationTarget(),
428 MergedMathInstr::kSinCos); 428 MergedMathInstr::kSinCos);
429 curr_instr->ReplaceWith(div_mod, current_iterator()); 429 curr_instr->ReplaceWith(sin_cos, current_iterator());
430 other_op->ReplaceUsesWith(div_mod); 430 other_op->ReplaceUsesWith(sin_cos);
431 other_op->RemoveFromGraph(); 431 other_op->RemoveFromGraph();
432 // Only one merge possible. Because canonicalization happens later,
433 // more candidates are possible.
434 // TODO(srdjan): Allow merging of sin/cos into sincos.
435 break;
432 } 436 }
433 } 437 }
434 } 438 }
435 } 439 }
436 440
437 441
438 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the 442 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the
439 // shift can be a truncating Smi shift-left and result is always Smi. 443 // shift can be a truncating Smi shift-left and result is always Smi.
440 // Merging occurs only per basic-block. 444 // Merging occurs only per basic-block.
441 void FlowGraphOptimizer::TryOptimizePatterns() { 445 void FlowGraphOptimizer::TryOptimizePatterns() {
(...skipping 7881 matching lines...) Expand 10 before | Expand all | Expand 10 after
8323 } 8327 }
8324 8328
8325 // Insert materializations at environment uses. 8329 // Insert materializations at environment uses.
8326 for (intptr_t i = 0; i < exits.length(); i++) { 8330 for (intptr_t i = 0; i < exits.length(); i++) {
8327 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 8331 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
8328 } 8332 }
8329 } 8333 }
8330 8334
8331 8335
8332 } // namespace dart 8336 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/arithmetic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698