Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
| index 1d70a291fb7b5f59b0aa6dd7475c2d8e15a2a291..bfb62971a666b75c658cc570875478f95ec9616b 100644 |
| --- a/runtime/vm/intermediate_language.h |
| +++ b/runtime/vm/intermediate_language.h |
| @@ -77,6 +77,121 @@ RECOGNIZED_LIST(DEFINE_ENUM_LIST) |
| }; |
| +// CompileType describes type of the value produced by the definition. |
| +// |
| +// It captures the following properties: |
| +// - whether value can potentially be null or it is definitely not null; |
| +// - concrete class id of the value or kDynamicCid if unknown statically; |
| +// - abstract super type of the value, concrete type of the value in runtime |
| +// is guaranteed to be sub type of this type. |
| +// |
| +// Values of CompileType form a lattice with a None type as a bottom and a |
| +// nullable Dynamic type as a top element. Method Union provides a join |
| +// operation for the lattice. |
| +class CompileType : public ZoneAllocated { |
| + public: |
| + static const bool kNullable = true; |
| + static const bool kNonNullable = false; |
| + |
| + // Return type such that concrete value's type in runtime is guaranteed to |
| + // be subtype of it. |
| + const AbstractType* ToAbstractType(); |
| + |
| + // Return class id such that it is either kDynamicCid or in runtime |
| + // value is guaranteed to have an equal class id. |
| + intptr_t ToCid(); |
| + |
| + // Return class id such that it is either kDynamicCid or in runtime |
| + // value is guaranteed to be either null or have an equal class id. |
| + intptr_t ToNullableCid(); |
| + |
| + // Returns true if the value is guaranteed to be not-null or is known to be |
| + // always null. |
| + bool HasDecidableNullability(); |
| + |
| + // Returns true if the value is known to be always null. |
| + bool IsNull(); |
| + |
| + // Returns true if this type is more specific than given type. |
| + bool IsMoreSpecificThan(const AbstractType& other); |
| + |
| + // Returns true if value of this type is assignable to a location of the |
| + // given type. |
| + bool IsAssignableTo(const AbstractType& type) { |
| + bool is_instance; |
| + return CanComputeIsInstanceOf(type, kNullable, &is_instance) && |
| + is_instance; |
| + } |
| + |
| + // Create a new CompileType representing given combination of class id and |
| + // abstract type. The pair is assumed to be coherent. |
| + static CompileType* New(intptr_t cid, const AbstractType& type); |
| + |
| + // Create a new CompileType representing given abstract type. By default |
| + // values as assumed to be nullable. |
| + static CompileType* FromAbstractType(const AbstractType& type, |
| + bool is_nullable = kNullable); |
| + |
| + // Create a new CompileType representing an value with the given class id. |
| + // Resulting CompileType is nullable only if cid is kDynamicCid or kNullCid. |
| + static CompileType* FromCid(intptr_t cid); |
| + |
| + // Create None CompileType. It is the bottom of the lattice and is used to |
| + // represent type of the phi that was not yet inferred. |
| + static CompileType* None() { |
| + return new CompileType(true, kIllegalCid, NULL); |
| + } |
| + |
| + // Create Dynamic CompileType. It is the top of the lattice and is used to |
| + // represent unknown type. |
| + static CompileType* Dynamic(); |
| + |
| + static CompileType* Null(); |
| + |
| + // Create non-nullable Bool type. |
| + static CompileType* Bool(); |
| + |
| + // Create non-nullable Int type. |
| + static CompileType* Int(); |
| + |
| + // Perform a join operation over the type lattice. |
| + void Union(CompileType* other); |
| + |
| + // Returns true if this and other types are the same. |
| + bool IsEqualTo(CompileType* other) { |
| + return (is_nullable_ == other->is_nullable_) && |
| + (ToNullableCid() == other->ToNullableCid()) && |
| + (ToAbstractType()->Equals(*other->ToAbstractType())); |
| + } |
| + |
| + // Replaces this type with other. |
| + void ReplaceWith(CompileType* other) { |
| + is_nullable_ = other->is_nullable_; |
| + cid_ = other->cid_; |
| + type_ = other->type_; |
| + } |
| + |
| + bool IsNone() const { |
| + return (cid_ == kIllegalCid) && (type_ == NULL); |
| + } |
| + |
| + void PrintTo(BufferFormatter* f) const; |
| + const char* ToCString() const; |
| + |
| + private: |
| + CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) |
| + : is_nullable_(is_nullable), cid_(cid), type_(type) { } |
| + |
| + bool CanComputeIsInstanceOf(const AbstractType& type, |
| + bool is_nullable, |
| + bool* is_instance); |
| + |
| + bool is_nullable_; |
| + intptr_t cid_; |
| + const AbstractType* type_; |
| +}; |
| + |
| + |
| class Value : public ZoneAllocated { |
| public: |
| // A forward iterator that allows removing the current value from the |
| @@ -102,7 +217,7 @@ class Value : public ZoneAllocated { |
| next_use_(NULL), |
| instruction_(NULL), |
| use_index_(-1), |
| - reaching_cid_(kIllegalCid) { } |
| + reaching_type_(NULL) { } |
| Definition* definition() const { return definition_; } |
| void set_definition(Definition* definition) { definition_ = definition; } |
| @@ -124,8 +239,11 @@ class Value : public ZoneAllocated { |
| Value* Copy() { return new Value(definition_); } |
| - RawAbstractType* CompileType() const; |
| - intptr_t ResultCid() const; |
| + CompileType* Type(); |
| + |
| + void SetReachingType(CompileType* type) { |
| + reaching_type_ = type; |
| + } |
| void PrintTo(BufferFormatter* f) const; |
| @@ -140,24 +258,12 @@ class Value : public ZoneAllocated { |
| // Assert if BindsToConstant() is false, otherwise returns the constant value. |
| const Object& BoundConstant() const; |
| - // Compute a run-time null test at compile-time and set result in is_null. |
| - // Return false if the computation is not possible at compile time. |
| - bool CanComputeIsNull(bool* is_null) const; |
| - |
| - // Compute a run-time type test at compile-time and set result in is_instance. |
| - // Return false if the computation is not possible at compile time. |
| - bool CanComputeIsInstanceOf(const AbstractType& type, |
| - bool* is_instance) const; |
| - |
| // Compile time constants, Bool, Smi and Nulls do not need to update |
| // the store buffer. |
| - bool NeedsStoreBuffer() const; |
| + bool NeedsStoreBuffer(); |
| bool Equals(Value* other) const; |
| - void set_reaching_cid(intptr_t cid) { reaching_cid_ = cid; } |
| - intptr_t reaching_cid() const { return reaching_cid_; } |
| - |
| private: |
| Definition* definition_; |
| Value* previous_use_; |
| @@ -165,7 +271,7 @@ class Value : public ZoneAllocated { |
| Instruction* instruction_; |
| intptr_t use_index_; |
| - intptr_t reaching_cid_; |
| + CompileType* reaching_type_; |
| DISALLOW_COPY_AND_ASSIGN(Value); |
| }; |
| @@ -1094,37 +1200,24 @@ class Definition : public Instruction { |
| // Compile time type of the definition, which may be requested before type |
| // propagation during graph building. |
| - virtual RawAbstractType* CompileType() const = 0; |
| - |
| - virtual intptr_t ResultCid() const = 0; |
| - |
| - bool HasPropagatedType() const { |
| - return !propagated_type_.IsNull(); |
| - } |
| - RawAbstractType* PropagatedType() const { |
| - ASSERT(HasPropagatedType()); |
| - return propagated_type_.raw(); |
| - } |
| - // Returns true if the propagated type has changed. |
| - bool SetPropagatedType(const AbstractType& propagated_type) { |
| - if (propagated_type.IsNull()) { |
| - // Not a typed definition, e.g. access to a VM field. |
| - return false; |
| + CompileType* Type() { |
| + if (type_ == NULL) { |
| + type_ = ComputeInitialType(); |
| } |
| - const bool changed = |
| - propagated_type_.IsNull() || !propagated_type.Equals(propagated_type_); |
| - propagated_type_ = propagated_type.raw(); |
| - return changed; |
| + return type_; |
| } |
| - 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(); |
| + // Compute initial compile type for this definition. It is safe to use this |
| + // approximation even before type propagator was run (e.g. during graph |
| + // building). |
| + virtual CompileType* ComputeInitialType() const { |
| + return CompileType::Dynamic(); |
| + } |
| - // Returns true if the propagated cid has changed. |
| - bool SetPropagatedCid(intptr_t cid); |
| + // Update CompileType of the definition. Returns true if the type has changed. |
| + virtual bool RecomputeType() { |
| + return false; |
| + } |
| bool HasUses() const { |
| return (input_use_list_ != NULL) || (env_use_list_ != NULL); |
| @@ -1193,14 +1286,11 @@ class Definition : public Instruction { |
| friend class RangeAnalysis; |
| Range* range_; |
| + CompileType* type_; |
| private: |
| intptr_t temp_index_; |
| intptr_t ssa_temp_index_; |
| - // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; |
| - // For now: |
| - AbstractType& propagated_type_; |
| - intptr_t propagated_cid_; |
| Value* input_use_list_; |
| Value* env_use_list_; |
| UseKind use_kind_; |
| @@ -1228,8 +1318,8 @@ class PhiInstr : public Definition { |
| virtual BlockEntryInstr* GetBlock() const { return block(); } |
| JoinEntryInstr* block() const { return block_; } |
| - virtual RawAbstractType* CompileType() const; |
| - virtual intptr_t GetPropagatedCid(); |
| + virtual CompileType* ComputeInitialType() const; |
| + virtual bool RecomputeType(); |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -1243,9 +1333,6 @@ class PhiInstr : public Definition { |
| virtual bool HasSideEffect() const { return false; } |
| - // TODO(regis): This helper will be removed once we support type sets. |
| - RawAbstractType* LeastSpecificInputType() const; |
| - |
| // Phi is alive if it reaches a non-environment use. |
| bool is_alive() const { return is_alive_; } |
| void mark_alive() { is_alive_ = true; } |
| @@ -1268,11 +1355,6 @@ class PhiInstr : public Definition { |
| return 0; |
| } |
| - virtual intptr_t ResultCid() const { |
| - UNREACHABLE(); |
| - return kIllegalCid; |
| - } |
| - |
| DECLARE_INSTRUCTION(Phi) |
| virtual void PrintTo(BufferFormatter* f) const; |
| @@ -1313,12 +1395,6 @@ class ParameterInstr : public Definition { |
| // Get the block entry for that instruction. |
| virtual BlockEntryInstr* GetBlock() const { return block_; } |
| - // Compile type of the passed-in parameter. |
| - virtual RawAbstractType* CompileType() const; |
| - |
| - // No known propagated cid for parameters. |
| - virtual intptr_t GetPropagatedCid(); |
| - |
| virtual intptr_t ArgumentCount() const { return 0; } |
| intptr_t InputCount() const { return 0; } |
| @@ -1337,13 +1413,10 @@ class ParameterInstr : public Definition { |
| return 0; |
| } |
| - virtual intptr_t ResultCid() const { |
| - UNREACHABLE(); |
| - return kIllegalCid; |
| - } |
| - |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| + virtual CompileType* ComputeInitialType() const; |
| + |
| private: |
| const intptr_t index_; |
| GraphEntryInstr* block_; |
| @@ -1373,12 +1446,7 @@ class PushArgumentInstr : public Definition { |
| virtual intptr_t ArgumentCount() const { return 0; } |
| - virtual RawAbstractType* CompileType() const; |
| - virtual intptr_t GetPropagatedCid() { return propagated_cid(); } |
| - virtual intptr_t ResultCid() const { |
| - UNREACHABLE(); |
| - return kIllegalCid; |
| - } |
| + virtual CompileType* ComputeInitialType() const; |
| Value* value() const { return value_; } |
| @@ -1599,7 +1667,6 @@ class StoreContextInstr : public TemplateInstruction<1> { |
| } |
| DECLARE_INSTRUCTION(StoreContext); |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -1818,16 +1885,12 @@ class ConstraintInstr : public TemplateDefinition<2> { |
| return (inputs_[1] == NULL) ? 1 : 2; |
| } |
| - virtual RawAbstractType* CompileType() const { |
| - return Type::SmiType(); |
| - } |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return false; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kSmiCid; } |
| - |
| virtual bool AttributesEqual(Instruction* other) const { |
| UNREACHABLE(); |
| return false; |
| @@ -1869,7 +1932,7 @@ class ConstantInstr : public TemplateDefinition<0> { |
| : value_(value) { } |
| DECLARE_INSTRUCTION(Constant) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const Object& value() const { return value_; } |
| @@ -1879,8 +1942,6 @@ class ConstantInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual bool AttributesEqual(Instruction* other) const; |
| virtual bool AffectedBySideEffect() const { return false; } |
| @@ -1903,8 +1964,7 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| const String& dst_name) |
| : token_pos_(token_pos), |
| dst_type_(AbstractType::ZoneHandle(dst_type.raw())), |
| - dst_name_(dst_name), |
| - is_eliminated_(false) { |
| + dst_name_(dst_name) { |
| ASSERT(value != NULL); |
| ASSERT(instantiator != NULL); |
| ASSERT(instantiator_type_arguments != NULL); |
| @@ -1916,7 +1976,8 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| } |
| DECLARE_INSTRUCTION(AssertAssignable) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| + virtual bool RecomputeType(); |
| Value* value() const { return inputs_[0]; } |
| Value* instantiator() const { return inputs_[1]; } |
| @@ -1929,14 +1990,6 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| } |
| const String& dst_name() const { return dst_name_; } |
| - bool is_eliminated() const { |
| - return is_eliminated_; |
| - } |
| - void eliminate() { |
| - ASSERT(!is_eliminated_); |
| - is_eliminated_ = true; |
| - } |
| - |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| virtual bool CanDeoptimize() const { return true; } |
| @@ -1946,16 +1999,12 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| virtual bool AffectedBySideEffect() const { return false; } |
| virtual bool AttributesEqual(Instruction* other) const; |
| - virtual intptr_t ResultCid() const { return value()->ResultCid(); } |
| - virtual intptr_t GetPropagatedCid(); |
| - |
| virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| private: |
| const intptr_t token_pos_; |
| AbstractType& dst_type_; |
| const String& dst_name_; |
| - bool is_eliminated_; |
| DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); |
| }; |
| @@ -1964,26 +2013,17 @@ class AssertAssignableInstr : public TemplateDefinition<3> { |
| class AssertBooleanInstr : public TemplateDefinition<1> { |
| public: |
| AssertBooleanInstr(intptr_t token_pos, Value* value) |
| - : token_pos_(token_pos), |
| - is_eliminated_(false) { |
| + : token_pos_(token_pos) { |
| ASSERT(value != NULL); |
| inputs_[0] = value; |
| } |
| DECLARE_INSTRUCTION(AssertBoolean) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| intptr_t token_pos() const { return token_pos_; } |
| Value* value() const { return inputs_[0]; } |
| - bool is_eliminated() const { |
| - return is_eliminated_; |
| - } |
| - void eliminate() { |
| - ASSERT(!is_eliminated_); |
| - is_eliminated_ = true; |
| - } |
| - |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| virtual bool CanDeoptimize() const { return true; } |
| @@ -1993,13 +2033,10 @@ class AssertBooleanInstr : public TemplateDefinition<1> { |
| virtual bool AffectedBySideEffect() const { return false; } |
| virtual bool AttributesEqual(Instruction* other) const { return true; } |
| - virtual intptr_t ResultCid() const { return kBoolCid; } |
| - |
| virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| private: |
| const intptr_t token_pos_; |
| - bool is_eliminated_; |
| DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); |
| }; |
| @@ -2015,7 +2052,7 @@ class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(ArgumentDefinitionTest) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| intptr_t token_pos() const { return ast_node_.token_pos(); } |
| intptr_t formal_parameter_index() const { |
| @@ -2024,6 +2061,7 @@ class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
| const String& formal_parameter_name() const { |
| return ast_node_.formal_parameter_name(); |
| } |
| + |
| Value* saved_arguments_descriptor() const { return inputs_[0]; } |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| @@ -2032,8 +2070,6 @@ class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kBoolCid; } |
| - |
| private: |
| const ArgumentDefinitionTestNode& ast_node_; |
| @@ -2048,14 +2084,12 @@ class CurrentContextInstr : public TemplateDefinition<0> { |
| CurrentContextInstr() { } |
| DECLARE_INSTRUCTION(CurrentContext) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return false; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
| }; |
| @@ -2069,7 +2103,6 @@ class ClosureCallInstr : public TemplateDefinition<0> { |
| arguments_(arguments) { } |
| DECLARE_INSTRUCTION(ClosureCall) |
| - virtual RawAbstractType* CompileType() const; |
| const Array& argument_names() const { return ast_node_.arguments()->names(); } |
| intptr_t token_pos() const { return ast_node_.token_pos(); } |
| @@ -2085,8 +2118,6 @@ class ClosureCallInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const ClosureCallNode& ast_node_; |
| ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| @@ -2123,7 +2154,6 @@ class InstanceCallInstr : public TemplateDefinition<0> { |
| } |
| DECLARE_INSTRUCTION(InstanceCall) |
| - virtual RawAbstractType* CompileType() const; |
| const ICData* ic_data() const { return ic_data_; } |
| bool HasICData() const { |
| @@ -2149,8 +2179,6 @@ class InstanceCallInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| protected: |
| friend class FlowGraphOptimizer; |
| void set_ic_data(ICData* value) { ic_data_ = value; } |
| @@ -2190,7 +2218,6 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { |
| } |
| DECLARE_INSTRUCTION(PolymorphicInstanceCall) |
| - virtual RawAbstractType* CompileType() const; |
| const ICData& ic_data() const { return ic_data_; } |
| @@ -2198,8 +2225,6 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| private: |
| @@ -2296,7 +2321,7 @@ class StrictCompareInstr : public ComparisonInstr { |
| StrictCompareInstr(Token::Kind kind, Value* left, Value* right); |
| DECLARE_INSTRUCTION(StrictCompare) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| @@ -2309,8 +2334,6 @@ class StrictCompareInstr : public ComparisonInstr { |
| virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| - virtual intptr_t ResultCid() const { return kBoolCid; } |
| - |
| virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| BranchInstr* branch); |
| @@ -2341,7 +2364,7 @@ class EqualityCompareInstr : public ComparisonInstr { |
| } |
| DECLARE_INSTRUCTION(EqualityCompare) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const ICData* ic_data() const { return ic_data_; } |
| bool HasICData() const { |
| @@ -2354,21 +2377,22 @@ class EqualityCompareInstr : public ComparisonInstr { |
| void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
| intptr_t receiver_class_id() const { return receiver_class_id_; } |
| + bool IsNumericComparison() const { |
| + return (receiver_class_id() == kDoubleCid) |
| + || (receiver_class_id() == kMintCid) |
| + || (receiver_class_id() == kSmiCid); |
|
srdjan
2013/02/11 21:10:50
Why not kBigintCid? Add a comment why or rename.
Vyacheslav Egorov (Google)
2013/02/18 14:05:22
Renamed to IsInlinedNumericComparison.
|
| + } |
| + |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| virtual bool CanDeoptimize() const { |
| - return (receiver_class_id() != kDoubleCid) |
| - && (receiver_class_id() != kMintCid) |
| - && (receiver_class_id() != kSmiCid); |
| + return !IsNumericComparison(); |
| } |
| + |
| virtual bool HasSideEffect() const { |
| - return (receiver_class_id() != kDoubleCid) |
| - && (receiver_class_id() != kMintCid) |
| - && (receiver_class_id() != kSmiCid); |
| + return !IsNumericComparison(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| BranchInstr* branch); |
| @@ -2409,7 +2433,7 @@ class RelationalOpInstr : public ComparisonInstr { |
| } |
| DECLARE_INSTRUCTION(RelationalOp) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const ICData* ic_data() const { return ic_data_; } |
| bool HasICData() const { |
| @@ -2426,21 +2450,21 @@ class RelationalOpInstr : public ComparisonInstr { |
| intptr_t operands_class_id() const { return operands_class_id_; } |
| + bool IsNumericComparison() const { |
| + return (operands_class_id() == kDoubleCid) |
| + || (operands_class_id() == kMintCid) |
| + || (operands_class_id() == kSmiCid); |
|
srdjan
2013/02/11 21:10:50
ditto
|
| + } |
| + |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| virtual bool CanDeoptimize() const { |
| - return (operands_class_id() != kDoubleCid) |
| - && (operands_class_id() != kMintCid) |
| - && (operands_class_id() != kSmiCid); |
| + return !IsNumericComparison(); |
| } |
| virtual bool HasSideEffect() const { |
| - return (operands_class_id() != kDoubleCid) |
| - && (operands_class_id() != kMintCid) |
| - && (operands_class_id() != kSmiCid); |
| + return !IsNumericComparison(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| BranchInstr* branch); |
| @@ -2482,7 +2506,7 @@ class StaticCallInstr : public TemplateDefinition<0> { |
| } |
| DECLARE_INSTRUCTION(StaticCall) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| // Accessors forwarded to the AST node. |
| const Function& function() const { return function_; } |
| @@ -2500,7 +2524,6 @@ class StaticCallInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return result_cid_; } |
| void set_result_cid(intptr_t value) { result_cid_ = value; } |
| bool is_known_constructor() const { return is_known_constructor_; } |
| @@ -2518,7 +2541,6 @@ class StaticCallInstr : public TemplateDefinition<0> { |
| // Some library constructors have known semantics. |
| bool is_known_constructor_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
| }; |
| @@ -2530,7 +2552,7 @@ class LoadLocalInstr : public TemplateDefinition<0> { |
| context_level_(context_level) { } |
| DECLARE_INSTRUCTION(LoadLocal) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const LocalVariable& local() const { return local_; } |
| intptr_t context_level() const { return context_level_; } |
| @@ -2544,8 +2566,6 @@ class LoadLocalInstr : public TemplateDefinition<0> { |
| return false; |
| } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const LocalVariable& local_; |
| const intptr_t context_level_; |
| @@ -2566,7 +2586,7 @@ class StoreLocalInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(StoreLocal) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const LocalVariable& local() const { return local_; } |
| Value* value() const { return inputs_[0]; } |
| @@ -2584,8 +2604,6 @@ class StoreLocalInstr : public TemplateDefinition<1> { |
| return false; |
| } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const LocalVariable& local_; |
| const intptr_t context_level_; |
| @@ -2600,7 +2618,6 @@ class NativeCallInstr : public TemplateDefinition<0> { |
| : ast_node_(*node) {} |
| DECLARE_INSTRUCTION(NativeCall) |
| - virtual RawAbstractType* CompileType() const; |
| intptr_t token_pos() const { return ast_node_.token_pos(); } |
| @@ -2620,8 +2637,6 @@ class NativeCallInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const NativeBodyNode& ast_node_; |
| @@ -2643,7 +2658,7 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2> { |
| } |
| DECLARE_INSTRUCTION(StoreInstanceField) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const Field& field() const { return field_; } |
| @@ -2659,8 +2674,6 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const Field& field_; |
| const bool emit_store_barrier_; |
| @@ -2674,7 +2687,7 @@ class LoadStaticFieldInstr : public TemplateDefinition<0> { |
| explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} |
| DECLARE_INSTRUCTION(LoadStaticField); |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const Field& field() const { return field_; } |
| @@ -2684,8 +2697,6 @@ class LoadStaticFieldInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| virtual bool AffectedBySideEffect() const { return !field().is_final(); } |
| virtual bool AttributesEqual(Instruction* other) const; |
| @@ -2706,7 +2717,7 @@ class StoreStaticFieldInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(StoreStaticField); |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| const Field& field() const { return field_; } |
| Value* value() const { return inputs_[0]; } |
| @@ -2717,8 +2728,6 @@ class StoreStaticFieldInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const Field& field_; |
| @@ -2742,7 +2751,7 @@ class LoadIndexedInstr : public TemplateDefinition<2> { |
| } |
| DECLARE_INSTRUCTION(LoadIndexed) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* array() const { return inputs_[0]; } |
| Value* index() const { return inputs_[1]; } |
| @@ -2755,8 +2764,6 @@ class LoadIndexedInstr : public TemplateDefinition<2> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual Representation representation() const; |
| virtual bool AttributesEqual(Instruction* other) const; |
| @@ -2785,7 +2792,7 @@ class StringFromCharCodeInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(StringFromCharCode) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* char_code() const { return inputs_[0]; } |
| @@ -2793,8 +2800,6 @@ class StringFromCharCodeInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return cid_; } |
| - |
| virtual bool AttributesEqual(Instruction* other) const { return true; } |
| virtual bool AffectedBySideEffect() const { return false; } |
| @@ -2826,7 +2831,6 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
| } |
| DECLARE_INSTRUCTION(StoreIndexed) |
| - virtual RawAbstractType* CompileType() const; |
| Value* array() const { return inputs_[0]; } |
| Value* index() const { return inputs_[1]; } |
| @@ -2841,8 +2845,6 @@ class StoreIndexedInstr : public TemplateDefinition<3> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| virtual Representation RequiredInputRepresentation(intptr_t idx) const; |
| virtual intptr_t DeoptimizationTarget() const { |
| @@ -2869,7 +2871,7 @@ class BooleanNegateInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(BooleanNegate) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* value() const { return inputs_[0]; } |
| @@ -2877,8 +2879,6 @@ class BooleanNegateInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kBoolCid; } |
| - |
| private: |
| DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
| }; |
| @@ -2905,7 +2905,7 @@ class InstanceOfInstr : public TemplateDefinition<3> { |
| } |
| DECLARE_INSTRUCTION(InstanceOf) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* value() const { return inputs_[0]; } |
| Value* instantiator() const { return inputs_[1]; } |
| @@ -2921,8 +2921,6 @@ class InstanceOfInstr : public TemplateDefinition<3> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kBoolCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| Value* value_; |
| @@ -2947,7 +2945,7 @@ class AllocateObjectInstr : public TemplateDefinition<0> { |
| } |
| DECLARE_INSTRUCTION(AllocateObject) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| @@ -2963,8 +2961,6 @@ class AllocateObjectInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return cid_; } |
| - |
| private: |
| const ConstructorCallNode& ast_node_; |
| ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| @@ -2987,7 +2983,6 @@ class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { |
| } |
| DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck) |
| - virtual RawAbstractType* CompileType() const; |
| const Function& constructor() const { return ast_node_.constructor(); } |
| intptr_t token_pos() const { return ast_node_.token_pos(); } |
| @@ -2998,8 +2993,6 @@ class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const ConstructorCallNode& ast_node_; |
| @@ -3029,7 +3022,7 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(CreateArray) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| @@ -3044,8 +3037,6 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kArrayCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| @@ -3065,7 +3056,7 @@ class CreateClosureInstr : public TemplateDefinition<0> { |
| token_pos_(token_pos) { } |
| DECLARE_INSTRUCTION(CreateClosure) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| intptr_t token_pos() const { return token_pos_; } |
| const Function& function() const { return function_; } |
| @@ -3081,8 +3072,6 @@ class CreateClosureInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const Function& function_; |
| ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| @@ -3109,7 +3098,7 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(LoadField) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* value() const { return inputs_[0]; } |
| intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| @@ -3122,8 +3111,6 @@ class LoadFieldInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return result_cid_; } |
| - |
| virtual bool AttributesEqual(Instruction* other) const; |
| virtual bool AffectedBySideEffect() const { return !immutable_; } |
| @@ -3171,7 +3158,7 @@ class StoreVMFieldInstr : public TemplateDefinition<2> { |
| } |
| DECLARE_INSTRUCTION(StoreVMField) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| Value* value() const { return inputs_[0]; } |
| Value* dest() const { return inputs_[1]; } |
| @@ -3184,8 +3171,6 @@ class StoreVMFieldInstr : public TemplateDefinition<2> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const intptr_t offset_in_bytes_; |
| const AbstractType& type_; |
| @@ -3207,7 +3192,6 @@ class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(InstantiateTypeArguments) |
| - virtual RawAbstractType* CompileType() const; |
| Value* instantiator() const { return inputs_[0]; } |
| const AbstractTypeArguments& type_arguments() const { |
| @@ -3221,8 +3205,6 @@ class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return true; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| const AbstractTypeArguments& type_arguments_; |
| @@ -3244,7 +3226,6 @@ class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) |
| - virtual RawAbstractType* CompileType() const; |
| Value* instantiator() const { return inputs_[0]; } |
| const AbstractTypeArguments& type_arguments() const { |
| @@ -3258,8 +3239,6 @@ class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| const AbstractTypeArguments& type_arguments_; |
| @@ -3278,7 +3257,6 @@ class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(ExtractConstructorInstantiator) |
| - virtual RawAbstractType* CompileType() const; |
| Value* instantiator() const { return inputs_[0]; } |
| const AbstractTypeArguments& type_arguments() const { |
| @@ -3291,8 +3269,6 @@ class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const ConstructorCallNode& ast_node_; |
| @@ -3308,7 +3284,7 @@ class AllocateContextInstr : public TemplateDefinition<0> { |
| num_context_variables_(num_context_variables) {} |
| DECLARE_INSTRUCTION(AllocateContext); |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| intptr_t token_pos() const { return token_pos_; } |
| intptr_t num_context_variables() const { return num_context_variables_; } |
| @@ -3319,8 +3295,6 @@ class AllocateContextInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| const intptr_t num_context_variables_; |
| @@ -3337,7 +3311,6 @@ class ChainContextInstr : public TemplateInstruction<1> { |
| } |
| DECLARE_INSTRUCTION(ChainContext) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -3364,14 +3337,12 @@ class CloneContextInstr : public TemplateDefinition<1> { |
| Value* context_value() const { return inputs_[0]; } |
| DECLARE_INSTRUCTION(CloneContext) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return true; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kContextCid; } |
| - |
| private: |
| const intptr_t token_pos_; |
| @@ -3389,7 +3360,6 @@ class CatchEntryInstr : public TemplateInstruction<0> { |
| const LocalVariable& stacktrace_var() const { return stacktrace_var_; } |
| DECLARE_INSTRUCTION(CatchEntry) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -3420,7 +3390,6 @@ class CheckEitherNonSmiInstr : public TemplateInstruction<2> { |
| } |
| DECLARE_INSTRUCTION(CheckEitherNonSmi) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -3462,15 +3431,13 @@ class BoxDoubleInstr : public TemplateDefinition<1> { |
| virtual bool AffectedBySideEffect() const { return false; } |
| virtual bool AttributesEqual(Instruction* other) const { return true; } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| ASSERT(idx == 0); |
| return kUnboxedDouble; |
| } |
| DECLARE_INSTRUCTION(BoxDouble) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| private: |
| const intptr_t token_pos_; |
| @@ -3495,15 +3462,13 @@ class BoxIntegerInstr : public TemplateDefinition<1> { |
| virtual bool AffectedBySideEffect() const { return false; } |
| virtual bool AttributesEqual(Instruction* other) const { return true; } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| ASSERT(idx == 0); |
| return kUnboxedMint; |
| } |
| DECLARE_INSTRUCTION(BoxInteger) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); |
| @@ -3521,15 +3486,12 @@ class UnboxDoubleInstr : public TemplateDefinition<1> { |
| Value* value() const { return inputs_[0]; } |
| virtual bool CanDeoptimize() const { |
| - return (value()->ResultCid() != kDoubleCid) |
| - && (value()->ResultCid() != kSmiCid); |
| + return (value()->Type()->ToCid() != kDoubleCid) |
| + && (value()->Type()->ToCid() != kSmiCid); |
| } |
| virtual bool HasSideEffect() const { return false; } |
| - // The output is not an instance but when it is boxed it becomes double. |
| - virtual intptr_t ResultCid() const { return kDoubleCid; } |
| - |
| virtual Representation representation() const { |
| return kUnboxedDouble; |
| } |
| @@ -3538,7 +3500,7 @@ class UnboxDoubleInstr : public TemplateDefinition<1> { |
| virtual bool AttributesEqual(Instruction* other) const { return true; } |
| DECLARE_INSTRUCTION(UnboxDouble) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| @@ -3556,15 +3518,13 @@ class UnboxIntegerInstr : public TemplateDefinition<1> { |
| Value* value() const { return inputs_[0]; } |
| virtual bool CanDeoptimize() const { |
| - return (value()->ResultCid() != kMintCid) |
| - && (value()->ResultCid() != kSmiCid); |
| + return (value()->Type()->ToCid() != kSmiCid) |
| + && (value()->Type()->ToCid() != kMintCid); |
| } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const; |
| - |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual Representation representation() const { |
| return kUnboxedMint; |
| @@ -3599,9 +3559,6 @@ class MathSqrtInstr : public TemplateDefinition<1> { |
| return true; |
| } |
| - // The output is not an instance but when it is boxed it becomes double. |
| - virtual intptr_t ResultCid() const { return kDoubleCid; } |
| - |
| virtual Representation representation() const { |
| return kUnboxedDouble; |
| } |
| @@ -3618,7 +3575,7 @@ class MathSqrtInstr : public TemplateDefinition<1> { |
| } |
| DECLARE_INSTRUCTION(MathSqrt) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); |
| @@ -3656,8 +3613,6 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| return op_kind() == other->AsBinaryDoubleOp()->op_kind(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - |
| virtual Representation representation() const { |
| return kUnboxedDouble; |
| } |
| @@ -3674,7 +3629,7 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| } |
| DECLARE_INSTRUCTION(BinaryDoubleOp) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| @@ -3718,8 +3673,7 @@ class BinaryMintOpInstr : public TemplateDefinition<2> { |
| return op_kind() == other->AsBinaryMintOp()->op_kind(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual Representation representation() const { |
| return kUnboxedMint; |
| @@ -3779,8 +3733,7 @@ class ShiftMintOpInstr : public TemplateDefinition<2> { |
| return op_kind() == other->AsShiftMintOp()->op_kind(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual Representation representation() const { |
| return kUnboxedMint; |
| @@ -3834,8 +3787,7 @@ class UnaryMintOpInstr : public TemplateDefinition<1> { |
| return op_kind() == other->AsUnaryMintOp()->op_kind(); |
| } |
| - virtual intptr_t ResultCid() const; |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual Representation representation() const { |
| return kUnboxedMint; |
| @@ -3890,7 +3842,7 @@ class BinarySmiOpInstr : public TemplateDefinition<2> { |
| DECLARE_INSTRUCTION(BinarySmiOp) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const; |
| @@ -3899,8 +3851,6 @@ class BinarySmiOpInstr : public TemplateDefinition<2> { |
| virtual bool AffectedBySideEffect() const { return false; } |
| virtual bool AttributesEqual(Instruction* other) const; |
| - virtual intptr_t ResultCid() const; |
| - |
| void set_overflow(bool overflow) { |
| overflow_ = overflow; |
| } |
| @@ -3943,14 +3893,12 @@ class UnarySmiOpInstr : public TemplateDefinition<1> { |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| DECLARE_INSTRUCTION(UnarySmiOp) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kSmiCid; } |
| - |
| private: |
| const Token::Kind op_kind_; |
| @@ -3966,7 +3914,6 @@ class CheckStackOverflowInstr : public TemplateInstruction<0> { |
| intptr_t token_pos() const { return token_pos_; } |
| DECLARE_INSTRUCTION(CheckStackOverflow) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -3989,7 +3936,7 @@ class SmiToDoubleInstr : public TemplateDefinition<0> { |
| InstanceCallInstr* instance_call() const { return instance_call_; } |
| DECLARE_INSTRUCTION(SmiToDouble) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual intptr_t ArgumentCount() const { return 1; } |
| @@ -3997,8 +3944,6 @@ class SmiToDoubleInstr : public TemplateDefinition<0> { |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDoubleCid; } |
| - |
| private: |
| InstanceCallInstr* instance_call_; |
| @@ -4018,7 +3963,7 @@ class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| InstanceCallInstr* instance_call() const { return instance_call_; } |
| DECLARE_INSTRUCTION(DoubleToInteger) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual intptr_t ArgumentCount() const { return 1; } |
| @@ -4026,9 +3971,6 @@ class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| virtual bool HasSideEffect() const { return false; } |
| - // Result could be any of the int types. |
| - virtual intptr_t ResultCid() const { return kDynamicCid; } |
| - |
| private: |
| InstanceCallInstr* instance_call_; |
| @@ -4049,14 +3991,12 @@ class DoubleToSmiInstr : public TemplateDefinition<1> { |
| Value* value() const { return inputs_[0]; } |
| DECLARE_INSTRUCTION(DoubleToSmi) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return true; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kSmiCid; } |
| - |
| virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| ASSERT(idx == 0); |
| return kUnboxedDouble; |
| @@ -4085,14 +4025,12 @@ class DoubleToDoubleInstr : public TemplateDefinition<1> { |
| MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
| DECLARE_INSTRUCTION(DoubleToDouble) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual bool CanDeoptimize() const { return false; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDoubleCid; } |
| - |
| virtual Representation representation() const { |
| return kUnboxedDouble; |
| } |
| @@ -4128,15 +4066,13 @@ class InvokeMathCFunctionInstr : public Definition { |
| MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
| DECLARE_INSTRUCTION(InvokeMathCFunction) |
| - virtual RawAbstractType* CompileType() const; |
| + virtual CompileType* ComputeInitialType() const; |
| virtual void PrintOperandsTo(BufferFormatter* f) const; |
| virtual bool CanDeoptimize() const { return false; } |
| virtual bool HasSideEffect() const { return false; } |
| - virtual intptr_t ResultCid() const { return kDoubleCid; } |
| - |
| virtual Representation representation() const { |
| return kUnboxedDouble; |
| } |
| @@ -4188,7 +4124,6 @@ class CheckClassInstr : public TemplateInstruction<1> { |
| const ICData& unary_checks); |
| DECLARE_INSTRUCTION(CheckClass) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -4225,7 +4160,6 @@ class CheckSmiInstr : public TemplateInstruction<1> { |
| } |
| DECLARE_INSTRUCTION(CheckSmi) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |
| @@ -4261,7 +4195,6 @@ class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| } |
| DECLARE_INSTRUCTION(CheckArrayBound) |
| - virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return 0; } |