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

Unified Diff: runtime/vm/intermediate_language.h

Issue 2974633003: Option to truncate integers to 64 bits, part 1 (core VM changes) (Closed)
Patch Set: Merged 2 flags into 1 (--limit-ints-to-64-bits) Created 3 years, 5 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
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 69164b03d908061e87dcb6423b4d2594a83c2fc3..fc856856d33545a3ffcead77ffd7aa321c1cd3c8 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -7,6 +7,7 @@
#include "vm/allocation.h"
#include "vm/ast.h"
+#include "vm/flags.h"
#include "vm/growable_array.h"
#include "vm/locations.h"
#include "vm/method_recognizer.h"
@@ -730,7 +731,7 @@ class Instruction : public ZoneAllocated {
}
inline Definition* ArgumentAt(intptr_t index) const;
- // Returns true, if this instruction can deoptimize with its current imputs.
+ // Returns true, if this instruction can deoptimize with its current inputs.
// This property can change if we add or remove redefinitions that constrain
// the type or the range of input operands during compilation.
virtual bool ComputeCanDeoptimize() const = 0;
@@ -7179,12 +7180,29 @@ class BinaryMintOpInstr : public BinaryIntegerOpInstr {
Value* left,
Value* right,
intptr_t deopt_id)
- : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) {}
+ : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) {
+ if (FLAG_limit_ints_to_64_bits) {
+ mark_truncating();
+ }
+ }
virtual bool ComputeCanDeoptimize() const {
- return (can_overflow() &&
- ((op_kind() == Token::kADD) || (op_kind() == Token::kSUB))) ||
- (op_kind() == Token::kMUL); // Deopt if inputs are not int32.
+ switch (op_kind()) {
+ case Token::kADD:
+ case Token::kSUB:
+ return can_overflow();
+ case Token::kMUL:
+// Note that ARM64 does not support operations with unboxed mints,
+// so it is not handled here.
+#if defined(TARGET_ARCH_X64)
+ return can_overflow(); // Deopt if overflow.
+#else
+ // IA32, ARM
+ return true; // Deopt if inputs are not int32.
+#endif
+ default:
+ return false;
+ }
}
virtual Representation representation() const { return kUnboxedMint; }
@@ -7213,6 +7231,9 @@ class ShiftMintOpInstr : public BinaryIntegerOpInstr {
: BinaryIntegerOpInstr(op_kind, left, right, deopt_id),
shift_range_(NULL) {
ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL));
+ if (FLAG_limit_ints_to_64_bits) {
+ mark_truncating();
+ }
}
Range* shift_range() const { return shift_range_; }

Powered by Google App Engine
This is Rietveld 408576698