| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 DECLARE_COMPUTATION(ShortName) \ | 303 DECLARE_COMPUTATION(ShortName) \ |
| 304 virtual void PrintTo(BufferFormatter* f) const; | 304 virtual void PrintTo(BufferFormatter* f) const; |
| 305 | 305 |
| 306 | 306 |
| 307 // Function defined in all call computation classes. | 307 // Function defined in all call computation classes. |
| 308 #define DECLARE_CALL_COMPUTATION(ShortName) \ | 308 #define DECLARE_CALL_COMPUTATION(ShortName) \ |
| 309 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ | 309 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ |
| 310 virtual ComputationType computation_type() const { \ | 310 virtual ComputationType computation_type() const { \ |
| 311 return Computation::k##ShortName; \ | 311 return Computation::k##ShortName; \ |
| 312 } \ | 312 } \ |
| 313 virtual intptr_t InputCount() const { return 0; } \ | |
| 314 virtual Value* InputAt(intptr_t i) const { \ | |
| 315 UNREACHABLE(); \ | |
| 316 return NULL; \ | |
| 317 } \ | |
| 318 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } \ | |
| 319 virtual const char* DebugName() const { return #ShortName; } \ | 313 virtual const char* DebugName() const { return #ShortName; } \ |
| 320 virtual RawAbstractType* StaticType() const; \ | 314 virtual RawAbstractType* StaticType() const; \ |
| 321 virtual LocationSummary* MakeLocationSummary() const; \ | 315 virtual LocationSummary* MakeLocationSummary() const; \ |
| 322 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 316 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 323 | 317 |
| 324 | 318 |
| 325 class Definition; | 319 class Definition; |
| 326 class PhiInstr; | 320 class PhiInstr; |
| 327 | 321 |
| 328 class UseVal : public Value { | 322 class UseVal : public Value { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 463 |
| 470 Value* value() const { return inputs_[0]; } | 464 Value* value() const { return inputs_[0]; } |
| 471 | 465 |
| 472 virtual bool CanDeoptimize() const { return false; } | 466 virtual bool CanDeoptimize() const { return false; } |
| 473 | 467 |
| 474 private: | 468 private: |
| 475 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); | 469 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); |
| 476 }; | 470 }; |
| 477 | 471 |
| 478 | 472 |
| 479 class ClosureCallComp : public Computation { | 473 class ClosureCallComp : public TemplateComputation<0> { |
| 480 public: | 474 public: |
| 481 ClosureCallComp(ClosureCallNode* node, | 475 ClosureCallComp(ClosureCallNode* node, |
| 482 intptr_t try_index, | 476 intptr_t try_index, |
| 483 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 477 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 484 : ast_node_(*node), | 478 : ast_node_(*node), |
| 485 try_index_(try_index), | 479 try_index_(try_index), |
| 486 arguments_(arguments) { } | 480 arguments_(arguments) { } |
| 487 | 481 |
| 488 DECLARE_CALL_COMPUTATION(ClosureCall) | 482 DECLARE_CALL_COMPUTATION(ClosureCall) |
| 489 | 483 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 502 | 496 |
| 503 private: | 497 private: |
| 504 const ClosureCallNode& ast_node_; | 498 const ClosureCallNode& ast_node_; |
| 505 const intptr_t try_index_; | 499 const intptr_t try_index_; |
| 506 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 500 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 507 | 501 |
| 508 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); | 502 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); |
| 509 }; | 503 }; |
| 510 | 504 |
| 511 | 505 |
| 512 class InstanceCallComp : public Computation { | 506 class InstanceCallComp : public TemplateComputation<0> { |
| 513 public: | 507 public: |
| 514 InstanceCallComp(intptr_t token_pos, | 508 InstanceCallComp(intptr_t token_pos, |
| 515 intptr_t try_index, | 509 intptr_t try_index, |
| 516 const String& function_name, | 510 const String& function_name, |
| 517 Token::Kind token_kind, | 511 Token::Kind token_kind, |
| 518 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 512 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 519 const Array& argument_names, | 513 const Array& argument_names, |
| 520 intptr_t checked_argument_count) | 514 intptr_t checked_argument_count) |
| 521 : token_pos_(token_pos), | 515 : token_pos_(token_pos), |
| 522 try_index_(try_index), | 516 try_index_(try_index), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 const String& function_name_; | 552 const String& function_name_; |
| 559 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 553 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
| 560 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 554 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 561 const Array& argument_names_; | 555 const Array& argument_names_; |
| 562 const intptr_t checked_argument_count_; | 556 const intptr_t checked_argument_count_; |
| 563 | 557 |
| 564 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 558 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 565 }; | 559 }; |
| 566 | 560 |
| 567 | 561 |
| 568 class PolymorphicInstanceCallComp : public Computation { | 562 class PolymorphicInstanceCallComp : public TemplateComputation<0> { |
| 569 public: | 563 public: |
| 570 explicit PolymorphicInstanceCallComp(InstanceCallComp* comp) | 564 explicit PolymorphicInstanceCallComp(InstanceCallComp* comp) |
| 571 : instance_call_(comp) { | 565 : instance_call_(comp) { |
| 572 ASSERT(instance_call_ != NULL); | 566 ASSERT(instance_call_ != NULL); |
| 573 } | 567 } |
| 574 | 568 |
| 575 InstanceCallComp* instance_call() const { return instance_call_; } | 569 InstanceCallComp* instance_call() const { return instance_call_; } |
| 576 | 570 |
| 577 virtual intptr_t InputCount() const { return 0; } | |
| 578 virtual Value* InputAt(intptr_t i) const { | |
| 579 UNREACHABLE(); | |
| 580 return NULL; | |
| 581 } | |
| 582 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | |
| 583 | |
| 584 void PrintTo(BufferFormatter* f) const; | 571 void PrintTo(BufferFormatter* f) const; |
| 585 | 572 |
| 586 DECLARE_COMPUTATION(PolymorphicInstanceCall) | 573 DECLARE_COMPUTATION(PolymorphicInstanceCall) |
| 587 | 574 |
| 588 virtual bool CanDeoptimize() const { return true; } | 575 virtual bool CanDeoptimize() const { return true; } |
| 589 | 576 |
| 590 private: | 577 private: |
| 591 InstanceCallComp* instance_call_; | 578 InstanceCallComp* instance_call_; |
| 592 | 579 |
| 593 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); | 580 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 687 |
| 701 private: | 688 private: |
| 702 const intptr_t token_pos_; | 689 const intptr_t token_pos_; |
| 703 const intptr_t try_index_; | 690 const intptr_t try_index_; |
| 704 intptr_t operands_class_id_; // class id of both operands. | 691 intptr_t operands_class_id_; // class id of both operands. |
| 705 | 692 |
| 706 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); | 693 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); |
| 707 }; | 694 }; |
| 708 | 695 |
| 709 | 696 |
| 710 class StaticCallComp : public Computation { | 697 class StaticCallComp : public TemplateComputation<0> { |
| 711 public: | 698 public: |
| 712 StaticCallComp(intptr_t token_pos, | 699 StaticCallComp(intptr_t token_pos, |
| 713 intptr_t try_index, | 700 intptr_t try_index, |
| 714 const Function& function, | 701 const Function& function, |
| 715 const Array& argument_names, | 702 const Array& argument_names, |
| 716 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 703 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 717 : token_pos_(token_pos), | 704 : token_pos_(token_pos), |
| 718 try_index_(try_index), | 705 try_index_(try_index), |
| 719 function_(function), | 706 function_(function), |
| 720 argument_names_(argument_names), | 707 argument_names_(argument_names), |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 virtual bool CanDeoptimize() const { return false; } | 1159 virtual bool CanDeoptimize() const { return false; } |
| 1173 | 1160 |
| 1174 private: | 1161 private: |
| 1175 const ConstructorCallNode& ast_node_; | 1162 const ConstructorCallNode& ast_node_; |
| 1176 const intptr_t try_index_; | 1163 const intptr_t try_index_; |
| 1177 ZoneGrowableArray<Value*>* const arguments_; | 1164 ZoneGrowableArray<Value*>* const arguments_; |
| 1178 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); | 1165 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); |
| 1179 }; | 1166 }; |
| 1180 | 1167 |
| 1181 | 1168 |
| 1182 class CreateArrayComp : public Computation { | 1169 class CreateArrayComp : public TemplateComputation<1> { |
| 1183 public: | 1170 public: |
| 1184 CreateArrayComp(intptr_t token_pos, | 1171 CreateArrayComp(intptr_t token_pos, |
| 1185 intptr_t try_index, | 1172 intptr_t try_index, |
| 1186 ZoneGrowableArray<Value*>* elements, | 1173 ZoneGrowableArray<Value*>* elements, |
| 1187 Value* element_type) | 1174 Value* element_type) |
| 1188 : token_pos_(token_pos), | 1175 : token_pos_(token_pos), |
| 1189 try_index_(try_index), | 1176 try_index_(try_index), |
| 1190 elements_(elements) { | 1177 elements_(elements) { |
| 1191 #if defined(DEBUG) | 1178 #if defined(DEBUG) |
| 1192 for (int i = 0; i < ElementCount(); ++i) { | 1179 for (int i = 0; i < ElementCount(); ++i) { |
| 1193 ASSERT(ElementAt(i) != NULL); | 1180 ASSERT(ElementAt(i) != NULL); |
| 1194 } | 1181 } |
| 1195 ASSERT(element_type != NULL); | 1182 ASSERT(element_type != NULL); |
| 1196 #endif | 1183 #endif |
| 1184 inputs_[0] = element_type; |
| 1197 } | 1185 } |
| 1198 | 1186 |
| 1199 DECLARE_CALL_COMPUTATION(CreateArray) | 1187 DECLARE_CALL_COMPUTATION(CreateArray) |
| 1200 | 1188 |
| 1201 virtual intptr_t ArgumentCount() const { return ElementCount() + 1; } | 1189 virtual intptr_t ArgumentCount() const { return ElementCount(); } |
| 1202 | 1190 |
| 1203 intptr_t token_pos() const { return token_pos_; } | 1191 intptr_t token_pos() const { return token_pos_; } |
| 1204 intptr_t try_index() const { return try_index_; } | 1192 intptr_t try_index() const { return try_index_; } |
| 1205 intptr_t ElementCount() const { return elements_->length(); } | 1193 intptr_t ElementCount() const { return elements_->length(); } |
| 1206 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } | 1194 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } |
| 1207 Value* element_type() const { return element_type_; } | 1195 Value* element_type() const { return inputs_[0]; } |
| 1208 | 1196 |
| 1209 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1197 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1210 | 1198 |
| 1211 virtual bool CanDeoptimize() const { return false; } | 1199 virtual bool CanDeoptimize() const { return false; } |
| 1212 | 1200 |
| 1213 private: | 1201 private: |
| 1214 const intptr_t token_pos_; | 1202 const intptr_t token_pos_; |
| 1215 const intptr_t try_index_; | 1203 const intptr_t try_index_; |
| 1216 ZoneGrowableArray<Value*>* const elements_; | 1204 ZoneGrowableArray<Value*>* const elements_; |
| 1217 Value* element_type_; | |
| 1218 | 1205 |
| 1219 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); | 1206 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); |
| 1220 }; | 1207 }; |
| 1221 | 1208 |
| 1222 | 1209 |
| 1223 class CreateClosureComp : public Computation { | 1210 class CreateClosureComp : public TemplateComputation<0> { |
| 1224 public: | 1211 public: |
| 1225 CreateClosureComp(ClosureNode* node, | 1212 CreateClosureComp(ClosureNode* node, |
| 1226 intptr_t try_index, | 1213 intptr_t try_index, |
| 1227 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 1214 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 1228 : ast_node_(*node), | 1215 : ast_node_(*node), |
| 1229 try_index_(try_index), | 1216 try_index_(try_index), |
| 1230 arguments_(arguments) { } | 1217 arguments_(arguments) { } |
| 1231 | 1218 |
| 1232 DECLARE_CALL_COMPUTATION(CreateClosure) | 1219 DECLARE_CALL_COMPUTATION(CreateClosure) |
| 1233 | 1220 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 | 1541 |
| 1555 private: | 1542 private: |
| 1556 const Token::Kind op_kind_; | 1543 const Token::Kind op_kind_; |
| 1557 const OperandsType operands_type_; | 1544 const OperandsType operands_type_; |
| 1558 InstanceCallComp* instance_call_; | 1545 InstanceCallComp* instance_call_; |
| 1559 | 1546 |
| 1560 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); | 1547 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); |
| 1561 }; | 1548 }; |
| 1562 | 1549 |
| 1563 | 1550 |
| 1564 class DoubleBinaryOpComp : public Computation { | 1551 class DoubleBinaryOpComp : public TemplateComputation<0> { |
| 1565 public: | 1552 public: |
| 1566 DoubleBinaryOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) | 1553 DoubleBinaryOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) |
| 1567 : op_kind_(op_kind), instance_call_(instance_call) { } | 1554 : op_kind_(op_kind), instance_call_(instance_call) { } |
| 1568 | 1555 |
| 1569 Token::Kind op_kind() const { return op_kind_; } | 1556 Token::Kind op_kind() const { return op_kind_; } |
| 1570 | 1557 |
| 1571 InstanceCallComp* instance_call() const { return instance_call_; } | 1558 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1572 | 1559 |
| 1573 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1560 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1574 | 1561 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 #define FORWARD_DECLARATION(type) class type##Instr; | 1726 #define FORWARD_DECLARATION(type) class type##Instr; |
| 1740 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 1727 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 1741 #undef FORWARD_DECLARATION | 1728 #undef FORWARD_DECLARATION |
| 1742 | 1729 |
| 1743 | 1730 |
| 1744 // Functions required in all concrete instruction classes. | 1731 // Functions required in all concrete instruction classes. |
| 1745 #define DECLARE_INSTRUCTION(type) \ | 1732 #define DECLARE_INSTRUCTION(type) \ |
| 1746 virtual void Accept(FlowGraphVisitor* visitor); \ | 1733 virtual void Accept(FlowGraphVisitor* visitor); \ |
| 1747 virtual bool Is##type() const { return true; } \ | 1734 virtual bool Is##type() const { return true; } \ |
| 1748 virtual type##Instr* As##type() { return this; } \ | 1735 virtual type##Instr* As##type() { return this; } \ |
| 1749 virtual intptr_t InputCount() const; \ | |
| 1750 virtual Value* InputAt(intptr_t i) const; \ | |
| 1751 virtual void SetInputAt(intptr_t i, Value* value); \ | |
| 1752 virtual const char* DebugName() const { return #type; } \ | |
| 1753 virtual void PrintTo(BufferFormatter* f) const; \ | |
| 1754 virtual void PrintToVisualizer(BufferFormatter* f) const; | |
| 1755 | |
| 1756 | |
| 1757 #define DECLARE_CALL_INSTRUCTION(type) \ | |
| 1758 virtual void Accept(FlowGraphVisitor* visitor); \ | |
| 1759 virtual bool Is##type() const { return true; } \ | |
| 1760 virtual type##Instr* As##type() { return this; } \ | |
| 1761 virtual intptr_t InputCount() const { return 0; } \ | |
| 1762 virtual Value* InputAt(intptr_t i) const { \ | |
| 1763 UNREACHABLE(); \ | |
| 1764 return NULL; \ | |
| 1765 } \ | |
| 1766 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } \ | |
| 1767 virtual const char* DebugName() const { return #type; } \ | 1736 virtual const char* DebugName() const { return #type; } \ |
| 1768 virtual void PrintTo(BufferFormatter* f) const; \ | 1737 virtual void PrintTo(BufferFormatter* f) const; \ |
| 1769 virtual void PrintToVisualizer(BufferFormatter* f) const; | 1738 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 1770 | 1739 |
| 1771 | 1740 |
| 1772 class Instruction : public ZoneAllocated { | 1741 class Instruction : public ZoneAllocated { |
| 1773 public: | 1742 public: |
| 1774 Instruction() | 1743 Instruction() |
| 1775 : lifetime_position_(-1), previous_(NULL), next_(NULL), env_(NULL) { } | 1744 : lifetime_position_(-1), previous_(NULL), next_(NULL), env_(NULL) { } |
| 1776 | 1745 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 | 1858 |
| 1890 private: | 1859 private: |
| 1891 intptr_t lifetime_position_; // Position used by register allocator. | 1860 intptr_t lifetime_position_; // Position used by register allocator. |
| 1892 Instruction* previous_; | 1861 Instruction* previous_; |
| 1893 Instruction* next_; | 1862 Instruction* next_; |
| 1894 Environment* env_; | 1863 Environment* env_; |
| 1895 DISALLOW_COPY_AND_ASSIGN(Instruction); | 1864 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 1896 }; | 1865 }; |
| 1897 | 1866 |
| 1898 | 1867 |
| 1899 class InstructionWithInputs : public Instruction { | 1868 template<intptr_t N> |
| 1869 class TemplateInstruction: public Instruction { |
| 1900 public: | 1870 public: |
| 1901 InstructionWithInputs() : locs_(NULL) { } | 1871 TemplateInstruction<N>() : locs_(NULL) { } |
| 1872 |
| 1873 virtual intptr_t InputCount() const { return N; } |
| 1874 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 1875 virtual void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| 1902 | 1876 |
| 1903 virtual LocationSummary* locs() { | 1877 virtual LocationSummary* locs() { |
| 1904 if (locs_ == NULL) { | 1878 if (locs_ == NULL) { |
| 1905 locs_ = MakeLocationSummary(); | 1879 locs_ = MakeLocationSummary(); |
| 1906 } | 1880 } |
| 1907 return locs_; | 1881 return locs_; |
| 1908 } | 1882 } |
| 1909 | 1883 |
| 1910 virtual LocationSummary* MakeLocationSummary() const = 0; | 1884 virtual LocationSummary* MakeLocationSummary() const = 0; |
| 1911 | 1885 |
| 1886 protected: |
| 1887 EmbeddedArray<Value*, N> inputs_; |
| 1888 |
| 1912 private: | 1889 private: |
| 1913 LocationSummary* locs_; | 1890 LocationSummary* locs_; |
| 1914 DISALLOW_COPY_AND_ASSIGN(InstructionWithInputs); | |
| 1915 }; | 1891 }; |
| 1916 | 1892 |
| 1917 | 1893 |
| 1918 class MoveOperands : public ZoneAllocated { | 1894 class MoveOperands : public ZoneAllocated { |
| 1919 public: | 1895 public: |
| 1920 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } | 1896 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } |
| 1921 | 1897 |
| 1922 Location src() const { return src_; } | 1898 Location src() const { return src_; } |
| 1923 Location dest() const { return dest_; } | 1899 Location dest() const { return dest_; } |
| 1924 | 1900 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 } | 1942 } |
| 1967 | 1943 |
| 1968 private: | 1944 private: |
| 1969 Location dest_; | 1945 Location dest_; |
| 1970 Location src_; | 1946 Location src_; |
| 1971 | 1947 |
| 1972 DISALLOW_COPY_AND_ASSIGN(MoveOperands); | 1948 DISALLOW_COPY_AND_ASSIGN(MoveOperands); |
| 1973 }; | 1949 }; |
| 1974 | 1950 |
| 1975 | 1951 |
| 1976 class ParallelMoveInstr : public Instruction { | 1952 class ParallelMoveInstr : public TemplateInstruction<0> { |
| 1977 public: | 1953 public: |
| 1978 ParallelMoveInstr() : moves_(4) { } | 1954 ParallelMoveInstr() : moves_(4) { } |
| 1979 | 1955 |
| 1980 DECLARE_INSTRUCTION(ParallelMove) | 1956 DECLARE_INSTRUCTION(ParallelMove) |
| 1981 | 1957 |
| 1982 virtual intptr_t ArgumentCount() const { return 0; } | 1958 virtual intptr_t ArgumentCount() const { return 0; } |
| 1983 | 1959 |
| 1984 virtual bool CanDeoptimize() const { return false; } | 1960 virtual bool CanDeoptimize() const { return false; } |
| 1985 | 1961 |
| 1986 MoveOperands* AddMove(Location dest, Location src) { | 1962 MoveOperands* AddMove(Location dest, Location src) { |
| 1987 MoveOperands* move = new MoveOperands(dest, src); | 1963 MoveOperands* move = new MoveOperands(dest, src); |
| 1988 moves_.Add(move); | 1964 moves_.Add(move); |
| 1989 return move; | 1965 return move; |
| 1990 } | 1966 } |
| 1991 | 1967 |
| 1992 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } | 1968 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } |
| 1993 | 1969 |
| 1994 void SetSrcSlotAt(intptr_t index, const Location& loc); | 1970 void SetSrcSlotAt(intptr_t index, const Location& loc); |
| 1995 void SetDestSlotAt(intptr_t index, const Location& loc); | 1971 void SetDestSlotAt(intptr_t index, const Location& loc); |
| 1996 | 1972 |
| 1997 intptr_t NumMoves() const { return moves_.length(); } | 1973 intptr_t NumMoves() const { return moves_.length(); } |
| 1998 | 1974 |
| 1975 LocationSummary* MakeLocationSummary() const { return NULL; } |
| 1976 |
| 1977 void EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } |
| 1978 |
| 1999 private: | 1979 private: |
| 2000 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. | 1980 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. |
| 2001 | 1981 |
| 2002 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); | 1982 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); |
| 2003 }; | 1983 }; |
| 2004 | 1984 |
| 2005 | 1985 |
| 2006 // Basic block entries are administrative nodes. There is a distinguished | 1986 // Basic block entries are administrative nodes. There is a distinguished |
| 2007 // graph entry with no predecessor. Joins are the only nodes with multiple | 1987 // graph entry with no predecessor. Joins are the only nodes with multiple |
| 2008 // predecessors. Targets are all other basic block entries. The types | 1988 // predecessors. Targets are all other basic block entries. The types |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2042 |
| 2063 virtual void DiscoverBlocks( | 2043 virtual void DiscoverBlocks( |
| 2064 BlockEntryInstr* current_block, | 2044 BlockEntryInstr* current_block, |
| 2065 GrowableArray<BlockEntryInstr*>* preorder, | 2045 GrowableArray<BlockEntryInstr*>* preorder, |
| 2066 GrowableArray<BlockEntryInstr*>* postorder, | 2046 GrowableArray<BlockEntryInstr*>* postorder, |
| 2067 GrowableArray<intptr_t>* parent, | 2047 GrowableArray<intptr_t>* parent, |
| 2068 GrowableArray<BitVector*>* assigned_vars, | 2048 GrowableArray<BitVector*>* assigned_vars, |
| 2069 intptr_t variable_count, | 2049 intptr_t variable_count, |
| 2070 intptr_t fixed_parameter_count); | 2050 intptr_t fixed_parameter_count); |
| 2071 | 2051 |
| 2052 virtual intptr_t InputCount() const { return 0; } |
| 2053 virtual Value* InputAt(intptr_t i) const { |
| 2054 UNREACHABLE(); |
| 2055 return NULL; |
| 2056 } |
| 2057 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2058 |
| 2072 virtual intptr_t ArgumentCount() const { return 0; } | 2059 virtual intptr_t ArgumentCount() const { return 0; } |
| 2073 | 2060 |
| 2074 virtual bool CanDeoptimize() const { return false; } | 2061 virtual bool CanDeoptimize() const { return false; } |
| 2075 | 2062 |
| 2076 protected: | 2063 protected: |
| 2077 BlockEntryInstr() | 2064 BlockEntryInstr() |
| 2078 : preorder_number_(-1), | 2065 : preorder_number_(-1), |
| 2079 postorder_number_(-1), | 2066 postorder_number_(-1), |
| 2080 block_id_(-1), | 2067 block_id_(-1), |
| 2081 dominator_(NULL), | 2068 dominator_(NULL), |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 BindInstr(UseKind used, Computation* computation) | 2319 BindInstr(UseKind used, Computation* computation) |
| 2333 : computation_(computation), is_used_(used != kUnused) { | 2320 : computation_(computation), is_used_(used != kUnused) { |
| 2334 ASSERT(computation != NULL); | 2321 ASSERT(computation != NULL); |
| 2335 } | 2322 } |
| 2336 | 2323 |
| 2337 DECLARE_INSTRUCTION(Bind) | 2324 DECLARE_INSTRUCTION(Bind) |
| 2338 | 2325 |
| 2339 virtual intptr_t ArgumentCount() const { | 2326 virtual intptr_t ArgumentCount() const { |
| 2340 return computation()->ArgumentCount(); | 2327 return computation()->ArgumentCount(); |
| 2341 } | 2328 } |
| 2329 intptr_t InputCount() const { return computation()->InputCount(); } |
| 2330 |
| 2331 Value* InputAt(intptr_t i) const { return computation()->InputAt(i); } |
| 2332 |
| 2333 void SetInputAt(intptr_t i, Value* value) { |
| 2334 computation()->SetInputAt(i, value); |
| 2335 } |
| 2342 | 2336 |
| 2343 virtual bool CanDeoptimize() const { return computation()->CanDeoptimize(); } | 2337 virtual bool CanDeoptimize() const { return computation()->CanDeoptimize(); } |
| 2344 | 2338 |
| 2345 Computation* computation() const { return computation_; } | 2339 Computation* computation() const { return computation_; } |
| 2346 void set_computation(Computation* value) { computation_ = value; } | 2340 void set_computation(Computation* value) { computation_ = value; } |
| 2347 bool is_used() const { return is_used_; } | 2341 bool is_used() const { return is_used_; } |
| 2348 | 2342 |
| 2349 // Static type of the underlying computation. | 2343 // Static type of the underlying computation. |
| 2350 virtual RawAbstractType* StaticType() const { | 2344 virtual RawAbstractType* StaticType() const { |
| 2351 return computation()->StaticType(); | 2345 return computation()->StaticType(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2374 for (intptr_t i = 0; i < num_inputs; ++i) { | 2368 for (intptr_t i = 0; i < num_inputs; ++i) { |
| 2375 inputs_.Add(NULL); | 2369 inputs_.Add(NULL); |
| 2376 } | 2370 } |
| 2377 } | 2371 } |
| 2378 | 2372 |
| 2379 // Least upper bound of the static types of the inputs. | 2373 // Least upper bound of the static types of the inputs. |
| 2380 virtual RawAbstractType* StaticType() const; | 2374 virtual RawAbstractType* StaticType() const; |
| 2381 | 2375 |
| 2382 virtual intptr_t ArgumentCount() const { return 0; } | 2376 virtual intptr_t ArgumentCount() const { return 0; } |
| 2383 | 2377 |
| 2378 intptr_t InputCount() const { return inputs_.length(); } |
| 2379 |
| 2380 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 2381 |
| 2382 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| 2383 |
| 2384 virtual bool CanDeoptimize() const { return false; } | 2384 virtual bool CanDeoptimize() const { return false; } |
| 2385 | 2385 |
| 2386 DECLARE_INSTRUCTION(Phi) | 2386 DECLARE_INSTRUCTION(Phi) |
| 2387 | 2387 |
| 2388 private: | 2388 private: |
| 2389 GrowableArray<Value*> inputs_; | 2389 GrowableArray<Value*> inputs_; |
| 2390 | 2390 |
| 2391 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2391 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
| 2392 }; | 2392 }; |
| 2393 | 2393 |
| 2394 | 2394 |
| 2395 class ParameterInstr : public Definition { | 2395 class ParameterInstr : public Definition { |
| 2396 public: | 2396 public: |
| 2397 explicit ParameterInstr(intptr_t index) : index_(index) { } | 2397 explicit ParameterInstr(intptr_t index) : index_(index) { } |
| 2398 | 2398 |
| 2399 DECLARE_INSTRUCTION(Parameter) | 2399 DECLARE_INSTRUCTION(Parameter) |
| 2400 | 2400 |
| 2401 intptr_t index() const { return index_; } | 2401 intptr_t index() const { return index_; } |
| 2402 | 2402 |
| 2403 // Static type of the passed-in parameter. | 2403 // Static type of the passed-in parameter. |
| 2404 virtual RawAbstractType* StaticType() const; | 2404 virtual RawAbstractType* StaticType() const; |
| 2405 | 2405 |
| 2406 virtual intptr_t ArgumentCount() const { return 0; } | 2406 virtual intptr_t ArgumentCount() const { return 0; } |
| 2407 | 2407 |
| 2408 intptr_t InputCount() const { return 0; } |
| 2409 Value* InputAt(intptr_t i) const { |
| 2410 UNREACHABLE(); |
| 2411 return NULL; |
| 2412 } |
| 2413 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2414 |
| 2415 |
| 2408 virtual bool CanDeoptimize() const { return false; } | 2416 virtual bool CanDeoptimize() const { return false; } |
| 2409 | 2417 |
| 2410 private: | 2418 private: |
| 2411 const intptr_t index_; | 2419 const intptr_t index_; |
| 2412 | 2420 |
| 2413 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2421 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2414 }; | 2422 }; |
| 2415 | 2423 |
| 2416 | 2424 |
| 2417 class PushArgumentInstr : public InstructionWithInputs { | 2425 class PushArgumentInstr : public TemplateInstruction<1> { |
| 2418 public: | 2426 public: |
| 2419 explicit PushArgumentInstr(Value* value) : value_(value) { } | 2427 explicit PushArgumentInstr(Value* value) { |
| 2428 ASSERT(value != NULL); |
| 2429 inputs_[0] = value; |
| 2430 } |
| 2420 | 2431 |
| 2421 DECLARE_INSTRUCTION(PushArgument) | 2432 DECLARE_INSTRUCTION(PushArgument) |
| 2422 | 2433 |
| 2423 virtual intptr_t ArgumentCount() const { return 0; } | 2434 virtual intptr_t ArgumentCount() const { return 0; } |
| 2424 | 2435 |
| 2425 Value* value() const { return value_; } | 2436 Value* value() const { return inputs_[0]; } |
| 2426 | 2437 |
| 2427 virtual LocationSummary* MakeLocationSummary() const; | 2438 virtual LocationSummary* MakeLocationSummary() const; |
| 2428 | 2439 |
| 2429 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2440 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2430 | 2441 |
| 2431 virtual bool CanDeoptimize() const { return false; } | 2442 virtual bool CanDeoptimize() const { return false; } |
| 2432 | 2443 |
| 2433 private: | 2444 private: |
| 2434 Value* value_; | |
| 2435 | |
| 2436 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2445 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
| 2437 }; | 2446 }; |
| 2438 | 2447 |
| 2439 | 2448 |
| 2440 class ReturnInstr : public InstructionWithInputs { | 2449 class ReturnInstr : public TemplateInstruction<1> { |
| 2441 public: | 2450 public: |
| 2442 ReturnInstr(intptr_t token_pos, Value* value) | 2451 ReturnInstr(intptr_t token_pos, Value* value) |
| 2443 : InstructionWithInputs(), | 2452 : cid_(Isolate::Current()->GetNextCid()), |
| 2444 cid_(Isolate::Current()->GetNextCid()), | 2453 token_pos_(token_pos) { |
| 2445 token_pos_(token_pos), | 2454 ASSERT(value != NULL); |
| 2446 value_(value) { | 2455 inputs_[0] = value; |
| 2447 ASSERT(value_ != NULL); | |
| 2448 } | 2456 } |
| 2449 | 2457 |
| 2450 DECLARE_INSTRUCTION(Return) | 2458 DECLARE_INSTRUCTION(Return) |
| 2451 | 2459 |
| 2452 virtual intptr_t ArgumentCount() const { return 0; } | 2460 virtual intptr_t ArgumentCount() const { return 0; } |
| 2453 | 2461 |
| 2454 intptr_t cid() const { return cid_; } | 2462 intptr_t cid() const { return cid_; } |
| 2455 intptr_t token_pos() const { return token_pos_; } | 2463 intptr_t token_pos() const { return token_pos_; } |
| 2456 Value* value() const { return value_; } | 2464 Value* value() const { return inputs_[0]; } |
| 2457 | 2465 |
| 2458 virtual LocationSummary* MakeLocationSummary() const; | 2466 virtual LocationSummary* MakeLocationSummary() const; |
| 2459 | 2467 |
| 2460 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2468 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2461 | 2469 |
| 2462 virtual bool CanDeoptimize() const { return false; } | 2470 virtual bool CanDeoptimize() const { return false; } |
| 2463 | 2471 |
| 2464 private: | 2472 private: |
| 2465 const intptr_t cid_; // Computation/instruction id. | 2473 const intptr_t cid_; // Computation/instruction id. |
| 2466 const intptr_t token_pos_; | 2474 const intptr_t token_pos_; |
| 2467 Value* value_; | |
| 2468 | 2475 |
| 2469 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 2476 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 2470 }; | 2477 }; |
| 2471 | 2478 |
| 2472 | 2479 |
| 2473 class ThrowInstr : public InstructionWithInputs { | 2480 class ThrowInstr : public TemplateInstruction<0> { |
| 2474 public: | 2481 public: |
| 2475 ThrowInstr(intptr_t token_pos, intptr_t try_index) | 2482 ThrowInstr(intptr_t token_pos, intptr_t try_index) |
| 2476 : InstructionWithInputs(), | 2483 : cid_(Isolate::Current()->GetNextCid()), |
| 2477 cid_(Isolate::Current()->GetNextCid()), | |
| 2478 token_pos_(token_pos), | 2484 token_pos_(token_pos), |
| 2479 try_index_(try_index) { } | 2485 try_index_(try_index) { } |
| 2480 | 2486 |
| 2481 DECLARE_CALL_INSTRUCTION(Throw) | 2487 DECLARE_INSTRUCTION(Throw) |
| 2482 | 2488 |
| 2483 virtual intptr_t ArgumentCount() const { return 1; } | 2489 virtual intptr_t ArgumentCount() const { return 1; } |
| 2484 | 2490 |
| 2485 intptr_t cid() const { return cid_; } | 2491 intptr_t cid() const { return cid_; } |
| 2486 intptr_t token_pos() const { return token_pos_; } | 2492 intptr_t token_pos() const { return token_pos_; } |
| 2487 intptr_t try_index() const { return try_index_; } | 2493 intptr_t try_index() const { return try_index_; } |
| 2488 | 2494 |
| 2489 virtual LocationSummary* MakeLocationSummary() const; | 2495 virtual LocationSummary* MakeLocationSummary() const; |
| 2490 | 2496 |
| 2491 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2497 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2492 | 2498 |
| 2493 virtual bool CanDeoptimize() const { return false; } | 2499 virtual bool CanDeoptimize() const { return false; } |
| 2494 | 2500 |
| 2495 private: | 2501 private: |
| 2496 const intptr_t cid_; // Computation/instruction id. | 2502 const intptr_t cid_; // Computation/instruction id. |
| 2497 const intptr_t token_pos_; | 2503 const intptr_t token_pos_; |
| 2498 const intptr_t try_index_; | 2504 const intptr_t try_index_; |
| 2499 | 2505 |
| 2500 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 2506 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 2501 }; | 2507 }; |
| 2502 | 2508 |
| 2503 | 2509 |
| 2504 class ReThrowInstr : public InstructionWithInputs { | 2510 class ReThrowInstr : public TemplateInstruction<0> { |
| 2505 public: | 2511 public: |
| 2506 ReThrowInstr(intptr_t token_pos, | 2512 ReThrowInstr(intptr_t token_pos, |
| 2507 intptr_t try_index) | 2513 intptr_t try_index) |
| 2508 : InstructionWithInputs(), | 2514 : cid_(Isolate::Current()->GetNextCid()), |
| 2509 cid_(Isolate::Current()->GetNextCid()), | |
| 2510 token_pos_(token_pos), | 2515 token_pos_(token_pos), |
| 2511 try_index_(try_index) { } | 2516 try_index_(try_index) { } |
| 2512 | 2517 |
| 2513 DECLARE_CALL_INSTRUCTION(ReThrow) | 2518 DECLARE_INSTRUCTION(ReThrow) |
| 2514 | 2519 |
| 2515 virtual intptr_t ArgumentCount() const { return 2; } | 2520 virtual intptr_t ArgumentCount() const { return 2; } |
| 2516 | 2521 |
| 2517 intptr_t cid() const { return cid_; } | 2522 intptr_t cid() const { return cid_; } |
| 2518 intptr_t token_pos() const { return token_pos_; } | 2523 intptr_t token_pos() const { return token_pos_; } |
| 2519 intptr_t try_index() const { return try_index_; } | 2524 intptr_t try_index() const { return try_index_; } |
| 2520 | 2525 |
| 2521 virtual LocationSummary* MakeLocationSummary() const; | 2526 virtual LocationSummary* MakeLocationSummary() const; |
| 2522 | 2527 |
| 2523 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2528 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2524 | 2529 |
| 2525 virtual bool CanDeoptimize() const { return false; } | 2530 virtual bool CanDeoptimize() const { return false; } |
| 2526 | 2531 |
| 2527 private: | 2532 private: |
| 2528 const intptr_t cid_; // Computation/instruction id. | 2533 const intptr_t cid_; // Computation/instruction id. |
| 2529 const intptr_t token_pos_; | 2534 const intptr_t token_pos_; |
| 2530 const intptr_t try_index_; | 2535 const intptr_t try_index_; |
| 2531 | 2536 |
| 2532 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 2537 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 2533 }; | 2538 }; |
| 2534 | 2539 |
| 2535 | 2540 |
| 2536 class GotoInstr : public InstructionWithInputs { | 2541 class GotoInstr : public TemplateInstruction<0> { |
| 2537 public: | 2542 public: |
| 2538 explicit GotoInstr(JoinEntryInstr* entry) | 2543 explicit GotoInstr(JoinEntryInstr* entry) |
| 2539 : successor_(entry), | 2544 : successor_(entry), |
| 2540 parallel_move_(NULL) { | 2545 parallel_move_(NULL) { } |
| 2541 } | |
| 2542 | 2546 |
| 2543 DECLARE_INSTRUCTION(Goto) | 2547 DECLARE_INSTRUCTION(Goto) |
| 2544 | 2548 |
| 2545 virtual intptr_t ArgumentCount() const { return 0; } | 2549 virtual intptr_t ArgumentCount() const { return 0; } |
| 2546 | 2550 |
| 2547 JoinEntryInstr* successor() const { return successor_; } | 2551 JoinEntryInstr* successor() const { return successor_; } |
| 2548 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } | 2552 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } |
| 2549 virtual intptr_t SuccessorCount() const; | 2553 virtual intptr_t SuccessorCount() const; |
| 2550 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 2554 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 2551 | 2555 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2572 | 2576 |
| 2573 private: | 2577 private: |
| 2574 JoinEntryInstr* successor_; | 2578 JoinEntryInstr* successor_; |
| 2575 | 2579 |
| 2576 // Parallel move that will be used by linear scan register allocator to | 2580 // Parallel move that will be used by linear scan register allocator to |
| 2577 // connect live ranges at the end of the block and resolve phis. | 2581 // connect live ranges at the end of the block and resolve phis. |
| 2578 ParallelMoveInstr* parallel_move_; | 2582 ParallelMoveInstr* parallel_move_; |
| 2579 }; | 2583 }; |
| 2580 | 2584 |
| 2581 | 2585 |
| 2582 class BranchInstr : public InstructionWithInputs { | 2586 class BranchInstr : public TemplateInstruction<2> { |
| 2583 public: | 2587 public: |
| 2584 BranchInstr(intptr_t token_pos, | 2588 BranchInstr(intptr_t token_pos, |
| 2585 intptr_t try_index, | 2589 intptr_t try_index, |
| 2586 Value* left, | 2590 Value* left, |
| 2587 Value* right, | 2591 Value* right, |
| 2588 Token::Kind kind) | 2592 Token::Kind kind) |
| 2589 : InstructionWithInputs(), | 2593 : cid_(Computation::kNoCid), |
| 2590 cid_(Computation::kNoCid), | |
| 2591 ic_data_(NULL), | 2594 ic_data_(NULL), |
| 2592 token_pos_(token_pos), | 2595 token_pos_(token_pos), |
| 2593 try_index_(try_index), | 2596 try_index_(try_index), |
| 2594 left_(left), | |
| 2595 right_(right), | |
| 2596 kind_(kind), | 2597 kind_(kind), |
| 2597 true_successor_(NULL), | 2598 true_successor_(NULL), |
| 2598 false_successor_(NULL) { | 2599 false_successor_(NULL) { |
| 2599 ASSERT(left_ != NULL); | 2600 ASSERT(left != NULL); |
| 2600 ASSERT(right_ != NULL); | 2601 ASSERT(right != NULL); |
| 2602 inputs_[0] = left; |
| 2603 inputs_[1] = right; |
| 2601 ASSERT(Token::IsEqualityOperator(kind) || | 2604 ASSERT(Token::IsEqualityOperator(kind) || |
| 2602 Token::IsRelationalOperator(kind) || | 2605 Token::IsRelationalOperator(kind) || |
| 2603 Token::IsTypeTestOperator(kind)); | 2606 Token::IsTypeTestOperator(kind)); |
| 2604 Isolate* isolate = Isolate::Current(); | 2607 Isolate* isolate = Isolate::Current(); |
| 2605 cid_ = isolate->GetNextCid(); | 2608 cid_ = isolate->GetNextCid(); |
| 2606 ic_data_ = isolate->GetICDataForCid(cid_); | 2609 ic_data_ = isolate->GetICDataForCid(cid_); |
| 2607 } | 2610 } |
| 2608 | 2611 |
| 2609 DECLARE_INSTRUCTION(Branch) | 2612 DECLARE_INSTRUCTION(Branch) |
| 2610 | 2613 |
| 2611 virtual intptr_t ArgumentCount() const { return 0; } | 2614 virtual intptr_t ArgumentCount() const { return 0; } |
| 2612 | 2615 |
| 2613 Value* left() const { return left_; } | 2616 Value* left() const { return inputs_[0]; } |
| 2614 Value* right() const { return right_; } | 2617 Value* right() const { return inputs_[1]; } |
| 2615 Token::Kind kind() const { return kind_; } | 2618 Token::Kind kind() const { return kind_; } |
| 2616 void set_kind(Token::Kind kind) { | 2619 void set_kind(Token::Kind kind) { |
| 2617 ASSERT(Token::IsEqualityOperator(kind) || | 2620 ASSERT(Token::IsEqualityOperator(kind) || |
| 2618 Token::IsRelationalOperator(kind) || | 2621 Token::IsRelationalOperator(kind) || |
| 2619 Token::IsTypeTestOperator(kind)); | 2622 Token::IsTypeTestOperator(kind)); |
| 2620 kind_ = kind; | 2623 kind_ = kind; |
| 2621 } | 2624 } |
| 2622 | 2625 |
| 2623 intptr_t cid() const { return cid_; } | 2626 intptr_t cid() const { return cid_; } |
| 2624 | 2627 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2655 void EmitBranchOnCondition(FlowGraphCompiler* compiler, | 2658 void EmitBranchOnCondition(FlowGraphCompiler* compiler, |
| 2656 Condition true_condition); | 2659 Condition true_condition); |
| 2657 | 2660 |
| 2658 virtual bool CanDeoptimize() const { return true; } | 2661 virtual bool CanDeoptimize() const { return true; } |
| 2659 | 2662 |
| 2660 private: | 2663 private: |
| 2661 intptr_t cid_; // Computation/instruction id. | 2664 intptr_t cid_; // Computation/instruction id. |
| 2662 ICData* ic_data_; | 2665 ICData* ic_data_; |
| 2663 const intptr_t token_pos_; | 2666 const intptr_t token_pos_; |
| 2664 const intptr_t try_index_; | 2667 const intptr_t try_index_; |
| 2665 Value* left_; | |
| 2666 Value* right_; | |
| 2667 Token::Kind kind_; | 2668 Token::Kind kind_; |
| 2668 TargetEntryInstr* true_successor_; | 2669 TargetEntryInstr* true_successor_; |
| 2669 TargetEntryInstr* false_successor_; | 2670 TargetEntryInstr* false_successor_; |
| 2670 | 2671 |
| 2671 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 2672 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
| 2672 }; | 2673 }; |
| 2673 | 2674 |
| 2674 | 2675 |
| 2675 #undef DECLARE_INSTRUCTION | 2676 #undef DECLARE_INSTRUCTION |
| 2676 | 2677 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 const GrowableArray<BlockEntryInstr*>& block_order_; | 2751 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2751 | 2752 |
| 2752 private: | 2753 private: |
| 2753 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2754 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2754 }; | 2755 }; |
| 2755 | 2756 |
| 2756 | 2757 |
| 2757 } // namespace dart | 2758 } // namespace dart |
| 2758 | 2759 |
| 2759 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2760 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |