Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 2904733003: Revert "Shuffle around deopt id allocation to give the flow graph builder a chance to record other … (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 6 #define RUNTIME_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 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 intptr_t offset() const { return offset_; } 1255 intptr_t offset() const { return offset_; }
1256 void set_offset(intptr_t offset) { offset_ = offset; } 1256 void set_offset(intptr_t offset) { offset_ = offset; }
1257 1257
1258 // For all instruction in this block: Remove all inputs (including in the 1258 // For all instruction in this block: Remove all inputs (including in the
1259 // environment) from their definition's use lists for all instructions. 1259 // environment) from their definition's use lists for all instructions.
1260 void ClearAllInstructions(); 1260 void ClearAllInstructions();
1261 1261
1262 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry) 1262 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry)
1263 1263
1264 protected: 1264 protected:
1265 BlockEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) 1265 BlockEntryInstr(intptr_t block_id, intptr_t try_index)
1266 : Instruction(deopt_id), 1266 : Instruction(Thread::Current()->GetNextDeoptId()),
1267 block_id_(block_id), 1267 block_id_(block_id),
1268 try_index_(try_index), 1268 try_index_(try_index),
1269 preorder_number_(-1), 1269 preorder_number_(-1),
1270 postorder_number_(-1), 1270 postorder_number_(-1),
1271 dominator_(NULL), 1271 dominator_(NULL),
1272 dominated_blocks_(1), 1272 dominated_blocks_(1),
1273 last_instruction_(NULL), 1273 last_instruction_(NULL),
1274 offset_(-1), 1274 offset_(-1),
1275 parallel_move_(NULL), 1275 parallel_move_(NULL),
1276 loop_info_(NULL) {} 1276 loop_info_(NULL) {}
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 intptr_t entry_count_; 1435 intptr_t entry_count_;
1436 intptr_t spill_slot_count_; 1436 intptr_t spill_slot_count_;
1437 intptr_t fixed_slot_count_; // For try-catch in optimized code. 1437 intptr_t fixed_slot_count_; // For try-catch in optimized code.
1438 1438
1439 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 1439 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
1440 }; 1440 };
1441 1441
1442 1442
1443 class JoinEntryInstr : public BlockEntryInstr { 1443 class JoinEntryInstr : public BlockEntryInstr {
1444 public: 1444 public:
1445 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) 1445 JoinEntryInstr(intptr_t block_id, intptr_t try_index)
1446 : BlockEntryInstr(block_id, try_index, deopt_id), 1446 : BlockEntryInstr(block_id, try_index),
1447 predecessors_(2), // Two is the assumed to be the common case. 1447 predecessors_(2), // Two is the assumed to be the common case.
1448 phis_(NULL) {} 1448 phis_(NULL) {}
1449 1449
1450 DECLARE_INSTRUCTION(JoinEntry) 1450 DECLARE_INSTRUCTION(JoinEntry)
1451 1451
1452 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 1452 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
1453 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1453 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1454 return predecessors_[index]; 1454 return predecessors_[index];
1455 } 1455 }
1456 1456
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 PhiInstr* Current() const { return (*phis_)[index_]; } 1505 PhiInstr* Current() const { return (*phis_)[index_]; }
1506 1506
1507 private: 1507 private:
1508 ZoneGrowableArray<PhiInstr*>* phis_; 1508 ZoneGrowableArray<PhiInstr*>* phis_;
1509 intptr_t index_; 1509 intptr_t index_;
1510 }; 1510 };
1511 1511
1512 1512
1513 class TargetEntryInstr : public BlockEntryInstr { 1513 class TargetEntryInstr : public BlockEntryInstr {
1514 public: 1514 public:
1515 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) 1515 TargetEntryInstr(intptr_t block_id, intptr_t try_index)
1516 : BlockEntryInstr(block_id, try_index, deopt_id), 1516 : BlockEntryInstr(block_id, try_index),
1517 predecessor_(NULL), 1517 predecessor_(NULL),
1518 edge_weight_(0.0) {} 1518 edge_weight_(0.0) {}
1519 1519
1520 DECLARE_INSTRUCTION(TargetEntry) 1520 DECLARE_INSTRUCTION(TargetEntry)
1521 1521
1522 double edge_weight() const { return edge_weight_; } 1522 double edge_weight() const { return edge_weight_; }
1523 void set_edge_weight(double weight) { edge_weight_ = weight; } 1523 void set_edge_weight(double weight) { edge_weight_ = weight; }
1524 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } 1524 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; }
1525 1525
1526 virtual intptr_t PredecessorCount() const { 1526 virtual intptr_t PredecessorCount() const {
(...skipping 19 matching lines...) Expand all
1546 double edge_weight_; 1546 double edge_weight_;
1547 1547
1548 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); 1548 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr);
1549 }; 1549 };
1550 1550
1551 1551
1552 class IndirectEntryInstr : public JoinEntryInstr { 1552 class IndirectEntryInstr : public JoinEntryInstr {
1553 public: 1553 public:
1554 IndirectEntryInstr(intptr_t block_id, 1554 IndirectEntryInstr(intptr_t block_id,
1555 intptr_t indirect_id, 1555 intptr_t indirect_id,
1556 intptr_t try_index, 1556 intptr_t try_index)
1557 intptr_t deopt_id) 1557 : JoinEntryInstr(block_id, try_index), indirect_id_(indirect_id) {}
1558 : JoinEntryInstr(block_id, try_index, deopt_id),
1559 indirect_id_(indirect_id) {}
1560 1558
1561 DECLARE_INSTRUCTION(IndirectEntry) 1559 DECLARE_INSTRUCTION(IndirectEntry)
1562 1560
1563 intptr_t indirect_id() const { return indirect_id_; } 1561 intptr_t indirect_id() const { return indirect_id_; }
1564 1562
1565 PRINT_TO_SUPPORT 1563 PRINT_TO_SUPPORT
1566 1564
1567 private: 1565 private:
1568 const intptr_t indirect_id_; 1566 const intptr_t indirect_id_;
1569 }; 1567 };
1570 1568
1571 1569
1572 class CatchBlockEntryInstr : public BlockEntryInstr { 1570 class CatchBlockEntryInstr : public BlockEntryInstr {
1573 public: 1571 public:
1574 CatchBlockEntryInstr(TokenPosition handler_token_pos, 1572 CatchBlockEntryInstr(TokenPosition handler_token_pos,
1575 bool is_generated, 1573 bool is_generated,
1576 intptr_t block_id, 1574 intptr_t block_id,
1577 intptr_t try_index, 1575 intptr_t try_index,
1578 GraphEntryInstr* graph_entry, 1576 GraphEntryInstr* graph_entry,
1579 const Array& handler_types, 1577 const Array& handler_types,
1580 intptr_t catch_try_index, 1578 intptr_t catch_try_index,
1581 const LocalVariable& exception_var, 1579 const LocalVariable& exception_var,
1582 const LocalVariable& stacktrace_var, 1580 const LocalVariable& stacktrace_var,
1583 bool needs_stacktrace, 1581 bool needs_stacktrace,
1584 intptr_t deopt_id, 1582 intptr_t deopt_id,
1585 bool should_restore_closure_context = false) 1583 bool should_restore_closure_context = false)
1586 : BlockEntryInstr(block_id, try_index, deopt_id), 1584 : BlockEntryInstr(block_id, try_index),
1587 graph_entry_(graph_entry), 1585 graph_entry_(graph_entry),
1588 predecessor_(NULL), 1586 predecessor_(NULL),
1589 catch_handler_types_(Array::ZoneHandle(handler_types.raw())), 1587 catch_handler_types_(Array::ZoneHandle(handler_types.raw())),
1590 catch_try_index_(catch_try_index), 1588 catch_try_index_(catch_try_index),
1591 exception_var_(exception_var), 1589 exception_var_(exception_var),
1592 stacktrace_var_(stacktrace_var), 1590 stacktrace_var_(stacktrace_var),
1593 needs_stacktrace_(needs_stacktrace), 1591 needs_stacktrace_(needs_stacktrace),
1594 should_restore_closure_context_(should_restore_closure_context), 1592 should_restore_closure_context_(should_restore_closure_context),
1595 handler_token_pos_(handler_token_pos), 1593 handler_token_pos_(handler_token_pos),
1596 is_generated_(is_generated) {} 1594 is_generated_(is_generated) {
1595 deopt_id_ = deopt_id;
1596 }
1597 1597
1598 DECLARE_INSTRUCTION(CatchBlockEntry) 1598 DECLARE_INSTRUCTION(CatchBlockEntry)
1599 1599
1600 virtual intptr_t PredecessorCount() const { 1600 virtual intptr_t PredecessorCount() const {
1601 return (predecessor_ == NULL) ? 0 : 1; 1601 return (predecessor_ == NULL) ? 0 : 1;
1602 } 1602 }
1603 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1603 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1604 ASSERT((index == 0) && (predecessor_ != NULL)); 1604 ASSERT((index == 0) && (predecessor_ != NULL));
1605 return predecessor_; 1605 return predecessor_;
1606 } 1606 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 }; 2101 };
2102 2102
2103 2103
2104 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 2104 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
2105 return PushArgumentAt(index)->value()->definition(); 2105 return PushArgumentAt(index)->value()->definition();
2106 } 2106 }
2107 2107
2108 2108
2109 class ReturnInstr : public TemplateInstruction<1, NoThrow> { 2109 class ReturnInstr : public TemplateInstruction<1, NoThrow> {
2110 public: 2110 public:
2111 ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) 2111 ReturnInstr(TokenPosition token_pos, Value* value)
2112 : TemplateInstruction(deopt_id), token_pos_(token_pos) { 2112 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
2113 token_pos_(token_pos) {
2113 SetInputAt(0, value); 2114 SetInputAt(0, value);
2114 } 2115 }
2115 2116
2116 DECLARE_INSTRUCTION(Return) 2117 DECLARE_INSTRUCTION(Return)
2117 2118
2118 virtual TokenPosition token_pos() const { return token_pos_; } 2119 virtual TokenPosition token_pos() const { return token_pos_; }
2119 Value* value() const { return inputs_[0]; } 2120 Value* value() const { return inputs_[0]; }
2120 2121
2121 virtual bool CanBecomeDeoptimizationTarget() const { 2122 virtual bool CanBecomeDeoptimizationTarget() const {
2122 // Return instruction might turn into a Goto instruction after inlining. 2123 // Return instruction might turn into a Goto instruction after inlining.
2123 // Every Goto must have an environment. 2124 // Every Goto must have an environment.
2124 return true; 2125 return true;
2125 } 2126 }
2126 2127
2127 virtual bool ComputeCanDeoptimize() const { return false; } 2128 virtual bool ComputeCanDeoptimize() const { return false; }
2128 2129
2129 virtual EffectSet Effects() const { return EffectSet::None(); } 2130 virtual EffectSet Effects() const { return EffectSet::None(); }
2130 2131
2131 private: 2132 private:
2132 const TokenPosition token_pos_; 2133 const TokenPosition token_pos_;
2133 2134
2134 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2135 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2135 }; 2136 };
2136 2137
2137 2138
2138 class ThrowInstr : public TemplateInstruction<0, Throws> { 2139 class ThrowInstr : public TemplateInstruction<0, Throws> {
2139 public: 2140 public:
2140 explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id) 2141 explicit ThrowInstr(TokenPosition token_pos)
2141 : TemplateInstruction(deopt_id), token_pos_(token_pos) {} 2142 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
2143 token_pos_(token_pos) {}
2142 2144
2143 DECLARE_INSTRUCTION(Throw) 2145 DECLARE_INSTRUCTION(Throw)
2144 2146
2145 virtual intptr_t ArgumentCount() const { return 1; } 2147 virtual intptr_t ArgumentCount() const { return 1; }
2146 2148
2147 virtual TokenPosition token_pos() const { return token_pos_; } 2149 virtual TokenPosition token_pos() const { return token_pos_; }
2148 2150
2149 virtual bool ComputeCanDeoptimize() const { return true; } 2151 virtual bool ComputeCanDeoptimize() const { return true; }
2150 2152
2151 virtual EffectSet Effects() const { return EffectSet::None(); } 2153 virtual EffectSet Effects() const { return EffectSet::None(); }
2152 2154
2153 private: 2155 private:
2154 const TokenPosition token_pos_; 2156 const TokenPosition token_pos_;
2155 2157
2156 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2158 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2157 }; 2159 };
2158 2160
2159 2161
2160 class ReThrowInstr : public TemplateInstruction<0, Throws> { 2162 class ReThrowInstr : public TemplateInstruction<0, Throws> {
2161 public: 2163 public:
2162 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2164 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2163 // rethrow has been artificially generated by the parser. 2165 // rethrow has been artificially generated by the parser.
2164 ReThrowInstr(TokenPosition token_pos, 2166 ReThrowInstr(TokenPosition token_pos, intptr_t catch_try_index)
2165 intptr_t catch_try_index, 2167 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
2166 intptr_t deopt_id)
2167 : TemplateInstruction(deopt_id),
2168 token_pos_(token_pos), 2168 token_pos_(token_pos),
2169 catch_try_index_(catch_try_index) {} 2169 catch_try_index_(catch_try_index) {}
2170 2170
2171 DECLARE_INSTRUCTION(ReThrow) 2171 DECLARE_INSTRUCTION(ReThrow)
2172 2172
2173 virtual intptr_t ArgumentCount() const { return 2; } 2173 virtual intptr_t ArgumentCount() const { return 2; }
2174 2174
2175 virtual TokenPosition token_pos() const { return token_pos_; } 2175 virtual TokenPosition token_pos() const { return token_pos_; }
2176 intptr_t catch_try_index() const { return catch_try_index_; } 2176 intptr_t catch_try_index() const { return catch_try_index_; }
2177 2177
(...skipping 29 matching lines...) Expand all
2207 2207
2208 private: 2208 private:
2209 const char* message_; 2209 const char* message_;
2210 2210
2211 DISALLOW_COPY_AND_ASSIGN(StopInstr); 2211 DISALLOW_COPY_AND_ASSIGN(StopInstr);
2212 }; 2212 };
2213 2213
2214 2214
2215 class GotoInstr : public TemplateInstruction<0, NoThrow> { 2215 class GotoInstr : public TemplateInstruction<0, NoThrow> {
2216 public: 2216 public:
2217 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) 2217 explicit GotoInstr(JoinEntryInstr* entry)
2218 : TemplateInstruction(deopt_id), 2218 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
2219 block_(NULL), 2219 block_(NULL),
2220 successor_(entry), 2220 successor_(entry),
2221 edge_weight_(0.0), 2221 edge_weight_(0.0),
2222 parallel_move_(NULL) {} 2222 parallel_move_(NULL) {}
2223 2223
2224 DECLARE_INSTRUCTION(Goto) 2224 DECLARE_INSTRUCTION(Goto)
2225 2225
2226 BlockEntryInstr* block() const { return block_; } 2226 BlockEntryInstr* block() const { return block_; }
2227 void set_block(BlockEntryInstr* block) { block_ = block; } 2227 void set_block(BlockEntryInstr* block) { block_ = block; }
2228 2228
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 protected: 2421 protected:
2422 EmbeddedArray<Value*, N> inputs_; 2422 EmbeddedArray<Value*, N> inputs_;
2423 2423
2424 private: 2424 private:
2425 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 2425 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
2426 }; 2426 };
2427 2427
2428 2428
2429 class BranchInstr : public Instruction { 2429 class BranchInstr : public Instruction {
2430 public: 2430 public:
2431 explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id) 2431 explicit BranchInstr(ComparisonInstr* comparison)
2432 : Instruction(deopt_id), comparison_(comparison), constant_target_(NULL) { 2432 : Instruction(Thread::Current()->GetNextDeoptId()),
2433 comparison_(comparison),
2434 constant_target_(NULL) {
2433 ASSERT(comparison->env() == NULL); 2435 ASSERT(comparison->env() == NULL);
2434 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 2436 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
2435 comparison->InputAt(i)->set_instruction(this); 2437 comparison->InputAt(i)->set_instruction(this);
2436 } 2438 }
2437 } 2439 }
2438 2440
2439 DECLARE_INSTRUCTION(Branch) 2441 DECLARE_INSTRUCTION(Branch)
2440 2442
2441 virtual intptr_t ArgumentCount() const { 2443 virtual intptr_t ArgumentCount() const {
2442 return comparison()->ArgumentCount(); 2444 return comparison()->ArgumentCount();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 const TokenPosition token_pos_; 2703 const TokenPosition token_pos_;
2702 AbstractType& dst_type_; 2704 AbstractType& dst_type_;
2703 const String& dst_name_; 2705 const String& dst_name_;
2704 2706
2705 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2707 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2706 }; 2708 };
2707 2709
2708 2710
2709 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { 2711 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> {
2710 public: 2712 public:
2711 AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) 2713 AssertBooleanInstr(TokenPosition token_pos, Value* value)
2712 : TemplateDefinition(deopt_id), token_pos_(token_pos) { 2714 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
2715 token_pos_(token_pos) {
2713 SetInputAt(0, value); 2716 SetInputAt(0, value);
2714 } 2717 }
2715 2718
2716 DECLARE_INSTRUCTION(AssertBoolean) 2719 DECLARE_INSTRUCTION(AssertBoolean)
2717 virtual CompileType ComputeType() const; 2720 virtual CompileType ComputeType() const;
2718 2721
2719 virtual TokenPosition token_pos() const { return token_pos_; } 2722 virtual TokenPosition token_pos() const { return token_pos_; }
2720 Value* value() const { return inputs_[0]; } 2723 Value* value() const { return inputs_[0]; }
2721 2724
2722 virtual bool ComputeCanDeoptimize() const { return true; } 2725 virtual bool ComputeCanDeoptimize() const { return true; }
2723 2726
2724 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2727 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2725 2728
2726 virtual bool AttributesEqual(Instruction* other) const { return true; } 2729 virtual bool AttributesEqual(Instruction* other) const { return true; }
2727 2730
2728 PRINT_OPERANDS_TO_SUPPORT 2731 PRINT_OPERANDS_TO_SUPPORT
2729 2732
2730 private: 2733 private:
2731 const TokenPosition token_pos_; 2734 const TokenPosition token_pos_;
2732 2735
2733 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2736 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2734 }; 2737 };
2735 2738
2736 2739
2737 // Denotes the current context, normally held in a register. This is 2740 // Denotes the current context, normally held in a register. This is
2738 // a computation, not a value, because it's mutable. 2741 // a computation, not a value, because it's mutable.
2739 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> { 2742 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> {
2740 public: 2743 public:
2741 explicit CurrentContextInstr(intptr_t deopt_id) 2744 CurrentContextInstr()
2742 : TemplateDefinition(deopt_id) {} 2745 : TemplateDefinition(Thread::Current()->GetNextDeoptId()) {}
2743 2746
2744 DECLARE_INSTRUCTION(CurrentContext) 2747 DECLARE_INSTRUCTION(CurrentContext)
2745 virtual CompileType ComputeType() const; 2748 virtual CompileType ComputeType() const;
2746 2749
2747 virtual bool ComputeCanDeoptimize() const { return false; } 2750 virtual bool ComputeCanDeoptimize() const { return false; }
2748 2751
2749 virtual EffectSet Effects() const { return EffectSet::None(); } 2752 virtual EffectSet Effects() const { return EffectSet::None(); }
2750 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2753 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2751 virtual bool AttributesEqual(Instruction* other) const { return true; } 2754 virtual bool AttributesEqual(Instruction* other) const { return true; }
2752 2755
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 TokenPosition token_pos_; 2818 TokenPosition token_pos_;
2816 2819
2817 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); 2820 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall);
2818 }; 2821 };
2819 2822
2820 2823
2821 class ClosureCallInstr : public TemplateDartCall<1> { 2824 class ClosureCallInstr : public TemplateDartCall<1> {
2822 public: 2825 public:
2823 ClosureCallInstr(Value* function, 2826 ClosureCallInstr(Value* function,
2824 ClosureCallNode* node, 2827 ClosureCallNode* node,
2825 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2828 ZoneGrowableArray<PushArgumentInstr*>* arguments)
2826 intptr_t deopt_id) 2829 : TemplateDartCall(Thread::Current()->GetNextDeoptId(),
2827 : TemplateDartCall(deopt_id,
2828 node->arguments()->type_args_len(), 2830 node->arguments()->type_args_len(),
2829 node->arguments()->names(), 2831 node->arguments()->names(),
2830 arguments, 2832 arguments,
2831 node->token_pos()) { 2833 node->token_pos()) {
2832 ASSERT(!arguments->is_empty()); 2834 ASSERT(!arguments->is_empty());
2833 SetInputAt(0, function); 2835 SetInputAt(0, function);
2834 } 2836 }
2835 2837
2836 ClosureCallInstr(Value* function, 2838 ClosureCallInstr(Value* function,
2837 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2839 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2838 intptr_t type_args_len, 2840 intptr_t type_args_len,
2839 const Array& argument_names, 2841 const Array& argument_names,
2840 TokenPosition token_pos, 2842 TokenPosition token_pos)
2841 intptr_t deopt_id) 2843 : TemplateDartCall(Thread::Current()->GetNextDeoptId(),
2842 : TemplateDartCall(deopt_id,
2843 type_args_len, 2844 type_args_len,
2844 argument_names, 2845 argument_names,
2845 arguments, 2846 arguments,
2846 token_pos) { 2847 token_pos) {
2847 ASSERT(!arguments->is_empty()); 2848 ASSERT(!arguments->is_empty());
2848 SetInputAt(0, function); 2849 SetInputAt(0, function);
2849 } 2850 }
2850 2851
2851 DECLARE_INSTRUCTION(ClosureCall) 2852 DECLARE_INSTRUCTION(ClosureCall)
2852 2853
(...skipping 13 matching lines...) Expand all
2866 2867
2867 class InstanceCallInstr : public TemplateDartCall<0> { 2868 class InstanceCallInstr : public TemplateDartCall<0> {
2868 public: 2869 public:
2869 InstanceCallInstr(TokenPosition token_pos, 2870 InstanceCallInstr(TokenPosition token_pos,
2870 const String& function_name, 2871 const String& function_name,
2871 Token::Kind token_kind, 2872 Token::Kind token_kind,
2872 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2873 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2873 intptr_t type_args_len, 2874 intptr_t type_args_len,
2874 const Array& argument_names, 2875 const Array& argument_names,
2875 intptr_t checked_argument_count, 2876 intptr_t checked_argument_count,
2876 const ZoneGrowableArray<const ICData*>& ic_data_array, 2877 const ZoneGrowableArray<const ICData*>& ic_data_array)
2877 intptr_t deopt_id) 2878 : TemplateDartCall(Thread::Current()->GetNextDeoptId(),
2878 : TemplateDartCall(deopt_id,
2879 type_args_len, 2879 type_args_len,
2880 argument_names, 2880 argument_names,
2881 arguments, 2881 arguments,
2882 token_pos), 2882 token_pos),
2883 ic_data_(NULL), 2883 ic_data_(NULL),
2884 function_name_(function_name), 2884 function_name_(function_name),
2885 token_kind_(token_kind), 2885 token_kind_(token_kind),
2886 checked_argument_count_(checked_argument_count), 2886 checked_argument_count_(checked_argument_count),
2887 has_unique_selector_(false) { 2887 has_unique_selector_(false) {
2888 ic_data_ = GetICData(ic_data_array); 2888 ic_data_ = GetICData(ic_data_array);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 3026 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
3027 }; 3027 };
3028 3028
3029 3029
3030 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3030 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3031 public: 3031 public:
3032 StrictCompareInstr(TokenPosition token_pos, 3032 StrictCompareInstr(TokenPosition token_pos,
3033 Token::Kind kind, 3033 Token::Kind kind,
3034 Value* left, 3034 Value* left,
3035 Value* right, 3035 Value* right,
3036 bool needs_number_check, 3036 bool needs_number_check);
3037 intptr_t deopt_id);
3038 3037
3039 DECLARE_INSTRUCTION(StrictCompare) 3038 DECLARE_INSTRUCTION(StrictCompare)
3040 3039
3041 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3040 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3042 3041
3043 virtual CompileType ComputeType() const; 3042 virtual CompileType ComputeType() const;
3044 3043
3045 virtual bool ComputeCanDeoptimize() const { return false; } 3044 virtual bool ComputeCanDeoptimize() const { return false; }
3046 3045
3047 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3046 virtual Definition* Canonicalize(FlowGraph* flow_graph);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 3238
3240 private: 3239 private:
3241 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 3240 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
3242 }; 3241 };
3243 3242
3244 3243
3245 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 3244 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
3246 // materialization of true and false constants. 3245 // materialization of true and false constants.
3247 class IfThenElseInstr : public Definition { 3246 class IfThenElseInstr : public Definition {
3248 public: 3247 public:
3249 IfThenElseInstr(ComparisonInstr* comparison, 3248 IfThenElseInstr(ComparisonInstr* comparison, Value* if_true, Value* if_false)
3250 Value* if_true, 3249 : Definition(Thread::Current()->GetNextDeoptId()),
3251 Value* if_false,
3252 intptr_t deopt_id)
3253 : Definition(deopt_id),
3254 comparison_(comparison), 3250 comparison_(comparison),
3255 if_true_(Smi::Cast(if_true->BoundConstant()).Value()), 3251 if_true_(Smi::Cast(if_true->BoundConstant()).Value()),
3256 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) { 3252 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) {
3257 // Adjust uses at the comparison. 3253 // Adjust uses at the comparison.
3258 ASSERT(comparison->env() == NULL); 3254 ASSERT(comparison->env() == NULL);
3259 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 3255 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
3260 comparison->InputAt(i)->set_instruction(this); 3256 comparison->InputAt(i)->set_instruction(this);
3261 } 3257 }
3262 } 3258 }
3263 3259
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 }; 3321 };
3326 3322
3327 3323
3328 class StaticCallInstr : public TemplateDartCall<0> { 3324 class StaticCallInstr : public TemplateDartCall<0> {
3329 public: 3325 public:
3330 StaticCallInstr(TokenPosition token_pos, 3326 StaticCallInstr(TokenPosition token_pos,
3331 const Function& function, 3327 const Function& function,
3332 intptr_t type_args_len, 3328 intptr_t type_args_len,
3333 const Array& argument_names, 3329 const Array& argument_names,
3334 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3330 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3335 const ZoneGrowableArray<const ICData*>& ic_data_array, 3331 const ZoneGrowableArray<const ICData*>& ic_data_array)
3336 intptr_t deopt_id) 3332 : TemplateDartCall(Thread::Current()->GetNextDeoptId(),
3337 : TemplateDartCall(deopt_id,
3338 type_args_len, 3333 type_args_len,
3339 argument_names, 3334 argument_names,
3340 arguments, 3335 arguments,
3341 token_pos), 3336 token_pos),
3342 ic_data_(NULL), 3337 ic_data_(NULL),
3343 call_count_(0), 3338 call_count_(0),
3344 function_(function), 3339 function_(function),
3345 result_cid_(kDynamicCid), 3340 result_cid_(kDynamicCid),
3346 is_known_list_constructor_(false), 3341 is_known_list_constructor_(false),
3347 identity_(AliasIdentity::Unknown()) { 3342 identity_(AliasIdentity::Unknown()) {
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
4047 4042
4048 private: 4043 private:
4049 const intptr_t cid_; 4044 const intptr_t cid_;
4050 4045
4051 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); 4046 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr);
4052 }; 4047 };
4053 4048
4054 4049
4055 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { 4050 class StringInterpolateInstr : public TemplateDefinition<1, Throws> {
4056 public: 4051 public:
4057 StringInterpolateInstr(Value* value, 4052 StringInterpolateInstr(Value* value, TokenPosition token_pos)
4058 TokenPosition token_pos, 4053 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
4059 intptr_t deopt_id)
4060 : TemplateDefinition(deopt_id),
4061 token_pos_(token_pos), 4054 token_pos_(token_pos),
4062 function_(Function::ZoneHandle()) { 4055 function_(Function::ZoneHandle()) {
4063 SetInputAt(0, value); 4056 SetInputAt(0, value);
4064 } 4057 }
4065 4058
4066 Value* value() const { return inputs_[0]; } 4059 Value* value() const { return inputs_[0]; }
4067 virtual TokenPosition token_pos() const { return token_pos_; } 4060 virtual TokenPosition token_pos() const { return token_pos_; }
4068 4061
4069 virtual CompileType ComputeType() const; 4062 virtual CompileType ComputeType() const;
4070 // Issues a static call to Dart code which calls toString on objects. 4063 // Issues a static call to Dart code which calls toString on objects.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 bool registers_remapped_; 4378 bool registers_remapped_;
4386 4379
4387 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4380 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4388 }; 4381 };
4389 4382
4390 4383
4391 class CreateArrayInstr : public TemplateDefinition<2, Throws> { 4384 class CreateArrayInstr : public TemplateDefinition<2, Throws> {
4392 public: 4385 public:
4393 CreateArrayInstr(TokenPosition token_pos, 4386 CreateArrayInstr(TokenPosition token_pos,
4394 Value* element_type, 4387 Value* element_type,
4395 Value* num_elements, 4388 Value* num_elements)
4396 intptr_t deopt_id) 4389 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
4397 : TemplateDefinition(deopt_id),
4398 token_pos_(token_pos), 4390 token_pos_(token_pos),
4399 identity_(AliasIdentity::Unknown()) { 4391 identity_(AliasIdentity::Unknown()) {
4400 SetInputAt(kElementTypePos, element_type); 4392 SetInputAt(kElementTypePos, element_type);
4401 SetInputAt(kLengthPos, num_elements); 4393 SetInputAt(kLengthPos, num_elements);
4402 } 4394 }
4403 4395
4404 enum { kElementTypePos = 0, kLengthPos = 1 }; 4396 enum { kElementTypePos = 0, kLengthPos = 1 };
4405 4397
4406 DECLARE_INSTRUCTION(CreateArray) 4398 DECLARE_INSTRUCTION(CreateArray)
4407 virtual CompileType ComputeType() const; 4399 virtual CompileType ComputeType() const;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
4595 4587
4596 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4588 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4597 }; 4589 };
4598 4590
4599 4591
4600 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { 4592 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> {
4601 public: 4593 public:
4602 InstantiateTypeInstr(TokenPosition token_pos, 4594 InstantiateTypeInstr(TokenPosition token_pos,
4603 const AbstractType& type, 4595 const AbstractType& type,
4604 Value* instantiator_type_arguments, 4596 Value* instantiator_type_arguments,
4605 Value* function_type_arguments, 4597 Value* function_type_arguments)
4606 intptr_t deopt_id) 4598 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
4607 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { 4599 token_pos_(token_pos),
4600 type_(type) {
4608 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); 4601 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle());
4609 SetInputAt(0, instantiator_type_arguments); 4602 SetInputAt(0, instantiator_type_arguments);
4610 SetInputAt(1, function_type_arguments); 4603 SetInputAt(1, function_type_arguments);
4611 } 4604 }
4612 4605
4613 DECLARE_INSTRUCTION(InstantiateType) 4606 DECLARE_INSTRUCTION(InstantiateType)
4614 4607
4615 Value* instantiator_type_arguments() const { return inputs_[0]; } 4608 Value* instantiator_type_arguments() const { return inputs_[0]; }
4616 Value* function_type_arguments() const { return inputs_[1]; } 4609 Value* function_type_arguments() const { return inputs_[1]; }
4617 const AbstractType& type() const { return type_; } 4610 const AbstractType& type() const { return type_; }
(...skipping 12 matching lines...) Expand all
4630 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4623 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4631 }; 4624 };
4632 4625
4633 4626
4634 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { 4627 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> {
4635 public: 4628 public:
4636 InstantiateTypeArgumentsInstr(TokenPosition token_pos, 4629 InstantiateTypeArgumentsInstr(TokenPosition token_pos,
4637 const TypeArguments& type_arguments, 4630 const TypeArguments& type_arguments,
4638 const Class& instantiator_class, 4631 const Class& instantiator_class,
4639 Value* instantiator_type_arguments, 4632 Value* instantiator_type_arguments,
4640 Value* function_type_arguments, 4633 Value* function_type_arguments)
4641 intptr_t deopt_id) 4634 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
4642 : TemplateDefinition(deopt_id),
4643 token_pos_(token_pos), 4635 token_pos_(token_pos),
4644 type_arguments_(type_arguments), 4636 type_arguments_(type_arguments),
4645 instantiator_class_(instantiator_class) { 4637 instantiator_class_(instantiator_class) {
4646 ASSERT(type_arguments.IsZoneHandle()); 4638 ASSERT(type_arguments.IsZoneHandle());
4647 SetInputAt(0, instantiator_type_arguments); 4639 SetInputAt(0, instantiator_type_arguments);
4648 SetInputAt(1, function_type_arguments); 4640 SetInputAt(1, function_type_arguments);
4649 } 4641 }
4650 4642
4651 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4643 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4652 4644
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4693 private: 4685 private:
4694 const TokenPosition token_pos_; 4686 const TokenPosition token_pos_;
4695 const intptr_t num_context_variables_; 4687 const intptr_t num_context_variables_;
4696 4688
4697 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4689 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4698 }; 4690 };
4699 4691
4700 4692
4701 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { 4693 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> {
4702 public: 4694 public:
4703 InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id) 4695 InitStaticFieldInstr(Value* input, const Field& field)
4704 : TemplateInstruction(deopt_id), field_(field) { 4696 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
4697 field_(field) {
4705 SetInputAt(0, input); 4698 SetInputAt(0, input);
4706 CheckField(field); 4699 CheckField(field);
4707 } 4700 }
4708 4701
4709 virtual TokenPosition token_pos() const { return field_.token_pos(); } 4702 virtual TokenPosition token_pos() const { return field_.token_pos(); }
4710 const Field& field() const { return field_; } 4703 const Field& field() const { return field_; }
4711 4704
4712 DECLARE_INSTRUCTION(InitStaticField) 4705 DECLARE_INSTRUCTION(InitStaticField)
4713 4706
4714 virtual bool ComputeCanDeoptimize() const { return true; } 4707 virtual bool ComputeCanDeoptimize() const { return true; }
4715 virtual EffectSet Effects() const { return EffectSet::All(); } 4708 virtual EffectSet Effects() const { return EffectSet::All(); }
4716 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 4709 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
4717 4710
4718 private: 4711 private:
4719 const Field& field_; 4712 const Field& field_;
4720 4713
4721 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); 4714 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr);
4722 }; 4715 };
4723 4716
4724 4717
4725 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { 4718 class CloneContextInstr : public TemplateDefinition<1, NoThrow> {
4726 public: 4719 public:
4727 CloneContextInstr(TokenPosition token_pos, 4720 CloneContextInstr(TokenPosition token_pos, Value* context_value)
4728 Value* context_value, 4721 : TemplateDefinition(Thread::Current()->GetNextDeoptId()),
4729 intptr_t deopt_id) 4722 token_pos_(token_pos) {
4730 : TemplateDefinition(deopt_id), token_pos_(token_pos) {
4731 SetInputAt(0, context_value); 4723 SetInputAt(0, context_value);
4732 } 4724 }
4733 4725
4734 virtual TokenPosition token_pos() const { return token_pos_; } 4726 virtual TokenPosition token_pos() const { return token_pos_; }
4735 Value* context_value() const { return inputs_[0]; } 4727 Value* context_value() const { return inputs_[0]; }
4736 4728
4737 DECLARE_INSTRUCTION(CloneContext) 4729 DECLARE_INSTRUCTION(CloneContext)
4738 virtual CompileType ComputeType() const; 4730 virtual CompileType ComputeType() const;
4739 4731
4740 virtual bool ComputeCanDeoptimize() const { return true; } 4732 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
7255 7247
7256 private: 7248 private:
7257 const Token::Kind op_kind_; 7249 const Token::Kind op_kind_;
7258 7250
7259 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 7251 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7260 }; 7252 };
7261 7253
7262 7254
7263 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { 7255 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> {
7264 public: 7256 public:
7265 CheckStackOverflowInstr(TokenPosition token_pos, 7257 CheckStackOverflowInstr(TokenPosition token_pos, intptr_t loop_depth)
7266 intptr_t loop_depth, 7258 : TemplateInstruction(Thread::Current()->GetNextDeoptId()),
7267 intptr_t deopt_id)
7268 : TemplateInstruction(deopt_id),
7269 token_pos_(token_pos), 7259 token_pos_(token_pos),
7270 loop_depth_(loop_depth) {} 7260 loop_depth_(loop_depth) {}
7271 7261
7272 virtual TokenPosition token_pos() const { return token_pos_; } 7262 virtual TokenPosition token_pos() const { return token_pos_; }
7273 bool in_loop() const { return loop_depth_ > 0; } 7263 bool in_loop() const { return loop_depth_ > 0; }
7274 intptr_t loop_depth() const { return loop_depth_; } 7264 intptr_t loop_depth() const { return loop_depth_; }
7275 7265
7276 DECLARE_INSTRUCTION(CheckStackOverflow) 7266 DECLARE_INSTRUCTION(CheckStackOverflow)
7277 7267
7278 virtual bool ComputeCanDeoptimize() const { return true; } 7268 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
8231 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8221 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8232 UNIMPLEMENTED(); \ 8222 UNIMPLEMENTED(); \
8233 return NULL; \ 8223 return NULL; \
8234 } \ 8224 } \
8235 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8225 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8236 8226
8237 8227
8238 } // namespace dart 8228 } // namespace dart
8239 8229
8240 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8230 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698