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

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

Issue 2896903002: Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as … (Closed)
Patch Set: format 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
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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 intptr_t offset() const { return offset_; } 1250 intptr_t offset() const { return offset_; }
1251 void set_offset(intptr_t offset) { offset_ = offset; } 1251 void set_offset(intptr_t offset) { offset_ = offset; }
1252 1252
1253 // For all instruction in this block: Remove all inputs (including in the 1253 // For all instruction in this block: Remove all inputs (including in the
1254 // environment) from their definition's use lists for all instructions. 1254 // environment) from their definition's use lists for all instructions.
1255 void ClearAllInstructions(); 1255 void ClearAllInstructions();
1256 1256
1257 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry) 1257 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry)
1258 1258
1259 protected: 1259 protected:
1260 BlockEntryInstr(intptr_t block_id, intptr_t try_index) 1260 BlockEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1261 : Instruction(Thread::Current()->GetNextDeoptId()), 1261 : Instruction(deopt_id),
1262 block_id_(block_id), 1262 block_id_(block_id),
1263 try_index_(try_index), 1263 try_index_(try_index),
1264 preorder_number_(-1), 1264 preorder_number_(-1),
1265 postorder_number_(-1), 1265 postorder_number_(-1),
1266 dominator_(NULL), 1266 dominator_(NULL),
1267 dominated_blocks_(1), 1267 dominated_blocks_(1),
1268 last_instruction_(NULL), 1268 last_instruction_(NULL),
1269 offset_(-1), 1269 offset_(-1),
1270 parallel_move_(NULL), 1270 parallel_move_(NULL),
1271 loop_info_(NULL) {} 1271 loop_info_(NULL) {}
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 intptr_t entry_count_; 1430 intptr_t entry_count_;
1431 intptr_t spill_slot_count_; 1431 intptr_t spill_slot_count_;
1432 intptr_t fixed_slot_count_; // For try-catch in optimized code. 1432 intptr_t fixed_slot_count_; // For try-catch in optimized code.
1433 1433
1434 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 1434 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
1435 }; 1435 };
1436 1436
1437 1437
1438 class JoinEntryInstr : public BlockEntryInstr { 1438 class JoinEntryInstr : public BlockEntryInstr {
1439 public: 1439 public:
1440 JoinEntryInstr(intptr_t block_id, intptr_t try_index) 1440 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1441 : BlockEntryInstr(block_id, try_index), 1441 : BlockEntryInstr(block_id, try_index, deopt_id),
1442 predecessors_(2), // Two is the assumed to be the common case. 1442 predecessors_(2), // Two is the assumed to be the common case.
1443 phis_(NULL) {} 1443 phis_(NULL) {}
1444 1444
1445 DECLARE_INSTRUCTION(JoinEntry) 1445 DECLARE_INSTRUCTION(JoinEntry)
1446 1446
1447 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 1447 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
1448 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1448 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1449 return predecessors_[index]; 1449 return predecessors_[index];
1450 } 1450 }
1451 1451
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 PhiInstr* Current() const { return (*phis_)[index_]; } 1500 PhiInstr* Current() const { return (*phis_)[index_]; }
1501 1501
1502 private: 1502 private:
1503 ZoneGrowableArray<PhiInstr*>* phis_; 1503 ZoneGrowableArray<PhiInstr*>* phis_;
1504 intptr_t index_; 1504 intptr_t index_;
1505 }; 1505 };
1506 1506
1507 1507
1508 class TargetEntryInstr : public BlockEntryInstr { 1508 class TargetEntryInstr : public BlockEntryInstr {
1509 public: 1509 public:
1510 TargetEntryInstr(intptr_t block_id, intptr_t try_index) 1510 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id)
1511 : BlockEntryInstr(block_id, try_index), 1511 : BlockEntryInstr(block_id, try_index, deopt_id),
1512 predecessor_(NULL), 1512 predecessor_(NULL),
1513 edge_weight_(0.0) {} 1513 edge_weight_(0.0) {}
1514 1514
1515 DECLARE_INSTRUCTION(TargetEntry) 1515 DECLARE_INSTRUCTION(TargetEntry)
1516 1516
1517 double edge_weight() const { return edge_weight_; } 1517 double edge_weight() const { return edge_weight_; }
1518 void set_edge_weight(double weight) { edge_weight_ = weight; } 1518 void set_edge_weight(double weight) { edge_weight_ = weight; }
1519 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } 1519 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; }
1520 1520
1521 virtual intptr_t PredecessorCount() const { 1521 virtual intptr_t PredecessorCount() const {
(...skipping 19 matching lines...) Expand all
1541 double edge_weight_; 1541 double edge_weight_;
1542 1542
1543 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); 1543 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr);
1544 }; 1544 };
1545 1545
1546 1546
1547 class IndirectEntryInstr : public JoinEntryInstr { 1547 class IndirectEntryInstr : public JoinEntryInstr {
1548 public: 1548 public:
1549 IndirectEntryInstr(intptr_t block_id, 1549 IndirectEntryInstr(intptr_t block_id,
1550 intptr_t indirect_id, 1550 intptr_t indirect_id,
1551 intptr_t try_index) 1551 intptr_t try_index,
1552 : JoinEntryInstr(block_id, try_index), indirect_id_(indirect_id) {} 1552 intptr_t deopt_id)
1553 : JoinEntryInstr(block_id, try_index, deopt_id),
1554 indirect_id_(indirect_id) {}
1553 1555
1554 DECLARE_INSTRUCTION(IndirectEntry) 1556 DECLARE_INSTRUCTION(IndirectEntry)
1555 1557
1556 intptr_t indirect_id() const { return indirect_id_; } 1558 intptr_t indirect_id() const { return indirect_id_; }
1557 1559
1558 PRINT_TO_SUPPORT 1560 PRINT_TO_SUPPORT
1559 1561
1560 private: 1562 private:
1561 const intptr_t indirect_id_; 1563 const intptr_t indirect_id_;
1562 }; 1564 };
1563 1565
1564 1566
1565 class CatchBlockEntryInstr : public BlockEntryInstr { 1567 class CatchBlockEntryInstr : public BlockEntryInstr {
1566 public: 1568 public:
1567 CatchBlockEntryInstr(TokenPosition handler_token_pos, 1569 CatchBlockEntryInstr(TokenPosition handler_token_pos,
1568 bool is_generated, 1570 bool is_generated,
1569 intptr_t block_id, 1571 intptr_t block_id,
1570 intptr_t try_index, 1572 intptr_t try_index,
1571 GraphEntryInstr* graph_entry, 1573 GraphEntryInstr* graph_entry,
1572 const Array& handler_types, 1574 const Array& handler_types,
1573 intptr_t catch_try_index, 1575 intptr_t catch_try_index,
1574 const LocalVariable& exception_var, 1576 const LocalVariable& exception_var,
1575 const LocalVariable& stacktrace_var, 1577 const LocalVariable& stacktrace_var,
1576 bool needs_stacktrace, 1578 bool needs_stacktrace,
1577 intptr_t deopt_id, 1579 intptr_t deopt_id,
1578 bool should_restore_closure_context = false) 1580 bool should_restore_closure_context = false)
1579 : BlockEntryInstr(block_id, try_index), 1581 : BlockEntryInstr(block_id, try_index, deopt_id),
1580 graph_entry_(graph_entry), 1582 graph_entry_(graph_entry),
1581 predecessor_(NULL), 1583 predecessor_(NULL),
1582 catch_handler_types_(Array::ZoneHandle(handler_types.raw())), 1584 catch_handler_types_(Array::ZoneHandle(handler_types.raw())),
1583 catch_try_index_(catch_try_index), 1585 catch_try_index_(catch_try_index),
1584 exception_var_(exception_var), 1586 exception_var_(exception_var),
1585 stacktrace_var_(stacktrace_var), 1587 stacktrace_var_(stacktrace_var),
1586 needs_stacktrace_(needs_stacktrace), 1588 needs_stacktrace_(needs_stacktrace),
1587 should_restore_closure_context_(should_restore_closure_context), 1589 should_restore_closure_context_(should_restore_closure_context),
1588 handler_token_pos_(handler_token_pos), 1590 handler_token_pos_(handler_token_pos),
1589 is_generated_(is_generated) { 1591 is_generated_(is_generated) {}
1590 deopt_id_ = deopt_id;
1591 }
1592 1592
1593 DECLARE_INSTRUCTION(CatchBlockEntry) 1593 DECLARE_INSTRUCTION(CatchBlockEntry)
1594 1594
1595 virtual intptr_t PredecessorCount() const { 1595 virtual intptr_t PredecessorCount() const {
1596 return (predecessor_ == NULL) ? 0 : 1; 1596 return (predecessor_ == NULL) ? 0 : 1;
1597 } 1597 }
1598 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1598 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1599 ASSERT((index == 0) && (predecessor_ != NULL)); 1599 ASSERT((index == 0) && (predecessor_ != NULL));
1600 return predecessor_; 1600 return predecessor_;
1601 } 1601 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 }; 2096 };
2097 2097
2098 2098
2099 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 2099 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
2100 return PushArgumentAt(index)->value()->definition(); 2100 return PushArgumentAt(index)->value()->definition();
2101 } 2101 }
2102 2102
2103 2103
2104 class ReturnInstr : public TemplateInstruction<1, NoThrow> { 2104 class ReturnInstr : public TemplateInstruction<1, NoThrow> {
2105 public: 2105 public:
2106 ReturnInstr(TokenPosition token_pos, Value* value) 2106 ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id)
2107 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2107 : TemplateInstruction(deopt_id), token_pos_(token_pos) {
2108 token_pos_(token_pos) {
2109 SetInputAt(0, value); 2108 SetInputAt(0, value);
2110 } 2109 }
2111 2110
2112 DECLARE_INSTRUCTION(Return) 2111 DECLARE_INSTRUCTION(Return)
2113 2112
2114 virtual TokenPosition token_pos() const { return token_pos_; } 2113 virtual TokenPosition token_pos() const { return token_pos_; }
2115 Value* value() const { return inputs_[0]; } 2114 Value* value() const { return inputs_[0]; }
2116 2115
2117 virtual bool CanBecomeDeoptimizationTarget() const { 2116 virtual bool CanBecomeDeoptimizationTarget() const {
2118 // Return instruction might turn into a Goto instruction after inlining. 2117 // Return instruction might turn into a Goto instruction after inlining.
2119 // Every Goto must have an environment. 2118 // Every Goto must have an environment.
2120 return true; 2119 return true;
2121 } 2120 }
2122 2121
2123 virtual bool ComputeCanDeoptimize() const { return false; } 2122 virtual bool ComputeCanDeoptimize() const { return false; }
2124 2123
2125 virtual EffectSet Effects() const { return EffectSet::None(); } 2124 virtual EffectSet Effects() const { return EffectSet::None(); }
2126 2125
2127 private: 2126 private:
2128 const TokenPosition token_pos_; 2127 const TokenPosition token_pos_;
2129 2128
2130 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2129 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2131 }; 2130 };
2132 2131
2133 2132
2134 class ThrowInstr : public TemplateInstruction<0, Throws> { 2133 class ThrowInstr : public TemplateInstruction<0, Throws> {
2135 public: 2134 public:
2136 explicit ThrowInstr(TokenPosition token_pos) 2135 explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id)
2137 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2136 : TemplateInstruction(deopt_id), token_pos_(token_pos) {}
2138 token_pos_(token_pos) {}
2139 2137
2140 DECLARE_INSTRUCTION(Throw) 2138 DECLARE_INSTRUCTION(Throw)
2141 2139
2142 virtual intptr_t ArgumentCount() const { return 1; } 2140 virtual intptr_t ArgumentCount() const { return 1; }
2143 2141
2144 virtual TokenPosition token_pos() const { return token_pos_; } 2142 virtual TokenPosition token_pos() const { return token_pos_; }
2145 2143
2146 virtual bool ComputeCanDeoptimize() const { return true; } 2144 virtual bool ComputeCanDeoptimize() const { return true; }
2147 2145
2148 virtual EffectSet Effects() const { return EffectSet::None(); } 2146 virtual EffectSet Effects() const { return EffectSet::None(); }
2149 2147
2150 private: 2148 private:
2151 const TokenPosition token_pos_; 2149 const TokenPosition token_pos_;
2152 2150
2153 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2151 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2154 }; 2152 };
2155 2153
2156 2154
2157 class ReThrowInstr : public TemplateInstruction<0, Throws> { 2155 class ReThrowInstr : public TemplateInstruction<0, Throws> {
2158 public: 2156 public:
2159 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2157 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2160 // rethrow has been artificially generated by the parser. 2158 // rethrow has been artificially generated by the parser.
2161 ReThrowInstr(TokenPosition token_pos, intptr_t catch_try_index) 2159 ReThrowInstr(TokenPosition token_pos,
2162 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2160 intptr_t catch_try_index,
2161 intptr_t deopt_id)
2162 : TemplateInstruction(deopt_id),
2163 token_pos_(token_pos), 2163 token_pos_(token_pos),
2164 catch_try_index_(catch_try_index) {} 2164 catch_try_index_(catch_try_index) {}
2165 2165
2166 DECLARE_INSTRUCTION(ReThrow) 2166 DECLARE_INSTRUCTION(ReThrow)
2167 2167
2168 virtual intptr_t ArgumentCount() const { return 2; } 2168 virtual intptr_t ArgumentCount() const { return 2; }
2169 2169
2170 virtual TokenPosition token_pos() const { return token_pos_; } 2170 virtual TokenPosition token_pos() const { return token_pos_; }
2171 intptr_t catch_try_index() const { return catch_try_index_; } 2171 intptr_t catch_try_index() const { return catch_try_index_; }
2172 2172
(...skipping 29 matching lines...) Expand all
2202 2202
2203 private: 2203 private:
2204 const char* message_; 2204 const char* message_;
2205 2205
2206 DISALLOW_COPY_AND_ASSIGN(StopInstr); 2206 DISALLOW_COPY_AND_ASSIGN(StopInstr);
2207 }; 2207 };
2208 2208
2209 2209
2210 class GotoInstr : public TemplateInstruction<0, NoThrow> { 2210 class GotoInstr : public TemplateInstruction<0, NoThrow> {
2211 public: 2211 public:
2212 explicit GotoInstr(JoinEntryInstr* entry) 2212 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id)
2213 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 2213 : TemplateInstruction(deopt_id),
2214 block_(NULL), 2214 block_(NULL),
2215 successor_(entry), 2215 successor_(entry),
2216 edge_weight_(0.0), 2216 edge_weight_(0.0),
2217 parallel_move_(NULL) {} 2217 parallel_move_(NULL) {}
2218 2218
2219 DECLARE_INSTRUCTION(Goto) 2219 DECLARE_INSTRUCTION(Goto)
2220 2220
2221 BlockEntryInstr* block() const { return block_; } 2221 BlockEntryInstr* block() const { return block_; }
2222 void set_block(BlockEntryInstr* block) { block_ = block; } 2222 void set_block(BlockEntryInstr* block) { block_ = block; }
2223 2223
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 protected: 2416 protected:
2417 EmbeddedArray<Value*, N> inputs_; 2417 EmbeddedArray<Value*, N> inputs_;
2418 2418
2419 private: 2419 private:
2420 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 2420 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
2421 }; 2421 };
2422 2422
2423 2423
2424 class BranchInstr : public Instruction { 2424 class BranchInstr : public Instruction {
2425 public: 2425 public:
2426 explicit BranchInstr(ComparisonInstr* comparison) 2426 explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id)
2427 : Instruction(Thread::Current()->GetNextDeoptId()), 2427 : Instruction(deopt_id), comparison_(comparison), constant_target_(NULL) {
2428 comparison_(comparison),
2429 constant_target_(NULL) {
2430 ASSERT(comparison->env() == NULL); 2428 ASSERT(comparison->env() == NULL);
2431 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 2429 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
2432 comparison->InputAt(i)->set_instruction(this); 2430 comparison->InputAt(i)->set_instruction(this);
2433 } 2431 }
2434 } 2432 }
2435 2433
2436 DECLARE_INSTRUCTION(Branch) 2434 DECLARE_INSTRUCTION(Branch)
2437 2435
2438 virtual intptr_t ArgumentCount() const { 2436 virtual intptr_t ArgumentCount() const {
2439 return comparison()->ArgumentCount(); 2437 return comparison()->ArgumentCount();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 const TokenPosition token_pos_; 2696 const TokenPosition token_pos_;
2699 AbstractType& dst_type_; 2697 AbstractType& dst_type_;
2700 const String& dst_name_; 2698 const String& dst_name_;
2701 2699
2702 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2700 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2703 }; 2701 };
2704 2702
2705 2703
2706 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { 2704 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> {
2707 public: 2705 public:
2708 AssertBooleanInstr(TokenPosition token_pos, Value* value) 2706 AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id)
2709 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 2707 : TemplateDefinition(deopt_id), token_pos_(token_pos) {
2710 token_pos_(token_pos) {
2711 SetInputAt(0, value); 2708 SetInputAt(0, value);
2712 } 2709 }
2713 2710
2714 DECLARE_INSTRUCTION(AssertBoolean) 2711 DECLARE_INSTRUCTION(AssertBoolean)
2715 virtual CompileType ComputeType() const; 2712 virtual CompileType ComputeType() const;
2716 2713
2717 virtual TokenPosition token_pos() const { return token_pos_; } 2714 virtual TokenPosition token_pos() const { return token_pos_; }
2718 Value* value() const { return inputs_[0]; } 2715 Value* value() const { return inputs_[0]; }
2719 2716
2720 virtual bool ComputeCanDeoptimize() const { return true; } 2717 virtual bool ComputeCanDeoptimize() const { return true; }
2721 2718
2722 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2719 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2723 2720
2724 virtual bool AttributesEqual(Instruction* other) const { return true; } 2721 virtual bool AttributesEqual(Instruction* other) const { return true; }
2725 2722
2726 PRINT_OPERANDS_TO_SUPPORT 2723 PRINT_OPERANDS_TO_SUPPORT
2727 2724
2728 private: 2725 private:
2729 const TokenPosition token_pos_; 2726 const TokenPosition token_pos_;
2730 2727
2731 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2728 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2732 }; 2729 };
2733 2730
2734 2731
2735 // Denotes the current context, normally held in a register. This is 2732 // Denotes the current context, normally held in a register. This is
2736 // a computation, not a value, because it's mutable. 2733 // a computation, not a value, because it's mutable.
2737 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> { 2734 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> {
2738 public: 2735 public:
2739 CurrentContextInstr() 2736 explicit CurrentContextInstr(intptr_t deopt_id)
2740 : TemplateDefinition(Thread::Current()->GetNextDeoptId()) {} 2737 : TemplateDefinition(deopt_id) {}
2741 2738
2742 DECLARE_INSTRUCTION(CurrentContext) 2739 DECLARE_INSTRUCTION(CurrentContext)
2743 virtual CompileType ComputeType() const; 2740 virtual CompileType ComputeType() const;
2744 2741
2745 virtual bool ComputeCanDeoptimize() const { return false; } 2742 virtual bool ComputeCanDeoptimize() const { return false; }
2746 2743
2747 virtual EffectSet Effects() const { return EffectSet::None(); } 2744 virtual EffectSet Effects() const { return EffectSet::None(); }
2748 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2745 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2749 virtual bool AttributesEqual(Instruction* other) const { return true; } 2746 virtual bool AttributesEqual(Instruction* other) const { return true; }
2750 2747
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 TokenPosition token_pos_; 2810 TokenPosition token_pos_;
2814 2811
2815 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); 2812 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall);
2816 }; 2813 };
2817 2814
2818 2815
2819 class ClosureCallInstr : public TemplateDartCall<1> { 2816 class ClosureCallInstr : public TemplateDartCall<1> {
2820 public: 2817 public:
2821 ClosureCallInstr(Value* function, 2818 ClosureCallInstr(Value* function,
2822 ClosureCallNode* node, 2819 ClosureCallNode* node,
2823 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2820 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2824 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2821 intptr_t deopt_id)
2822 : TemplateDartCall(deopt_id,
2825 node->arguments()->type_args_len(), 2823 node->arguments()->type_args_len(),
2826 node->arguments()->names(), 2824 node->arguments()->names(),
2827 arguments, 2825 arguments,
2828 node->token_pos()) { 2826 node->token_pos()) {
2829 ASSERT(!arguments->is_empty()); 2827 ASSERT(!arguments->is_empty());
2830 SetInputAt(0, function); 2828 SetInputAt(0, function);
2831 } 2829 }
2832 2830
2833 ClosureCallInstr(Value* function, 2831 ClosureCallInstr(Value* function,
2834 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2832 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2835 intptr_t type_args_len, 2833 intptr_t type_args_len,
2836 const Array& argument_names, 2834 const Array& argument_names,
2837 TokenPosition token_pos) 2835 TokenPosition token_pos,
2838 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2836 intptr_t deopt_id)
2837 : TemplateDartCall(deopt_id,
2839 type_args_len, 2838 type_args_len,
2840 argument_names, 2839 argument_names,
2841 arguments, 2840 arguments,
2842 token_pos) { 2841 token_pos) {
2843 ASSERT(!arguments->is_empty()); 2842 ASSERT(!arguments->is_empty());
2844 SetInputAt(0, function); 2843 SetInputAt(0, function);
2845 } 2844 }
2846 2845
2847 DECLARE_INSTRUCTION(ClosureCall) 2846 DECLARE_INSTRUCTION(ClosureCall)
2848 2847
(...skipping 13 matching lines...) Expand all
2862 2861
2863 class InstanceCallInstr : public TemplateDartCall<0> { 2862 class InstanceCallInstr : public TemplateDartCall<0> {
2864 public: 2863 public:
2865 InstanceCallInstr(TokenPosition token_pos, 2864 InstanceCallInstr(TokenPosition token_pos,
2866 const String& function_name, 2865 const String& function_name,
2867 Token::Kind token_kind, 2866 Token::Kind token_kind,
2868 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2867 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2869 intptr_t type_args_len, 2868 intptr_t type_args_len,
2870 const Array& argument_names, 2869 const Array& argument_names,
2871 intptr_t checked_argument_count, 2870 intptr_t checked_argument_count,
2872 const ZoneGrowableArray<const ICData*>& ic_data_array) 2871 const ZoneGrowableArray<const ICData*>& ic_data_array,
2873 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 2872 intptr_t deopt_id)
2873 : TemplateDartCall(deopt_id,
2874 type_args_len, 2874 type_args_len,
2875 argument_names, 2875 argument_names,
2876 arguments, 2876 arguments,
2877 token_pos), 2877 token_pos),
2878 ic_data_(NULL), 2878 ic_data_(NULL),
2879 function_name_(function_name), 2879 function_name_(function_name),
2880 token_kind_(token_kind), 2880 token_kind_(token_kind),
2881 checked_argument_count_(checked_argument_count), 2881 checked_argument_count_(checked_argument_count),
2882 has_unique_selector_(false) { 2882 has_unique_selector_(false) {
2883 ic_data_ = GetICData(ic_data_array); 2883 ic_data_ = GetICData(ic_data_array);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 3018 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
3019 }; 3019 };
3020 3020
3021 3021
3022 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3022 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3023 public: 3023 public:
3024 StrictCompareInstr(TokenPosition token_pos, 3024 StrictCompareInstr(TokenPosition token_pos,
3025 Token::Kind kind, 3025 Token::Kind kind,
3026 Value* left, 3026 Value* left,
3027 Value* right, 3027 Value* right,
3028 bool needs_number_check); 3028 bool needs_number_check,
3029 intptr_t deopt_id);
3029 3030
3030 DECLARE_INSTRUCTION(StrictCompare) 3031 DECLARE_INSTRUCTION(StrictCompare)
3031 3032
3032 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3033 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3033 3034
3034 virtual CompileType ComputeType() const; 3035 virtual CompileType ComputeType() const;
3035 3036
3036 virtual bool ComputeCanDeoptimize() const { return false; } 3037 virtual bool ComputeCanDeoptimize() const { return false; }
3037 3038
3038 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3039 virtual Definition* Canonicalize(FlowGraph* flow_graph);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 3231
3231 private: 3232 private:
3232 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 3233 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
3233 }; 3234 };
3234 3235
3235 3236
3236 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 3237 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
3237 // materialization of true and false constants. 3238 // materialization of true and false constants.
3238 class IfThenElseInstr : public Definition { 3239 class IfThenElseInstr : public Definition {
3239 public: 3240 public:
3240 IfThenElseInstr(ComparisonInstr* comparison, Value* if_true, Value* if_false) 3241 IfThenElseInstr(ComparisonInstr* comparison,
3241 : Definition(Thread::Current()->GetNextDeoptId()), 3242 Value* if_true,
3243 Value* if_false,
3244 intptr_t deopt_id)
3245 : Definition(deopt_id),
3242 comparison_(comparison), 3246 comparison_(comparison),
3243 if_true_(Smi::Cast(if_true->BoundConstant()).Value()), 3247 if_true_(Smi::Cast(if_true->BoundConstant()).Value()),
3244 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) { 3248 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) {
3245 // Adjust uses at the comparison. 3249 // Adjust uses at the comparison.
3246 ASSERT(comparison->env() == NULL); 3250 ASSERT(comparison->env() == NULL);
3247 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 3251 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
3248 comparison->InputAt(i)->set_instruction(this); 3252 comparison->InputAt(i)->set_instruction(this);
3249 } 3253 }
3250 } 3254 }
3251 3255
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 }; 3317 };
3314 3318
3315 3319
3316 class StaticCallInstr : public TemplateDartCall<0> { 3320 class StaticCallInstr : public TemplateDartCall<0> {
3317 public: 3321 public:
3318 StaticCallInstr(TokenPosition token_pos, 3322 StaticCallInstr(TokenPosition token_pos,
3319 const Function& function, 3323 const Function& function,
3320 intptr_t type_args_len, 3324 intptr_t type_args_len,
3321 const Array& argument_names, 3325 const Array& argument_names,
3322 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3326 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3323 const ZoneGrowableArray<const ICData*>& ic_data_array) 3327 const ZoneGrowableArray<const ICData*>& ic_data_array,
3324 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), 3328 intptr_t deopt_id)
3329 : TemplateDartCall(deopt_id,
3325 type_args_len, 3330 type_args_len,
3326 argument_names, 3331 argument_names,
3327 arguments, 3332 arguments,
3328 token_pos), 3333 token_pos),
3329 ic_data_(NULL), 3334 ic_data_(NULL),
3330 function_(function), 3335 function_(function),
3331 result_cid_(kDynamicCid), 3336 result_cid_(kDynamicCid),
3332 is_known_list_constructor_(false), 3337 is_known_list_constructor_(false),
3333 identity_(AliasIdentity::Unknown()) { 3338 identity_(AliasIdentity::Unknown()) {
3334 ic_data_ = GetICData(ic_data_array); 3339 ic_data_ = GetICData(ic_data_array);
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 4019
4015 private: 4020 private:
4016 const intptr_t cid_; 4021 const intptr_t cid_;
4017 4022
4018 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); 4023 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr);
4019 }; 4024 };
4020 4025
4021 4026
4022 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { 4027 class StringInterpolateInstr : public TemplateDefinition<1, Throws> {
4023 public: 4028 public:
4024 StringInterpolateInstr(Value* value, TokenPosition token_pos) 4029 StringInterpolateInstr(Value* value,
4025 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4030 TokenPosition token_pos,
4031 intptr_t deopt_id)
4032 : TemplateDefinition(deopt_id),
4026 token_pos_(token_pos), 4033 token_pos_(token_pos),
4027 function_(Function::ZoneHandle()) { 4034 function_(Function::ZoneHandle()) {
4028 SetInputAt(0, value); 4035 SetInputAt(0, value);
4029 } 4036 }
4030 4037
4031 Value* value() const { return inputs_[0]; } 4038 Value* value() const { return inputs_[0]; }
4032 virtual TokenPosition token_pos() const { return token_pos_; } 4039 virtual TokenPosition token_pos() const { return token_pos_; }
4033 4040
4034 virtual CompileType ComputeType() const; 4041 virtual CompileType ComputeType() const;
4035 // Issues a static call to Dart code which calls toString on objects. 4042 // Issues a static call to Dart code which calls toString on objects.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 bool registers_remapped_; 4357 bool registers_remapped_;
4351 4358
4352 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4359 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4353 }; 4360 };
4354 4361
4355 4362
4356 class CreateArrayInstr : public TemplateDefinition<2, Throws> { 4363 class CreateArrayInstr : public TemplateDefinition<2, Throws> {
4357 public: 4364 public:
4358 CreateArrayInstr(TokenPosition token_pos, 4365 CreateArrayInstr(TokenPosition token_pos,
4359 Value* element_type, 4366 Value* element_type,
4360 Value* num_elements) 4367 Value* num_elements,
4361 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4368 intptr_t deopt_id)
4369 : TemplateDefinition(deopt_id),
4362 token_pos_(token_pos), 4370 token_pos_(token_pos),
4363 identity_(AliasIdentity::Unknown()) { 4371 identity_(AliasIdentity::Unknown()) {
4364 SetInputAt(kElementTypePos, element_type); 4372 SetInputAt(kElementTypePos, element_type);
4365 SetInputAt(kLengthPos, num_elements); 4373 SetInputAt(kLengthPos, num_elements);
4366 } 4374 }
4367 4375
4368 enum { kElementTypePos = 0, kLengthPos = 1 }; 4376 enum { kElementTypePos = 0, kLengthPos = 1 };
4369 4377
4370 DECLARE_INSTRUCTION(CreateArray) 4378 DECLARE_INSTRUCTION(CreateArray)
4371 virtual CompileType ComputeType() const; 4379 virtual CompileType ComputeType() const;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4552 4560
4553 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4561 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4554 }; 4562 };
4555 4563
4556 4564
4557 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { 4565 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> {
4558 public: 4566 public:
4559 InstantiateTypeInstr(TokenPosition token_pos, 4567 InstantiateTypeInstr(TokenPosition token_pos,
4560 const AbstractType& type, 4568 const AbstractType& type,
4561 Value* instantiator_type_arguments, 4569 Value* instantiator_type_arguments,
4562 Value* function_type_arguments) 4570 Value* function_type_arguments,
4563 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4571 intptr_t deopt_id)
4564 token_pos_(token_pos), 4572 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) {
4565 type_(type) {
4566 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); 4573 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle());
4567 SetInputAt(0, instantiator_type_arguments); 4574 SetInputAt(0, instantiator_type_arguments);
4568 SetInputAt(1, function_type_arguments); 4575 SetInputAt(1, function_type_arguments);
4569 } 4576 }
4570 4577
4571 DECLARE_INSTRUCTION(InstantiateType) 4578 DECLARE_INSTRUCTION(InstantiateType)
4572 4579
4573 Value* instantiator_type_arguments() const { return inputs_[0]; } 4580 Value* instantiator_type_arguments() const { return inputs_[0]; }
4574 Value* function_type_arguments() const { return inputs_[1]; } 4581 Value* function_type_arguments() const { return inputs_[1]; }
4575 const AbstractType& type() const { return type_; } 4582 const AbstractType& type() const { return type_; }
(...skipping 12 matching lines...) Expand all
4588 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4595 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4589 }; 4596 };
4590 4597
4591 4598
4592 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { 4599 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> {
4593 public: 4600 public:
4594 InstantiateTypeArgumentsInstr(TokenPosition token_pos, 4601 InstantiateTypeArgumentsInstr(TokenPosition token_pos,
4595 const TypeArguments& type_arguments, 4602 const TypeArguments& type_arguments,
4596 const Class& instantiator_class, 4603 const Class& instantiator_class,
4597 Value* instantiator_type_arguments, 4604 Value* instantiator_type_arguments,
4598 Value* function_type_arguments) 4605 Value* function_type_arguments,
4599 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4606 intptr_t deopt_id)
4607 : TemplateDefinition(deopt_id),
4600 token_pos_(token_pos), 4608 token_pos_(token_pos),
4601 type_arguments_(type_arguments), 4609 type_arguments_(type_arguments),
4602 instantiator_class_(instantiator_class) { 4610 instantiator_class_(instantiator_class) {
4603 ASSERT(type_arguments.IsZoneHandle()); 4611 ASSERT(type_arguments.IsZoneHandle());
4604 SetInputAt(0, instantiator_type_arguments); 4612 SetInputAt(0, instantiator_type_arguments);
4605 SetInputAt(1, function_type_arguments); 4613 SetInputAt(1, function_type_arguments);
4606 } 4614 }
4607 4615
4608 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4616 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4609 4617
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4650 private: 4658 private:
4651 const TokenPosition token_pos_; 4659 const TokenPosition token_pos_;
4652 const intptr_t num_context_variables_; 4660 const intptr_t num_context_variables_;
4653 4661
4654 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4662 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4655 }; 4663 };
4656 4664
4657 4665
4658 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { 4666 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> {
4659 public: 4667 public:
4660 InitStaticFieldInstr(Value* input, const Field& field) 4668 InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id)
4661 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 4669 : TemplateInstruction(deopt_id), field_(field) {
4662 field_(field) {
4663 SetInputAt(0, input); 4670 SetInputAt(0, input);
4664 CheckField(field); 4671 CheckField(field);
4665 } 4672 }
4666 4673
4667 virtual TokenPosition token_pos() const { return field_.token_pos(); } 4674 virtual TokenPosition token_pos() const { return field_.token_pos(); }
4668 const Field& field() const { return field_; } 4675 const Field& field() const { return field_; }
4669 4676
4670 DECLARE_INSTRUCTION(InitStaticField) 4677 DECLARE_INSTRUCTION(InitStaticField)
4671 4678
4672 virtual bool ComputeCanDeoptimize() const { return true; } 4679 virtual bool ComputeCanDeoptimize() const { return true; }
4673 virtual EffectSet Effects() const { return EffectSet::All(); } 4680 virtual EffectSet Effects() const { return EffectSet::All(); }
4674 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 4681 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
4675 4682
4676 private: 4683 private:
4677 const Field& field_; 4684 const Field& field_;
4678 4685
4679 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); 4686 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr);
4680 }; 4687 };
4681 4688
4682 4689
4683 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { 4690 class CloneContextInstr : public TemplateDefinition<1, NoThrow> {
4684 public: 4691 public:
4685 CloneContextInstr(TokenPosition token_pos, Value* context_value) 4692 CloneContextInstr(TokenPosition token_pos,
4686 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), 4693 Value* context_value,
4687 token_pos_(token_pos) { 4694 intptr_t deopt_id)
4695 : TemplateDefinition(deopt_id), token_pos_(token_pos) {
4688 SetInputAt(0, context_value); 4696 SetInputAt(0, context_value);
4689 } 4697 }
4690 4698
4691 virtual TokenPosition token_pos() const { return token_pos_; } 4699 virtual TokenPosition token_pos() const { return token_pos_; }
4692 Value* context_value() const { return inputs_[0]; } 4700 Value* context_value() const { return inputs_[0]; }
4693 4701
4694 DECLARE_INSTRUCTION(CloneContext) 4702 DECLARE_INSTRUCTION(CloneContext)
4695 virtual CompileType ComputeType() const; 4703 virtual CompileType ComputeType() const;
4696 4704
4697 virtual bool ComputeCanDeoptimize() const { return true; } 4705 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
7197 7205
7198 private: 7206 private:
7199 const Token::Kind op_kind_; 7207 const Token::Kind op_kind_;
7200 7208
7201 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 7209 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7202 }; 7210 };
7203 7211
7204 7212
7205 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { 7213 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> {
7206 public: 7214 public:
7207 CheckStackOverflowInstr(TokenPosition token_pos, intptr_t loop_depth) 7215 CheckStackOverflowInstr(TokenPosition token_pos,
7208 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), 7216 intptr_t loop_depth,
7217 intptr_t deopt_id)
7218 : TemplateInstruction(deopt_id),
7209 token_pos_(token_pos), 7219 token_pos_(token_pos),
7210 loop_depth_(loop_depth) {} 7220 loop_depth_(loop_depth) {}
7211 7221
7212 virtual TokenPosition token_pos() const { return token_pos_; } 7222 virtual TokenPosition token_pos() const { return token_pos_; }
7213 bool in_loop() const { return loop_depth_ > 0; } 7223 bool in_loop() const { return loop_depth_ > 0; }
7214 intptr_t loop_depth() const { return loop_depth_; } 7224 intptr_t loop_depth() const { return loop_depth_; }
7215 7225
7216 DECLARE_INSTRUCTION(CheckStackOverflow) 7226 DECLARE_INSTRUCTION(CheckStackOverflow)
7217 7227
7218 virtual bool ComputeCanDeoptimize() const { return true; } 7228 virtual bool ComputeCanDeoptimize() const { return true; }
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
8214 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8224 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8215 UNIMPLEMENTED(); \ 8225 UNIMPLEMENTED(); \
8216 return NULL; \ 8226 return NULL; \
8217 } \ 8227 } \
8218 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8228 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8219 8229
8220 8230
8221 } // namespace dart 8231 } // namespace dart
8222 8232
8223 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8233 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698