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

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

Issue 285483002: More general dead phi elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 ASSERT(new_min.IsUnknown() == new_max.IsUnknown()); 2871 ASSERT(new_min.IsUnknown() == new_max.IsUnknown());
2872 if (new_min.IsUnknown()) { 2872 if (new_min.IsUnknown()) {
2873 range_ = Range::Unknown(); 2873 range_ = Range::Unknown();
2874 return; 2874 return;
2875 } 2875 }
2876 2876
2877 range_ = new Range(new_min, new_max); 2877 range_ = new Range(new_min, new_max);
2878 } 2878 }
2879 2879
2880 2880
2881 bool PhiInstr::IsRedundant() const {
2882 ASSERT(InputCount() > 1);
2883 Definition* first = InputAt(0)->definition();
2884 for (intptr_t i = 1; i < InputCount(); ++i) {
2885 Definition* def = InputAt(i)->definition();
2886 if (def != first) return false;
2887 }
2888 return true;
2889 }
2890
2891
2881 static bool SymbolicSub(const RangeBoundary& a, 2892 static bool SymbolicSub(const RangeBoundary& a,
2882 const RangeBoundary& b, 2893 const RangeBoundary& b,
2883 RangeBoundary* result) { 2894 RangeBoundary* result) {
2884 if (a.IsSymbol() && b.IsConstant() && !b.Overflowed()) { 2895 if (a.IsSymbol() && b.IsConstant() && !b.Overflowed()) {
2885 const intptr_t offset = a.offset() - b.value(); 2896 const intptr_t offset = a.offset() - b.value();
2886 if (!Smi::IsValid(offset)) return false; 2897 if (!Smi::IsValid(offset)) return false;
2887 2898
2888 *result = RangeBoundary::FromDefinition(a.symbol(), offset); 2899 *result = RangeBoundary::FromDefinition(a.symbol(), offset);
2889 return true; 2900 return true;
2890 } 2901 }
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
3401 case Token::kTRUNCDIV: return 0; 3412 case Token::kTRUNCDIV: return 0;
3402 case Token::kMOD: return 1; 3413 case Token::kMOD: return 1;
3403 default: UNIMPLEMENTED(); return -1; 3414 default: UNIMPLEMENTED(); return -1;
3404 } 3415 }
3405 } 3416 }
3406 3417
3407 3418
3408 #undef __ 3419 #undef __
3409 3420
3410 } // namespace dart 3421 } // namespace dart
OLDNEW
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698