| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 class BindInstr; | 111 class BindInstr; |
| 112 class BranchInstr; | 112 class BranchInstr; |
| 113 class BufferFormatter; | 113 class BufferFormatter; |
| 114 class ComparisonComp; | 114 class ComparisonComp; |
| 115 class Instruction; | 115 class Instruction; |
| 116 class PushArgumentInstr; | 116 class PushArgumentInstr; |
| 117 class Value; | 117 class Value; |
| 118 | 118 |
| 119 class Computation : public ZoneAllocated { | 119 class Computation : public ZoneAllocated { |
| 120 public: | 120 public: |
| 121 static const int kNoCid = -1; | 121 static const intptr_t kNoCid = -1; |
| 122 | 122 |
| 123 Computation() : cid_(-1), ic_data_(NULL), locs_(NULL) { | 123 Computation() : cid_(kNoCid), ic_data_(NULL), locs_(NULL) { |
| 124 Isolate* isolate = Isolate::Current(); | 124 Isolate* isolate = Isolate::Current(); |
| 125 cid_ = GetNextCid(isolate); | 125 cid_ = isolate->GetNextCid(); |
| 126 ic_data_ = GetICDataForCid(cid_, isolate); | 126 ic_data_ = isolate->GetICDataForCid(cid_); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Unique computation/instruction id, used for deoptimization. | 129 // Unique computation/instruction id, used for deoptimization. |
| 130 intptr_t cid() const { return cid_; } | 130 intptr_t cid() const { return cid_; } |
| 131 | 131 |
| 132 ICData* ic_data() const { return ic_data_; } | 132 ICData* ic_data() const { return ic_data_; } |
| 133 void set_ic_data(ICData* value) { ic_data_ = value; } | 133 void set_ic_data(ICData* value) { ic_data_ = value; } |
| 134 bool HasICData() const { | 134 bool HasICData() const { |
| 135 return (ic_data() != NULL) && !ic_data()->IsNull(); | 135 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 136 } | 136 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 #define DECLARE_COMPUTATION_TYPE(ShortName, ClassName) k##ShortName, | 190 #define DECLARE_COMPUTATION_TYPE(ShortName, ClassName) k##ShortName, |
| 191 | 191 |
| 192 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_TYPE) | 192 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_TYPE) |
| 193 | 193 |
| 194 #undef DECLARE_COMPUTATION_TYPE | 194 #undef DECLARE_COMPUTATION_TYPE |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 virtual ComputationType computation_type() const = 0; | 197 virtual ComputationType computation_type() const = 0; |
| 198 | 198 |
| 199 // Declare predicate for each computation. | 199 // Declare predicate for each computation. |
| 200 #define DECLARE_PREDICATE(ShortName, ClassName) \ | 200 #define DECLARE_PREDICATE(ShortName, ClassName) \ |
| 201 inline bool Is##ShortName() const; \ | 201 inline bool Is##ShortName() const; \ |
| 202 inline const ClassName* As##ShortName() const; \ |
| 202 inline ClassName* As##ShortName(); | 203 inline ClassName* As##ShortName(); |
| 203 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) | 204 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) |
| 204 #undef DECLARE_PREDICATE | 205 #undef DECLARE_PREDICATE |
| 205 | 206 |
| 206 private: | 207 private: |
| 207 friend class Instruction; | |
| 208 static intptr_t GetNextCid(Isolate* isolate) { | |
| 209 intptr_t tmp = isolate->computation_id(); | |
| 210 isolate->set_computation_id(tmp + 1); | |
| 211 return tmp; | |
| 212 } | |
| 213 static ICData* GetICDataForCid(intptr_t cid, Isolate* isolate) { | |
| 214 if (isolate->ic_data_array() == Array::null()) { | |
| 215 return NULL; | |
| 216 } else { | |
| 217 const Array& array_handle = Array::Handle(isolate->ic_data_array()); | |
| 218 if (cid >= array_handle.Length()) { | |
| 219 // For computations being added in the optimizing compiler. | |
| 220 return NULL; | |
| 221 } | |
| 222 ICData& ic_data_handle = ICData::ZoneHandle(); | |
| 223 ic_data_handle ^= array_handle.At(cid); | |
| 224 return &ic_data_handle; | |
| 225 } | |
| 226 } | |
| 227 | |
| 228 intptr_t cid_; | 208 intptr_t cid_; |
| 229 ICData* ic_data_; | 209 ICData* ic_data_; |
| 230 LocationSummary* locs_; | 210 LocationSummary* locs_; |
| 231 | 211 |
| 232 DISALLOW_COPY_AND_ASSIGN(Computation); | 212 DISALLOW_COPY_AND_ASSIGN(Computation); |
| 233 }; | 213 }; |
| 234 | 214 |
| 235 | 215 |
| 236 // An embedded container with N elements of type T. Used (with partial | 216 // An embedded container with N elements of type T. Used (with partial |
| 237 // specialization for N=0) because embedded arrays cannot have size 0. | 217 // specialization for N=0) because embedded arrays cannot have size 0. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 273 |
| 294 protected: | 274 protected: |
| 295 EmbeddedArray<Value*, N> inputs_; | 275 EmbeddedArray<Value*, N> inputs_; |
| 296 }; | 276 }; |
| 297 | 277 |
| 298 | 278 |
| 299 class Value : public TemplateComputation<0> { | 279 class Value : public TemplateComputation<0> { |
| 300 public: | 280 public: |
| 301 Value() { } | 281 Value() { } |
| 302 | 282 |
| 283 bool StaticTypeIsMoreSpecificThan(const AbstractType& dst_type) const; |
| 284 |
| 303 private: | 285 private: |
| 304 DISALLOW_COPY_AND_ASSIGN(Value); | 286 DISALLOW_COPY_AND_ASSIGN(Value); |
| 305 }; | 287 }; |
| 306 | 288 |
| 307 | 289 |
| 308 // Functions defined in all concrete computation classes. | 290 // Functions defined in all concrete computation classes. |
| 309 #define DECLARE_COMPUTATION(ShortName) \ | 291 #define DECLARE_COMPUTATION(ShortName) \ |
| 310 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ | 292 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ |
| 311 virtual ComputationType computation_type() const { \ | 293 virtual ComputationType computation_type() const { \ |
| 312 return Computation::k##ShortName; \ | 294 return Computation::k##ShortName; \ |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 | 1735 |
| 1754 | 1736 |
| 1755 #undef DECLARE_COMPUTATION | 1737 #undef DECLARE_COMPUTATION |
| 1756 | 1738 |
| 1757 | 1739 |
| 1758 // Implementation of type testers and cast functins. | 1740 // Implementation of type testers and cast functins. |
| 1759 #define DEFINE_PREDICATE(ShortName, ClassName) \ | 1741 #define DEFINE_PREDICATE(ShortName, ClassName) \ |
| 1760 bool Computation::Is##ShortName() const { \ | 1742 bool Computation::Is##ShortName() const { \ |
| 1761 return computation_type() == k##ShortName; \ | 1743 return computation_type() == k##ShortName; \ |
| 1762 } \ | 1744 } \ |
| 1745 const ClassName* Computation::As##ShortName() const { \ |
| 1746 if (!Is##ShortName()) return NULL; \ |
| 1747 return static_cast<const ClassName*>(this); \ |
| 1748 } \ |
| 1763 ClassName* Computation::As##ShortName() { \ | 1749 ClassName* Computation::As##ShortName() { \ |
| 1764 if (!Is##ShortName()) return NULL; \ | 1750 if (!Is##ShortName()) return NULL; \ |
| 1765 return static_cast<ClassName*>(this); \ | 1751 return static_cast<ClassName*>(this); \ |
| 1766 } | 1752 } |
| 1767 FOR_EACH_COMPUTATION(DEFINE_PREDICATE) | 1753 FOR_EACH_COMPUTATION(DEFINE_PREDICATE) |
| 1768 #undef DEFINE_PREDICATE | 1754 #undef DEFINE_PREDICATE |
| 1769 | 1755 |
| 1770 | 1756 |
| 1771 // Instructions. | 1757 // Instructions. |
| 1772 | 1758 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 virtual Value* InputAt(intptr_t i) const; \ | 1794 virtual Value* InputAt(intptr_t i) const; \ |
| 1809 virtual void SetInputAt(intptr_t i, Value* value); \ | 1795 virtual void SetInputAt(intptr_t i, Value* value); \ |
| 1810 virtual const char* DebugName() const { return #type; } \ | 1796 virtual const char* DebugName() const { return #type; } \ |
| 1811 virtual void PrintTo(BufferFormatter* f) const; \ | 1797 virtual void PrintTo(BufferFormatter* f) const; \ |
| 1812 virtual void PrintToVisualizer(BufferFormatter* f) const; | 1798 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 1813 | 1799 |
| 1814 | 1800 |
| 1815 class Instruction : public ZoneAllocated { | 1801 class Instruction : public ZoneAllocated { |
| 1816 public: | 1802 public: |
| 1817 Instruction() | 1803 Instruction() |
| 1818 : cid_(-1), | 1804 : lifetime_position_(-1), previous_(NULL), next_(NULL), env_(NULL) { } |
| 1819 lifetime_position_(-1), | |
| 1820 ic_data_(NULL), | |
| 1821 previous_(NULL), | |
| 1822 next_(NULL), | |
| 1823 env_(NULL) { | |
| 1824 Isolate* isolate = Isolate::Current(); | |
| 1825 cid_ = Computation::GetNextCid(isolate); | |
| 1826 ic_data_ = Computation::GetICDataForCid(cid_, isolate); | |
| 1827 } | |
| 1828 | |
| 1829 // Unique computation/instruction id, used for deoptimization, e.g. for | |
| 1830 // ReturnInstr, ThrowInstr and ReThrowInstr. | |
| 1831 intptr_t cid() const { return cid_; } | |
| 1832 | |
| 1833 const ICData* ic_data() const { return ic_data_; } | |
| 1834 bool HasICData() const { | |
| 1835 return (ic_data() != NULL) && !ic_data()->IsNull(); | |
| 1836 } | |
| 1837 | 1805 |
| 1838 virtual bool IsBlockEntry() const { return false; } | 1806 virtual bool IsBlockEntry() const { return false; } |
| 1839 BlockEntryInstr* AsBlockEntry() { | 1807 BlockEntryInstr* AsBlockEntry() { |
| 1840 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; | 1808 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; |
| 1841 } | 1809 } |
| 1842 virtual bool IsDefinition() const { return false; } | 1810 virtual bool IsDefinition() const { return false; } |
| 1843 virtual Definition* AsDefinition() { return NULL; } | 1811 virtual Definition* AsDefinition() { return NULL; } |
| 1844 | 1812 |
| 1845 virtual intptr_t InputCount() const = 0; | 1813 virtual intptr_t InputCount() const = 0; |
| 1846 virtual Value* InputAt(intptr_t i) const = 0; | 1814 virtual Value* InputAt(intptr_t i) const = 0; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 | 1910 |
| 1943 Environment* env() const { return env_; } | 1911 Environment* env() const { return env_; } |
| 1944 void set_env(Environment* env) { env_ = env; } | 1912 void set_env(Environment* env) { env_ = env; } |
| 1945 | 1913 |
| 1946 intptr_t lifetime_position() const { return lifetime_position_; } | 1914 intptr_t lifetime_position() const { return lifetime_position_; } |
| 1947 void set_lifetime_position(intptr_t pos) { | 1915 void set_lifetime_position(intptr_t pos) { |
| 1948 lifetime_position_ = pos; | 1916 lifetime_position_ = pos; |
| 1949 } | 1917 } |
| 1950 | 1918 |
| 1951 private: | 1919 private: |
| 1952 intptr_t cid_; // Computation id. | |
| 1953 intptr_t lifetime_position_; // Position used by register allocator. | 1920 intptr_t lifetime_position_; // Position used by register allocator. |
| 1954 ICData* ic_data_; | |
| 1955 Instruction* previous_; | 1921 Instruction* previous_; |
| 1956 Instruction* next_; | 1922 Instruction* next_; |
| 1957 Environment* env_; | 1923 Environment* env_; |
| 1958 DISALLOW_COPY_AND_ASSIGN(Instruction); | 1924 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 1959 }; | 1925 }; |
| 1960 | 1926 |
| 1961 | 1927 |
| 1962 class InstructionWithInputs : public Instruction { | 1928 class InstructionWithInputs : public Instruction { |
| 1963 public: | 1929 public: |
| 1964 InstructionWithInputs() : locs_(NULL) { } | 1930 InstructionWithInputs() : locs_(NULL) { } |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 private: | 2462 private: |
| 2497 Value* value_; | 2463 Value* value_; |
| 2498 | 2464 |
| 2499 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2465 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
| 2500 }; | 2466 }; |
| 2501 | 2467 |
| 2502 | 2468 |
| 2503 class ReturnInstr : public InstructionWithInputs { | 2469 class ReturnInstr : public InstructionWithInputs { |
| 2504 public: | 2470 public: |
| 2505 ReturnInstr(intptr_t token_pos, Value* value) | 2471 ReturnInstr(intptr_t token_pos, Value* value) |
| 2506 : InstructionWithInputs(), token_pos_(token_pos), value_(value) { | 2472 : InstructionWithInputs(), |
| 2473 cid_(Isolate::Current()->GetNextCid()), |
| 2474 token_pos_(token_pos), |
| 2475 value_(value) { |
| 2507 ASSERT(value_ != NULL); | 2476 ASSERT(value_ != NULL); |
| 2508 } | 2477 } |
| 2509 | 2478 |
| 2510 DECLARE_INSTRUCTION(Return) | 2479 DECLARE_INSTRUCTION(Return) |
| 2511 | 2480 |
| 2481 intptr_t cid() const { return cid_; } |
| 2482 intptr_t token_pos() const { return token_pos_; } |
| 2512 Value* value() const { return value_; } | 2483 Value* value() const { return value_; } |
| 2513 intptr_t token_pos() const { return token_pos_; } | |
| 2514 | 2484 |
| 2515 virtual LocationSummary* MakeLocationSummary() const; | 2485 virtual LocationSummary* MakeLocationSummary() const; |
| 2516 | 2486 |
| 2517 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2487 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2518 | 2488 |
| 2519 virtual bool CanDeoptimize() const { return false; } | 2489 virtual bool CanDeoptimize() const { return false; } |
| 2520 | 2490 |
| 2521 private: | 2491 private: |
| 2492 const intptr_t cid_; // Computation/instruction id. |
| 2522 const intptr_t token_pos_; | 2493 const intptr_t token_pos_; |
| 2523 Value* value_; | 2494 Value* value_; |
| 2524 | 2495 |
| 2525 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 2496 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 2526 }; | 2497 }; |
| 2527 | 2498 |
| 2528 | 2499 |
| 2529 class ThrowInstr : public InstructionWithInputs { | 2500 class ThrowInstr : public InstructionWithInputs { |
| 2530 public: | 2501 public: |
| 2531 ThrowInstr(intptr_t token_pos, | 2502 ThrowInstr(intptr_t token_pos, |
| 2532 intptr_t try_index, | 2503 intptr_t try_index, |
| 2533 Value* exception) | 2504 Value* exception) |
| 2534 : InstructionWithInputs(), | 2505 : InstructionWithInputs(), |
| 2506 cid_(Isolate::Current()->GetNextCid()), |
| 2535 token_pos_(token_pos), | 2507 token_pos_(token_pos), |
| 2536 try_index_(try_index), | 2508 try_index_(try_index), |
| 2537 exception_(exception) { | 2509 exception_(exception) { |
| 2538 ASSERT(exception_ != NULL); | 2510 ASSERT(exception_ != NULL); |
| 2539 } | 2511 } |
| 2540 | 2512 |
| 2541 DECLARE_INSTRUCTION(Throw) | 2513 DECLARE_INSTRUCTION(Throw) |
| 2542 | 2514 |
| 2515 intptr_t cid() const { return cid_; } |
| 2543 intptr_t token_pos() const { return token_pos_; } | 2516 intptr_t token_pos() const { return token_pos_; } |
| 2544 intptr_t try_index() const { return try_index_; } | 2517 intptr_t try_index() const { return try_index_; } |
| 2545 Value* exception() const { return exception_; } | 2518 Value* exception() const { return exception_; } |
| 2546 | 2519 |
| 2547 virtual LocationSummary* MakeLocationSummary() const; | 2520 virtual LocationSummary* MakeLocationSummary() const; |
| 2548 | 2521 |
| 2549 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2522 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2550 | 2523 |
| 2551 virtual bool CanDeoptimize() const { return false; } | 2524 virtual bool CanDeoptimize() const { return false; } |
| 2552 | 2525 |
| 2553 private: | 2526 private: |
| 2527 const intptr_t cid_; // Computation/instruction id. |
| 2554 const intptr_t token_pos_; | 2528 const intptr_t token_pos_; |
| 2555 const intptr_t try_index_; | 2529 const intptr_t try_index_; |
| 2556 Value* exception_; | 2530 Value* exception_; |
| 2557 | 2531 |
| 2558 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 2532 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 2559 }; | 2533 }; |
| 2560 | 2534 |
| 2561 | 2535 |
| 2562 class ReThrowInstr : public InstructionWithInputs { | 2536 class ReThrowInstr : public InstructionWithInputs { |
| 2563 public: | 2537 public: |
| 2564 ReThrowInstr(intptr_t token_pos, | 2538 ReThrowInstr(intptr_t token_pos, |
| 2565 intptr_t try_index, | 2539 intptr_t try_index, |
| 2566 Value* exception, | 2540 Value* exception, |
| 2567 Value* stack_trace) | 2541 Value* stack_trace) |
| 2568 : InstructionWithInputs(), | 2542 : InstructionWithInputs(), |
| 2543 cid_(Isolate::Current()->GetNextCid()), |
| 2569 token_pos_(token_pos), | 2544 token_pos_(token_pos), |
| 2570 try_index_(try_index), | 2545 try_index_(try_index), |
| 2571 exception_(exception), | 2546 exception_(exception), |
| 2572 stack_trace_(stack_trace) { | 2547 stack_trace_(stack_trace) { |
| 2573 ASSERT(exception_ != NULL); | 2548 ASSERT(exception_ != NULL); |
| 2574 ASSERT(stack_trace_ != NULL); | 2549 ASSERT(stack_trace_ != NULL); |
| 2575 } | 2550 } |
| 2576 | 2551 |
| 2577 DECLARE_INSTRUCTION(ReThrow) | 2552 DECLARE_INSTRUCTION(ReThrow) |
| 2578 | 2553 |
| 2554 intptr_t cid() const { return cid_; } |
| 2579 intptr_t token_pos() const { return token_pos_; } | 2555 intptr_t token_pos() const { return token_pos_; } |
| 2580 intptr_t try_index() const { return try_index_; } | 2556 intptr_t try_index() const { return try_index_; } |
| 2581 Value* exception() const { return exception_; } | 2557 Value* exception() const { return exception_; } |
| 2582 Value* stack_trace() const { return stack_trace_; } | 2558 Value* stack_trace() const { return stack_trace_; } |
| 2583 | 2559 |
| 2584 virtual LocationSummary* MakeLocationSummary() const; | 2560 virtual LocationSummary* MakeLocationSummary() const; |
| 2585 | 2561 |
| 2586 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2562 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2587 | 2563 |
| 2588 virtual bool CanDeoptimize() const { return false; } | 2564 virtual bool CanDeoptimize() const { return false; } |
| 2589 | 2565 |
| 2590 private: | 2566 private: |
| 2567 const intptr_t cid_; // Computation/instruction id. |
| 2591 const intptr_t token_pos_; | 2568 const intptr_t token_pos_; |
| 2592 const intptr_t try_index_; | 2569 const intptr_t try_index_; |
| 2593 Value* exception_; | 2570 Value* exception_; |
| 2594 Value* stack_trace_; | 2571 Value* stack_trace_; |
| 2595 | 2572 |
| 2596 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 2573 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 2597 }; | 2574 }; |
| 2598 | 2575 |
| 2599 | 2576 |
| 2600 class GotoInstr : public InstructionWithInputs { | 2577 class GotoInstr : public InstructionWithInputs { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 // Parallel move that will be used by linear scan register allocator to | 2615 // Parallel move that will be used by linear scan register allocator to |
| 2639 // connect live ranges at the end of the block and resolve phis. | 2616 // connect live ranges at the end of the block and resolve phis. |
| 2640 ParallelMoveInstr* parallel_move_; | 2617 ParallelMoveInstr* parallel_move_; |
| 2641 }; | 2618 }; |
| 2642 | 2619 |
| 2643 | 2620 |
| 2644 class BranchInstr : public InstructionWithInputs { | 2621 class BranchInstr : public InstructionWithInputs { |
| 2645 public: | 2622 public: |
| 2646 BranchInstr(intptr_t token_pos, | 2623 BranchInstr(intptr_t token_pos, |
| 2647 intptr_t try_index, | 2624 intptr_t try_index, |
| 2648 Value* left, | 2625 Value* left, |
| 2649 Value* right, | 2626 Value* right, |
| 2650 Token::Kind kind) | 2627 Token::Kind kind) |
| 2651 : InstructionWithInputs(), | 2628 : InstructionWithInputs(), |
| 2629 cid_(Computation::kNoCid), |
| 2630 ic_data_(NULL), |
| 2652 token_pos_(token_pos), | 2631 token_pos_(token_pos), |
| 2653 try_index_(try_index), | 2632 try_index_(try_index), |
| 2654 left_(left), | 2633 left_(left), |
| 2655 right_(right), | 2634 right_(right), |
| 2656 kind_(kind), | 2635 kind_(kind), |
| 2657 true_successor_(NULL), | 2636 true_successor_(NULL), |
| 2658 false_successor_(NULL) { | 2637 false_successor_(NULL) { |
| 2659 ASSERT(left_ != NULL); | 2638 ASSERT(left_ != NULL); |
| 2660 ASSERT(right_ != NULL); | 2639 ASSERT(right_ != NULL); |
| 2661 ASSERT(Token::IsEqualityOperator(kind) || | 2640 ASSERT(Token::IsEqualityOperator(kind) || |
| 2662 Token::IsRelationalOperator(kind) || | 2641 Token::IsRelationalOperator(kind) || |
| 2663 Token::IsTypeTestOperator(kind)); | 2642 Token::IsTypeTestOperator(kind)); |
| 2643 Isolate* isolate = Isolate::Current(); |
| 2644 cid_ = isolate->GetNextCid(); |
| 2645 ic_data_ = isolate->GetICDataForCid(cid_); |
| 2664 } | 2646 } |
| 2665 | 2647 |
| 2666 DECLARE_INSTRUCTION(Branch) | 2648 DECLARE_INSTRUCTION(Branch) |
| 2667 | 2649 |
| 2668 Value* left() const { return left_; } | 2650 Value* left() const { return left_; } |
| 2669 Value* right() const { return right_; } | 2651 Value* right() const { return right_; } |
| 2670 Token::Kind kind() const { return kind_; } | 2652 Token::Kind kind() const { return kind_; } |
| 2671 void set_kind(Token::Kind kind) { | 2653 void set_kind(Token::Kind kind) { |
| 2672 ASSERT(Token::IsEqualityOperator(kind) || | 2654 ASSERT(Token::IsEqualityOperator(kind) || |
| 2673 Token::IsRelationalOperator(kind) || | 2655 Token::IsRelationalOperator(kind) || |
| 2674 Token::IsTypeTestOperator(kind)); | 2656 Token::IsTypeTestOperator(kind)); |
| 2675 kind_ = kind; | 2657 kind_ = kind; |
| 2676 } | 2658 } |
| 2659 |
| 2660 intptr_t cid() const { return cid_; } |
| 2661 |
| 2662 const ICData* ic_data() const { return ic_data_; } |
| 2663 bool HasICData() const { |
| 2664 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 2665 } |
| 2666 |
| 2677 intptr_t token_pos() const { return token_pos_;} | 2667 intptr_t token_pos() const { return token_pos_;} |
| 2678 intptr_t try_index() const { return try_index_; } | 2668 intptr_t try_index() const { return try_index_; } |
| 2679 | 2669 |
| 2680 TargetEntryInstr* true_successor() const { return true_successor_; } | 2670 TargetEntryInstr* true_successor() const { return true_successor_; } |
| 2681 TargetEntryInstr* false_successor() const { return false_successor_; } | 2671 TargetEntryInstr* false_successor() const { return false_successor_; } |
| 2682 | 2672 |
| 2683 TargetEntryInstr** true_successor_address() { return &true_successor_; } | 2673 TargetEntryInstr** true_successor_address() { return &true_successor_; } |
| 2684 TargetEntryInstr** false_successor_address() { return &false_successor_; } | 2674 TargetEntryInstr** false_successor_address() { return &false_successor_; } |
| 2685 | 2675 |
| 2686 virtual intptr_t SuccessorCount() const; | 2676 virtual intptr_t SuccessorCount() const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2698 virtual LocationSummary* MakeLocationSummary() const; | 2688 virtual LocationSummary* MakeLocationSummary() const; |
| 2699 | 2689 |
| 2700 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2690 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2701 | 2691 |
| 2702 void EmitBranchOnCondition(FlowGraphCompiler* compiler, | 2692 void EmitBranchOnCondition(FlowGraphCompiler* compiler, |
| 2703 Condition true_condition); | 2693 Condition true_condition); |
| 2704 | 2694 |
| 2705 virtual bool CanDeoptimize() const { return true; } | 2695 virtual bool CanDeoptimize() const { return true; } |
| 2706 | 2696 |
| 2707 private: | 2697 private: |
| 2698 intptr_t cid_; // Computation/instruction id. |
| 2699 ICData* ic_data_; |
| 2708 const intptr_t token_pos_; | 2700 const intptr_t token_pos_; |
| 2709 const intptr_t try_index_; | 2701 const intptr_t try_index_; |
| 2710 Value* left_; | 2702 Value* left_; |
| 2711 Value* right_; | 2703 Value* right_; |
| 2712 Token::Kind kind_; | 2704 Token::Kind kind_; |
| 2713 TargetEntryInstr* true_successor_; | 2705 TargetEntryInstr* true_successor_; |
| 2714 TargetEntryInstr* false_successor_; | 2706 TargetEntryInstr* false_successor_; |
| 2715 | 2707 |
| 2716 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 2708 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
| 2717 }; | 2709 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 const GrowableArray<BlockEntryInstr*>& block_order_; | 2787 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2796 | 2788 |
| 2797 private: | 2789 private: |
| 2798 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2790 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2799 }; | 2791 }; |
| 2800 | 2792 |
| 2801 | 2793 |
| 2802 } // namespace dart | 2794 } // namespace dart |
| 2803 | 2795 |
| 2804 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2796 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |