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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 2891113002: Use same range info when emitting code and computing if instruction can deopt. (Closed)
Patch Set: Add a comment to the test Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index cb1ed6f25e7b06495c70471598ae2ed39fd5974b..8e3400b410ee7a57bf068d4a40d40b5a0eeb9a91 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1392,8 +1392,9 @@ bool BinaryInt32OpInstr::ComputeCanDeoptimize() const {
return false;
case Token::kSHL:
- return can_overflow() ||
- !RangeUtils::IsPositive(right()->definition()->range());
+ // Currently only shifts by in range constant are supported, see
+ // BinaryInt32OpInstr::IsSupported.
+ return can_overflow();
case Token::kMOD: {
UNREACHABLE();
@@ -1413,22 +1414,25 @@ bool BinarySmiOpInstr::ComputeCanDeoptimize() const {
return false;
case Token::kSHR:
- return !RangeUtils::IsPositive(right()->definition()->range());
+ return !RangeUtils::IsPositive(right_range());
case Token::kSHL:
- return can_overflow() ||
- !RangeUtils::IsPositive(right()->definition()->range());
+ return can_overflow() || !RangeUtils::IsPositive(right_range());
+
+ case Token::kMOD:
+ return RangeUtils::CanBeZero(right_range());
- case Token::kMOD: {
- Range* right_range = this->right()->definition()->range();
- return (right_range == NULL) || right_range->Overlaps(0, 0);
- }
default:
return can_overflow();
}
}
+bool ShiftMintOpInstr::has_shift_count_check() const {
+ return !RangeUtils::IsWithin(shift_range(), 0, kMintShiftCountLimit);
+}
+
+
bool BinaryIntegerOpInstr::RightIsPowerOfTwoConstant() const {
if (!right()->definition()->IsConstant()) return false;
const Object& constant = right()->definition()->AsConstant()->value();
@@ -4244,33 +4248,14 @@ const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const {
}
-MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
- intptr_t deopt_id,
- MergedMathInstr::Kind kind)
- : PureDefinition(deopt_id), inputs_(inputs), kind_(kind) {
- ASSERT(inputs_->length() == InputCountFor(kind_));
- for (intptr_t i = 0; i < inputs_->length(); ++i) {
- ASSERT((*inputs)[i] != NULL);
- (*inputs)[i]->set_instruction(this);
- (*inputs)[i]->set_use_index(i);
- }
-}
-
-
-intptr_t MergedMathInstr::OutputIndexOf(MethodRecognizer::Kind kind) {
- switch (kind) {
- case MethodRecognizer::kMathSin:
- return 1;
- case MethodRecognizer::kMathCos:
- return 0;
- default:
- UNIMPLEMENTED();
- return -1;
- }
+TruncDivModInstr::TruncDivModInstr(Value* lhs, Value* rhs, intptr_t deopt_id)
+ : TemplateDefinition(deopt_id) {
+ SetInputAt(0, lhs);
+ SetInputAt(1, rhs);
}
-intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) {
+intptr_t TruncDivModInstr::OutputIndexOf(Token::Kind token) {
switch (token) {
case Token::kTRUNCDIV:
return 0;
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698