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

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 10748)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -156,6 +156,7 @@
// 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;
+ virtual intptr_t ResultCid() const { return kDynamicCid; }
regis 2012/08/15 22:46:54 This is correct to provide a default implementatio
srdjan 2012/08/16 00:34:46 Added TODO.
// Mutate assigned_vars to add the local variable index for all
// frame-allocated locals assigned to by the computation.
@@ -354,6 +355,8 @@
virtual void RemoveFromUseList();
virtual void RemoveInputUses() { RemoveFromUseList(); }
+ virtual intptr_t ResultCid() const;
+
private:
void AddToUseList();
Definition* definition_;
@@ -366,7 +369,7 @@
};
-class ConstantVal: public Value {
+class ConstantVal : public Value {
public:
explicit ConstantVal(const Object& value)
: value_(value) {
@@ -382,6 +385,8 @@
virtual void RemoveFromUseList() { }
+ virtual intptr_t ResultCid() const;
+
private:
const Object& value_;
@@ -479,6 +484,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 +680,8 @@
virtual Definition* TryReplace(BindInstr* instr);
+ virtual intptr_t ResultCid() const { return kBoolCid; }
+
private:
DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
};
@@ -705,6 +714,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 +756,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 +2368,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 +2407,30 @@
return changed;
}
+ bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; }
+ intptr_t propagated_cid() const { return propagated_cid_; }
+
+ // Returns true if the propagated cid has changed.
+ // Merges the cids:
+ // - overwrite if not set before.
+ // - if cid-s differ set to kDynamicCid.
+ bool SetPropagatedCid(intptr_t cid) {
regis 2012/08/15 22:46:54 I see now that you are not just setting the propag
srdjan 2012/08/16 00:34:46 Moved the merge logic out.
+ ASSERT(cid != 1);
+ ASSERT(cid != kIllegalCid);
+ if (propagated_cid_ == kDynamicCid) {
+ return false;
+ }
+ if (propagated_cid_ == kIllegalCid) {
+ propagated_cid_ = cid;
+ return true;
+ }
+ if (propagated_cid_ != cid) {
+ propagated_cid_ = kDynamicCid;
+ return true;
+ }
+ return false;
+ }
+
UseVal* use_list() { return use_list_; }
void set_use_list(UseVal* head) {
ASSERT(head == NULL || head->previous_use() == NULL);
@@ -2407,6 +2445,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);

Powered by Google App Engine
This is Rietveld 408576698