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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10830339: Propagate class ids using existing type propagation framework. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 10775)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -156,6 +156,9 @@
// Compile time type of the computation, which typically depends on the
// compile time types (and possibly propagated types) of its inputs.
virtual RawAbstractType* CompileType() const = 0;
+ // TODO(srdjan): Make this abstract so that it gets correctly implemented
+ // in all computations.
+ virtual intptr_t ResultCid() const { return kDynamicCid; }
// Mutate assigned_vars to add the local variable index for all
// frame-allocated locals assigned to by the computation.
@@ -354,6 +357,8 @@
virtual void RemoveFromUseList();
virtual void RemoveInputUses() { RemoveFromUseList(); }
+ virtual intptr_t ResultCid() const;
+
private:
void AddToUseList();
Definition* definition_;
@@ -366,7 +371,7 @@
};
-class ConstantVal: public Value {
+class ConstantVal : public Value {
public:
explicit ConstantVal(const Object& value)
: value_(value) {
@@ -382,6 +387,8 @@
virtual void RemoveFromUseList() { }
+ virtual intptr_t ResultCid() const;
+
private:
const Object& value_;
@@ -479,6 +486,8 @@
virtual bool CanDeoptimize() const { return false; }
+ virtual intptr_t ResultCid() const { return kBoolCid; }
+
private:
const intptr_t token_pos_;
const intptr_t try_index_;
@@ -673,6 +682,8 @@
virtual Definition* TryReplace(BindInstr* instr);
+ virtual intptr_t ResultCid() const { return kBoolCid; }
+
private:
DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
};
@@ -705,6 +716,8 @@
virtual bool CanDeoptimize() const { return true; }
+ virtual intptr_t ResultCid() const { return kBoolCid; }
+
private:
const intptr_t token_pos_;
const intptr_t try_index_;
@@ -745,6 +758,8 @@
virtual bool CanDeoptimize() const { return true; }
+ virtual intptr_t ResultCid() const { return kBoolCid; }
+
private:
const intptr_t token_pos_;
const intptr_t try_index_;
@@ -2355,6 +2370,7 @@
: temp_index_(-1),
ssa_temp_index_(-1),
propagated_type_(AbstractType::Handle()),
+ propagated_cid_(kIllegalCid),
use_list_(NULL) { }
virtual bool IsDefinition() const { return true; }
@@ -2393,6 +2409,14 @@
return changed;
}
+ bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; }
+ intptr_t propagated_cid() const { return propagated_cid_; }
+ // May compute and set propagated cid.
+ virtual intptr_t GetPropagatedCid() = 0;
+
+ // Returns true if the propagated cid has changed.
+ bool SetPropagatedCid(intptr_t cid);
+
UseVal* use_list() { return use_list_; }
void set_use_list(UseVal* head) {
ASSERT(head == NULL || head->previous_use() == NULL);
@@ -2407,6 +2431,7 @@
// TODO(regis): GrowableArray<const AbstractType*> propagated_types_;
// For now:
AbstractType& propagated_type_;
+ intptr_t propagated_cid_;
UseVal* use_list_;
DISALLOW_COPY_AND_ASSIGN(Definition);
@@ -2449,6 +2474,7 @@
bool is_used() const { return is_used_; }
virtual RawAbstractType* CompileType() const;
+ virtual intptr_t GetPropagatedCid();
virtual void RecordAssignedVars(BitVector* assigned_vars,
intptr_t fixed_parameter_count);
@@ -2479,6 +2505,7 @@
}
virtual RawAbstractType* CompileType() const;
+ virtual intptr_t GetPropagatedCid() { return propagated_cid(); }
virtual intptr_t ArgumentCount() const { return 0; }
@@ -2524,6 +2551,8 @@
// Compile type of the passed-in parameter.
virtual RawAbstractType* CompileType() const;
+ // No known propagated cid for parameters.
+ virtual intptr_t GetPropagatedCid() { return propagated_cid(); }
virtual intptr_t ArgumentCount() const { return 0; }
@@ -2566,6 +2595,7 @@
virtual intptr_t ArgumentCount() const { return 0; }
virtual RawAbstractType* CompileType() const;
+ virtual intptr_t GetPropagatedCid() { return propagated_cid(); }
Value* value() const { return value_; }

Powered by Google App Engine
This is Rietveld 408576698