| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 value->set_use_index(i); | 624 value->set_use_index(i); |
| 625 RawSetInputAt(i, value); | 625 RawSetInputAt(i, value); |
| 626 } | 626 } |
| 627 | 627 |
| 628 // Remove all inputs (including in the environment) from their | 628 // Remove all inputs (including in the environment) from their |
| 629 // definition's use lists. | 629 // definition's use lists. |
| 630 void UnuseAllInputs(); | 630 void UnuseAllInputs(); |
| 631 | 631 |
| 632 // Call instructions override this function and return the number of | 632 // Call instructions override this function and return the number of |
| 633 // pushed arguments. | 633 // pushed arguments. |
| 634 virtual intptr_t ArgumentCount() const = 0; | 634 virtual intptr_t ArgumentCount() const { return 0; } |
| 635 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 635 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 636 UNREACHABLE(); | 636 UNREACHABLE(); |
| 637 return NULL; | 637 return NULL; |
| 638 } | 638 } |
| 639 inline Definition* ArgumentAt(intptr_t index) const; | 639 inline Definition* ArgumentAt(intptr_t index) const; |
| 640 | 640 |
| 641 // Returns true, if this instruction can deoptimize. | 641 // Returns true, if this instruction can deoptimize. |
| 642 virtual bool CanDeoptimize() const = 0; | 642 virtual bool CanDeoptimize() const = 0; |
| 643 | 643 |
| 644 // Visiting support. | 644 // Visiting support. |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 | 1561 |
| 1562 intptr_t value_; | 1562 intptr_t value_; |
| 1563 }; | 1563 }; |
| 1564 | 1564 |
| 1565 | 1565 |
| 1566 // Abstract super-class of all instructions that define a value (Bind, Phi). | 1566 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 1567 class Definition : public Instruction { | 1567 class Definition : public Instruction { |
| 1568 public: | 1568 public: |
| 1569 explicit Definition(intptr_t deopt_id = Isolate::kNoDeoptId); | 1569 explicit Definition(intptr_t deopt_id = Isolate::kNoDeoptId); |
| 1570 | 1570 |
| 1571 // Overridden by definitions that have pushed arguments. | |
| 1572 virtual intptr_t ArgumentCount() const { return 0; } | |
| 1573 | |
| 1574 // Overridden by definitions that have call counts. | 1571 // Overridden by definitions that have call counts. |
| 1575 virtual intptr_t CallCount() const { | 1572 virtual intptr_t CallCount() const { |
| 1576 UNREACHABLE(); | 1573 UNREACHABLE(); |
| 1577 return -1; | 1574 return -1; |
| 1578 } | 1575 } |
| 1579 | 1576 |
| 1580 intptr_t temp_index() const { return temp_index_; } | 1577 intptr_t temp_index() const { return temp_index_; } |
| 1581 void set_temp_index(intptr_t index) { temp_index_ = index; } | 1578 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 1582 void ClearTempIndex() { temp_index_ = -1; } | 1579 void ClearTempIndex() { temp_index_ = -1; } |
| 1583 bool HasTemp() const { return temp_index_ >= 0; } | 1580 bool HasTemp() const { return temp_index_ >= 0; } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1597 return (representation() == kPairOfTagged) || | 1594 return (representation() == kPairOfTagged) || |
| 1598 (representation() == kPairOfUnboxedDouble) || | 1595 (representation() == kPairOfUnboxedDouble) || |
| 1599 (representation() == kUnboxedMint); | 1596 (representation() == kUnboxedMint); |
| 1600 #endif | 1597 #endif |
| 1601 } | 1598 } |
| 1602 | 1599 |
| 1603 // Compile time type of the definition, which may be requested before type | 1600 // Compile time type of the definition, which may be requested before type |
| 1604 // propagation during graph building. | 1601 // propagation during graph building. |
| 1605 CompileType* Type() { | 1602 CompileType* Type() { |
| 1606 if (type_ == NULL) { | 1603 if (type_ == NULL) { |
| 1607 type_ = ComputeInitialType(); | 1604 type_ = ZoneCompileType::Wrap(ComputeType()); |
| 1608 } | 1605 } |
| 1609 return type_; | 1606 return type_; |
| 1610 } | 1607 } |
| 1611 | 1608 |
| 1612 virtual CompileType* ComputeInitialType() const { | |
| 1613 return ZoneCompileType::Wrap(ComputeType()); | |
| 1614 } | |
| 1615 | |
| 1616 // Does this define a mint? | 1609 // Does this define a mint? |
| 1617 inline bool IsMintDefinition(); | 1610 inline bool IsMintDefinition(); |
| 1618 | 1611 |
| 1619 bool IsInt32Definition() { | 1612 bool IsInt32Definition() { |
| 1620 return IsBinaryInt32Op() || | 1613 return IsBinaryInt32Op() || |
| 1621 IsBoxInt32() || | 1614 IsBoxInt32() || |
| 1622 IsUnboxInt32() || | 1615 IsUnboxInt32() || |
| 1623 IsUnboxedIntConverter(); | 1616 IsUnboxedIntConverter(); |
| 1624 } | 1617 } |
| 1625 | 1618 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 } | 1823 } |
| 1831 } | 1824 } |
| 1832 | 1825 |
| 1833 // Get the block entry for that instruction. | 1826 // Get the block entry for that instruction. |
| 1834 virtual BlockEntryInstr* GetBlock() const { return block(); } | 1827 virtual BlockEntryInstr* GetBlock() const { return block(); } |
| 1835 JoinEntryInstr* block() const { return block_; } | 1828 JoinEntryInstr* block() const { return block_; } |
| 1836 | 1829 |
| 1837 virtual CompileType ComputeType() const; | 1830 virtual CompileType ComputeType() const; |
| 1838 virtual bool RecomputeType(); | 1831 virtual bool RecomputeType(); |
| 1839 | 1832 |
| 1840 virtual intptr_t ArgumentCount() const { return 0; } | |
| 1841 | |
| 1842 intptr_t InputCount() const { return inputs_.length(); } | 1833 intptr_t InputCount() const { return inputs_.length(); } |
| 1843 | 1834 |
| 1844 Value* InputAt(intptr_t i) const { return inputs_[i]; } | 1835 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 1845 | 1836 |
| 1846 virtual bool CanDeoptimize() const { return false; } | 1837 virtual bool CanDeoptimize() const { return false; } |
| 1847 | 1838 |
| 1848 virtual EffectSet Effects() const { return EffectSet::None(); } | 1839 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 1849 | 1840 |
| 1850 // Phi is alive if it reaches a non-environment use. | 1841 // Phi is alive if it reaches a non-environment use. |
| 1851 bool is_alive() const { return is_alive_; } | 1842 bool is_alive() const { return is_alive_; } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 : index_(index), base_reg_(base_reg), block_(block) { } | 1914 : index_(index), base_reg_(base_reg), block_(block) { } |
| 1924 | 1915 |
| 1925 DECLARE_INSTRUCTION(Parameter) | 1916 DECLARE_INSTRUCTION(Parameter) |
| 1926 | 1917 |
| 1927 intptr_t index() const { return index_; } | 1918 intptr_t index() const { return index_; } |
| 1928 Register base_reg() const { return base_reg_; } | 1919 Register base_reg() const { return base_reg_; } |
| 1929 | 1920 |
| 1930 // Get the block entry for that instruction. | 1921 // Get the block entry for that instruction. |
| 1931 virtual BlockEntryInstr* GetBlock() const { return block_; } | 1922 virtual BlockEntryInstr* GetBlock() const { return block_; } |
| 1932 | 1923 |
| 1933 virtual intptr_t ArgumentCount() const { return 0; } | |
| 1934 | |
| 1935 intptr_t InputCount() const { return 0; } | 1924 intptr_t InputCount() const { return 0; } |
| 1936 Value* InputAt(intptr_t i) const { | 1925 Value* InputAt(intptr_t i) const { |
| 1937 UNREACHABLE(); | 1926 UNREACHABLE(); |
| 1938 return NULL; | 1927 return NULL; |
| 1939 } | 1928 } |
| 1940 | 1929 |
| 1941 virtual bool CanDeoptimize() const { return false; } | 1930 virtual bool CanDeoptimize() const { return false; } |
| 1942 | 1931 |
| 1943 virtual EffectSet Effects() const { return EffectSet::None(); } | 1932 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 1944 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 1933 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1966 | 1955 |
| 1967 | 1956 |
| 1968 class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { | 1957 class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { |
| 1969 public: | 1958 public: |
| 1970 explicit PushArgumentInstr(Value* value) { | 1959 explicit PushArgumentInstr(Value* value) { |
| 1971 SetInputAt(0, value); | 1960 SetInputAt(0, value); |
| 1972 } | 1961 } |
| 1973 | 1962 |
| 1974 DECLARE_INSTRUCTION(PushArgument) | 1963 DECLARE_INSTRUCTION(PushArgument) |
| 1975 | 1964 |
| 1976 virtual intptr_t ArgumentCount() const { return 0; } | |
| 1977 | |
| 1978 virtual CompileType ComputeType() const; | 1965 virtual CompileType ComputeType() const; |
| 1979 | 1966 |
| 1980 Value* value() const { return InputAt(0); } | 1967 Value* value() const { return InputAt(0); } |
| 1981 | 1968 |
| 1982 virtual bool CanDeoptimize() const { return false; } | 1969 virtual bool CanDeoptimize() const { return false; } |
| 1983 | 1970 |
| 1984 virtual EffectSet Effects() const { return EffectSet::None(); } | 1971 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 1985 | 1972 |
| 1986 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1973 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1987 | 1974 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1998 class ReturnInstr : public TemplateInstruction<1, NoThrow> { | 1985 class ReturnInstr : public TemplateInstruction<1, NoThrow> { |
| 1999 public: | 1986 public: |
| 2000 ReturnInstr(intptr_t token_pos, Value* value) | 1987 ReturnInstr(intptr_t token_pos, Value* value) |
| 2001 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), | 1988 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), |
| 2002 token_pos_(token_pos) { | 1989 token_pos_(token_pos) { |
| 2003 SetInputAt(0, value); | 1990 SetInputAt(0, value); |
| 2004 } | 1991 } |
| 2005 | 1992 |
| 2006 DECLARE_INSTRUCTION(Return) | 1993 DECLARE_INSTRUCTION(Return) |
| 2007 | 1994 |
| 2008 virtual intptr_t ArgumentCount() const { return 0; } | |
| 2009 | |
| 2010 virtual intptr_t token_pos() const { return token_pos_; } | 1995 virtual intptr_t token_pos() const { return token_pos_; } |
| 2011 Value* value() const { return inputs_[0]; } | 1996 Value* value() const { return inputs_[0]; } |
| 2012 | 1997 |
| 2013 virtual bool CanBecomeDeoptimizationTarget() const { | 1998 virtual bool CanBecomeDeoptimizationTarget() const { |
| 2014 // Return instruction might turn into a Goto instruction after inlining. | 1999 // Return instruction might turn into a Goto instruction after inlining. |
| 2015 // Every Goto must have an environment. | 2000 // Every Goto must have an environment. |
| 2016 return true; | 2001 return true; |
| 2017 } | 2002 } |
| 2018 | 2003 |
| 2019 virtual bool CanDeoptimize() const { return false; } | 2004 virtual bool CanDeoptimize() const { return false; } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 public: | 2069 public: |
| 2085 explicit GotoInstr(JoinEntryInstr* entry) | 2070 explicit GotoInstr(JoinEntryInstr* entry) |
| 2086 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), | 2071 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), |
| 2087 successor_(entry), | 2072 successor_(entry), |
| 2088 edge_weight_(0.0), | 2073 edge_weight_(0.0), |
| 2089 parallel_move_(NULL) { | 2074 parallel_move_(NULL) { |
| 2090 } | 2075 } |
| 2091 | 2076 |
| 2092 DECLARE_INSTRUCTION(Goto) | 2077 DECLARE_INSTRUCTION(Goto) |
| 2093 | 2078 |
| 2094 virtual intptr_t ArgumentCount() const { return 0; } | |
| 2095 | |
| 2096 JoinEntryInstr* successor() const { return successor_; } | 2079 JoinEntryInstr* successor() const { return successor_; } |
| 2097 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } | 2080 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } |
| 2098 virtual intptr_t SuccessorCount() const; | 2081 virtual intptr_t SuccessorCount() const; |
| 2099 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 2082 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 2100 | 2083 |
| 2101 double edge_weight() const { return edge_weight_; } | 2084 double edge_weight() const { return edge_weight_; } |
| 2102 void set_edge_weight(double weight) { edge_weight_ = weight; } | 2085 void set_edge_weight(double weight) { edge_weight_ = weight; } |
| 2103 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } | 2086 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } |
| 2104 | 2087 |
| 2105 virtual bool CanBecomeDeoptimizationTarget() const { | 2088 virtual bool CanBecomeDeoptimizationTarget() const { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 }; | 2299 }; |
| 2317 | 2300 |
| 2318 | 2301 |
| 2319 class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { | 2302 class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { |
| 2320 public: | 2303 public: |
| 2321 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) | 2304 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) |
| 2322 : TemplateInstruction(deopt_id), | 2305 : TemplateInstruction(deopt_id), |
| 2323 deopt_reason_(deopt_reason) { | 2306 deopt_reason_(deopt_reason) { |
| 2324 } | 2307 } |
| 2325 | 2308 |
| 2326 virtual intptr_t ArgumentCount() const { return 0; } | |
| 2327 | |
| 2328 virtual bool CanDeoptimize() const { return true; } | 2309 virtual bool CanDeoptimize() const { return true; } |
| 2329 | 2310 |
| 2330 virtual bool AttributesEqual(Instruction* other) const { | 2311 virtual bool AttributesEqual(Instruction* other) const { |
| 2331 return true; | 2312 return true; |
| 2332 } | 2313 } |
| 2333 | 2314 |
| 2334 DECLARE_INSTRUCTION(Deoptimize) | 2315 DECLARE_INSTRUCTION(Deoptimize) |
| 2335 | 2316 |
| 2336 private: | 2317 private: |
| 2337 const ICData::DeoptReasonId deopt_reason_; | 2318 const ICData::DeoptReasonId deopt_reason_; |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3185 virtual intptr_t InputCount() const { return value_ != NULL ? 1 : 0; } | 3166 virtual intptr_t InputCount() const { return value_ != NULL ? 1 : 0; } |
| 3186 virtual Value* InputAt(intptr_t i) const { | 3167 virtual Value* InputAt(intptr_t i) const { |
| 3187 ASSERT((value_ != NULL) && (i == 0)); | 3168 ASSERT((value_ != NULL) && (i == 0)); |
| 3188 return value_; | 3169 return value_; |
| 3189 } | 3170 } |
| 3190 | 3171 |
| 3191 Value* value() const { return value_; } | 3172 Value* value() const { return value_; } |
| 3192 | 3173 |
| 3193 intptr_t num_temps() const { return num_temps_; } | 3174 intptr_t num_temps() const { return num_temps_; } |
| 3194 | 3175 |
| 3195 virtual CompileType* ComputeInitialType() const; | 3176 virtual CompileType ComputeType() const; |
| 3196 | 3177 |
| 3197 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3178 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3198 | 3179 |
| 3199 virtual bool CanDeoptimize() const { return false; } | 3180 virtual bool CanDeoptimize() const { return false; } |
| 3200 | 3181 |
| 3201 virtual EffectSet Effects() const { | 3182 virtual EffectSet Effects() const { |
| 3202 UNREACHABLE(); // Eliminated by SSA construction. | 3183 UNREACHABLE(); // Eliminated by SSA construction. |
| 3203 return EffectSet::None(); | 3184 return EffectSet::None(); |
| 3204 } | 3185 } |
| 3205 | 3186 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3221 | 3202 |
| 3222 | 3203 |
| 3223 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { | 3204 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { |
| 3224 public: | 3205 public: |
| 3225 StoreLocalInstr(const LocalVariable& local, Value* value) | 3206 StoreLocalInstr(const LocalVariable& local, Value* value) |
| 3226 : local_(local), is_dead_(false), is_last_(false) { | 3207 : local_(local), is_dead_(false), is_last_(false) { |
| 3227 SetInputAt(0, value); | 3208 SetInputAt(0, value); |
| 3228 } | 3209 } |
| 3229 | 3210 |
| 3230 DECLARE_INSTRUCTION(StoreLocal) | 3211 DECLARE_INSTRUCTION(StoreLocal) |
| 3231 virtual CompileType* ComputeInitialType() const; | 3212 virtual CompileType ComputeType() const; |
| 3232 | 3213 |
| 3233 const LocalVariable& local() const { return local_; } | 3214 const LocalVariable& local() const { return local_; } |
| 3234 Value* value() const { return inputs_[0]; } | 3215 Value* value() const { return inputs_[0]; } |
| 3235 | 3216 |
| 3236 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3217 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3237 | 3218 |
| 3238 virtual bool CanDeoptimize() const { return false; } | 3219 virtual bool CanDeoptimize() const { return false; } |
| 3239 | 3220 |
| 3240 void mark_dead() { is_dead_ = true; } | 3221 void mark_dead() { is_dead_ = true; } |
| 3241 bool is_dead() const { return is_dead_; } | 3222 bool is_dead() const { return is_dead_; } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 RawPcDescriptors::Kind stub_kind) | 3280 RawPcDescriptors::Kind stub_kind) |
| 3300 : token_pos_(token_pos), | 3281 : token_pos_(token_pos), |
| 3301 stub_kind_(stub_kind) { | 3282 stub_kind_(stub_kind) { |
| 3302 } | 3283 } |
| 3303 | 3284 |
| 3304 DECLARE_INSTRUCTION(DebugStepCheck) | 3285 DECLARE_INSTRUCTION(DebugStepCheck) |
| 3305 | 3286 |
| 3306 virtual intptr_t token_pos() const { return token_pos_; } | 3287 virtual intptr_t token_pos() const { return token_pos_; } |
| 3307 virtual bool CanDeoptimize() const { return false; } | 3288 virtual bool CanDeoptimize() const { return false; } |
| 3308 virtual EffectSet Effects() const { return EffectSet::All(); } | 3289 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 3309 virtual intptr_t ArgumentCount() const { return 0; } | |
| 3310 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3290 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 3311 | 3291 |
| 3312 private: | 3292 private: |
| 3313 const intptr_t token_pos_; | 3293 const intptr_t token_pos_; |
| 3314 const RawPcDescriptors::Kind stub_kind_; | 3294 const RawPcDescriptors::Kind stub_kind_; |
| 3315 | 3295 |
| 3316 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); | 3296 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); |
| 3317 }; | 3297 }; |
| 3318 | 3298 |
| 3319 | 3299 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 enum { | 3340 enum { |
| 3361 kInstancePos = 0, | 3341 kInstancePos = 0, |
| 3362 kValuePos = 1 | 3342 kValuePos = 1 |
| 3363 }; | 3343 }; |
| 3364 | 3344 |
| 3365 Value* instance() const { return inputs_[kInstancePos]; } | 3345 Value* instance() const { return inputs_[kInstancePos]; } |
| 3366 Value* value() const { return inputs_[kValuePos]; } | 3346 Value* value() const { return inputs_[kValuePos]; } |
| 3367 bool is_initialization() const { return is_initialization_; } | 3347 bool is_initialization() const { return is_initialization_; } |
| 3368 virtual intptr_t token_pos() const { return token_pos_; } | 3348 virtual intptr_t token_pos() const { return token_pos_; } |
| 3369 | 3349 |
| 3370 virtual CompileType* ComputeInitialType() const; | |
| 3371 | |
| 3372 const Field& field() const { return field_; } | 3350 const Field& field() const { return field_; } |
| 3373 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 3351 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| 3374 | 3352 |
| 3375 bool ShouldEmitStoreBarrier() const { | 3353 bool ShouldEmitStoreBarrier() const { |
| 3376 return value()->NeedsStoreBuffer() | 3354 return value()->NeedsStoreBuffer() |
| 3377 && (emit_store_barrier_ == kEmitStoreBarrier); | 3355 && (emit_store_barrier_ == kEmitStoreBarrier); |
| 3378 } | 3356 } |
| 3379 | 3357 |
| 3380 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3358 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3381 | 3359 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3424 intptr_t deopt_id) | 3402 intptr_t deopt_id) |
| 3425 : TemplateInstruction(deopt_id), | 3403 : TemplateInstruction(deopt_id), |
| 3426 field_(field) { | 3404 field_(field) { |
| 3427 SetInputAt(0, value); | 3405 SetInputAt(0, value); |
| 3428 } | 3406 } |
| 3429 | 3407 |
| 3430 Value* value() const { return inputs_[0]; } | 3408 Value* value() const { return inputs_[0]; } |
| 3431 | 3409 |
| 3432 const Field& field() const { return field_; } | 3410 const Field& field() const { return field_; } |
| 3433 | 3411 |
| 3434 virtual intptr_t ArgumentCount() const { return 0; } | |
| 3435 | |
| 3436 virtual bool CanDeoptimize() const { return true; } | 3412 virtual bool CanDeoptimize() const { return true; } |
| 3437 virtual bool CanBecomeDeoptimizationTarget() const { | 3413 virtual bool CanBecomeDeoptimizationTarget() const { |
| 3438 // Ensure that we record kDeopt PC descriptor in unoptimized code. | 3414 // Ensure that we record kDeopt PC descriptor in unoptimized code. |
| 3439 return true; | 3415 return true; |
| 3440 } | 3416 } |
| 3441 | 3417 |
| 3442 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3418 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3443 | 3419 |
| 3444 private: | 3420 private: |
| 3445 const Field& field_; | 3421 const Field& field_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3518 : field_(field) { | 3494 : field_(field) { |
| 3519 ASSERT(field.IsZoneHandle()); | 3495 ASSERT(field.IsZoneHandle()); |
| 3520 SetInputAt(kValuePos, value); | 3496 SetInputAt(kValuePos, value); |
| 3521 } | 3497 } |
| 3522 | 3498 |
| 3523 enum { | 3499 enum { |
| 3524 kValuePos = 0 | 3500 kValuePos = 0 |
| 3525 }; | 3501 }; |
| 3526 | 3502 |
| 3527 DECLARE_INSTRUCTION(StoreStaticField) | 3503 DECLARE_INSTRUCTION(StoreStaticField) |
| 3528 virtual CompileType* ComputeInitialType() const; | |
| 3529 | 3504 |
| 3530 const Field& field() const { return field_; } | 3505 const Field& field() const { return field_; } |
| 3531 Value* value() const { return inputs_[kValuePos]; } | 3506 Value* value() const { return inputs_[kValuePos]; } |
| 3532 | 3507 |
| 3533 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3508 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3534 | 3509 |
| 3535 virtual bool CanDeoptimize() const { return false; } | 3510 virtual bool CanDeoptimize() const { return false; } |
| 3536 | 3511 |
| 3537 // Currently CSE/LICM don't operate on any instructions that can be affected | 3512 // Currently CSE/LICM don't operate on any instructions that can be affected |
| 3538 // by stores/loads. LoadOptimizer handles loads separately. Hence stores | 3513 // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4278 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), | 4253 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), |
| 4279 field_(field) { | 4254 field_(field) { |
| 4280 SetInputAt(0, input); | 4255 SetInputAt(0, input); |
| 4281 } | 4256 } |
| 4282 | 4257 |
| 4283 virtual intptr_t token_pos() const { return field_.token_pos(); } | 4258 virtual intptr_t token_pos() const { return field_.token_pos(); } |
| 4284 const Field& field() const { return field_; } | 4259 const Field& field() const { return field_; } |
| 4285 | 4260 |
| 4286 DECLARE_INSTRUCTION(InitStaticField) | 4261 DECLARE_INSTRUCTION(InitStaticField) |
| 4287 | 4262 |
| 4288 virtual intptr_t ArgumentCount() const { return 0; } | |
| 4289 virtual bool CanDeoptimize() const { return true; } | 4263 virtual bool CanDeoptimize() const { return true; } |
| 4290 virtual EffectSet Effects() const { return EffectSet::All(); } | 4264 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 4291 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 4265 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 4292 | 4266 |
| 4293 private: | 4267 private: |
| 4294 const Field& field_; | 4268 const Field& field_; |
| 4295 | 4269 |
| 4296 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); | 4270 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); |
| 4297 }; | 4271 }; |
| 4298 | 4272 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4356 : TemplateInstruction(deopt_id), licm_hoisted_(false) { | 4330 : TemplateInstruction(deopt_id), licm_hoisted_(false) { |
| 4357 SetInputAt(0, left); | 4331 SetInputAt(0, left); |
| 4358 SetInputAt(1, right); | 4332 SetInputAt(1, right); |
| 4359 } | 4333 } |
| 4360 | 4334 |
| 4361 Value* left() const { return inputs_[0]; } | 4335 Value* left() const { return inputs_[0]; } |
| 4362 Value* right() const { return inputs_[1]; } | 4336 Value* right() const { return inputs_[1]; } |
| 4363 | 4337 |
| 4364 DECLARE_INSTRUCTION(CheckEitherNonSmi) | 4338 DECLARE_INSTRUCTION(CheckEitherNonSmi) |
| 4365 | 4339 |
| 4366 virtual intptr_t ArgumentCount() const { return 0; } | |
| 4367 | |
| 4368 virtual bool CanDeoptimize() const { return true; } | 4340 virtual bool CanDeoptimize() const { return true; } |
| 4369 | 4341 |
| 4370 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 4342 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 4371 | 4343 |
| 4372 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4344 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 4373 | 4345 |
| 4374 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 4346 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
| 4375 | 4347 |
| 4376 private: | 4348 private: |
| 4377 bool licm_hoisted_; | 4349 bool licm_hoisted_; |
| (...skipping 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6804 token_pos_(token_pos), | 6776 token_pos_(token_pos), |
| 6805 loop_depth_(loop_depth) { | 6777 loop_depth_(loop_depth) { |
| 6806 } | 6778 } |
| 6807 | 6779 |
| 6808 virtual intptr_t token_pos() const { return token_pos_; } | 6780 virtual intptr_t token_pos() const { return token_pos_; } |
| 6809 bool in_loop() const { return loop_depth_ > 0; } | 6781 bool in_loop() const { return loop_depth_ > 0; } |
| 6810 intptr_t loop_depth() const { return loop_depth_; } | 6782 intptr_t loop_depth() const { return loop_depth_; } |
| 6811 | 6783 |
| 6812 DECLARE_INSTRUCTION(CheckStackOverflow) | 6784 DECLARE_INSTRUCTION(CheckStackOverflow) |
| 6813 | 6785 |
| 6814 virtual intptr_t ArgumentCount() const { return 0; } | |
| 6815 | |
| 6816 virtual bool CanDeoptimize() const { return true; } | 6786 virtual bool CanDeoptimize() const { return true; } |
| 6817 | 6787 |
| 6818 virtual EffectSet Effects() const { return EffectSet::None(); } | 6788 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 6819 | 6789 |
| 6820 virtual void PrintOperandsTo(BufferFormatter* f) const; | 6790 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 6821 | 6791 |
| 6822 private: | 6792 private: |
| 6823 const intptr_t token_pos_; | 6793 const intptr_t token_pos_; |
| 6824 const intptr_t loop_depth_; | 6794 const intptr_t loop_depth_; |
| 6825 | 6795 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7308 | 7278 |
| 7309 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { | 7279 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { |
| 7310 public: | 7280 public: |
| 7311 CheckClassInstr(Value* value, | 7281 CheckClassInstr(Value* value, |
| 7312 intptr_t deopt_id, | 7282 intptr_t deopt_id, |
| 7313 const ICData& unary_checks, | 7283 const ICData& unary_checks, |
| 7314 intptr_t token_pos); | 7284 intptr_t token_pos); |
| 7315 | 7285 |
| 7316 DECLARE_INSTRUCTION(CheckClass) | 7286 DECLARE_INSTRUCTION(CheckClass) |
| 7317 | 7287 |
| 7318 virtual intptr_t ArgumentCount() const { return 0; } | |
| 7319 | |
| 7320 virtual bool CanDeoptimize() const { return true; } | 7288 virtual bool CanDeoptimize() const { return true; } |
| 7321 | 7289 |
| 7322 virtual intptr_t token_pos() const { return token_pos_; } | 7290 virtual intptr_t token_pos() const { return token_pos_; } |
| 7323 | 7291 |
| 7324 Value* value() const { return inputs_[0]; } | 7292 Value* value() const { return inputs_[0]; } |
| 7325 | 7293 |
| 7326 const ICData& unary_checks() const { return unary_checks_; } | 7294 const ICData& unary_checks() const { return unary_checks_; } |
| 7327 | 7295 |
| 7328 const GrowableArray<intptr_t>& cids() const { return cids_; } | 7296 const GrowableArray<intptr_t>& cids() const { return cids_; } |
| 7329 | 7297 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7361 token_pos_(token_pos), | 7329 token_pos_(token_pos), |
| 7362 licm_hoisted_(false) { | 7330 licm_hoisted_(false) { |
| 7363 SetInputAt(0, value); | 7331 SetInputAt(0, value); |
| 7364 } | 7332 } |
| 7365 | 7333 |
| 7366 Value* value() const { return inputs_[0]; } | 7334 Value* value() const { return inputs_[0]; } |
| 7367 virtual intptr_t token_pos() const { return token_pos_; } | 7335 virtual intptr_t token_pos() const { return token_pos_; } |
| 7368 | 7336 |
| 7369 DECLARE_INSTRUCTION(CheckSmi) | 7337 DECLARE_INSTRUCTION(CheckSmi) |
| 7370 | 7338 |
| 7371 virtual intptr_t ArgumentCount() const { return 0; } | |
| 7372 | |
| 7373 virtual bool CanDeoptimize() const { return true; } | 7339 virtual bool CanDeoptimize() const { return true; } |
| 7374 | 7340 |
| 7375 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7341 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7376 | 7342 |
| 7377 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7343 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 7378 | 7344 |
| 7379 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7345 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
| 7380 | 7346 |
| 7381 private: | 7347 private: |
| 7382 const intptr_t token_pos_; | 7348 const intptr_t token_pos_; |
| 7383 bool licm_hoisted_; | 7349 bool licm_hoisted_; |
| 7384 | 7350 |
| 7385 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7351 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
| 7386 }; | 7352 }; |
| 7387 | 7353 |
| 7388 | 7354 |
| 7389 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { | 7355 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { |
| 7390 public: | 7356 public: |
| 7391 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) | 7357 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) |
| 7392 : TemplateInstruction(deopt_id), cid_(cid) { | 7358 : TemplateInstruction(deopt_id), cid_(cid) { |
| 7393 SetInputAt(0, value); | 7359 SetInputAt(0, value); |
| 7394 } | 7360 } |
| 7395 | 7361 |
| 7396 Value* value() const { return inputs_[0]; } | 7362 Value* value() const { return inputs_[0]; } |
| 7397 intptr_t cid() const { return cid_; } | 7363 intptr_t cid() const { return cid_; } |
| 7398 | 7364 |
| 7399 DECLARE_INSTRUCTION(CheckClassId) | 7365 DECLARE_INSTRUCTION(CheckClassId) |
| 7400 | 7366 |
| 7401 virtual intptr_t ArgumentCount() const { return 0; } | |
| 7402 | |
| 7403 virtual bool CanDeoptimize() const { return true; } | 7367 virtual bool CanDeoptimize() const { return true; } |
| 7404 | 7368 |
| 7405 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7369 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7406 | 7370 |
| 7407 virtual bool AllowsCSE() const { return true; } | 7371 virtual bool AllowsCSE() const { return true; } |
| 7408 virtual EffectSet Dependencies() const; | 7372 virtual EffectSet Dependencies() const; |
| 7409 virtual EffectSet Effects() const { return EffectSet::None(); } | 7373 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 7410 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7374 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 7411 | 7375 |
| 7412 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7376 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 7426 licm_hoisted_(false) { | 7390 licm_hoisted_(false) { |
| 7427 SetInputAt(kLengthPos, length); | 7391 SetInputAt(kLengthPos, length); |
| 7428 SetInputAt(kIndexPos, index); | 7392 SetInputAt(kIndexPos, index); |
| 7429 } | 7393 } |
| 7430 | 7394 |
| 7431 Value* length() const { return inputs_[kLengthPos]; } | 7395 Value* length() const { return inputs_[kLengthPos]; } |
| 7432 Value* index() const { return inputs_[kIndexPos]; } | 7396 Value* index() const { return inputs_[kIndexPos]; } |
| 7433 | 7397 |
| 7434 DECLARE_INSTRUCTION(CheckArrayBound) | 7398 DECLARE_INSTRUCTION(CheckArrayBound) |
| 7435 | 7399 |
| 7436 virtual intptr_t ArgumentCount() const { return 0; } | |
| 7437 | |
| 7438 virtual bool CanDeoptimize() const { return true; } | 7400 virtual bool CanDeoptimize() const { return true; } |
| 7439 | 7401 |
| 7440 bool IsRedundant(const RangeBoundary& length); | 7402 bool IsRedundant(const RangeBoundary& length); |
| 7441 | 7403 |
| 7442 void mark_generalized() { | 7404 void mark_generalized() { |
| 7443 generalized_ = true; | 7405 generalized_ = true; |
| 7444 } | 7406 } |
| 7445 | 7407 |
| 7446 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7408 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7447 | 7409 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7768 Isolate* isolate, bool opt) const { \ | 7730 Isolate* isolate, bool opt) const { \ |
| 7769 UNIMPLEMENTED(); \ | 7731 UNIMPLEMENTED(); \ |
| 7770 return NULL; \ | 7732 return NULL; \ |
| 7771 } \ | 7733 } \ |
| 7772 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 7734 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 7773 | 7735 |
| 7774 | 7736 |
| 7775 } // namespace dart | 7737 } // namespace dart |
| 7776 | 7738 |
| 7777 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7739 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |