Chromium Code Reviews| 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,28 @@ |
| 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. |
| + // Merges the cids: |
| + // - overwrite if not set before. |
| + // - if cid-s differ set to kDynamicCid. |
|
regis
2012/08/16 01:07:44
The code is correct, but the comment is not.
srdjan
2012/08/16 01:21:28
Done.
|
| + bool SetPropagatedCid(intptr_t cid) { |
| + ASSERT(cid != 1); |
| + ASSERT(cid != kIllegalCid); |
| + if (propagated_cid_ == kIllegalCid) { |
| + // First setting, nothing has changed. |
| + propagated_cid_ = cid; |
| + return false; |
| + } |
| + bool has_changed = (propagated_cid_ != cid); |
| + propagated_cid_ = cid; |
| + return has_changed; |
| + } |
| + |
| 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); |
| @@ -2449,6 +2488,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 +2519,7 @@ |
| } |
| virtual RawAbstractType* CompileType() const; |
| + virtual intptr_t GetPropagatedCid() { return propagated_cid(); } |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -2524,6 +2565,8 @@ |
| // Compile type of the passed-in parameter. |
| virtual RawAbstractType* CompileType() const; |
| + // No known propagated cid for parameters. |
| + virtual intptr_t GetPropagatedCid() { return kDynamicCid; } |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -2566,6 +2609,7 @@ |
| virtual intptr_t ArgumentCount() const { return 0; } |
| virtual RawAbstractType* CompileType() const; |
| + virtual intptr_t GetPropagatedCid() { return propagated_cid(); } |
| Value* value() const { return value_; } |