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

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

Issue 2463593002: VM: Enable branch merging of isnan, isinf. (Closed)
Patch Set: DBC support Created 4 years, 1 month 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
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | runtime/vm/intermediate_language.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/branch_optimizer.h" 5 #include "vm/branch_optimizer.h"
6 6
7 #include "vm/flow_graph.h" 7 #include "vm/flow_graph.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 26 matching lines...) Expand all
37 // 37 //
38 // Branch(Comparison(kind, Phi, Constant)) 38 // Branch(Comparison(kind, Phi, Constant))
39 // 39 //
40 // These are the branches produced by inlining in a test context. Also, 40 // These are the branches produced by inlining in a test context. Also,
41 // the phi has no other uses so they can simply be eliminated. The block 41 // the phi has no other uses so they can simply be eliminated. The block
42 // has no other phis and no instructions intervening between the phi and 42 // has no other phis and no instructions intervening between the phi and
43 // branch so the block can simply be eliminated. 43 // branch so the block can simply be eliminated.
44 BranchInstr* branch = block->last_instruction()->AsBranch(); 44 BranchInstr* branch = block->last_instruction()->AsBranch();
45 ASSERT(branch != NULL); 45 ASSERT(branch != NULL);
46 ComparisonInstr* comparison = branch->comparison(); 46 ComparisonInstr* comparison = branch->comparison();
47 if (comparison->InputCount() != 2) return false;
zra 2016/10/31 17:28:14 Please use {}
Florian Schneider 2016/10/31 18:48:16 Done.
47 Value* left = comparison->left(); 48 Value* left = comparison->left();
48 PhiInstr* phi = left->definition()->AsPhi(); 49 PhiInstr* phi = left->definition()->AsPhi();
49 Value* right = comparison->right(); 50 Value* right = comparison->right();
50 ConstantInstr* constant = 51 ConstantInstr* constant =
51 (right == NULL) ? NULL : right->definition()->AsConstant(); 52 (right == NULL) ? NULL : right->definition()->AsConstant();
52 return (phi != NULL) && 53 return (phi != NULL) &&
53 (constant != NULL) && 54 (constant != NULL) &&
54 (phi->GetBlock() == block) && 55 (phi->GetBlock() == block) &&
55 PhiHasSingleUse(phi, left) && 56 PhiHasSingleUse(phi, left) &&
56 (block->next() == branch) && 57 (block->next() == branch) &&
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (changed) { 347 if (changed) {
347 // We may have changed the block order and the dominator tree. 348 // We may have changed the block order and the dominator tree.
348 flow_graph->DiscoverBlocks(); 349 flow_graph->DiscoverBlocks();
349 GrowableArray<BitVector*> dominance_frontier; 350 GrowableArray<BitVector*> dominance_frontier;
350 flow_graph->ComputeDominators(&dominance_frontier); 351 flow_graph->ComputeDominators(&dominance_frontier);
351 } 352 }
352 } 353 }
353 354
354 355
355 } // namespace dart 356 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698