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

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

Issue 798933002: When canonicalizing UnboxInt32([tr], BoxInt64()) make sure to mark resulting converter truncating. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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) 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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 const intptr_t value_cid = value()->Type()->ToCid(); 1201 const intptr_t value_cid = value()->Type()->ToCid();
1202 if (value_cid == kSmiCid) { 1202 if (value_cid == kSmiCid) {
1203 return (kSmiBits > 32) && 1203 return (kSmiBits > 32) &&
1204 !is_truncating() && 1204 !is_truncating() &&
1205 !RangeUtils::Fits(value()->definition()->range(), 1205 !RangeUtils::Fits(value()->definition()->range(),
1206 RangeBoundary::kRangeBoundaryInt32); 1206 RangeBoundary::kRangeBoundaryInt32);
1207 } else if (value_cid == kMintCid) { 1207 } else if (value_cid == kMintCid) {
1208 return !is_truncating() && 1208 return !is_truncating() &&
1209 !RangeUtils::Fits(value()->definition()->range(), 1209 !RangeUtils::Fits(value()->definition()->range(),
1210 RangeBoundary::kRangeBoundaryInt32); 1210 RangeBoundary::kRangeBoundaryInt32);
1211 } else if (is_truncating() && value()->definition()->IsBoxInteger()) {
1212 return false;
1211 } else if ((kSmiBits < 32) && value()->Type()->IsInt()) { 1213 } else if ((kSmiBits < 32) && value()->Type()->IsInt()) {
1212 // Note: we don't support truncation of Bigint values. 1214 // Note: we don't support truncation of Bigint values.
1213 return !RangeUtils::Fits(value()->definition()->range(), 1215 return !RangeUtils::Fits(value()->definition()->range(),
1214 RangeBoundary::kRangeBoundaryInt32); 1216 RangeBoundary::kRangeBoundaryInt32);
1215 } else { 1217 } else {
1216 return true; 1218 return true;
1217 } 1219 }
1218 } 1220 }
1219 1221
1220 1222
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 if (box_defn != NULL) { 2058 if (box_defn != NULL) {
2057 if (box_defn->value()->definition()->representation() == representation()) { 2059 if (box_defn->value()->definition()->representation() == representation()) {
2058 return box_defn->value()->definition(); 2060 return box_defn->value()->definition();
2059 } else { 2061 } else {
2060 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( 2062 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr(
2061 box_defn->value()->definition()->representation(), 2063 box_defn->value()->definition()->representation(),
2062 representation(), 2064 representation(),
2063 box_defn->value()->CopyWithType(), 2065 box_defn->value()->CopyWithType(),
2064 (representation() == kUnboxedInt32) ? 2066 (representation() == kUnboxedInt32) ?
2065 GetDeoptId() : Isolate::kNoDeoptId); 2067 GetDeoptId() : Isolate::kNoDeoptId);
2066 if ((representation() == kUnboxedInt32) && !CanDeoptimize()) { 2068 if ((representation() == kUnboxedInt32) && is_truncating()) {
2067 converter->mark_truncating(); 2069 converter->mark_truncating();
2068 } 2070 }
2069 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); 2071 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue);
2070 return converter; 2072 return converter;
2071 } 2073 }
2072 } 2074 }
2073 2075
2074 return this; 2076 return this;
2075 } 2077 }
2076 2078
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 case Token::kTRUNCDIV: return 0; 3472 case Token::kTRUNCDIV: return 0;
3471 case Token::kMOD: return 1; 3473 case Token::kMOD: return 1;
3472 default: UNIMPLEMENTED(); return -1; 3474 default: UNIMPLEMENTED(); return -1;
3473 } 3475 }
3474 } 3476 }
3475 3477
3476 3478
3477 #undef __ 3479 #undef __
3478 3480
3479 } // namespace dart 3481 } // 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