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

Unified Diff: runtime/vm/intermediate_language.h

Issue 3010673002: [vm] Implement gradual refinement of types (Closed)
Patch Set: Address review comments Created 3 years, 4 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/flow_graph_type_propagator.cc ('k') | runtime/vm/redundancy_elimination.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index e72f7bf419f182bc307dacee6b3ee959af84327a..961e045f784ffb50c7db808c0ee72673215386e4 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -149,6 +149,12 @@ class CompileType : public ZoneAllocated {
// Perform a join operation over the type lattice.
void Union(CompileType* other);
+ // Refine old type with newly inferred type (it could be more or less
+ // specific, or even unrelated to an old type in case of unreachable code).
+ // May return 'old_type', 'new_type' or create a new CompileType instance.
+ static CompileType* ComputeRefinedType(CompileType* old_type,
+ CompileType* new_type);
+
// Returns true if this and other types are the same.
bool IsEqualTo(CompileType* other) {
return (is_nullable_ == other->is_nullable_) &&
@@ -234,17 +240,19 @@ class Value : public ZoneAllocated {
Value* Copy(Zone* zone) { return new (zone) Value(definition_); }
- // This function must only be used when the new Value is dominated by
+ // CopyWithType() must only be used when the new Value is dominated by
// the original Value.
- Value* CopyWithType() {
- Value* copy = new Value(definition_);
+ Value* CopyWithType(Zone* zone) {
+ Value* copy = new (zone) Value(definition_);
copy->reaching_type_ = reaching_type_;
return copy;
}
+ Value* CopyWithType() { return CopyWithType(Thread::Current()->zone()); }
CompileType* Type();
void SetReachingType(CompileType* type) { reaching_type_ = type; }
+ void RefineReachingType(CompileType* type);
void PrintTo(BufferFormatter* f) const;
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/redundancy_elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698