| Index: runtime/vm/intermediate_language.h
|
| ===================================================================
|
| --- runtime/vm/intermediate_language.h (revision 10475)
|
| +++ runtime/vm/intermediate_language.h (working copy)
|
| @@ -147,9 +147,8 @@
|
| // Returns true, if this computation can deoptimize.
|
| virtual bool CanDeoptimize() const = 0;
|
|
|
| - // 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;
|
| + // Static type of the computation.
|
| + virtual RawAbstractType* StaticType() const = 0;
|
|
|
| // Mutate assigned_vars to add the local variable index for all
|
| // frame-allocated locals assigned to by the computation.
|
| @@ -184,16 +183,16 @@
|
|
|
| static LocationSummary* MakeCallSummary();
|
|
|
| - // Declare an enum value used to define kind-test predicates.
|
| - enum ComputationKind {
|
| -#define DECLARE_COMPUTATION_KIND(ShortName, ClassName) k##ShortName,
|
| + // Declare an enum value used to define type-test predicates.
|
| + enum ComputationType {
|
| +#define DECLARE_COMPUTATION_TYPE(ShortName, ClassName) k##ShortName,
|
|
|
| - FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_KIND)
|
| + FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_TYPE)
|
|
|
| -#undef DECLARE_COMPUTATION_KIND
|
| +#undef DECLARE_COMPUTATION_TYPE
|
| };
|
|
|
| - virtual ComputationKind computation_kind() const = 0;
|
| + virtual ComputationType computation_type() const = 0;
|
|
|
| // Declare predicate for each computation.
|
| #define DECLARE_PREDICATE(ShortName, ClassName) \
|
| @@ -279,7 +278,7 @@
|
| public:
|
| Value() { }
|
|
|
| - bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const;
|
| + bool StaticTypeIsMoreSpecificThan(const AbstractType& dst_type) const;
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(Value);
|
| @@ -289,12 +288,12 @@
|
| // Functions defined in all concrete computation classes.
|
| #define DECLARE_COMPUTATION(ShortName) \
|
| virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \
|
| - virtual ComputationKind computation_kind() const { \
|
| + virtual ComputationType computation_type() const { \
|
| return Computation::k##ShortName; \
|
| } \
|
| virtual intptr_t ArgumentCount() const { return 0; } \
|
| virtual const char* DebugName() const { return #ShortName; } \
|
| - virtual RawAbstractType* CompileType() const; \
|
| + virtual RawAbstractType* StaticType() const; \
|
| virtual LocationSummary* MakeLocationSummary() const; \
|
| virtual void EmitNativeCode(FlowGraphCompiler* compiler);
|
|
|
| @@ -307,11 +306,11 @@
|
| // Function defined in all call computation classes.
|
| #define DECLARE_CALL_COMPUTATION(ShortName) \
|
| virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \
|
| - virtual ComputationKind computation_kind() const { \
|
| + virtual ComputationType computation_type() const { \
|
| return Computation::k##ShortName; \
|
| } \
|
| virtual const char* DebugName() const { return #ShortName; } \
|
| - virtual RawAbstractType* CompileType() const; \
|
| + virtual RawAbstractType* StaticType() const; \
|
| virtual LocationSummary* MakeLocationSummary() const; \
|
| virtual void EmitNativeCode(FlowGraphCompiler* compiler);
|
|
|
| @@ -374,8 +373,7 @@
|
| : token_pos_(token_pos),
|
| try_index_(try_index),
|
| dst_type_(dst_type),
|
| - dst_name_(dst_name),
|
| - eliminated_(false) {
|
| + dst_name_(dst_name) {
|
| ASSERT(value != NULL);
|
| ASSERT(instantiator != NULL);
|
| ASSERT(instantiator_type_arguments != NULL);
|
| @@ -397,14 +395,6 @@
|
| const AbstractType& dst_type() const { return dst_type_; }
|
| const String& dst_name() const { return dst_name_; }
|
|
|
| - bool IsEliminated() const {
|
| - return eliminated_;
|
| - }
|
| - void Eliminate() {
|
| - ASSERT(!eliminated_);
|
| - eliminated_ = true;
|
| - }
|
| -
|
| virtual void PrintOperandsTo(BufferFormatter* f) const;
|
|
|
| virtual bool CanDeoptimize() const { return false; }
|
| @@ -414,7 +404,6 @@
|
| const intptr_t try_index_;
|
| const AbstractType& dst_type_;
|
| const String& dst_name_;
|
| - bool eliminated_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp);
|
| };
|
| @@ -1688,7 +1677,7 @@
|
| // Implementation of type testers and cast functins.
|
| #define DEFINE_PREDICATE(ShortName, ClassName) \
|
| bool Computation::Is##ShortName() const { \
|
| - return computation_kind() == k##ShortName; \
|
| + return computation_type() == k##ShortName; \
|
| } \
|
| const ClassName* Computation::As##ShortName() const { \
|
| if (!Is##ShortName()) return NULL; \
|
| @@ -2285,10 +2274,7 @@
|
| // Abstract super-class of all instructions that define a value (Bind, Phi).
|
| class Definition : public Instruction {
|
| public:
|
| - Definition()
|
| - : temp_index_(-1),
|
| - ssa_temp_index_(-1),
|
| - propagated_type_(AbstractType::Handle()) { }
|
| + Definition() : temp_index_(-1), ssa_temp_index_(-1) { }
|
|
|
| virtual bool IsDefinition() const { return true; }
|
| virtual Definition* AsDefinition() { return this; }
|
| @@ -2303,35 +2289,12 @@
|
| }
|
| bool HasSSATemp() const { return ssa_temp_index_ >= 0; }
|
|
|
| - // Compile time type of the definition, which may be requested before type
|
| - // propagation during graph building.
|
| - virtual RawAbstractType* CompileType() const = 0;
|
| + // Static type of the definition.
|
| + virtual RawAbstractType* StaticType() 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;
|
| - }
|
| - const bool changed =
|
| - propagated_type_.IsNull() || !propagated_type.Equals(propagated_type_);
|
| - propagated_type_ = propagated_type.raw();
|
| - return changed;
|
| - }
|
| -
|
| private:
|
| intptr_t temp_index_;
|
| intptr_t ssa_temp_index_;
|
| - // TODO(regis): GrowableArray<const AbstractType*> propagated_types_;
|
| - // For now:
|
| - AbstractType& propagated_type_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Definition);
|
| };
|
| @@ -2372,7 +2335,10 @@
|
| void set_computation(Computation* value) { computation_ = value; }
|
| bool is_used() const { return is_used_; }
|
|
|
| - virtual RawAbstractType* CompileType() const;
|
| + // Static type of the underlying computation.
|
| + virtual RawAbstractType* StaticType() const {
|
| + return computation()->StaticType();
|
| + }
|
|
|
| virtual void RecordAssignedVars(BitVector* assigned_vars,
|
| intptr_t fixed_parameter_count);
|
| @@ -2400,7 +2366,8 @@
|
| }
|
| }
|
|
|
| - virtual RawAbstractType* CompileType() const;
|
| + // Least upper bound of the static types of the inputs.
|
| + virtual RawAbstractType* StaticType() const;
|
|
|
| virtual intptr_t ArgumentCount() const { return 0; }
|
|
|
| @@ -2412,9 +2379,6 @@
|
|
|
| virtual bool CanDeoptimize() 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; }
|
| @@ -2437,8 +2401,8 @@
|
|
|
| intptr_t index() const { return index_; }
|
|
|
| - // Compile type of the passed-in parameter.
|
| - virtual RawAbstractType* CompileType() const;
|
| + // Static type of the passed-in parameter.
|
| + virtual RawAbstractType* StaticType() const;
|
|
|
| virtual intptr_t ArgumentCount() const { return 0; }
|
|
|
|
|