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

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

Issue 2772143002: Reland "VM: Handle null-comparisons in the flow graph type propagation" (Closed)
Patch Set: address comments Created 3 years, 8 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intrinsifier.cc » ('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/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/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 ASSERT(index == 0); 1224 ASSERT(index == 0);
1225 return successor(); 1225 return successor();
1226 } 1226 }
1227 1227
1228 1228
1229 void Instruction::Goto(JoinEntryInstr* entry) { 1229 void Instruction::Goto(JoinEntryInstr* entry) {
1230 LinkTo(new GotoInstr(entry)); 1230 LinkTo(new GotoInstr(entry));
1231 } 1231 }
1232 1232
1233 1233
1234 bool UnboxedIntConverterInstr::CanDeoptimize() const { 1234 bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const {
1235 return (to() == kUnboxedInt32) && !is_truncating() && 1235 return (to() == kUnboxedInt32) && !is_truncating() &&
1236 !RangeUtils::Fits(value()->definition()->range(), 1236 !RangeUtils::Fits(value()->definition()->range(),
1237 RangeBoundary::kRangeBoundaryInt32); 1237 RangeBoundary::kRangeBoundaryInt32);
1238 } 1238 }
1239 1239
1240 1240
1241 bool UnboxInt32Instr::CanDeoptimize() const { 1241 bool UnboxInt32Instr::ComputeCanDeoptimize() const {
1242 const intptr_t value_cid = value()->Type()->ToCid(); 1242 const intptr_t value_cid = value()->Type()->ToCid();
1243 if (value_cid == kSmiCid) { 1243 if (value_cid == kSmiCid) {
1244 return (kSmiBits > 32) && !is_truncating() && 1244 return (kSmiBits > 32) && !is_truncating() &&
1245 !RangeUtils::Fits(value()->definition()->range(), 1245 !RangeUtils::Fits(value()->definition()->range(),
1246 RangeBoundary::kRangeBoundaryInt32); 1246 RangeBoundary::kRangeBoundaryInt32);
1247 } else if (value_cid == kMintCid) { 1247 } else if (value_cid == kMintCid) {
1248 return !is_truncating() && 1248 return !is_truncating() &&
1249 !RangeUtils::Fits(value()->definition()->range(), 1249 !RangeUtils::Fits(value()->definition()->range(),
1250 RangeBoundary::kRangeBoundaryInt32); 1250 RangeBoundary::kRangeBoundaryInt32);
1251 } else if (is_truncating() && value()->definition()->IsBoxInteger()) { 1251 } else if (is_truncating() && value()->definition()->IsBoxInteger()) {
1252 return false; 1252 return false;
1253 } else if ((kSmiBits < 32) && value()->Type()->IsInt()) { 1253 } else if ((kSmiBits < 32) && value()->Type()->IsInt()) {
1254 // Note: we don't support truncation of Bigint values. 1254 // Note: we don't support truncation of Bigint values.
1255 return !RangeUtils::Fits(value()->definition()->range(), 1255 return !RangeUtils::Fits(value()->definition()->range(),
1256 RangeBoundary::kRangeBoundaryInt32); 1256 RangeBoundary::kRangeBoundaryInt32);
1257 } else { 1257 } else {
1258 return true; 1258 return true;
1259 } 1259 }
1260 } 1260 }
1261 1261
1262 1262
1263 bool UnboxUint32Instr::CanDeoptimize() const { 1263 bool UnboxUint32Instr::ComputeCanDeoptimize() const {
1264 ASSERT(is_truncating()); 1264 ASSERT(is_truncating());
1265 if ((value()->Type()->ToCid() == kSmiCid) || 1265 if ((value()->Type()->ToCid() == kSmiCid) ||
1266 (value()->Type()->ToCid() == kMintCid)) { 1266 (value()->Type()->ToCid() == kMintCid)) {
1267 return false; 1267 return false;
1268 } 1268 }
1269 // Check input value's range. 1269 // Check input value's range.
1270 Range* value_range = value()->definition()->range(); 1270 Range* value_range = value()->definition()->range();
1271 return !RangeUtils::Fits(value_range, RangeBoundary::kRangeBoundaryInt64); 1271 return !RangeUtils::Fits(value_range, RangeBoundary::kRangeBoundaryInt64);
1272 } 1272 }
1273 1273
1274 1274
1275 bool BinaryInt32OpInstr::CanDeoptimize() const { 1275 bool BinaryInt32OpInstr::ComputeCanDeoptimize() const {
1276 switch (op_kind()) { 1276 switch (op_kind()) {
1277 case Token::kBIT_AND: 1277 case Token::kBIT_AND:
1278 case Token::kBIT_OR: 1278 case Token::kBIT_OR:
1279 case Token::kBIT_XOR: 1279 case Token::kBIT_XOR:
1280 return false; 1280 return false;
1281 1281
1282 case Token::kSHR: 1282 case Token::kSHR:
1283 return false; 1283 return false;
1284 1284
1285 case Token::kSHL: 1285 case Token::kSHL:
1286 return can_overflow() || 1286 return can_overflow() ||
1287 !RangeUtils::IsPositive(right()->definition()->range()); 1287 !RangeUtils::IsPositive(right()->definition()->range());
1288 1288
1289 case Token::kMOD: { 1289 case Token::kMOD: {
1290 UNREACHABLE(); 1290 UNREACHABLE();
1291 } 1291 }
1292 1292
1293 default: 1293 default:
1294 return can_overflow(); 1294 return can_overflow();
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 1298
1299 bool BinarySmiOpInstr::CanDeoptimize() const { 1299 bool BinarySmiOpInstr::ComputeCanDeoptimize() const {
1300 switch (op_kind()) { 1300 switch (op_kind()) {
1301 case Token::kBIT_AND: 1301 case Token::kBIT_AND:
1302 case Token::kBIT_OR: 1302 case Token::kBIT_OR:
1303 case Token::kBIT_XOR: 1303 case Token::kBIT_XOR:
1304 return false; 1304 return false;
1305 1305
1306 case Token::kSHR: 1306 case Token::kSHR:
1307 return !RangeUtils::IsPositive(right()->definition()->range()); 1307 return !RangeUtils::IsPositive(right()->definition()->range());
1308 1308
1309 case Token::kSHL: 1309 case Token::kSHL:
(...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after
3992 "native function '%s' (%" Pd " arguments) cannot be found", 3992 "native function '%s' (%" Pd " arguments) cannot be found",
3993 native_name().ToCString(), function().NumParameters()); 3993 native_name().ToCString(), function().NumParameters());
3994 } 3994 }
3995 set_native_c_function(native_function); 3995 set_native_c_function(native_function);
3996 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3996 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3997 } 3997 }
3998 3998
3999 #undef __ 3999 #undef __
4000 4000
4001 } // namespace dart 4001 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698