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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 721773003: Suppress canonicalization of Unbox() instruction that can deoptimize. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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') | tests/language/vm/canonicalization_preserves_deopt_test.dart » ('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 59f0cb232b255b1a368a5c80c48d04b7e4fe768c..cdd9d7f7a85493b6f293ff03acbc281d79788488 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -789,6 +789,18 @@ bool Instruction::IsDominatedBy(Instruction* dom) {
}
+bool Instruction::HasUnmatchedInputRepresentations() const {
+ for (intptr_t i = 0; i < InputCount(); i++) {
+ Definition* input = InputAt(i)->definition();
+ if (RequiredInputRepresentation(i) != input->representation()) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
void Definition::ReplaceWith(Definition* other,
ForwardInstructionIterator* iterator) {
// Record other's input uses.
@@ -1994,7 +2006,7 @@ Definition* BoxInt64Instr::Canonicalize(FlowGraph* flow_graph) {
Definition* UnboxInstr::Canonicalize(FlowGraph* flow_graph) {
- if (!HasUses()) return NULL;
+ if (!HasUses() && !CanDeoptimize()) return NULL;
// Fold away Unbox<rep>(Box<rep>(v)).
BoxInstr* box_defn = value()->definition()->AsBox();
@@ -2250,19 +2262,12 @@ Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) {
return this;
}
ComparisonInstr* comp = replacement->AsComparison();
- if ((comp == NULL) || comp->CanDeoptimize()) {
+ if ((comp == NULL) ||
+ comp->CanDeoptimize() ||
+ comp->HasUnmatchedInputRepresentations()) {
return this;
}
- // Assert that the comparison is not serving as a pending deoptimization
- // target for conversions.
- for (intptr_t i = 0; i < comp->InputCount(); i++) {
- if (comp->RequiredInputRepresentation(i) !=
- comp->InputAt(i)->definition()->representation()) {
- return this;
- }
- }
-
// Replace the comparison if the replacement is used at this branch,
// and has exactly one use.
Value* use = comp->input_use_list();
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | tests/language/vm/canonicalization_preserves_deopt_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698