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

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

Issue 2900963008: Reapply "Shuffle around deopt id allocation... (Closed)
Patch Set: . Created 3 years, 6 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
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) 1265 BlockEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1266 : Instruction(Thread::Current()->GetNextDeoptId()), 1266 : Instruction(deopt_id),
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) 1445 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1446 : BlockEntryInstr(block_id, try_index), 1446 : BlockEntryInstr(block_id, try_index, deopt_id),
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) 1515 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1516 : BlockEntryInstr(block_id, try_index), 1516 : BlockEntryInstr(block_id, try_index, deopt_id),
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 : JoinEntryInstr(block_id, try_index), indirect_id_(indirect_id) {} 1557 intptr_t deopt_id)
1558 : JoinEntryInstr(block_id, try_index, deopt_id),
1559 indirect_id_(indirect_id) {}
1558 1560
1559 DECLARE_INSTRUCTION(IndirectEntry) 1561 DECLARE_INSTRUCTION(IndirectEntry)
1560 1562
1561 intptr_t indirect_id() const { return indirect_id_; } 1563 intptr_t indirect_id() const { return indirect_id_; }
1562 1564
1563 PRINT_TO_SUPPORT 1565 PRINT_TO_SUPPORT
1564 1566
1565 private: 1567 private:
1566 const intptr_t indirect_id_; 1568 const intptr_t indirect_id_;
1567 }; 1569 };
1568 1570
1569 1571
1570 class CatchBlockEntryInstr : public BlockEntryInstr { 1572 class CatchBlockEntryInstr : public BlockEntryInstr {
1571 public: 1573 public:
1572 CatchBlockEntryInstr(TokenPosition handler_token_pos, 1574 CatchBlockEntryInstr(TokenPosition handler_token_pos,
1573 bool is_generated, 1575 bool is_generated,
1574 intptr_t block_id, 1576 intptr_t block_id,
1575 intptr_t try_index, 1577 intptr_t try_index,
1576 GraphEntryInstr* graph_entry, 1578 GraphEntryInstr* graph_entry,
1577 const Array& handler_types, 1579 const Array& handler_types,
1578 intptr_t catch_try_index, 1580 intptr_t catch_try_index,
1579 const LocalVariable& exception_var, 1581 const LocalVariable& exception_var,
1580 const LocalVariable& stacktrace_var, 1582 const LocalVariable& stacktrace_var,
1581 bool needs_stacktrace, 1583 bool needs_stacktrace,
1582 intptr_t deopt_id, 1584 intptr_t deopt_id,
1583 bool should_restore_closure_context = false) 1585 bool should_restore_closure_context = false)
1584 : BlockEntryInstr(block_id, try_index), 1586 : BlockEntryInstr(block_id, try_index, deopt_id),
1585 graph_entry_(graph_entry), 1587 graph_entry_(graph_entry),
1586 predecessor_(NULL), 1588 predecessor_(NULL),
1587 catch_handler_types_(Array::ZoneHandle(handler_types.raw())), 1589 catch_handler_types_(Array::ZoneHandle(handler_types.raw())),
1588 catch_try_index_(catch_try_index), 1590 catch_try_index_(catch_try_index),
1589 exception_var_(exception_var), 1591 exception_var_(exception_var),
1590 stacktrace_var_(stacktrace_var), 1592 stacktrace_var_(stacktrace_var),
1591 needs_stacktrace_(needs_stacktrace), 1593 needs_stacktrace_(needs_stacktrace),
1592 should_restore_closure_context_(should_restore_closure_context), 1594 should_restore_closure_context_(should_restore_closure_context),
1593 handler_token_pos_(handler_token_pos), 1595 handler_token_pos_(handler_token_pos),
1594 is_generated_(is_generated) { 1596 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) 2111 ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id)
2112 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2112 : TemplateInstruction(deopt_id), token_pos_(token_pos) {
2113 token_pos_(token_pos) {
2114 SetInputAt(0, value); 2113 SetInputAt(0, value);
2115 } 2114 }
2116 2115
2117 DECLARE_INSTRUCTION(Return) 2116 DECLARE_INSTRUCTION(Return)
2118 2117
2119 virtual TokenPosition token_pos() const { return token_pos_; } 2118 virtual TokenPosition token_pos() const { return token_pos_; }
2120 Value* value() const { return inputs_[0]; } 2119 Value* value() const { return inputs_[0]; }
2121 2120
2122 virtual bool CanBecomeDeoptimizationTarget() const { 2121 virtual bool CanBecomeDeoptimizationTarget() const {
2123 // Return instruction might turn into a Goto instruction after inlining. 2122 // Return instruction might turn into a Goto instruction after inlining.
2124 // Every Goto must have an environment. 2123 // Every Goto must have an environment.
2125 return true; 2124 return true;
2126 } 2125 }
2127 2126
2128 virtual bool ComputeCanDeoptimize() const { return false; } 2127 virtual bool ComputeCanDeoptimize() const { return false; }
2129 2128
2130 virtual EffectSet Effects() const { return EffectSet::None(); } 2129 virtual EffectSet Effects() const { return EffectSet::None(); }
2131 2130
2132 private: 2131 private:
2133 const TokenPosition token_pos_; 2132 const TokenPosition token_pos_;
2134 2133
2135 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2134 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2136 }; 2135 };
2137 2136
2138 2137
2139 class ThrowInstr : public TemplateInstruction<0, Throws> { 2138 class ThrowInstr : public TemplateInstruction<0, Throws> {
2140 public: 2139 public:
2141 explicit ThrowInstr(TokenPosition token_pos) 2140 explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id)
2142 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2141 : TemplateInstruction(deopt_id), token_pos_(token_pos) {}
2143 token_pos_(token_pos) {}
2144 2142
2145 DECLARE_INSTRUCTION(Throw) 2143 DECLARE_INSTRUCTION(Throw)
2146 2144
2147 virtual intptr_t ArgumentCount() const { return 1; } 2145 virtual intptr_t ArgumentCount() const { return 1; }
2148 2146
2149 virtual TokenPosition token_pos() const { return token_pos_; } 2147 virtual TokenPosition token_pos() const { return token_pos_; }
2150 2148
2151 virtual bool ComputeCanDeoptimize() const { return true; } 2149 virtual bool ComputeCanDeoptimize() const { return true; }
2152 2150
2153 virtual EffectSet Effects() const { return EffectSet::None(); } 2151 virtual EffectSet Effects() const { return EffectSet::None(); }
2154 2152
2155 private: 2153 private:
2156 const TokenPosition token_pos_; 2154 const TokenPosition token_pos_;
2157 2155
2158 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2156 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2159 }; 2157 };
2160 2158
2161 2159
2162 class ReThrowInstr : public TemplateInstruction<0, Throws> { 2160 class ReThrowInstr : public TemplateInstruction<0, Throws> {
2163 public: 2161 public:
2164 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2162 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2165 // rethrow has been artificially generated by the parser. 2163 // rethrow has been artificially generated by the parser.
2166 ReThrowInstr(TokenPosition token_pos, intptr_t catch_try_index) 2164 ReThrowInstr(TokenPosition token_pos,
2167 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2165 intptr_t catch_try_index,
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) 2217 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id)
2218 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2218 : TemplateInstruction(deopt_id),
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) 2431 explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id)
2432 : Instruction(Thread::Current()->GetNextDeoptId()), 2432 : Instruction(deopt_id), comparison_(comparison), constant_target_(NULL) {
2433 comparison_(comparison),
2434 constant_target_(NULL) {
2435 ASSERT(comparison->env() == NULL); 2433 ASSERT(comparison->env() == NULL);
2436 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 2434 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
2437 comparison->InputAt(i)->set_instruction(this); 2435 comparison->InputAt(i)->set_instruction(this);
2438 } 2436 }
2439 } 2437 }
2440 2438
2441 DECLARE_INSTRUCTION(Branch) 2439 DECLARE_INSTRUCTION(Branch)
2442 2440
2443 virtual intptr_t ArgumentCount() const { 2441 virtual intptr_t ArgumentCount() const {
2444 return comparison()->ArgumentCount(); 2442 return comparison()->ArgumentCount();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 const TokenPosition token_pos_; 2701 const TokenPosition token_pos_;
2704 AbstractType& dst_type_; 2702 AbstractType& dst_type_;
2705 const String& dst_name_; 2703 const String& dst_name_;
2706 2704
2707 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2705 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2708 }; 2706 };
2709 2707
2710 2708
2711 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { 2709 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> {
2712 public: 2710 public:
2713 AssertBooleanInstr(TokenPosition token_pos, Value* value) 2711 AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id)
2714 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 2712 : TemplateDefinition(deopt_id), token_pos_(token_pos) {
2715 token_pos_(token_pos) {
2716 SetInputAt(0, value); 2713 SetInputAt(0, value);
2717 } 2714 }
2718 2715
2719 DECLARE_INSTRUCTION(AssertBoolean) 2716 DECLARE_INSTRUCTION(AssertBoolean)
2720 virtual CompileType ComputeType() const; 2717 virtual CompileType ComputeType() const;
2721 2718
2722 virtual TokenPosition token_pos() const { return token_pos_; } 2719 virtual TokenPosition token_pos() const { return token_pos_; }
2723 Value* value() const { return inputs_[0]; } 2720 Value* value() const { return inputs_[0]; }
2724 2721
2725 virtual bool ComputeCanDeoptimize() const { return true; } 2722 virtual bool ComputeCanDeoptimize() const { return true; }
2726 2723
2727 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2724 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2728 2725
2729 virtual bool AttributesEqual(Instruction* other) const { return true; } 2726 virtual bool AttributesEqual(Instruction* other) const { return true; }
2730 2727
2731 PRINT_OPERANDS_TO_SUPPORT 2728 PRINT_OPERANDS_TO_SUPPORT
2732 2729
2733 private: 2730 private:
2734 const TokenPosition token_pos_; 2731 const TokenPosition token_pos_;
2735 2732
2736 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2733 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2737 }; 2734 };
2738 2735
2739 2736
2740 // Denotes the current context, normally held in a register. This is 2737 // Denotes the current context, normally held in a register. This is
2741 // a computation, not a value, because it's mutable. 2738 // a computation, not a value, because it's mutable.
2742 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> { 2739 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> {
2743 public: 2740 public:
2744 CurrentContextInstr() 2741 explicit CurrentContextInstr(intptr_t deopt_id)
2745 : TemplateDefinition(Thread::Current()->GetNextDeoptId()) {} 2742 : TemplateDefinition(deopt_id) {}
2746 2743
2747 DECLARE_INSTRUCTION(CurrentContext) 2744 DECLARE_INSTRUCTION(CurrentContext)
2748 virtual CompileType ComputeType() const; 2745 virtual CompileType ComputeType() const;
2749 2746
2750 virtual bool ComputeCanDeoptimize() const { return false; } 2747 virtual bool ComputeCanDeoptimize() const { return false; }
2751 2748
2752 virtual EffectSet Effects() const { return EffectSet::None(); } 2749 virtual EffectSet Effects() const { return EffectSet::None(); }
2753 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2750 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2754 virtual bool AttributesEqual(Instruction* other) const { return true; } 2751 virtual bool AttributesEqual(Instruction* other) const { return true; }
2755 2752
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 TokenPosition token_pos_; 2815 TokenPosition token_pos_;
2819 2816
2820 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); 2817 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall);
2821 }; 2818 };
2822 2819
2823 2820
2824 class ClosureCallInstr : public TemplateDartCall<1> { 2821 class ClosureCallInstr : public TemplateDartCall<1> {
2825 public: 2822 public:
2826 ClosureCallInstr(Value* function, 2823 ClosureCallInstr(Value* function,
2827 ClosureCallNode* node, 2824 ClosureCallNode* node,
2828 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2825 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2829 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2826 intptr_t deopt_id)
2827 : TemplateDartCall(deopt_id,
2830 node->arguments()->type_args_len(), 2828 node->arguments()->type_args_len(),
2831 node->arguments()->names(), 2829 node->arguments()->names(),
2832 arguments, 2830 arguments,
2833 node->token_pos()) { 2831 node->token_pos()) {
2834 ASSERT(!arguments->is_empty()); 2832 ASSERT(!arguments->is_empty());
2835 SetInputAt(0, function); 2833 SetInputAt(0, function);
2836 } 2834 }
2837 2835
2838 ClosureCallInstr(Value* function, 2836 ClosureCallInstr(Value* function,
2839 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2837 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2840 intptr_t type_args_len, 2838 intptr_t type_args_len,
2841 const Array& argument_names, 2839 const Array& argument_names,
2842 TokenPosition token_pos) 2840 TokenPosition token_pos,
2843 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2841 intptr_t deopt_id)
2842 : TemplateDartCall(deopt_id,
2844 type_args_len, 2843 type_args_len,
2845 argument_names, 2844 argument_names,
2846 arguments, 2845 arguments,
2847 token_pos) { 2846 token_pos) {
2848 ASSERT(!arguments->is_empty()); 2847 ASSERT(!arguments->is_empty());
2849 SetInputAt(0, function); 2848 SetInputAt(0, function);
2850 } 2849 }
2851 2850
2852 DECLARE_INSTRUCTION(ClosureCall) 2851 DECLARE_INSTRUCTION(ClosureCall)
2853 2852
(...skipping 13 matching lines...) Expand all
2867 2866
2868 class InstanceCallInstr : public TemplateDartCall<0> { 2867 class InstanceCallInstr : public TemplateDartCall<0> {
2869 public: 2868 public:
2870 InstanceCallInstr(TokenPosition token_pos, 2869 InstanceCallInstr(TokenPosition token_pos,
2871 const String& function_name, 2870 const String& function_name,
2872 Token::Kind token_kind, 2871 Token::Kind token_kind,
2873 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2872 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2874 intptr_t type_args_len, 2873 intptr_t type_args_len,
2875 const Array& argument_names, 2874 const Array& argument_names,
2876 intptr_t checked_argument_count, 2875 intptr_t checked_argument_count,
2877 const ZoneGrowableArray<const ICData*>& ic_data_array) 2876 const ZoneGrowableArray<const ICData*>& ic_data_array,
2878 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2877 intptr_t deopt_id)
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);
3037 3038
3038 DECLARE_INSTRUCTION(StrictCompare) 3039 DECLARE_INSTRUCTION(StrictCompare)
3039 3040
3040 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3041 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3041 3042
3042 virtual CompileType ComputeType() const; 3043 virtual CompileType ComputeType() const;
3043 3044
3044 virtual bool ComputeCanDeoptimize() const { return false; } 3045 virtual bool ComputeCanDeoptimize() const { return false; }
3045 3046
3046 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3047 virtual Definition* Canonicalize(FlowGraph* flow_graph);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 3239
3239 private: 3240 private:
3240 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 3241 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
3241 }; 3242 };
3242 3243
3243 3244
3244 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 3245 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
3245 // materialization of true and false constants. 3246 // materialization of true and false constants.
3246 class IfThenElseInstr : public Definition { 3247 class IfThenElseInstr : public Definition {
3247 public: 3248 public:
3248 IfThenElseInstr(ComparisonInstr* comparison, Value* if_true, Value* if_false) 3249 IfThenElseInstr(ComparisonInstr* comparison,
3249 : Definition(Thread::Current()->GetNextDeoptId()), 3250 Value* if_true,
3251 Value* if_false,
3252 intptr_t deopt_id)
3253 : Definition(deopt_id),
3250 comparison_(comparison), 3254 comparison_(comparison),
3251 if_true_(Smi::Cast(if_true->BoundConstant()).Value()), 3255 if_true_(Smi::Cast(if_true->BoundConstant()).Value()),
3252 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) { 3256 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) {
3253 // Adjust uses at the comparison. 3257 // Adjust uses at the comparison.
3254 ASSERT(comparison->env() == NULL); 3258 ASSERT(comparison->env() == NULL);
3255 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 3259 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
3256 comparison->InputAt(i)->set_instruction(this); 3260 comparison->InputAt(i)->set_instruction(this);
3257 } 3261 }
3258 } 3262 }
3259 3263
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 }; 3325 };
3322 3326
3323 3327
3324 class StaticCallInstr : public TemplateDartCall<0> { 3328 class StaticCallInstr : public TemplateDartCall<0> {
3325 public: 3329 public:
3326 StaticCallInstr(TokenPosition token_pos, 3330 StaticCallInstr(TokenPosition token_pos,
3327 const Function& function, 3331 const Function& function,
3328 intptr_t type_args_len, 3332 intptr_t type_args_len,
3329 const Array& argument_names, 3333 const Array& argument_names,
3330 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3334 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3331 const ZoneGrowableArray<const ICData*>& ic_data_array) 3335 const ZoneGrowableArray<const ICData*>& ic_data_array,
3332 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 3336 intptr_t deopt_id)
3337 : TemplateDartCall(deopt_id,
3333 type_args_len, 3338 type_args_len,
3334 argument_names, 3339 argument_names,
3335 arguments, 3340 arguments,
3336 token_pos), 3341 token_pos),
3337 ic_data_(NULL), 3342 ic_data_(NULL),
3338 call_count_(0), 3343 call_count_(0),
3339 function_(function), 3344 function_(function),
3340 result_cid_(kDynamicCid), 3345 result_cid_(kDynamicCid),
3341 is_known_list_constructor_(false), 3346 is_known_list_constructor_(false),
3342 identity_(AliasIdentity::Unknown()) { 3347 identity_(AliasIdentity::Unknown()) {
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 4047
4043 private: 4048 private:
4044 const intptr_t cid_; 4049 const intptr_t cid_;
4045 4050
4046 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); 4051 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr);
4047 }; 4052 };
4048 4053
4049 4054
4050 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { 4055 class StringInterpolateInstr : public TemplateDefinition<1, Throws> {
4051 public: 4056 public:
4052 StringInterpolateInstr(Value* value, TokenPosition token_pos) 4057 StringInterpolateInstr(Value* value,
4053 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4058 TokenPosition token_pos,
4059 intptr_t deopt_id)
4060 : TemplateDefinition(deopt_id),
4054 token_pos_(token_pos), 4061 token_pos_(token_pos),
4055 function_(Function::ZoneHandle()) { 4062 function_(Function::ZoneHandle()) {
4056 SetInputAt(0, value); 4063 SetInputAt(0, value);
4057 } 4064 }
4058 4065
4059 Value* value() const { return inputs_[0]; } 4066 Value* value() const { return inputs_[0]; }
4060 virtual TokenPosition token_pos() const { return token_pos_; } 4067 virtual TokenPosition token_pos() const { return token_pos_; }
4061 4068
4062 virtual CompileType ComputeType() const; 4069 virtual CompileType ComputeType() const;
4063 // Issues a static call to Dart code which calls toString on objects. 4070 // Issues a static call to Dart code which calls toString on objects.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 bool registers_remapped_; 4385 bool registers_remapped_;
4379 4386
4380 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4387 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4381 }; 4388 };
4382 4389
4383 4390
4384 class CreateArrayInstr : public TemplateDefinition<2, Throws> { 4391 class CreateArrayInstr : public TemplateDefinition<2, Throws> {
4385 public: 4392 public:
4386 CreateArrayInstr(TokenPosition token_pos, 4393 CreateArrayInstr(TokenPosition token_pos,
4387 Value* element_type, 4394 Value* element_type,
4388 Value* num_elements) 4395 Value* num_elements,
4389 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4396 intptr_t deopt_id)
4397 : TemplateDefinition(deopt_id),
4390 token_pos_(token_pos), 4398 token_pos_(token_pos),
4391 identity_(AliasIdentity::Unknown()) { 4399 identity_(AliasIdentity::Unknown()) {
4392 SetInputAt(kElementTypePos, element_type); 4400 SetInputAt(kElementTypePos, element_type);
4393 SetInputAt(kLengthPos, num_elements); 4401 SetInputAt(kLengthPos, num_elements);
4394 } 4402 }
4395 4403
4396 enum { kElementTypePos = 0, kLengthPos = 1 }; 4404 enum { kElementTypePos = 0, kLengthPos = 1 };
4397 4405
4398 DECLARE_INSTRUCTION(CreateArray) 4406 DECLARE_INSTRUCTION(CreateArray)
4399 virtual CompileType ComputeType() const; 4407 virtual CompileType ComputeType() const;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
4587 4595
4588 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4596 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4589 }; 4597 };
4590 4598
4591 4599
4592 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { 4600 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> {
4593 public: 4601 public:
4594 InstantiateTypeInstr(TokenPosition token_pos, 4602 InstantiateTypeInstr(TokenPosition token_pos,
4595 const AbstractType& type, 4603 const AbstractType& type,
4596 Value* instantiator_type_arguments, 4604 Value* instantiator_type_arguments,
4597 Value* function_type_arguments) 4605 Value* function_type_arguments,
4598 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4606 intptr_t deopt_id)
4599 token_pos_(token_pos), 4607 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) {
4600 type_(type) {
4601 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); 4608 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle());
4602 SetInputAt(0, instantiator_type_arguments); 4609 SetInputAt(0, instantiator_type_arguments);
4603 SetInputAt(1, function_type_arguments); 4610 SetInputAt(1, function_type_arguments);
4604 } 4611 }
4605 4612
4606 DECLARE_INSTRUCTION(InstantiateType) 4613 DECLARE_INSTRUCTION(InstantiateType)
4607 4614
4608 Value* instantiator_type_arguments() const { return inputs_[0]; } 4615 Value* instantiator_type_arguments() const { return inputs_[0]; }
4609 Value* function_type_arguments() const { return inputs_[1]; } 4616 Value* function_type_arguments() const { return inputs_[1]; }
4610 const AbstractType& type() const { return type_; } 4617 const AbstractType& type() const { return type_; }
(...skipping 12 matching lines...) Expand all
4623 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4630 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4624 }; 4631 };
4625 4632
4626 4633
4627 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { 4634 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> {
4628 public: 4635 public:
4629 InstantiateTypeArgumentsInstr(TokenPosition token_pos, 4636 InstantiateTypeArgumentsInstr(TokenPosition token_pos,
4630 const TypeArguments& type_arguments, 4637 const TypeArguments& type_arguments,
4631 const Class& instantiator_class, 4638 const Class& instantiator_class,
4632 Value* instantiator_type_arguments, 4639 Value* instantiator_type_arguments,
4633 Value* function_type_arguments) 4640 Value* function_type_arguments,
4634 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4641 intptr_t deopt_id)
4642 : TemplateDefinition(deopt_id),
4635 token_pos_(token_pos), 4643 token_pos_(token_pos),
4636 type_arguments_(type_arguments), 4644 type_arguments_(type_arguments),
4637 instantiator_class_(instantiator_class) { 4645 instantiator_class_(instantiator_class) {
4638 ASSERT(type_arguments.IsZoneHandle()); 4646 ASSERT(type_arguments.IsZoneHandle());
4639 SetInputAt(0, instantiator_type_arguments); 4647 SetInputAt(0, instantiator_type_arguments);
4640 SetInputAt(1, function_type_arguments); 4648 SetInputAt(1, function_type_arguments);
4641 } 4649 }
4642 4650
4643 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4651 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4644 4652
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4685 private: 4693 private:
4686 const TokenPosition token_pos_; 4694 const TokenPosition token_pos_;
4687 const intptr_t num_context_variables_; 4695 const intptr_t num_context_variables_;
4688 4696
4689 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4697 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4690 }; 4698 };
4691 4699
4692 4700
4693 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { 4701 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> {
4694 public: 4702 public:
4695 InitStaticFieldInstr(Value* input, const Field& field) 4703 InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id)
4696 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 4704 : TemplateInstruction(deopt_id), field_(field) {
4697 field_(field) {
4698 SetInputAt(0, input); 4705 SetInputAt(0, input);
4699 CheckField(field); 4706 CheckField(field);
4700 } 4707 }
4701 4708
4702 virtual TokenPosition token_pos() const { return field_.token_pos(); } 4709 virtual TokenPosition token_pos() const { return field_.token_pos(); }
4703 const Field& field() const { return field_; } 4710 const Field& field() const { return field_; }
4704 4711
4705 DECLARE_INSTRUCTION(InitStaticField) 4712 DECLARE_INSTRUCTION(InitStaticField)
4706 4713
4707 virtual bool ComputeCanDeoptimize() const { return true; } 4714 virtual bool ComputeCanDeoptimize() const { return true; }
4708 virtual EffectSet Effects() const { return EffectSet::All(); } 4715 virtual EffectSet Effects() const { return EffectSet::All(); }
4709 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 4716 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
4710 4717
4711 private: 4718 private:
4712 const Field& field_; 4719 const Field& field_;
4713 4720
4714 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); 4721 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr);
4715 }; 4722 };
4716 4723
4717 4724
4718 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { 4725 class CloneContextInstr : public TemplateDefinition<1, NoThrow> {
4719 public: 4726 public:
4720 CloneContextInstr(TokenPosition token_pos, Value* context_value) 4727 CloneContextInstr(TokenPosition token_pos,
4721 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4728 Value* context_value,
4722 token_pos_(token_pos) { 4729 intptr_t deopt_id)
4730 : TemplateDefinition(deopt_id), token_pos_(token_pos) {
4723 SetInputAt(0, context_value); 4731 SetInputAt(0, context_value);
4724 } 4732 }
4725 4733
4726 virtual TokenPosition token_pos() const { return token_pos_; } 4734 virtual TokenPosition token_pos() const { return token_pos_; }
4727 Value* context_value() const { return inputs_[0]; } 4735 Value* context_value() const { return inputs_[0]; }
4728 4736
4729 DECLARE_INSTRUCTION(CloneContext) 4737 DECLARE_INSTRUCTION(CloneContext)
4730 virtual CompileType ComputeType() const; 4738 virtual CompileType ComputeType() const;
4731 4739
4732 virtual bool ComputeCanDeoptimize() const { return true; } 4740 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
7247 7255
7248 private: 7256 private:
7249 const Token::Kind op_kind_; 7257 const Token::Kind op_kind_;
7250 7258
7251 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 7259 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7252 }; 7260 };
7253 7261
7254 7262
7255 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { 7263 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> {
7256 public: 7264 public:
7257 CheckStackOverflowInstr(TokenPosition token_pos, intptr_t loop_depth) 7265 CheckStackOverflowInstr(TokenPosition token_pos,
7258 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 7266 intptr_t loop_depth,
7267 intptr_t deopt_id)
7268 : TemplateInstruction(deopt_id),
7259 token_pos_(token_pos), 7269 token_pos_(token_pos),
7260 loop_depth_(loop_depth) {} 7270 loop_depth_(loop_depth) {}
7261 7271
7262 virtual TokenPosition token_pos() const { return token_pos_; } 7272 virtual TokenPosition token_pos() const { return token_pos_; }
7263 bool in_loop() const { return loop_depth_ > 0; } 7273 bool in_loop() const { return loop_depth_ > 0; }
7264 intptr_t loop_depth() const { return loop_depth_; } 7274 intptr_t loop_depth() const { return loop_depth_; }
7265 7275
7266 DECLARE_INSTRUCTION(CheckStackOverflow) 7276 DECLARE_INSTRUCTION(CheckStackOverflow)
7267 7277
7268 virtual bool ComputeCanDeoptimize() const { return true; } 7278 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
8221 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8231 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8222 UNIMPLEMENTED(); \ 8232 UNIMPLEMENTED(); \
8223 return NULL; \ 8233 return NULL; \
8224 } \ 8234 } \
8225 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8235 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8226 8236
8227 8237
8228 } // namespace dart 8238 } // namespace dart
8229 8239
8230 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8240 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698