OLD | NEW |
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 VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
11 #include "vm/handles_impl.h" | 11 #include "vm/handles_impl.h" |
12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
13 #include "vm/method_recognizer.h" | 13 #include "vm/method_recognizer.h" |
14 #include "vm/object.h" | 14 #include "vm/object.h" |
15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/token_descriptor.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 | 19 |
19 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 20 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
20 | 21 |
21 class BitVector; | 22 class BitVector; |
22 class BlockEntryInstr; | 23 class BlockEntryInstr; |
23 class BoxIntegerInstr; | 24 class BoxIntegerInstr; |
24 class BufferFormatter; | 25 class BufferFormatter; |
25 class CatchBlockEntryInstr; | 26 class CatchBlockEntryInstr; |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 virtual Tag tag() const = 0; | 621 virtual Tag tag() const = 0; |
621 | 622 |
622 intptr_t deopt_id() const { | 623 intptr_t deopt_id() const { |
623 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget()); | 624 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget()); |
624 return GetDeoptId(); | 625 return GetDeoptId(); |
625 } | 626 } |
626 | 627 |
627 const ICData* GetICData( | 628 const ICData* GetICData( |
628 const ZoneGrowableArray<const ICData*>& ic_data_array) const; | 629 const ZoneGrowableArray<const ICData*>& ic_data_array) const; |
629 | 630 |
630 virtual intptr_t token_pos() const { return Token::kNoSourcePos; } | 631 virtual TokenDescriptor token_pos() const { |
| 632 return TokenDescriptor::kNoSource; |
| 633 } |
631 | 634 |
632 virtual intptr_t InputCount() const = 0; | 635 virtual intptr_t InputCount() const = 0; |
633 virtual Value* InputAt(intptr_t i) const = 0; | 636 virtual Value* InputAt(intptr_t i) const = 0; |
634 void SetInputAt(intptr_t i, Value* value) { | 637 void SetInputAt(intptr_t i, Value* value) { |
635 ASSERT(value != NULL); | 638 ASSERT(value != NULL); |
636 value->set_instruction(this); | 639 value->set_instruction(this); |
637 value->set_use_index(i); | 640 value->set_use_index(i); |
638 RawSetInputAt(i, value); | 641 RawSetInputAt(i, value); |
639 } | 642 } |
640 | 643 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 } | 1049 } |
1047 | 1050 |
1048 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } | 1051 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } |
1049 | 1052 |
1050 intptr_t NumMoves() const { return moves_.length(); } | 1053 intptr_t NumMoves() const { return moves_.length(); } |
1051 | 1054 |
1052 bool IsRedundant() const; | 1055 bool IsRedundant() const; |
1053 | 1056 |
1054 virtual void PrintTo(BufferFormatter* f) const; | 1057 virtual void PrintTo(BufferFormatter* f) const; |
1055 | 1058 |
1056 virtual intptr_t token_pos() const { | 1059 virtual TokenDescriptor token_pos() const { |
1057 return ClassifyingTokenPositions::kParallelMove; | 1060 return TokenDescriptor::kParallelMove; |
1058 } | 1061 } |
1059 | 1062 |
1060 private: | 1063 private: |
1061 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. | 1064 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. |
1062 | 1065 |
1063 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); | 1066 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); |
1064 }; | 1067 }; |
1065 | 1068 |
1066 | 1069 |
1067 // Basic block entries are administrative nodes. There is a distinguished | 1070 // Basic block entries are administrative nodes. There is a distinguished |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 | 1185 |
1183 BitVector* loop_info() const { return loop_info_; } | 1186 BitVector* loop_info() const { return loop_info_; } |
1184 void set_loop_info(BitVector* loop_info) { | 1187 void set_loop_info(BitVector* loop_info) { |
1185 loop_info_ = loop_info; | 1188 loop_info_ = loop_info; |
1186 } | 1189 } |
1187 | 1190 |
1188 virtual BlockEntryInstr* GetBlock() { | 1191 virtual BlockEntryInstr* GetBlock() { |
1189 return this; | 1192 return this; |
1190 } | 1193 } |
1191 | 1194 |
1192 virtual intptr_t token_pos() const { | 1195 virtual TokenDescriptor token_pos() const { |
1193 return ClassifyingTokenPositions::kControlFlow; | 1196 return TokenDescriptor::kControlFlow; |
1194 } | 1197 } |
1195 | 1198 |
1196 // Helper to mutate the graph during inlining. This block should be | 1199 // Helper to mutate the graph during inlining. This block should be |
1197 // replaced with new_block as a predecessor of all of this block's | 1200 // replaced with new_block as a predecessor of all of this block's |
1198 // successors. | 1201 // successors. |
1199 void ReplaceAsPredecessorWith(BlockEntryInstr* new_block); | 1202 void ReplaceAsPredecessorWith(BlockEntryInstr* new_block); |
1200 | 1203 |
1201 void set_block_id(intptr_t block_id) { block_id_ = block_id; } | 1204 void set_block_id(intptr_t block_id) { block_id_ = block_id; } |
1202 | 1205 |
1203 intptr_t offset() const { return offset_; } | 1206 intptr_t offset() const { return offset_; } |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 virtual CompileType ComputeType() const; | 2038 virtual CompileType ComputeType() const; |
2036 | 2039 |
2037 Value* value() const { return InputAt(0); } | 2040 Value* value() const { return InputAt(0); } |
2038 | 2041 |
2039 virtual bool CanDeoptimize() const { return false; } | 2042 virtual bool CanDeoptimize() const { return false; } |
2040 | 2043 |
2041 virtual EffectSet Effects() const { return EffectSet::None(); } | 2044 virtual EffectSet Effects() const { return EffectSet::None(); } |
2042 | 2045 |
2043 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2046 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2044 | 2047 |
2045 virtual intptr_t token_pos() const { | 2048 virtual TokenDescriptor token_pos() const { |
2046 return ClassifyingTokenPositions::kPushArgument; | 2049 return TokenDescriptor::kPushArgument; |
2047 } | 2050 } |
2048 | 2051 |
2049 private: | 2052 private: |
2050 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2053 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
2051 }; | 2054 }; |
2052 | 2055 |
2053 | 2056 |
2054 inline Definition* Instruction::ArgumentAt(intptr_t index) const { | 2057 inline Definition* Instruction::ArgumentAt(intptr_t index) const { |
2055 return PushArgumentAt(index)->value()->definition(); | 2058 return PushArgumentAt(index)->value()->definition(); |
2056 } | 2059 } |
2057 | 2060 |
2058 | 2061 |
2059 class ReturnInstr : public TemplateInstruction<1, NoThrow> { | 2062 class ReturnInstr : public TemplateInstruction<1, NoThrow> { |
2060 public: | 2063 public: |
2061 ReturnInstr(intptr_t token_pos, Value* value) | 2064 ReturnInstr(TokenDescriptor token_pos, Value* value) |
2062 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), | 2065 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), |
2063 token_pos_(token_pos) { | 2066 token_pos_(token_pos) { |
2064 SetInputAt(0, value); | 2067 SetInputAt(0, value); |
2065 } | 2068 } |
2066 | 2069 |
2067 DECLARE_INSTRUCTION(Return) | 2070 DECLARE_INSTRUCTION(Return) |
2068 | 2071 |
2069 virtual intptr_t token_pos() const { return token_pos_; } | 2072 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2070 Value* value() const { return inputs_[0]; } | 2073 Value* value() const { return inputs_[0]; } |
2071 | 2074 |
2072 virtual bool CanBecomeDeoptimizationTarget() const { | 2075 virtual bool CanBecomeDeoptimizationTarget() const { |
2073 // Return instruction might turn into a Goto instruction after inlining. | 2076 // Return instruction might turn into a Goto instruction after inlining. |
2074 // Every Goto must have an environment. | 2077 // Every Goto must have an environment. |
2075 return true; | 2078 return true; |
2076 } | 2079 } |
2077 | 2080 |
2078 virtual bool CanDeoptimize() const { return false; } | 2081 virtual bool CanDeoptimize() const { return false; } |
2079 | 2082 |
2080 virtual EffectSet Effects() const { return EffectSet::None(); } | 2083 virtual EffectSet Effects() const { return EffectSet::None(); } |
2081 | 2084 |
2082 private: | 2085 private: |
2083 const intptr_t token_pos_; | 2086 const TokenDescriptor token_pos_; |
2084 | 2087 |
2085 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 2088 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
2086 }; | 2089 }; |
2087 | 2090 |
2088 | 2091 |
2089 class ThrowInstr : public TemplateInstruction<0, Throws> { | 2092 class ThrowInstr : public TemplateInstruction<0, Throws> { |
2090 public: | 2093 public: |
2091 explicit ThrowInstr(intptr_t token_pos) | 2094 explicit ThrowInstr(TokenDescriptor token_pos) |
2092 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), | 2095 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), |
2093 token_pos_(token_pos) { | 2096 token_pos_(token_pos) { |
2094 } | 2097 } |
2095 | 2098 |
2096 DECLARE_INSTRUCTION(Throw) | 2099 DECLARE_INSTRUCTION(Throw) |
2097 | 2100 |
2098 virtual intptr_t ArgumentCount() const { return 1; } | 2101 virtual intptr_t ArgumentCount() const { return 1; } |
2099 | 2102 |
2100 virtual intptr_t token_pos() const { return token_pos_; } | 2103 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2101 | 2104 |
2102 virtual bool CanDeoptimize() const { return true; } | 2105 virtual bool CanDeoptimize() const { return true; } |
2103 | 2106 |
2104 virtual EffectSet Effects() const { return EffectSet::None(); } | 2107 virtual EffectSet Effects() const { return EffectSet::None(); } |
2105 | 2108 |
2106 private: | 2109 private: |
2107 const intptr_t token_pos_; | 2110 const TokenDescriptor token_pos_; |
2108 | 2111 |
2109 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 2112 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
2110 }; | 2113 }; |
2111 | 2114 |
2112 | 2115 |
2113 class ReThrowInstr : public TemplateInstruction<0, Throws> { | 2116 class ReThrowInstr : public TemplateInstruction<0, Throws> { |
2114 public: | 2117 public: |
2115 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the | 2118 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the |
2116 // rethrow has been artifically generated by the parser. | 2119 // rethrow has been artifically generated by the parser. |
2117 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index) | 2120 ReThrowInstr(TokenDescriptor token_pos, intptr_t catch_try_index) |
2118 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), | 2121 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), |
2119 token_pos_(token_pos), | 2122 token_pos_(token_pos), |
2120 catch_try_index_(catch_try_index) { | 2123 catch_try_index_(catch_try_index) { |
2121 } | 2124 } |
2122 | 2125 |
2123 DECLARE_INSTRUCTION(ReThrow) | 2126 DECLARE_INSTRUCTION(ReThrow) |
2124 | 2127 |
2125 virtual intptr_t ArgumentCount() const { return 2; } | 2128 virtual intptr_t ArgumentCount() const { return 2; } |
2126 | 2129 |
2127 virtual intptr_t token_pos() const { return token_pos_; } | 2130 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2128 intptr_t catch_try_index() const { return catch_try_index_; } | 2131 intptr_t catch_try_index() const { return catch_try_index_; } |
2129 | 2132 |
2130 virtual bool CanDeoptimize() const { return true; } | 2133 virtual bool CanDeoptimize() const { return true; } |
2131 | 2134 |
2132 virtual EffectSet Effects() const { return EffectSet::None(); } | 2135 virtual EffectSet Effects() const { return EffectSet::None(); } |
2133 | 2136 |
2134 private: | 2137 private: |
2135 const intptr_t token_pos_; | 2138 const TokenDescriptor token_pos_; |
2136 const intptr_t catch_try_index_; | 2139 const intptr_t catch_try_index_; |
2137 | 2140 |
2138 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 2141 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
2139 }; | 2142 }; |
2140 | 2143 |
2141 | 2144 |
2142 class StopInstr : public TemplateInstruction<0, NoThrow> { | 2145 class StopInstr : public TemplateInstruction<0, NoThrow> { |
2143 public: | 2146 public: |
2144 explicit StopInstr(const char* message) | 2147 explicit StopInstr(const char* message) |
2145 : message_(message) { | 2148 : message_(message) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 | 2216 |
2214 ParallelMoveInstr* GetParallelMove() { | 2217 ParallelMoveInstr* GetParallelMove() { |
2215 if (parallel_move_ == NULL) { | 2218 if (parallel_move_ == NULL) { |
2216 parallel_move_ = new ParallelMoveInstr(); | 2219 parallel_move_ = new ParallelMoveInstr(); |
2217 } | 2220 } |
2218 return parallel_move_; | 2221 return parallel_move_; |
2219 } | 2222 } |
2220 | 2223 |
2221 virtual void PrintTo(BufferFormatter* f) const; | 2224 virtual void PrintTo(BufferFormatter* f) const; |
2222 | 2225 |
2223 virtual intptr_t token_pos() const { | 2226 virtual TokenDescriptor token_pos() const { |
2224 return ClassifyingTokenPositions::kControlFlow; | 2227 return TokenDescriptor::kControlFlow; |
2225 } | 2228 } |
2226 | 2229 |
2227 private: | 2230 private: |
2228 BlockEntryInstr* block_; | 2231 BlockEntryInstr* block_; |
2229 JoinEntryInstr* successor_; | 2232 JoinEntryInstr* successor_; |
2230 double edge_weight_; | 2233 double edge_weight_; |
2231 | 2234 |
2232 // Parallel move that will be used by linear scan register allocator to | 2235 // Parallel move that will be used by linear scan register allocator to |
2233 // connect live ranges at the end of the block and resolve phis. | 2236 // connect live ranges at the end of the block and resolve phis. |
2234 ParallelMoveInstr* parallel_move_; | 2237 ParallelMoveInstr* parallel_move_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 GrowableArray<TargetEntryInstr*> successors_; | 2293 GrowableArray<TargetEntryInstr*> successors_; |
2291 TypedData& offsets_; | 2294 TypedData& offsets_; |
2292 }; | 2295 }; |
2293 | 2296 |
2294 | 2297 |
2295 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { | 2298 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { |
2296 public: | 2299 public: |
2297 Value* left() const { return inputs_[0]; } | 2300 Value* left() const { return inputs_[0]; } |
2298 Value* right() const { return inputs_[1]; } | 2301 Value* right() const { return inputs_[1]; } |
2299 | 2302 |
2300 virtual intptr_t token_pos() const { return token_pos_; } | 2303 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2301 Token::Kind kind() const { return kind_; } | 2304 Token::Kind kind() const { return kind_; } |
2302 | 2305 |
2303 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; | 2306 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; |
2304 | 2307 |
2305 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 2308 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
2306 BranchInstr* branch) = 0; | 2309 BranchInstr* branch) = 0; |
2307 | 2310 |
2308 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, | 2311 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
2309 BranchLabels labels) = 0; | 2312 BranchLabels labels) = 0; |
2310 | 2313 |
(...skipping 14 matching lines...) Expand all Loading... |
2325 | 2328 |
2326 virtual bool AttributesEqual(Instruction* other) const { | 2329 virtual bool AttributesEqual(Instruction* other) const { |
2327 ComparisonInstr* other_comparison = other->AsComparison(); | 2330 ComparisonInstr* other_comparison = other->AsComparison(); |
2328 return kind() == other_comparison->kind() && | 2331 return kind() == other_comparison->kind() && |
2329 (operation_cid() == other_comparison->operation_cid()); | 2332 (operation_cid() == other_comparison->operation_cid()); |
2330 } | 2333 } |
2331 | 2334 |
2332 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison) | 2335 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison) |
2333 | 2336 |
2334 protected: | 2337 protected: |
2335 ComparisonInstr(intptr_t token_pos, | 2338 ComparisonInstr(TokenDescriptor token_pos, |
2336 Token::Kind kind, | 2339 Token::Kind kind, |
2337 Value* left, | 2340 Value* left, |
2338 Value* right, | 2341 Value* right, |
2339 intptr_t deopt_id = Thread::kNoDeoptId) | 2342 intptr_t deopt_id = Thread::kNoDeoptId) |
2340 : TemplateDefinition(deopt_id), | 2343 : TemplateDefinition(deopt_id), |
2341 token_pos_(token_pos), | 2344 token_pos_(token_pos), |
2342 kind_(kind), | 2345 kind_(kind), |
2343 operation_cid_(kIllegalCid) { | 2346 operation_cid_(kIllegalCid) { |
2344 SetInputAt(0, left); | 2347 SetInputAt(0, left); |
2345 if (right != NULL) { | 2348 if (right != NULL) { |
2346 SetInputAt(1, right); | 2349 SetInputAt(1, right); |
2347 } | 2350 } |
2348 } | 2351 } |
2349 | 2352 |
2350 private: | 2353 private: |
2351 const intptr_t token_pos_; | 2354 const TokenDescriptor token_pos_; |
2352 Token::Kind kind_; | 2355 Token::Kind kind_; |
2353 intptr_t operation_cid_; // Set by optimizer. | 2356 intptr_t operation_cid_; // Set by optimizer. |
2354 | 2357 |
2355 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); | 2358 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); |
2356 }; | 2359 }; |
2357 | 2360 |
2358 | 2361 |
2359 class BranchInstr : public Instruction { | 2362 class BranchInstr : public Instruction { |
2360 public: | 2363 public: |
2361 explicit BranchInstr(ComparisonInstr* comparison) | 2364 explicit BranchInstr(ComparisonInstr* comparison) |
(...skipping 11 matching lines...) Expand all Loading... |
2373 DECLARE_INSTRUCTION(Branch) | 2376 DECLARE_INSTRUCTION(Branch) |
2374 | 2377 |
2375 virtual intptr_t ArgumentCount() const { | 2378 virtual intptr_t ArgumentCount() const { |
2376 return comparison()->ArgumentCount(); | 2379 return comparison()->ArgumentCount(); |
2377 } | 2380 } |
2378 | 2381 |
2379 intptr_t InputCount() const { return comparison()->InputCount(); } | 2382 intptr_t InputCount() const { return comparison()->InputCount(); } |
2380 | 2383 |
2381 Value* InputAt(intptr_t i) const { return comparison()->InputAt(i); } | 2384 Value* InputAt(intptr_t i) const { return comparison()->InputAt(i); } |
2382 | 2385 |
2383 virtual intptr_t token_pos() const { return comparison_->token_pos(); } | 2386 virtual TokenDescriptor token_pos() const { return comparison_->token_pos(); } |
2384 | 2387 |
2385 virtual bool CanDeoptimize() const { | 2388 virtual bool CanDeoptimize() const { |
2386 // Branches need a deoptimization info in checked mode if they | 2389 // Branches need a deoptimization info in checked mode if they |
2387 // can throw a type check error. | 2390 // can throw a type check error. |
2388 return comparison()->CanDeoptimize() || is_checked(); | 2391 return comparison()->CanDeoptimize() || is_checked(); |
2389 } | 2392 } |
2390 | 2393 |
2391 virtual bool CanBecomeDeoptimizationTarget() const { | 2394 virtual bool CanBecomeDeoptimizationTarget() const { |
2392 return comparison()->CanBecomeDeoptimizationTarget(); | 2395 return comparison()->CanBecomeDeoptimizationTarget(); |
2393 } | 2396 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 Range* constraint_; | 2554 Range* constraint_; |
2552 TargetEntryInstr* target_; | 2555 TargetEntryInstr* target_; |
2553 | 2556 |
2554 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); | 2557 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); |
2555 }; | 2558 }; |
2556 | 2559 |
2557 | 2560 |
2558 class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { | 2561 class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { |
2559 public: | 2562 public: |
2560 ConstantInstr(const Object& value, | 2563 ConstantInstr(const Object& value, |
2561 intptr_t token_pos = ClassifyingTokenPositions::kConstant); | 2564 TokenDescriptor token_pos = TokenDescriptor::kConstant); |
2562 | 2565 |
2563 DECLARE_INSTRUCTION(Constant) | 2566 DECLARE_INSTRUCTION(Constant) |
2564 virtual CompileType ComputeType() const; | 2567 virtual CompileType ComputeType() const; |
2565 | 2568 |
2566 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2569 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2567 | 2570 |
2568 const Object& value() const { return value_; } | 2571 const Object& value() const { return value_; } |
2569 | 2572 |
2570 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2573 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2571 | 2574 |
2572 virtual bool CanDeoptimize() const { return false; } | 2575 virtual bool CanDeoptimize() const { return false; } |
2573 | 2576 |
2574 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 2577 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
2575 | 2578 |
2576 virtual bool AttributesEqual(Instruction* other) const; | 2579 virtual bool AttributesEqual(Instruction* other) const; |
2577 | 2580 |
2578 virtual intptr_t token_pos() const { return token_pos_; } | 2581 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2579 | 2582 |
2580 private: | 2583 private: |
2581 const Object& value_; | 2584 const Object& value_; |
2582 const intptr_t token_pos_; | 2585 const TokenDescriptor token_pos_; |
2583 | 2586 |
2584 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); | 2587 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); |
2585 }; | 2588 }; |
2586 | 2589 |
2587 | 2590 |
2588 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. | 2591 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. |
2589 // TODO(srdjan): Implemented currently for doubles only, should implement | 2592 // TODO(srdjan): Implemented currently for doubles only, should implement |
2590 // for other unboxing instructions. | 2593 // for other unboxing instructions. |
2591 class UnboxedConstantInstr : public ConstantInstr { | 2594 class UnboxedConstantInstr : public ConstantInstr { |
2592 public: | 2595 public: |
(...skipping 12 matching lines...) Expand all Loading... |
2605 private: | 2608 private: |
2606 const Representation representation_; | 2609 const Representation representation_; |
2607 uword constant_address_; // Either NULL or points to the untagged constant. | 2610 uword constant_address_; // Either NULL or points to the untagged constant. |
2608 | 2611 |
2609 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); | 2612 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); |
2610 }; | 2613 }; |
2611 | 2614 |
2612 | 2615 |
2613 class AssertAssignableInstr : public TemplateDefinition<2, Throws, Pure> { | 2616 class AssertAssignableInstr : public TemplateDefinition<2, Throws, Pure> { |
2614 public: | 2617 public: |
2615 AssertAssignableInstr(intptr_t token_pos, | 2618 AssertAssignableInstr(TokenDescriptor token_pos, |
2616 Value* value, | 2619 Value* value, |
2617 Value* instantiator_type_arguments, | 2620 Value* instantiator_type_arguments, |
2618 const AbstractType& dst_type, | 2621 const AbstractType& dst_type, |
2619 const String& dst_name, | 2622 const String& dst_name, |
2620 intptr_t deopt_id) | 2623 intptr_t deopt_id) |
2621 : TemplateDefinition(deopt_id), | 2624 : TemplateDefinition(deopt_id), |
2622 token_pos_(token_pos), | 2625 token_pos_(token_pos), |
2623 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), | 2626 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), |
2624 dst_name_(dst_name) { | 2627 dst_name_(dst_name) { |
2625 ASSERT(!dst_type.IsNull()); | 2628 ASSERT(!dst_type.IsNull()); |
2626 ASSERT(!dst_name.IsNull()); | 2629 ASSERT(!dst_name.IsNull()); |
2627 SetInputAt(0, value); | 2630 SetInputAt(0, value); |
2628 SetInputAt(1, instantiator_type_arguments); | 2631 SetInputAt(1, instantiator_type_arguments); |
2629 } | 2632 } |
2630 | 2633 |
2631 DECLARE_INSTRUCTION(AssertAssignable) | 2634 DECLARE_INSTRUCTION(AssertAssignable) |
2632 virtual CompileType ComputeType() const; | 2635 virtual CompileType ComputeType() const; |
2633 virtual bool RecomputeType(); | 2636 virtual bool RecomputeType(); |
2634 | 2637 |
2635 Value* value() const { return inputs_[0]; } | 2638 Value* value() const { return inputs_[0]; } |
2636 Value* instantiator_type_arguments() const { return inputs_[1]; } | 2639 Value* instantiator_type_arguments() const { return inputs_[1]; } |
2637 | 2640 |
2638 virtual intptr_t token_pos() const { return token_pos_; } | 2641 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2639 const AbstractType& dst_type() const { return dst_type_; } | 2642 const AbstractType& dst_type() const { return dst_type_; } |
2640 void set_dst_type(const AbstractType& dst_type) { | 2643 void set_dst_type(const AbstractType& dst_type) { |
2641 dst_type_ = dst_type.raw(); | 2644 dst_type_ = dst_type.raw(); |
2642 } | 2645 } |
2643 const String& dst_name() const { return dst_name_; } | 2646 const String& dst_name() const { return dst_name_; } |
2644 | 2647 |
2645 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2648 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2646 | 2649 |
2647 virtual bool CanDeoptimize() const { return true; } | 2650 virtual bool CanDeoptimize() const { return true; } |
2648 | 2651 |
2649 virtual bool CanBecomeDeoptimizationTarget() const { | 2652 virtual bool CanBecomeDeoptimizationTarget() const { |
2650 // AssertAssignable instructions that are specialized by the optimizer | 2653 // AssertAssignable instructions that are specialized by the optimizer |
2651 // (e.g. replaced with CheckClass) need a deoptimization descriptor before. | 2654 // (e.g. replaced with CheckClass) need a deoptimization descriptor before. |
2652 return true; | 2655 return true; |
2653 } | 2656 } |
2654 | 2657 |
2655 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2658 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2656 | 2659 |
2657 virtual bool AttributesEqual(Instruction* other) const; | 2660 virtual bool AttributesEqual(Instruction* other) const; |
2658 | 2661 |
2659 private: | 2662 private: |
2660 const intptr_t token_pos_; | 2663 const TokenDescriptor token_pos_; |
2661 AbstractType& dst_type_; | 2664 AbstractType& dst_type_; |
2662 const String& dst_name_; | 2665 const String& dst_name_; |
2663 | 2666 |
2664 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); | 2667 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); |
2665 }; | 2668 }; |
2666 | 2669 |
2667 | 2670 |
2668 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { | 2671 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { |
2669 public: | 2672 public: |
2670 AssertBooleanInstr(intptr_t token_pos, Value* value) | 2673 AssertBooleanInstr(TokenDescriptor token_pos, Value* value) |
2671 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2674 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
2672 token_pos_(token_pos) { | 2675 token_pos_(token_pos) { |
2673 SetInputAt(0, value); | 2676 SetInputAt(0, value); |
2674 } | 2677 } |
2675 | 2678 |
2676 DECLARE_INSTRUCTION(AssertBoolean) | 2679 DECLARE_INSTRUCTION(AssertBoolean) |
2677 virtual CompileType ComputeType() const; | 2680 virtual CompileType ComputeType() const; |
2678 | 2681 |
2679 virtual intptr_t token_pos() const { return token_pos_; } | 2682 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2680 Value* value() const { return inputs_[0]; } | 2683 Value* value() const { return inputs_[0]; } |
2681 | 2684 |
2682 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2685 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2683 | 2686 |
2684 virtual bool CanDeoptimize() const { return true; } | 2687 virtual bool CanDeoptimize() const { return true; } |
2685 | 2688 |
2686 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2689 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2687 | 2690 |
2688 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2691 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2689 | 2692 |
2690 private: | 2693 private: |
2691 const intptr_t token_pos_; | 2694 const TokenDescriptor token_pos_; |
2692 | 2695 |
2693 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); | 2696 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); |
2694 }; | 2697 }; |
2695 | 2698 |
2696 | 2699 |
2697 // Denotes the current context, normally held in a register. This is | 2700 // Denotes the current context, normally held in a register. This is |
2698 // a computation, not a value, because it's mutable. | 2701 // a computation, not a value, because it's mutable. |
2699 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> { | 2702 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> { |
2700 public: | 2703 public: |
2701 CurrentContextInstr() | 2704 CurrentContextInstr() |
(...skipping 21 matching lines...) Expand all Loading... |
2723 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2726 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
2724 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2727 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
2725 ast_node_(*node), | 2728 ast_node_(*node), |
2726 arguments_(arguments) { | 2729 arguments_(arguments) { |
2727 SetInputAt(0, function); | 2730 SetInputAt(0, function); |
2728 } | 2731 } |
2729 | 2732 |
2730 DECLARE_INSTRUCTION(ClosureCall) | 2733 DECLARE_INSTRUCTION(ClosureCall) |
2731 | 2734 |
2732 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 2735 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
2733 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } | 2736 virtual TokenDescriptor token_pos() const { |
| 2737 return TokenDescriptor(ast_node_.token_pos()); |
| 2738 } |
2734 | 2739 |
2735 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2740 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
2736 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2741 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2737 return (*arguments_)[index]; | 2742 return (*arguments_)[index]; |
2738 } | 2743 } |
2739 | 2744 |
2740 // TODO(kmillikin): implement exact call counts for closure calls. | 2745 // TODO(kmillikin): implement exact call counts for closure calls. |
2741 virtual intptr_t CallCount() const { return 1; } | 2746 virtual intptr_t CallCount() const { return 1; } |
2742 | 2747 |
2743 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2748 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2744 | 2749 |
2745 virtual bool CanDeoptimize() const { return true; } | 2750 virtual bool CanDeoptimize() const { return true; } |
2746 | 2751 |
2747 virtual EffectSet Effects() const { return EffectSet::All(); } | 2752 virtual EffectSet Effects() const { return EffectSet::All(); } |
2748 | 2753 |
2749 private: | 2754 private: |
2750 const ClosureCallNode& ast_node_; | 2755 const ClosureCallNode& ast_node_; |
2751 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 2756 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
2752 | 2757 |
2753 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); | 2758 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); |
2754 }; | 2759 }; |
2755 | 2760 |
2756 | 2761 |
2757 class InstanceCallInstr : public TemplateDefinition<0, Throws> { | 2762 class InstanceCallInstr : public TemplateDefinition<0, Throws> { |
2758 public: | 2763 public: |
2759 InstanceCallInstr(intptr_t token_pos, | 2764 InstanceCallInstr(TokenDescriptor token_pos, |
2760 const String& function_name, | 2765 const String& function_name, |
2761 Token::Kind token_kind, | 2766 Token::Kind token_kind, |
2762 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2767 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
2763 const Array& argument_names, | 2768 const Array& argument_names, |
2764 intptr_t checked_argument_count, | 2769 intptr_t checked_argument_count, |
2765 const ZoneGrowableArray<const ICData*>& ic_data_array) | 2770 const ZoneGrowableArray<const ICData*>& ic_data_array) |
2766 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2771 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
2767 ic_data_(NULL), | 2772 ic_data_(NULL), |
2768 token_pos_(token_pos), | 2773 token_pos_(token_pos), |
2769 function_name_(function_name), | 2774 function_name_(function_name), |
(...skipping 20 matching lines...) Expand all Loading... |
2790 DECLARE_INSTRUCTION(InstanceCall) | 2795 DECLARE_INSTRUCTION(InstanceCall) |
2791 | 2796 |
2792 const ICData* ic_data() const { return ic_data_; } | 2797 const ICData* ic_data() const { return ic_data_; } |
2793 bool HasICData() const { | 2798 bool HasICData() const { |
2794 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2799 return (ic_data() != NULL) && !ic_data()->IsNull(); |
2795 } | 2800 } |
2796 | 2801 |
2797 // ICData can be replaced by optimizer. | 2802 // ICData can be replaced by optimizer. |
2798 void set_ic_data(const ICData* value) { ic_data_ = value; } | 2803 void set_ic_data(const ICData* value) { ic_data_ = value; } |
2799 | 2804 |
2800 virtual intptr_t token_pos() const { return token_pos_; } | 2805 virtual TokenDescriptor token_pos() const { return token_pos_; } |
2801 const String& function_name() const { return function_name_; } | 2806 const String& function_name() const { return function_name_; } |
2802 Token::Kind token_kind() const { return token_kind_; } | 2807 Token::Kind token_kind() const { return token_kind_; } |
2803 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2808 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
2804 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2809 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2805 return (*arguments_)[index]; | 2810 return (*arguments_)[index]; |
2806 } | 2811 } |
2807 const Array& argument_names() const { return argument_names_; } | 2812 const Array& argument_names() const { return argument_names_; } |
2808 intptr_t checked_argument_count() const { return checked_argument_count_; } | 2813 intptr_t checked_argument_count() const { return checked_argument_count_; } |
2809 | 2814 |
2810 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2815 virtual void PrintOperandsTo(BufferFormatter* f) const; |
2811 | 2816 |
2812 virtual bool CanDeoptimize() const { return true; } | 2817 virtual bool CanDeoptimize() const { return true; } |
2813 | 2818 |
2814 virtual bool CanBecomeDeoptimizationTarget() const { | 2819 virtual bool CanBecomeDeoptimizationTarget() const { |
2815 // Instance calls that are specialized by the optimizer need a | 2820 // Instance calls that are specialized by the optimizer need a |
2816 // deoptimization descriptor before the call. | 2821 // deoptimization descriptor before the call. |
2817 return true; | 2822 return true; |
2818 } | 2823 } |
2819 | 2824 |
2820 virtual EffectSet Effects() const { return EffectSet::All(); } | 2825 virtual EffectSet Effects() const { return EffectSet::All(); } |
2821 | 2826 |
2822 protected: | 2827 protected: |
2823 friend class FlowGraphOptimizer; | 2828 friend class FlowGraphOptimizer; |
2824 void set_ic_data(ICData* value) { ic_data_ = value; } | 2829 void set_ic_data(ICData* value) { ic_data_ = value; } |
2825 | 2830 |
2826 private: | 2831 private: |
2827 const ICData* ic_data_; | 2832 const ICData* ic_data_; |
2828 const intptr_t token_pos_; | 2833 const TokenDescriptor token_pos_; |
2829 const String& function_name_; | 2834 const String& function_name_; |
2830 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 2835 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
2831 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 2836 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
2832 const Array& argument_names_; | 2837 const Array& argument_names_; |
2833 const intptr_t checked_argument_count_; | 2838 const intptr_t checked_argument_count_; |
2834 | 2839 |
2835 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2840 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
2836 }; | 2841 }; |
2837 | 2842 |
2838 | 2843 |
2839 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2844 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
2840 public: | 2845 public: |
2841 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2846 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
2842 const ICData& ic_data, | 2847 const ICData& ic_data, |
2843 bool with_checks) | 2848 bool with_checks) |
2844 : TemplateDefinition(instance_call->deopt_id()), | 2849 : TemplateDefinition(instance_call->deopt_id()), |
2845 instance_call_(instance_call), | 2850 instance_call_(instance_call), |
2846 ic_data_(ic_data), | 2851 ic_data_(ic_data), |
2847 with_checks_(with_checks) { | 2852 with_checks_(with_checks) { |
2848 ASSERT(instance_call_ != NULL); | 2853 ASSERT(instance_call_ != NULL); |
2849 ASSERT(ic_data.NumberOfChecks() > 0); | 2854 ASSERT(ic_data.NumberOfChecks() > 0); |
2850 } | 2855 } |
2851 | 2856 |
2852 InstanceCallInstr* instance_call() const { return instance_call_; } | 2857 InstanceCallInstr* instance_call() const { return instance_call_; } |
2853 bool with_checks() const { return with_checks_; } | 2858 bool with_checks() const { return with_checks_; } |
2854 virtual intptr_t token_pos() const { return instance_call_->token_pos(); } | 2859 virtual TokenDescriptor token_pos() const { |
| 2860 return instance_call_->token_pos(); |
| 2861 } |
2855 | 2862 |
2856 virtual intptr_t ArgumentCount() const { | 2863 virtual intptr_t ArgumentCount() const { |
2857 return instance_call()->ArgumentCount(); | 2864 return instance_call()->ArgumentCount(); |
2858 } | 2865 } |
2859 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2866 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2860 return instance_call()->PushArgumentAt(index); | 2867 return instance_call()->PushArgumentAt(index); |
2861 } | 2868 } |
2862 | 2869 |
2863 bool HasSingleRecognizedTarget() const; | 2870 bool HasSingleRecognizedTarget() const; |
2864 | 2871 |
(...skipping 15 matching lines...) Expand all Loading... |
2880 InstanceCallInstr* instance_call_; | 2887 InstanceCallInstr* instance_call_; |
2881 const ICData& ic_data_; | 2888 const ICData& ic_data_; |
2882 const bool with_checks_; | 2889 const bool with_checks_; |
2883 | 2890 |
2884 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); | 2891 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); |
2885 }; | 2892 }; |
2886 | 2893 |
2887 | 2894 |
2888 class StrictCompareInstr : public ComparisonInstr { | 2895 class StrictCompareInstr : public ComparisonInstr { |
2889 public: | 2896 public: |
2890 StrictCompareInstr(intptr_t token_pos, | 2897 StrictCompareInstr(TokenDescriptor token_pos, |
2891 Token::Kind kind, | 2898 Token::Kind kind, |
2892 Value* left, | 2899 Value* left, |
2893 Value* right, | 2900 Value* right, |
2894 bool needs_number_check); | 2901 bool needs_number_check); |
2895 | 2902 |
2896 DECLARE_INSTRUCTION(StrictCompare) | 2903 DECLARE_INSTRUCTION(StrictCompare) |
2897 | 2904 |
2898 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 2905 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
2899 | 2906 |
2900 virtual CompileType ComputeType() const; | 2907 virtual CompileType ComputeType() const; |
(...skipping 21 matching lines...) Expand all Loading... |
2922 bool needs_number_check_; | 2929 bool needs_number_check_; |
2923 | 2930 |
2924 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); | 2931 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); |
2925 }; | 2932 }; |
2926 | 2933 |
2927 | 2934 |
2928 // Comparison instruction that is equivalent to the (left & right) == 0 | 2935 // Comparison instruction that is equivalent to the (left & right) == 0 |
2929 // comparison pattern. | 2936 // comparison pattern. |
2930 class TestSmiInstr : public ComparisonInstr { | 2937 class TestSmiInstr : public ComparisonInstr { |
2931 public: | 2938 public: |
2932 TestSmiInstr(intptr_t token_pos, Token::Kind kind, Value* left, Value* right) | 2939 TestSmiInstr(TokenDescriptor token_pos, |
| 2940 Token::Kind kind, |
| 2941 Value* left, |
| 2942 Value* right) |
2933 : ComparisonInstr(token_pos, kind, left, right) { | 2943 : ComparisonInstr(token_pos, kind, left, right) { |
2934 ASSERT(kind == Token::kEQ || kind == Token::kNE); | 2944 ASSERT(kind == Token::kEQ || kind == Token::kNE); |
2935 } | 2945 } |
2936 | 2946 |
2937 DECLARE_INSTRUCTION(TestSmi); | 2947 DECLARE_INSTRUCTION(TestSmi); |
2938 | 2948 |
2939 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 2949 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
2940 | 2950 |
2941 virtual CompileType ComputeType() const; | 2951 virtual CompileType ComputeType() const; |
2942 | 2952 |
(...skipping 13 matching lines...) Expand all Loading... |
2956 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); | 2966 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); |
2957 }; | 2967 }; |
2958 | 2968 |
2959 | 2969 |
2960 // Checks the input value cid against cids stored in a table and returns either | 2970 // Checks the input value cid against cids stored in a table and returns either |
2961 // a result or deoptimizes. | 2971 // a result or deoptimizes. |
2962 // TODO(srdjan): Modify ComparisonInstr to allow 1 or 2 arguments, since | 2972 // TODO(srdjan): Modify ComparisonInstr to allow 1 or 2 arguments, since |
2963 // TestCidInstr needs only one argument | 2973 // TestCidInstr needs only one argument |
2964 class TestCidsInstr : public ComparisonInstr { | 2974 class TestCidsInstr : public ComparisonInstr { |
2965 public: | 2975 public: |
2966 TestCidsInstr(intptr_t token_pos, | 2976 TestCidsInstr(TokenDescriptor token_pos, |
2967 Token::Kind kind, | 2977 Token::Kind kind, |
2968 Value* value, | 2978 Value* value, |
2969 const ZoneGrowableArray<intptr_t>& cid_results, | 2979 const ZoneGrowableArray<intptr_t>& cid_results, |
2970 intptr_t deopt_id) | 2980 intptr_t deopt_id) |
2971 : ComparisonInstr(token_pos, kind, value, NULL, deopt_id), | 2981 : ComparisonInstr(token_pos, kind, value, NULL, deopt_id), |
2972 cid_results_(cid_results) { | 2982 cid_results_(cid_results) { |
2973 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT)); | 2983 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT)); |
2974 set_operation_cid(kObjectCid); | 2984 set_operation_cid(kObjectCid); |
2975 } | 2985 } |
2976 | 2986 |
(...skipping 28 matching lines...) Expand all Loading... |
3005 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3015 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3006 | 3016 |
3007 private: | 3017 private: |
3008 const ZoneGrowableArray<intptr_t>& cid_results_; | 3018 const ZoneGrowableArray<intptr_t>& cid_results_; |
3009 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); | 3019 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); |
3010 }; | 3020 }; |
3011 | 3021 |
3012 | 3022 |
3013 class EqualityCompareInstr : public ComparisonInstr { | 3023 class EqualityCompareInstr : public ComparisonInstr { |
3014 public: | 3024 public: |
3015 EqualityCompareInstr(intptr_t token_pos, | 3025 EqualityCompareInstr(TokenDescriptor token_pos, |
3016 Token::Kind kind, | 3026 Token::Kind kind, |
3017 Value* left, | 3027 Value* left, |
3018 Value* right, | 3028 Value* right, |
3019 intptr_t cid, | 3029 intptr_t cid, |
3020 intptr_t deopt_id) | 3030 intptr_t deopt_id) |
3021 : ComparisonInstr(token_pos, kind, left, right, deopt_id) { | 3031 : ComparisonInstr(token_pos, kind, left, right, deopt_id) { |
3022 ASSERT(Token::IsEqualityOperator(kind)); | 3032 ASSERT(Token::IsEqualityOperator(kind)); |
3023 set_operation_cid(cid); | 3033 set_operation_cid(cid); |
3024 } | 3034 } |
3025 | 3035 |
(...skipping 20 matching lines...) Expand all Loading... |
3046 return kTagged; | 3056 return kTagged; |
3047 } | 3057 } |
3048 | 3058 |
3049 private: | 3059 private: |
3050 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 3060 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
3051 }; | 3061 }; |
3052 | 3062 |
3053 | 3063 |
3054 class RelationalOpInstr : public ComparisonInstr { | 3064 class RelationalOpInstr : public ComparisonInstr { |
3055 public: | 3065 public: |
3056 RelationalOpInstr(intptr_t token_pos, | 3066 RelationalOpInstr(TokenDescriptor token_pos, |
3057 Token::Kind kind, | 3067 Token::Kind kind, |
3058 Value* left, | 3068 Value* left, |
3059 Value* right, | 3069 Value* right, |
3060 intptr_t cid, | 3070 intptr_t cid, |
3061 intptr_t deopt_id) | 3071 intptr_t deopt_id) |
3062 : ComparisonInstr(token_pos, kind, left, right, deopt_id) { | 3072 : ComparisonInstr(token_pos, kind, left, right, deopt_id) { |
3063 ASSERT(Token::IsRelationalOperator(kind)); | 3073 ASSERT(Token::IsRelationalOperator(kind)); |
3064 set_operation_cid(cid); | 3074 set_operation_cid(cid); |
3065 } | 3075 } |
3066 | 3076 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 ComparisonInstr* comparison_; | 3179 ComparisonInstr* comparison_; |
3170 const intptr_t if_true_; | 3180 const intptr_t if_true_; |
3171 const intptr_t if_false_; | 3181 const intptr_t if_false_; |
3172 | 3182 |
3173 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); | 3183 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); |
3174 }; | 3184 }; |
3175 | 3185 |
3176 | 3186 |
3177 class StaticCallInstr : public TemplateDefinition<0, Throws> { | 3187 class StaticCallInstr : public TemplateDefinition<0, Throws> { |
3178 public: | 3188 public: |
3179 StaticCallInstr(intptr_t token_pos, | 3189 StaticCallInstr(TokenDescriptor token_pos, |
3180 const Function& function, | 3190 const Function& function, |
3181 const Array& argument_names, | 3191 const Array& argument_names, |
3182 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3192 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3183 const ZoneGrowableArray<const ICData*>& ic_data_array) | 3193 const ZoneGrowableArray<const ICData*>& ic_data_array) |
3184 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 3194 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
3185 ic_data_(NULL), | 3195 ic_data_(NULL), |
3186 token_pos_(token_pos), | 3196 token_pos_(token_pos), |
3187 function_(function), | 3197 function_(function), |
3188 argument_names_(argument_names), | 3198 argument_names_(argument_names), |
3189 arguments_(arguments), | 3199 arguments_(arguments), |
(...skipping 11 matching lines...) Expand all Loading... |
3201 bool HasICData() const { | 3211 bool HasICData() const { |
3202 return (ic_data() != NULL) && !ic_data()->IsNull(); | 3212 return (ic_data() != NULL) && !ic_data()->IsNull(); |
3203 } | 3213 } |
3204 | 3214 |
3205 DECLARE_INSTRUCTION(StaticCall) | 3215 DECLARE_INSTRUCTION(StaticCall) |
3206 virtual CompileType ComputeType() const; | 3216 virtual CompileType ComputeType() const; |
3207 | 3217 |
3208 // Accessors forwarded to the AST node. | 3218 // Accessors forwarded to the AST node. |
3209 const Function& function() const { return function_; } | 3219 const Function& function() const { return function_; } |
3210 const Array& argument_names() const { return argument_names_; } | 3220 const Array& argument_names() const { return argument_names_; } |
3211 virtual intptr_t token_pos() const { return token_pos_; } | 3221 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3212 | 3222 |
3213 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3223 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
3214 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 3224 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
3215 return (*arguments_)[index]; | 3225 return (*arguments_)[index]; |
3216 } | 3226 } |
3217 | 3227 |
3218 virtual intptr_t CallCount() const { | 3228 virtual intptr_t CallCount() const { |
3219 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); | 3229 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); |
3220 } | 3230 } |
3221 | 3231 |
(...skipping 23 matching lines...) Expand all Loading... |
3245 | 3255 |
3246 bool IsRecognizedFactory() const { | 3256 bool IsRecognizedFactory() const { |
3247 return is_known_list_constructor() || is_native_list_factory(); | 3257 return is_known_list_constructor() || is_native_list_factory(); |
3248 } | 3258 } |
3249 | 3259 |
3250 virtual AliasIdentity Identity() const { return identity_; } | 3260 virtual AliasIdentity Identity() const { return identity_; } |
3251 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 3261 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
3252 | 3262 |
3253 private: | 3263 private: |
3254 const ICData* ic_data_; | 3264 const ICData* ic_data_; |
3255 const intptr_t token_pos_; | 3265 const TokenDescriptor token_pos_; |
3256 const Function& function_; | 3266 const Function& function_; |
3257 const Array& argument_names_; | 3267 const Array& argument_names_; |
3258 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 3268 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
3259 intptr_t result_cid_; // For some library functions we know the result. | 3269 intptr_t result_cid_; // For some library functions we know the result. |
3260 | 3270 |
3261 // 'True' for recognized list constructors. | 3271 // 'True' for recognized list constructors. |
3262 bool is_known_list_constructor_; | 3272 bool is_known_list_constructor_; |
3263 bool is_native_list_factory_; | 3273 bool is_native_list_factory_; |
3264 | 3274 |
3265 AliasIdentity identity_; | 3275 AliasIdentity identity_; |
3266 | 3276 |
3267 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 3277 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
3268 }; | 3278 }; |
3269 | 3279 |
3270 | 3280 |
3271 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { | 3281 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { |
3272 public: | 3282 public: |
3273 LoadLocalInstr(const LocalVariable& local, | 3283 LoadLocalInstr(const LocalVariable& local, |
3274 intptr_t token_pos) | 3284 TokenDescriptor token_pos) |
3275 : local_(local), is_last_(false), token_pos_(token_pos) { } | 3285 : local_(local), is_last_(false), token_pos_(token_pos) { } |
3276 | 3286 |
3277 DECLARE_INSTRUCTION(LoadLocal) | 3287 DECLARE_INSTRUCTION(LoadLocal) |
3278 virtual CompileType ComputeType() const; | 3288 virtual CompileType ComputeType() const; |
3279 | 3289 |
3280 const LocalVariable& local() const { return local_; } | 3290 const LocalVariable& local() const { return local_; } |
3281 | 3291 |
3282 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3292 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3283 | 3293 |
3284 virtual bool CanDeoptimize() const { return false; } | 3294 virtual bool CanDeoptimize() const { return false; } |
3285 | 3295 |
3286 virtual EffectSet Effects() const { | 3296 virtual EffectSet Effects() const { |
3287 UNREACHABLE(); // Eliminated by SSA construction. | 3297 UNREACHABLE(); // Eliminated by SSA construction. |
3288 return EffectSet::None(); | 3298 return EffectSet::None(); |
3289 } | 3299 } |
3290 | 3300 |
3291 void mark_last() { is_last_ = true; } | 3301 void mark_last() { is_last_ = true; } |
3292 bool is_last() const { return is_last_; } | 3302 bool is_last() const { return is_last_; } |
3293 | 3303 |
3294 virtual intptr_t token_pos() const { return token_pos_; } | 3304 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3295 | 3305 |
3296 private: | 3306 private: |
3297 const LocalVariable& local_; | 3307 const LocalVariable& local_; |
3298 bool is_last_; | 3308 bool is_last_; |
3299 const intptr_t token_pos_; | 3309 const TokenDescriptor token_pos_; |
3300 | 3310 |
3301 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); | 3311 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); |
3302 }; | 3312 }; |
3303 | 3313 |
3304 | 3314 |
3305 class PushTempInstr : public TemplateDefinition<1, NoThrow> { | 3315 class PushTempInstr : public TemplateDefinition<1, NoThrow> { |
3306 public: | 3316 public: |
3307 explicit PushTempInstr(Value* value) { | 3317 explicit PushTempInstr(Value* value) { |
3308 SetInputAt(0, value); | 3318 SetInputAt(0, value); |
3309 } | 3319 } |
3310 | 3320 |
3311 DECLARE_INSTRUCTION(PushTemp) | 3321 DECLARE_INSTRUCTION(PushTemp) |
3312 | 3322 |
3313 Value* value() const { return inputs_[0]; } | 3323 Value* value() const { return inputs_[0]; } |
3314 | 3324 |
3315 virtual CompileType ComputeType() const; | 3325 virtual CompileType ComputeType() const; |
3316 | 3326 |
3317 virtual bool CanDeoptimize() const { return false; } | 3327 virtual bool CanDeoptimize() const { return false; } |
3318 | 3328 |
3319 virtual EffectSet Effects() const { | 3329 virtual EffectSet Effects() const { |
3320 UNREACHABLE(); // Eliminated by SSA construction. | 3330 UNREACHABLE(); // Eliminated by SSA construction. |
3321 return EffectSet::None(); | 3331 return EffectSet::None(); |
3322 } | 3332 } |
3323 | 3333 |
3324 virtual intptr_t token_pos() const { | 3334 virtual TokenDescriptor token_pos() const { |
3325 return ClassifyingTokenPositions::kTempMove; | 3335 return TokenDescriptor::kTempMove; |
3326 } | 3336 } |
3327 | 3337 |
3328 private: | 3338 private: |
3329 DISALLOW_COPY_AND_ASSIGN(PushTempInstr); | 3339 DISALLOW_COPY_AND_ASSIGN(PushTempInstr); |
3330 }; | 3340 }; |
3331 | 3341 |
3332 | 3342 |
3333 class DropTempsInstr : public Definition { | 3343 class DropTempsInstr : public Definition { |
3334 public: | 3344 public: |
3335 DropTempsInstr(intptr_t num_temps, Value* value) | 3345 DropTempsInstr(intptr_t num_temps, Value* value) |
(...skipping 24 matching lines...) Expand all Loading... |
3360 virtual EffectSet Effects() const { | 3370 virtual EffectSet Effects() const { |
3361 UNREACHABLE(); // Eliminated by SSA construction. | 3371 UNREACHABLE(); // Eliminated by SSA construction. |
3362 return EffectSet::None(); | 3372 return EffectSet::None(); |
3363 } | 3373 } |
3364 | 3374 |
3365 virtual bool MayThrow() const { | 3375 virtual bool MayThrow() const { |
3366 UNREACHABLE(); | 3376 UNREACHABLE(); |
3367 return false; | 3377 return false; |
3368 } | 3378 } |
3369 | 3379 |
3370 virtual intptr_t token_pos() const { | 3380 virtual TokenDescriptor token_pos() const { |
3371 return ClassifyingTokenPositions::kTempMove; | 3381 return TokenDescriptor::kTempMove; |
3372 } | 3382 } |
3373 | 3383 |
3374 private: | 3384 private: |
3375 virtual void RawSetInputAt(intptr_t i, Value* value) { | 3385 virtual void RawSetInputAt(intptr_t i, Value* value) { |
3376 value_ = value; | 3386 value_ = value; |
3377 } | 3387 } |
3378 | 3388 |
3379 const intptr_t num_temps_; | 3389 const intptr_t num_temps_; |
3380 Value* value_; | 3390 Value* value_; |
3381 | 3391 |
3382 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); | 3392 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); |
3383 }; | 3393 }; |
3384 | 3394 |
3385 | 3395 |
3386 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { | 3396 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { |
3387 public: | 3397 public: |
3388 StoreLocalInstr(const LocalVariable& local, | 3398 StoreLocalInstr(const LocalVariable& local, |
3389 Value* value, | 3399 Value* value, |
3390 intptr_t token_pos) | 3400 TokenDescriptor token_pos) |
3391 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { | 3401 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { |
3392 SetInputAt(0, value); | 3402 SetInputAt(0, value); |
3393 } | 3403 } |
3394 | 3404 |
3395 DECLARE_INSTRUCTION(StoreLocal) | 3405 DECLARE_INSTRUCTION(StoreLocal) |
3396 virtual CompileType ComputeType() const; | 3406 virtual CompileType ComputeType() const; |
3397 | 3407 |
3398 const LocalVariable& local() const { return local_; } | 3408 const LocalVariable& local() const { return local_; } |
3399 Value* value() const { return inputs_[0]; } | 3409 Value* value() const { return inputs_[0]; } |
3400 | 3410 |
3401 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3411 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3402 | 3412 |
3403 virtual bool CanDeoptimize() const { return false; } | 3413 virtual bool CanDeoptimize() const { return false; } |
3404 | 3414 |
3405 void mark_dead() { is_dead_ = true; } | 3415 void mark_dead() { is_dead_ = true; } |
3406 bool is_dead() const { return is_dead_; } | 3416 bool is_dead() const { return is_dead_; } |
3407 | 3417 |
3408 void mark_last() { is_last_ = true; } | 3418 void mark_last() { is_last_ = true; } |
3409 bool is_last() const { return is_last_; } | 3419 bool is_last() const { return is_last_; } |
3410 | 3420 |
3411 virtual EffectSet Effects() const { | 3421 virtual EffectSet Effects() const { |
3412 UNREACHABLE(); // Eliminated by SSA construction. | 3422 UNREACHABLE(); // Eliminated by SSA construction. |
3413 return EffectSet::None(); | 3423 return EffectSet::None(); |
3414 } | 3424 } |
3415 | 3425 |
3416 virtual intptr_t token_pos() const { return token_pos_; } | 3426 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3417 | 3427 |
3418 private: | 3428 private: |
3419 const LocalVariable& local_; | 3429 const LocalVariable& local_; |
3420 bool is_dead_; | 3430 bool is_dead_; |
3421 bool is_last_; | 3431 bool is_last_; |
3422 const intptr_t token_pos_; | 3432 const TokenDescriptor token_pos_; |
3423 | 3433 |
3424 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); | 3434 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); |
3425 }; | 3435 }; |
3426 | 3436 |
3427 | 3437 |
3428 class NativeCallInstr : public TemplateDefinition<0, Throws> { | 3438 class NativeCallInstr : public TemplateDefinition<0, Throws> { |
3429 public: | 3439 public: |
3430 explicit NativeCallInstr(NativeBodyNode* node) | 3440 explicit NativeCallInstr(NativeBodyNode* node) |
3431 : ast_node_(*node), | 3441 : ast_node_(*node), |
3432 native_c_function_(NULL), | 3442 native_c_function_(NULL), |
3433 is_bootstrap_native_(false) { } | 3443 is_bootstrap_native_(false) { } |
3434 | 3444 |
3435 DECLARE_INSTRUCTION(NativeCall) | 3445 DECLARE_INSTRUCTION(NativeCall) |
3436 | 3446 |
3437 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } | 3447 virtual TokenDescriptor token_pos() const { |
| 3448 return TokenDescriptor(ast_node_.token_pos()); |
| 3449 } |
3438 | 3450 |
3439 const Function& function() const { return ast_node_.function(); } | 3451 const Function& function() const { return ast_node_.function(); } |
3440 | 3452 |
3441 const String& native_name() const { | 3453 const String& native_name() const { |
3442 return ast_node_.native_c_function_name(); | 3454 return ast_node_.native_c_function_name(); |
3443 } | 3455 } |
3444 | 3456 |
3445 NativeFunction native_c_function() const { | 3457 NativeFunction native_c_function() const { |
3446 return native_c_function_; | 3458 return native_c_function_; |
3447 } | 3459 } |
(...skipping 24 matching lines...) Expand all Loading... |
3472 const NativeBodyNode& ast_node_; | 3484 const NativeBodyNode& ast_node_; |
3473 NativeFunction native_c_function_; | 3485 NativeFunction native_c_function_; |
3474 bool is_bootstrap_native_; | 3486 bool is_bootstrap_native_; |
3475 | 3487 |
3476 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); | 3488 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); |
3477 }; | 3489 }; |
3478 | 3490 |
3479 | 3491 |
3480 class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { | 3492 class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { |
3481 public: | 3493 public: |
3482 DebugStepCheckInstr(intptr_t token_pos, | 3494 DebugStepCheckInstr(TokenDescriptor token_pos, |
3483 RawPcDescriptors::Kind stub_kind) | 3495 RawPcDescriptors::Kind stub_kind) |
3484 : token_pos_(token_pos), | 3496 : token_pos_(token_pos), |
3485 stub_kind_(stub_kind) { | 3497 stub_kind_(stub_kind) { |
3486 } | 3498 } |
3487 | 3499 |
3488 DECLARE_INSTRUCTION(DebugStepCheck) | 3500 DECLARE_INSTRUCTION(DebugStepCheck) |
3489 | 3501 |
3490 virtual intptr_t token_pos() const { return token_pos_; } | 3502 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3491 virtual bool CanDeoptimize() const { return false; } | 3503 virtual bool CanDeoptimize() const { return false; } |
3492 virtual EffectSet Effects() const { return EffectSet::All(); } | 3504 virtual EffectSet Effects() const { return EffectSet::All(); } |
3493 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3505 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
3494 | 3506 |
3495 private: | 3507 private: |
3496 const intptr_t token_pos_; | 3508 const TokenDescriptor token_pos_; |
3497 const RawPcDescriptors::Kind stub_kind_; | 3509 const RawPcDescriptors::Kind stub_kind_; |
3498 | 3510 |
3499 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); | 3511 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); |
3500 }; | 3512 }; |
3501 | 3513 |
3502 | 3514 |
3503 enum StoreBarrierType { | 3515 enum StoreBarrierType { |
3504 kNoStoreBarrier, | 3516 kNoStoreBarrier, |
3505 kEmitStoreBarrier | 3517 kEmitStoreBarrier |
3506 }; | 3518 }; |
3507 | 3519 |
3508 | 3520 |
3509 class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { | 3521 class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { |
3510 public: | 3522 public: |
3511 StoreInstanceFieldInstr(const Field& field, | 3523 StoreInstanceFieldInstr(const Field& field, |
3512 Value* instance, | 3524 Value* instance, |
3513 Value* value, | 3525 Value* value, |
3514 StoreBarrierType emit_store_barrier, | 3526 StoreBarrierType emit_store_barrier, |
3515 intptr_t token_pos) | 3527 TokenDescriptor token_pos) |
3516 : field_(field), | 3528 : field_(field), |
3517 offset_in_bytes_(field.Offset()), | 3529 offset_in_bytes_(field.Offset()), |
3518 emit_store_barrier_(emit_store_barrier), | 3530 emit_store_barrier_(emit_store_barrier), |
3519 token_pos_(token_pos), | 3531 token_pos_(token_pos), |
3520 is_potential_unboxed_initialization_(false), | 3532 is_potential_unboxed_initialization_(false), |
3521 is_object_reference_initialization_(false) { | 3533 is_object_reference_initialization_(false) { |
3522 SetInputAt(kInstancePos, instance); | 3534 SetInputAt(kInstancePos, instance); |
3523 SetInputAt(kValuePos, value); | 3535 SetInputAt(kValuePos, value); |
3524 } | 3536 } |
3525 | 3537 |
3526 StoreInstanceFieldInstr(intptr_t offset_in_bytes, | 3538 StoreInstanceFieldInstr(intptr_t offset_in_bytes, |
3527 Value* instance, | 3539 Value* instance, |
3528 Value* value, | 3540 Value* value, |
3529 StoreBarrierType emit_store_barrier, | 3541 StoreBarrierType emit_store_barrier, |
3530 intptr_t token_pos) | 3542 TokenDescriptor token_pos) |
3531 : field_(Field::ZoneHandle()), | 3543 : field_(Field::ZoneHandle()), |
3532 offset_in_bytes_(offset_in_bytes), | 3544 offset_in_bytes_(offset_in_bytes), |
3533 emit_store_barrier_(emit_store_barrier), | 3545 emit_store_barrier_(emit_store_barrier), |
3534 token_pos_(token_pos), | 3546 token_pos_(token_pos), |
3535 is_potential_unboxed_initialization_(false), | 3547 is_potential_unboxed_initialization_(false), |
3536 is_object_reference_initialization_(false) { | 3548 is_object_reference_initialization_(false) { |
3537 SetInputAt(kInstancePos, instance); | 3549 SetInputAt(kInstancePos, instance); |
3538 SetInputAt(kValuePos, value); | 3550 SetInputAt(kValuePos, value); |
3539 } | 3551 } |
3540 | 3552 |
(...skipping 12 matching lines...) Expand all Loading... |
3553 }; | 3565 }; |
3554 | 3566 |
3555 Value* instance() const { return inputs_[kInstancePos]; } | 3567 Value* instance() const { return inputs_[kInstancePos]; } |
3556 Value* value() const { return inputs_[kValuePos]; } | 3568 Value* value() const { return inputs_[kValuePos]; } |
3557 bool is_potential_unboxed_initialization() const { | 3569 bool is_potential_unboxed_initialization() const { |
3558 return is_potential_unboxed_initialization_; | 3570 return is_potential_unboxed_initialization_; |
3559 } | 3571 } |
3560 bool is_object_reference_initialization() const { | 3572 bool is_object_reference_initialization() const { |
3561 return is_object_reference_initialization_; | 3573 return is_object_reference_initialization_; |
3562 } | 3574 } |
3563 virtual intptr_t token_pos() const { return token_pos_; } | 3575 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3564 | 3576 |
3565 const Field& field() const { return field_; } | 3577 const Field& field() const { return field_; } |
3566 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 3578 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
3567 | 3579 |
3568 bool ShouldEmitStoreBarrier() const { | 3580 bool ShouldEmitStoreBarrier() const { |
3569 return value()->NeedsStoreBuffer() | 3581 return value()->NeedsStoreBuffer() |
3570 && (emit_store_barrier_ == kEmitStoreBarrier); | 3582 && (emit_store_barrier_ == kEmitStoreBarrier); |
3571 } | 3583 } |
3572 | 3584 |
3573 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3585 virtual void PrintOperandsTo(BufferFormatter* f) const; |
(...skipping 22 matching lines...) Expand all Loading... |
3596 bool CanValueBeSmi() const { | 3608 bool CanValueBeSmi() const { |
3597 const intptr_t cid = value()->Type()->ToNullableCid(); | 3609 const intptr_t cid = value()->Type()->ToNullableCid(); |
3598 // Write barrier is skipped for nullable and non-nullable smis. | 3610 // Write barrier is skipped for nullable and non-nullable smis. |
3599 ASSERT(cid != kSmiCid); | 3611 ASSERT(cid != kSmiCid); |
3600 return (cid == kDynamicCid); | 3612 return (cid == kDynamicCid); |
3601 } | 3613 } |
3602 | 3614 |
3603 const Field& field_; | 3615 const Field& field_; |
3604 intptr_t offset_in_bytes_; | 3616 intptr_t offset_in_bytes_; |
3605 const StoreBarrierType emit_store_barrier_; | 3617 const StoreBarrierType emit_store_barrier_; |
3606 const intptr_t token_pos_; | 3618 const TokenDescriptor token_pos_; |
3607 // This may be the first store to an unboxed field. | 3619 // This may be the first store to an unboxed field. |
3608 bool is_potential_unboxed_initialization_; | 3620 bool is_potential_unboxed_initialization_; |
3609 // True if this store initializes an object reference field of an object that | 3621 // True if this store initializes an object reference field of an object that |
3610 // was allocated uninitialized; see AllocateUninitializedContext. | 3622 // was allocated uninitialized; see AllocateUninitializedContext. |
3611 bool is_object_reference_initialization_; | 3623 bool is_object_reference_initialization_; |
3612 | 3624 |
3613 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 3625 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
3614 }; | 3626 }; |
3615 | 3627 |
3616 | 3628 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3674 | 3686 |
3675 virtual bool AttributesEqual(Instruction* other) const; | 3687 virtual bool AttributesEqual(Instruction* other) const; |
3676 | 3688 |
3677 private: | 3689 private: |
3678 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); | 3690 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); |
3679 }; | 3691 }; |
3680 | 3692 |
3681 | 3693 |
3682 class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3694 class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
3683 public: | 3695 public: |
3684 LoadStaticFieldInstr(Value* field_value, intptr_t token_pos) | 3696 LoadStaticFieldInstr(Value* field_value, TokenDescriptor token_pos) |
3685 : token_pos_(token_pos) { | 3697 : token_pos_(token_pos) { |
3686 ASSERT(field_value->BindsToConstant()); | 3698 ASSERT(field_value->BindsToConstant()); |
3687 SetInputAt(0, field_value); | 3699 SetInputAt(0, field_value); |
3688 } | 3700 } |
3689 | 3701 |
3690 DECLARE_INSTRUCTION(LoadStaticField) | 3702 DECLARE_INSTRUCTION(LoadStaticField) |
3691 virtual CompileType ComputeType() const; | 3703 virtual CompileType ComputeType() const; |
3692 | 3704 |
3693 const Field& StaticField() const; | 3705 const Field& StaticField() const; |
3694 | 3706 |
3695 Value* field_value() const { return inputs_[0]; } | 3707 Value* field_value() const { return inputs_[0]; } |
3696 | 3708 |
3697 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3709 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3698 | 3710 |
3699 virtual bool CanDeoptimize() const { return false; } | 3711 virtual bool CanDeoptimize() const { return false; } |
3700 | 3712 |
3701 virtual bool AllowsCSE() const { return StaticField().is_final(); } | 3713 virtual bool AllowsCSE() const { return StaticField().is_final(); } |
3702 virtual EffectSet Effects() const { return EffectSet::None(); } | 3714 virtual EffectSet Effects() const { return EffectSet::None(); } |
3703 virtual EffectSet Dependencies() const; | 3715 virtual EffectSet Dependencies() const; |
3704 virtual bool AttributesEqual(Instruction* other) const; | 3716 virtual bool AttributesEqual(Instruction* other) const; |
3705 | 3717 |
3706 virtual intptr_t token_pos() const { return token_pos_; } | 3718 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3707 | 3719 |
3708 private: | 3720 private: |
3709 const intptr_t token_pos_; | 3721 const TokenDescriptor token_pos_; |
3710 | 3722 |
3711 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3723 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
3712 }; | 3724 }; |
3713 | 3725 |
3714 | 3726 |
3715 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3727 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
3716 public: | 3728 public: |
3717 StoreStaticFieldInstr(const Field& field, | 3729 StoreStaticFieldInstr(const Field& field, |
3718 Value* value, | 3730 Value* value, |
3719 intptr_t token_pos) | 3731 TokenDescriptor token_pos) |
3720 : field_(field), | 3732 : field_(field), |
3721 token_pos_(token_pos) { | 3733 token_pos_(token_pos) { |
3722 ASSERT(field.IsZoneHandle()); | 3734 ASSERT(field.IsZoneHandle()); |
3723 SetInputAt(kValuePos, value); | 3735 SetInputAt(kValuePos, value); |
3724 } | 3736 } |
3725 | 3737 |
3726 enum { | 3738 enum { |
3727 kValuePos = 0 | 3739 kValuePos = 0 |
3728 }; | 3740 }; |
3729 | 3741 |
3730 DECLARE_INSTRUCTION(StoreStaticField) | 3742 DECLARE_INSTRUCTION(StoreStaticField) |
3731 | 3743 |
3732 const Field& field() const { return field_; } | 3744 const Field& field() const { return field_; } |
3733 Value* value() const { return inputs_[kValuePos]; } | 3745 Value* value() const { return inputs_[kValuePos]; } |
3734 | 3746 |
3735 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3747 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3736 | 3748 |
3737 virtual bool CanDeoptimize() const { return false; } | 3749 virtual bool CanDeoptimize() const { return false; } |
3738 | 3750 |
3739 // Currently CSE/LICM don't operate on any instructions that can be affected | 3751 // Currently CSE/LICM don't operate on any instructions that can be affected |
3740 // by stores/loads. LoadOptimizer handles loads separately. Hence stores | 3752 // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
3741 // are marked as having no side-effects. | 3753 // are marked as having no side-effects. |
3742 virtual EffectSet Effects() const { return EffectSet::None(); } | 3754 virtual EffectSet Effects() const { return EffectSet::None(); } |
3743 | 3755 |
3744 virtual intptr_t token_pos() const { return token_pos_; } | 3756 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3745 | 3757 |
3746 private: | 3758 private: |
3747 bool CanValueBeSmi() const { | 3759 bool CanValueBeSmi() const { |
3748 const intptr_t cid = value()->Type()->ToNullableCid(); | 3760 const intptr_t cid = value()->Type()->ToNullableCid(); |
3749 // Write barrier is skipped for nullable and non-nullable smis. | 3761 // Write barrier is skipped for nullable and non-nullable smis. |
3750 ASSERT(cid != kSmiCid); | 3762 ASSERT(cid != kSmiCid); |
3751 return (cid == kDynamicCid); | 3763 return (cid == kDynamicCid); |
3752 } | 3764 } |
3753 | 3765 |
3754 const Field& field_; | 3766 const Field& field_; |
3755 const intptr_t token_pos_; | 3767 const TokenDescriptor token_pos_; |
3756 | 3768 |
3757 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); | 3769 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); |
3758 }; | 3770 }; |
3759 | 3771 |
3760 | 3772 |
3761 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { | 3773 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { |
3762 public: | 3774 public: |
3763 LoadIndexedInstr(Value* array, | 3775 LoadIndexedInstr(Value* array, |
3764 Value* index, | 3776 Value* index, |
3765 intptr_t index_scale, | 3777 intptr_t index_scale, |
3766 intptr_t class_id, | 3778 intptr_t class_id, |
3767 intptr_t deopt_id, | 3779 intptr_t deopt_id, |
3768 intptr_t token_pos) | 3780 TokenDescriptor token_pos) |
3769 : TemplateDefinition(deopt_id), | 3781 : TemplateDefinition(deopt_id), |
3770 index_scale_(index_scale), | 3782 index_scale_(index_scale), |
3771 class_id_(class_id), | 3783 class_id_(class_id), |
3772 token_pos_(token_pos) { | 3784 token_pos_(token_pos) { |
3773 SetInputAt(0, array); | 3785 SetInputAt(0, array); |
3774 SetInputAt(1, index); | 3786 SetInputAt(1, index); |
3775 } | 3787 } |
3776 | 3788 |
3777 intptr_t token_pos() const { return token_pos_; } | 3789 TokenDescriptor token_pos() const { return token_pos_; } |
3778 | 3790 |
3779 DECLARE_INSTRUCTION(LoadIndexed) | 3791 DECLARE_INSTRUCTION(LoadIndexed) |
3780 virtual CompileType ComputeType() const; | 3792 virtual CompileType ComputeType() const; |
3781 | 3793 |
3782 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3794 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3783 ASSERT(idx == 0 || idx == 1); | 3795 ASSERT(idx == 0 || idx == 1); |
3784 // The array may be tagged or untagged (for external arrays). | 3796 // The array may be tagged or untagged (for external arrays). |
3785 if (idx == 0) return kNoRepresentation; | 3797 if (idx == 0) return kNoRepresentation; |
3786 return kTagged; | 3798 return kTagged; |
3787 } | 3799 } |
(...skipping 12 matching lines...) Expand all Loading... |
3800 } | 3812 } |
3801 | 3813 |
3802 virtual Representation representation() const; | 3814 virtual Representation representation() const; |
3803 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 3815 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
3804 | 3816 |
3805 virtual EffectSet Effects() const { return EffectSet::None(); } | 3817 virtual EffectSet Effects() const { return EffectSet::None(); } |
3806 | 3818 |
3807 private: | 3819 private: |
3808 const intptr_t index_scale_; | 3820 const intptr_t index_scale_; |
3809 const intptr_t class_id_; | 3821 const intptr_t class_id_; |
3810 const intptr_t token_pos_; | 3822 const TokenDescriptor token_pos_; |
3811 | 3823 |
3812 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); | 3824 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); |
3813 }; | 3825 }; |
3814 | 3826 |
3815 | 3827 |
3816 // Loads the specified number of code units from the given string, packing | 3828 // Loads the specified number of code units from the given string, packing |
3817 // multiple code units into a single datatype. In essence, this is a specialized | 3829 // multiple code units into a single datatype. In essence, this is a specialized |
3818 // version of LoadIndexedInstr which accepts only string targets and can load | 3830 // version of LoadIndexedInstr which accepts only string targets and can load |
3819 // multiple elements at once. The result datatype differs depending on the | 3831 // multiple elements at once. The result datatype differs depending on the |
3820 // string type, element count, and architecture; if possible, the result is | 3832 // string type, element count, and architecture; if possible, the result is |
3821 // packed into a Smi, falling back to a Mint otherwise. | 3833 // packed into a Smi, falling back to a Mint otherwise. |
3822 // TODO(zerny): Add support for loading into UnboxedInt32x4. | 3834 // TODO(zerny): Add support for loading into UnboxedInt32x4. |
3823 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { | 3835 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { |
3824 public: | 3836 public: |
3825 LoadCodeUnitsInstr(Value* str, | 3837 LoadCodeUnitsInstr(Value* str, |
3826 Value* index, | 3838 Value* index, |
3827 intptr_t element_count, | 3839 intptr_t element_count, |
3828 intptr_t class_id, | 3840 intptr_t class_id, |
3829 intptr_t token_pos) | 3841 TokenDescriptor token_pos) |
3830 : class_id_(class_id), | 3842 : class_id_(class_id), |
3831 token_pos_(token_pos), | 3843 token_pos_(token_pos), |
3832 element_count_(element_count), | 3844 element_count_(element_count), |
3833 representation_(kTagged) { | 3845 representation_(kTagged) { |
3834 ASSERT(element_count == 1 || element_count == 2 || element_count == 4); | 3846 ASSERT(element_count == 1 || element_count == 2 || element_count == 4); |
3835 ASSERT(RawObject::IsStringClassId(class_id)); | 3847 ASSERT(RawObject::IsStringClassId(class_id)); |
3836 SetInputAt(0, str); | 3848 SetInputAt(0, str); |
3837 SetInputAt(1, index); | 3849 SetInputAt(1, index); |
3838 } | 3850 } |
3839 | 3851 |
3840 intptr_t token_pos() const { return token_pos_; } | 3852 TokenDescriptor token_pos() const { return token_pos_; } |
3841 | 3853 |
3842 DECLARE_INSTRUCTION(LoadCodeUnits) | 3854 DECLARE_INSTRUCTION(LoadCodeUnits) |
3843 virtual CompileType ComputeType() const; | 3855 virtual CompileType ComputeType() const; |
3844 | 3856 |
3845 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3857 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3846 if (idx == 0) { | 3858 if (idx == 0) { |
3847 // The string may be tagged or untagged (for external strings). | 3859 // The string may be tagged or untagged (for external strings). |
3848 return kNoRepresentation; | 3860 return kNoRepresentation; |
3849 } | 3861 } |
3850 ASSERT(idx == 1); | 3862 ASSERT(idx == 1); |
(...skipping 17 matching lines...) Expand all Loading... |
3868 virtual bool CanDeoptimize() const { return false; } | 3880 virtual bool CanDeoptimize() const { return false; } |
3869 | 3881 |
3870 virtual Representation representation() const { return representation_; } | 3882 virtual Representation representation() const { return representation_; } |
3871 void set_representation(Representation repr) { representation_ = repr; } | 3883 void set_representation(Representation repr) { representation_ = repr; } |
3872 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 3884 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
3873 | 3885 |
3874 virtual EffectSet Effects() const { return EffectSet::None(); } | 3886 virtual EffectSet Effects() const { return EffectSet::None(); } |
3875 | 3887 |
3876 private: | 3888 private: |
3877 const intptr_t class_id_; | 3889 const intptr_t class_id_; |
3878 const intptr_t token_pos_; | 3890 const TokenDescriptor token_pos_; |
3879 const intptr_t element_count_; | 3891 const intptr_t element_count_; |
3880 Representation representation_; | 3892 Representation representation_; |
3881 | 3893 |
3882 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); | 3894 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); |
3883 }; | 3895 }; |
3884 | 3896 |
3885 | 3897 |
3886 class StringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { | 3898 class StringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { |
3887 public: | 3899 public: |
3888 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { | 3900 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3931 | 3943 |
3932 private: | 3944 private: |
3933 const intptr_t cid_; | 3945 const intptr_t cid_; |
3934 | 3946 |
3935 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); | 3947 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); |
3936 }; | 3948 }; |
3937 | 3949 |
3938 | 3950 |
3939 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { | 3951 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { |
3940 public: | 3952 public: |
3941 StringInterpolateInstr(Value* value, intptr_t token_pos) | 3953 StringInterpolateInstr(Value* value, TokenDescriptor token_pos) |
3942 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 3954 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
3943 token_pos_(token_pos), | 3955 token_pos_(token_pos), |
3944 function_(Function::ZoneHandle()) { | 3956 function_(Function::ZoneHandle()) { |
3945 SetInputAt(0, value); | 3957 SetInputAt(0, value); |
3946 } | 3958 } |
3947 | 3959 |
3948 Value* value() const { return inputs_[0]; } | 3960 Value* value() const { return inputs_[0]; } |
3949 virtual intptr_t token_pos() const { return token_pos_; } | 3961 virtual TokenDescriptor token_pos() const { return token_pos_; } |
3950 | 3962 |
3951 virtual CompileType ComputeType() const; | 3963 virtual CompileType ComputeType() const; |
3952 // Issues a static call to Dart code which calls toString on objects. | 3964 // Issues a static call to Dart code which calls toString on objects. |
3953 virtual EffectSet Effects() const { return EffectSet::All(); } | 3965 virtual EffectSet Effects() const { return EffectSet::All(); } |
3954 virtual bool CanDeoptimize() const { return true; } | 3966 virtual bool CanDeoptimize() const { return true; } |
3955 | 3967 |
3956 const Function& CallFunction() const; | 3968 const Function& CallFunction() const; |
3957 | 3969 |
3958 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3970 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
3959 | 3971 |
3960 DECLARE_INSTRUCTION(StringInterpolate) | 3972 DECLARE_INSTRUCTION(StringInterpolate) |
3961 | 3973 |
3962 private: | 3974 private: |
3963 const intptr_t token_pos_; | 3975 const TokenDescriptor token_pos_; |
3964 Function& function_; | 3976 Function& function_; |
3965 | 3977 |
3966 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); | 3978 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); |
3967 }; | 3979 }; |
3968 | 3980 |
3969 | 3981 |
3970 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { | 3982 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { |
3971 public: | 3983 public: |
3972 StoreIndexedInstr(Value* array, | 3984 StoreIndexedInstr(Value* array, |
3973 Value* index, | 3985 Value* index, |
3974 Value* value, | 3986 Value* value, |
3975 StoreBarrierType emit_store_barrier, | 3987 StoreBarrierType emit_store_barrier, |
3976 intptr_t index_scale, | 3988 intptr_t index_scale, |
3977 intptr_t class_id, | 3989 intptr_t class_id, |
3978 intptr_t deopt_id, | 3990 intptr_t deopt_id, |
3979 intptr_t token_pos) | 3991 TokenDescriptor token_pos) |
3980 : TemplateDefinition(deopt_id), | 3992 : TemplateDefinition(deopt_id), |
3981 emit_store_barrier_(emit_store_barrier), | 3993 emit_store_barrier_(emit_store_barrier), |
3982 index_scale_(index_scale), | 3994 index_scale_(index_scale), |
3983 class_id_(class_id), | 3995 class_id_(class_id), |
3984 token_pos_(token_pos) { | 3996 token_pos_(token_pos) { |
3985 SetInputAt(kArrayPos, array); | 3997 SetInputAt(kArrayPos, array); |
3986 SetInputAt(kIndexPos, index); | 3998 SetInputAt(kIndexPos, index); |
3987 SetInputAt(kValuePos, value); | 3999 SetInputAt(kValuePos, value); |
3988 } | 4000 } |
3989 | 4001 |
(...skipping 30 matching lines...) Expand all Loading... |
4020 // was inherited from another instruction that could deoptimize. | 4032 // was inherited from another instruction that could deoptimize. |
4021 return GetDeoptId(); | 4033 return GetDeoptId(); |
4022 } | 4034 } |
4023 | 4035 |
4024 virtual EffectSet Effects() const { return EffectSet::None(); } | 4036 virtual EffectSet Effects() const { return EffectSet::None(); } |
4025 | 4037 |
4026 private: | 4038 private: |
4027 const StoreBarrierType emit_store_barrier_; | 4039 const StoreBarrierType emit_store_barrier_; |
4028 const intptr_t index_scale_; | 4040 const intptr_t index_scale_; |
4029 const intptr_t class_id_; | 4041 const intptr_t class_id_; |
4030 const intptr_t token_pos_; | 4042 const TokenDescriptor token_pos_; |
4031 | 4043 |
4032 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); | 4044 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); |
4033 }; | 4045 }; |
4034 | 4046 |
4035 | 4047 |
4036 // Note overrideable, built-in: value ? false : true. | 4048 // Note overrideable, built-in: value ? false : true. |
4037 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { | 4049 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { |
4038 public: | 4050 public: |
4039 explicit BooleanNegateInstr(Value* value) { | 4051 explicit BooleanNegateInstr(Value* value) { |
4040 SetInputAt(0, value); | 4052 SetInputAt(0, value); |
(...skipping 10 matching lines...) Expand all Loading... |
4051 | 4063 |
4052 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4064 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
4053 | 4065 |
4054 private: | 4066 private: |
4055 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); | 4067 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
4056 }; | 4068 }; |
4057 | 4069 |
4058 | 4070 |
4059 class InstanceOfInstr : public TemplateDefinition<2, Throws> { | 4071 class InstanceOfInstr : public TemplateDefinition<2, Throws> { |
4060 public: | 4072 public: |
4061 InstanceOfInstr(intptr_t token_pos, | 4073 InstanceOfInstr(TokenDescriptor token_pos, |
4062 Value* value, | 4074 Value* value, |
4063 Value* instantiator_type_arguments, | 4075 Value* instantiator_type_arguments, |
4064 const AbstractType& type, | 4076 const AbstractType& type, |
4065 bool negate_result, | 4077 bool negate_result, |
4066 intptr_t deopt_id) | 4078 intptr_t deopt_id) |
4067 : TemplateDefinition(deopt_id), | 4079 : TemplateDefinition(deopt_id), |
4068 token_pos_(token_pos), | 4080 token_pos_(token_pos), |
4069 type_(type), | 4081 type_(type), |
4070 negate_result_(negate_result) { | 4082 negate_result_(negate_result) { |
4071 ASSERT(!type.IsNull()); | 4083 ASSERT(!type.IsNull()); |
4072 SetInputAt(0, value); | 4084 SetInputAt(0, value); |
4073 SetInputAt(1, instantiator_type_arguments); | 4085 SetInputAt(1, instantiator_type_arguments); |
4074 } | 4086 } |
4075 | 4087 |
4076 DECLARE_INSTRUCTION(InstanceOf) | 4088 DECLARE_INSTRUCTION(InstanceOf) |
4077 virtual CompileType ComputeType() const; | 4089 virtual CompileType ComputeType() const; |
4078 | 4090 |
4079 Value* value() const { return inputs_[0]; } | 4091 Value* value() const { return inputs_[0]; } |
4080 Value* instantiator_type_arguments() const { return inputs_[1]; } | 4092 Value* instantiator_type_arguments() const { return inputs_[1]; } |
4081 | 4093 |
4082 bool negate_result() const { return negate_result_; } | 4094 bool negate_result() const { return negate_result_; } |
4083 const AbstractType& type() const { return type_; } | 4095 const AbstractType& type() const { return type_; } |
4084 virtual intptr_t token_pos() const { return token_pos_; } | 4096 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4085 | 4097 |
4086 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4098 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4087 | 4099 |
4088 virtual bool CanDeoptimize() const { return true; } | 4100 virtual bool CanDeoptimize() const { return true; } |
4089 | 4101 |
4090 virtual EffectSet Effects() const { return EffectSet::None(); } | 4102 virtual EffectSet Effects() const { return EffectSet::None(); } |
4091 | 4103 |
4092 private: | 4104 private: |
4093 const intptr_t token_pos_; | 4105 const TokenDescriptor token_pos_; |
4094 Value* value_; | 4106 Value* value_; |
4095 Value* type_arguments_; | 4107 Value* type_arguments_; |
4096 const AbstractType& type_; | 4108 const AbstractType& type_; |
4097 const bool negate_result_; | 4109 const bool negate_result_; |
4098 | 4110 |
4099 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); | 4111 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); |
4100 }; | 4112 }; |
4101 | 4113 |
4102 | 4114 |
4103 class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { | 4115 class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { |
4104 public: | 4116 public: |
4105 AllocateObjectInstr(intptr_t token_pos, | 4117 AllocateObjectInstr(TokenDescriptor token_pos, |
4106 const Class& cls, | 4118 const Class& cls, |
4107 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 4119 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
4108 : token_pos_(token_pos), | 4120 : token_pos_(token_pos), |
4109 cls_(cls), | 4121 cls_(cls), |
4110 arguments_(arguments), | 4122 arguments_(arguments), |
4111 identity_(AliasIdentity::Unknown()), | 4123 identity_(AliasIdentity::Unknown()), |
4112 closure_function_(Function::ZoneHandle()) { | 4124 closure_function_(Function::ZoneHandle()) { |
4113 // Either no arguments or one type-argument and one instantiator. | 4125 // Either no arguments or one type-argument and one instantiator. |
4114 ASSERT(arguments->is_empty() || (arguments->length() == 1)); | 4126 ASSERT(arguments->is_empty() || (arguments->length() == 1)); |
4115 } | 4127 } |
4116 | 4128 |
4117 DECLARE_INSTRUCTION(AllocateObject) | 4129 DECLARE_INSTRUCTION(AllocateObject) |
4118 virtual CompileType ComputeType() const; | 4130 virtual CompileType ComputeType() const; |
4119 | 4131 |
4120 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 4132 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
4121 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 4133 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
4122 return (*arguments_)[index]; | 4134 return (*arguments_)[index]; |
4123 } | 4135 } |
4124 | 4136 |
4125 const Class& cls() const { return cls_; } | 4137 const Class& cls() const { return cls_; } |
4126 virtual intptr_t token_pos() const { return token_pos_; } | 4138 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4127 | 4139 |
4128 const Function& closure_function() const { return closure_function_; } | 4140 const Function& closure_function() const { return closure_function_; } |
4129 void set_closure_function(const Function& function) { | 4141 void set_closure_function(const Function& function) { |
4130 closure_function_ ^= function.raw(); | 4142 closure_function_ ^= function.raw(); |
4131 } | 4143 } |
4132 | 4144 |
4133 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4145 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4134 | 4146 |
4135 virtual bool CanDeoptimize() const { return false; } | 4147 virtual bool CanDeoptimize() const { return false; } |
4136 | 4148 |
4137 virtual EffectSet Effects() const { return EffectSet::None(); } | 4149 virtual EffectSet Effects() const { return EffectSet::None(); } |
4138 | 4150 |
4139 virtual AliasIdentity Identity() const { return identity_; } | 4151 virtual AliasIdentity Identity() const { return identity_; } |
4140 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 4152 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
4141 | 4153 |
4142 private: | 4154 private: |
4143 const intptr_t token_pos_; | 4155 const TokenDescriptor token_pos_; |
4144 const Class& cls_; | 4156 const Class& cls_; |
4145 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 4157 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
4146 AliasIdentity identity_; | 4158 AliasIdentity identity_; |
4147 Function& closure_function_; | 4159 Function& closure_function_; |
4148 | 4160 |
4149 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); | 4161 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); |
4150 }; | 4162 }; |
4151 | 4163 |
4152 | 4164 |
4153 class AllocateUninitializedContextInstr | 4165 class AllocateUninitializedContextInstr |
4154 : public TemplateDefinition<0, NoThrow> { | 4166 : public TemplateDefinition<0, NoThrow> { |
4155 public: | 4167 public: |
4156 AllocateUninitializedContextInstr(intptr_t token_pos, | 4168 AllocateUninitializedContextInstr(TokenDescriptor token_pos, |
4157 intptr_t num_context_variables) | 4169 intptr_t num_context_variables) |
4158 : token_pos_(token_pos), | 4170 : token_pos_(token_pos), |
4159 num_context_variables_(num_context_variables), | 4171 num_context_variables_(num_context_variables), |
4160 identity_(AliasIdentity::Unknown()) {} | 4172 identity_(AliasIdentity::Unknown()) {} |
4161 | 4173 |
4162 DECLARE_INSTRUCTION(AllocateUninitializedContext) | 4174 DECLARE_INSTRUCTION(AllocateUninitializedContext) |
4163 virtual CompileType ComputeType() const; | 4175 virtual CompileType ComputeType() const; |
4164 | 4176 |
4165 virtual intptr_t token_pos() const { return token_pos_; } | 4177 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4166 intptr_t num_context_variables() const { return num_context_variables_; } | 4178 intptr_t num_context_variables() const { return num_context_variables_; } |
4167 | 4179 |
4168 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4180 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4169 | 4181 |
4170 virtual bool CanDeoptimize() const { return false; } | 4182 virtual bool CanDeoptimize() const { return false; } |
4171 | 4183 |
4172 virtual EffectSet Effects() const { return EffectSet::None(); } | 4184 virtual EffectSet Effects() const { return EffectSet::None(); } |
4173 | 4185 |
4174 virtual AliasIdentity Identity() const { return identity_; } | 4186 virtual AliasIdentity Identity() const { return identity_; } |
4175 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 4187 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
4176 | 4188 |
4177 private: | 4189 private: |
4178 const intptr_t token_pos_; | 4190 const TokenDescriptor token_pos_; |
4179 const intptr_t num_context_variables_; | 4191 const intptr_t num_context_variables_; |
4180 AliasIdentity identity_; | 4192 AliasIdentity identity_; |
4181 | 4193 |
4182 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); | 4194 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); |
4183 }; | 4195 }; |
4184 | 4196 |
4185 | 4197 |
4186 // This instruction captures the state of the object which had its allocation | 4198 // This instruction captures the state of the object which had its allocation |
4187 // removed during the AllocationSinking pass. | 4199 // removed during the AllocationSinking pass. |
4188 // It does not produce any real code only deoptimization information. | 4200 // It does not produce any real code only deoptimization information. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 | 4304 |
4293 bool visited_for_liveness_; | 4305 bool visited_for_liveness_; |
4294 bool registers_remapped_; | 4306 bool registers_remapped_; |
4295 | 4307 |
4296 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); | 4308 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); |
4297 }; | 4309 }; |
4298 | 4310 |
4299 | 4311 |
4300 class CreateArrayInstr : public TemplateDefinition<2, Throws> { | 4312 class CreateArrayInstr : public TemplateDefinition<2, Throws> { |
4301 public: | 4313 public: |
4302 CreateArrayInstr(intptr_t token_pos, | 4314 CreateArrayInstr(TokenDescriptor token_pos, |
4303 Value* element_type, | 4315 Value* element_type, |
4304 Value* num_elements) | 4316 Value* num_elements) |
4305 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4317 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
4306 token_pos_(token_pos), | 4318 token_pos_(token_pos), |
4307 identity_(AliasIdentity::Unknown()) { | 4319 identity_(AliasIdentity::Unknown()) { |
4308 SetInputAt(kElementTypePos, element_type); | 4320 SetInputAt(kElementTypePos, element_type); |
4309 SetInputAt(kLengthPos, num_elements); | 4321 SetInputAt(kLengthPos, num_elements); |
4310 } | 4322 } |
4311 | 4323 |
4312 enum { | 4324 enum { |
4313 kElementTypePos = 0, | 4325 kElementTypePos = 0, |
4314 kLengthPos = 1 | 4326 kLengthPos = 1 |
4315 }; | 4327 }; |
4316 | 4328 |
4317 DECLARE_INSTRUCTION(CreateArray) | 4329 DECLARE_INSTRUCTION(CreateArray) |
4318 virtual CompileType ComputeType() const; | 4330 virtual CompileType ComputeType() const; |
4319 | 4331 |
4320 virtual intptr_t token_pos() const { return token_pos_; } | 4332 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4321 Value* element_type() const { return inputs_[kElementTypePos]; } | 4333 Value* element_type() const { return inputs_[kElementTypePos]; } |
4322 Value* num_elements() const { return inputs_[kLengthPos]; } | 4334 Value* num_elements() const { return inputs_[kLengthPos]; } |
4323 | 4335 |
4324 // Throw needs environment, which is created only if instruction can | 4336 // Throw needs environment, which is created only if instruction can |
4325 // deoptimize. | 4337 // deoptimize. |
4326 virtual bool CanDeoptimize() const { return MayThrow(); } | 4338 virtual bool CanDeoptimize() const { return MayThrow(); } |
4327 | 4339 |
4328 virtual EffectSet Effects() const { return EffectSet::None(); } | 4340 virtual EffectSet Effects() const { return EffectSet::None(); } |
4329 | 4341 |
4330 virtual AliasIdentity Identity() const { return identity_; } | 4342 virtual AliasIdentity Identity() const { return identity_; } |
4331 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 4343 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
4332 | 4344 |
4333 private: | 4345 private: |
4334 const intptr_t token_pos_; | 4346 const TokenDescriptor token_pos_; |
4335 AliasIdentity identity_; | 4347 AliasIdentity identity_; |
4336 | 4348 |
4337 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); | 4349 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); |
4338 }; | 4350 }; |
4339 | 4351 |
4340 | 4352 |
4341 // Note: this instruction must not be moved without the indexed access that | 4353 // Note: this instruction must not be moved without the indexed access that |
4342 // depends on it (e.g. out of loops). GC may cause collect | 4354 // depends on it (e.g. out of loops). GC may cause collect |
4343 // the array while the external data-array is still accessed. | 4355 // the array while the external data-array is still accessed. |
4344 // TODO(vegorov) enable LICMing this instruction by ensuring that array itself | 4356 // TODO(vegorov) enable LICMing this instruction by ensuring that array itself |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4402 private: | 4414 private: |
4403 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); | 4415 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); |
4404 }; | 4416 }; |
4405 | 4417 |
4406 | 4418 |
4407 class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { | 4419 class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { |
4408 public: | 4420 public: |
4409 LoadFieldInstr(Value* instance, | 4421 LoadFieldInstr(Value* instance, |
4410 intptr_t offset_in_bytes, | 4422 intptr_t offset_in_bytes, |
4411 const AbstractType& type, | 4423 const AbstractType& type, |
4412 intptr_t token_pos) | 4424 TokenDescriptor token_pos) |
4413 : offset_in_bytes_(offset_in_bytes), | 4425 : offset_in_bytes_(offset_in_bytes), |
4414 type_(type), | 4426 type_(type), |
4415 result_cid_(kDynamicCid), | 4427 result_cid_(kDynamicCid), |
4416 immutable_(false), | 4428 immutable_(false), |
4417 recognized_kind_(MethodRecognizer::kUnknown), | 4429 recognized_kind_(MethodRecognizer::kUnknown), |
4418 field_(NULL), | 4430 field_(NULL), |
4419 token_pos_(token_pos) { | 4431 token_pos_(token_pos) { |
4420 ASSERT(offset_in_bytes >= 0); | 4432 ASSERT(offset_in_bytes >= 0); |
4421 // May be null if field is not an instance. | 4433 // May be null if field is not an instance. |
4422 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); | 4434 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); |
4423 SetInputAt(0, instance); | 4435 SetInputAt(0, instance); |
4424 } | 4436 } |
4425 | 4437 |
4426 LoadFieldInstr(Value* instance, | 4438 LoadFieldInstr(Value* instance, |
4427 const Field* field, | 4439 const Field* field, |
4428 const AbstractType& type, | 4440 const AbstractType& type, |
4429 intptr_t token_pos) | 4441 TokenDescriptor token_pos) |
4430 : offset_in_bytes_(field->Offset()), | 4442 : offset_in_bytes_(field->Offset()), |
4431 type_(type), | 4443 type_(type), |
4432 result_cid_(kDynamicCid), | 4444 result_cid_(kDynamicCid), |
4433 immutable_(false), | 4445 immutable_(false), |
4434 recognized_kind_(MethodRecognizer::kUnknown), | 4446 recognized_kind_(MethodRecognizer::kUnknown), |
4435 field_(field), | 4447 field_(field), |
4436 token_pos_(token_pos) { | 4448 token_pos_(token_pos) { |
4437 ASSERT(field->IsZoneHandle()); | 4449 ASSERT(field->IsZoneHandle()); |
4438 // May be null if field is not an instance. | 4450 // May be null if field is not an instance. |
4439 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); | 4451 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); |
4440 SetInputAt(0, instance); | 4452 SetInputAt(0, instance); |
4441 } | 4453 } |
4442 | 4454 |
4443 void set_is_immutable(bool value) { immutable_ = value; } | 4455 void set_is_immutable(bool value) { immutable_ = value; } |
4444 | 4456 |
4445 Value* instance() const { return inputs_[0]; } | 4457 Value* instance() const { return inputs_[0]; } |
4446 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 4458 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
4447 const AbstractType& type() const { return type_; } | 4459 const AbstractType& type() const { return type_; } |
4448 void set_result_cid(intptr_t value) { result_cid_ = value; } | 4460 void set_result_cid(intptr_t value) { result_cid_ = value; } |
4449 intptr_t result_cid() const { return result_cid_; } | 4461 intptr_t result_cid() const { return result_cid_; } |
4450 virtual intptr_t token_pos() const { return token_pos_; } | 4462 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4451 | 4463 |
4452 const Field* field() const { return field_; } | 4464 const Field* field() const { return field_; } |
4453 | 4465 |
4454 virtual Representation representation() const; | 4466 virtual Representation representation() const; |
4455 | 4467 |
4456 bool IsUnboxedLoad() const; | 4468 bool IsUnboxedLoad() const; |
4457 | 4469 |
4458 bool IsPotentialUnboxedLoad() const; | 4470 bool IsPotentialUnboxedLoad() const; |
4459 | 4471 |
4460 void set_recognized_kind(MethodRecognizer::Kind kind) { | 4472 void set_recognized_kind(MethodRecognizer::Kind kind) { |
(...skipping 27 matching lines...) Expand all Loading... |
4488 virtual bool AttributesEqual(Instruction* other) const; | 4500 virtual bool AttributesEqual(Instruction* other) const; |
4489 | 4501 |
4490 private: | 4502 private: |
4491 const intptr_t offset_in_bytes_; | 4503 const intptr_t offset_in_bytes_; |
4492 const AbstractType& type_; | 4504 const AbstractType& type_; |
4493 intptr_t result_cid_; | 4505 intptr_t result_cid_; |
4494 bool immutable_; | 4506 bool immutable_; |
4495 | 4507 |
4496 MethodRecognizer::Kind recognized_kind_; | 4508 MethodRecognizer::Kind recognized_kind_; |
4497 const Field* field_; | 4509 const Field* field_; |
4498 const intptr_t token_pos_; | 4510 const TokenDescriptor token_pos_; |
4499 | 4511 |
4500 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); | 4512 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); |
4501 }; | 4513 }; |
4502 | 4514 |
4503 | 4515 |
4504 class InstantiateTypeInstr : public TemplateDefinition<1, Throws> { | 4516 class InstantiateTypeInstr : public TemplateDefinition<1, Throws> { |
4505 public: | 4517 public: |
4506 InstantiateTypeInstr(intptr_t token_pos, | 4518 InstantiateTypeInstr(TokenDescriptor token_pos, |
4507 const AbstractType& type, | 4519 const AbstractType& type, |
4508 const Class& instantiator_class, | 4520 const Class& instantiator_class, |
4509 Value* instantiator) | 4521 Value* instantiator) |
4510 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4522 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
4511 token_pos_(token_pos), | 4523 token_pos_(token_pos), |
4512 type_(type), | 4524 type_(type), |
4513 instantiator_class_(instantiator_class) { | 4525 instantiator_class_(instantiator_class) { |
4514 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); | 4526 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); |
4515 SetInputAt(0, instantiator); | 4527 SetInputAt(0, instantiator); |
4516 } | 4528 } |
4517 | 4529 |
4518 DECLARE_INSTRUCTION(InstantiateType) | 4530 DECLARE_INSTRUCTION(InstantiateType) |
4519 | 4531 |
4520 Value* instantiator() const { return inputs_[0]; } | 4532 Value* instantiator() const { return inputs_[0]; } |
4521 const AbstractType& type() const { return type_; | 4533 const AbstractType& type() const { return type_; |
4522 } | 4534 } |
4523 const Class& instantiator_class() const { return instantiator_class_; } | 4535 const Class& instantiator_class() const { return instantiator_class_; } |
4524 virtual intptr_t token_pos() const { return token_pos_; } | 4536 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4525 | 4537 |
4526 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4538 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4527 | 4539 |
4528 virtual bool CanDeoptimize() const { return true; } | 4540 virtual bool CanDeoptimize() const { return true; } |
4529 | 4541 |
4530 virtual EffectSet Effects() const { return EffectSet::None(); } | 4542 virtual EffectSet Effects() const { return EffectSet::None(); } |
4531 | 4543 |
4532 private: | 4544 private: |
4533 const intptr_t token_pos_; | 4545 const TokenDescriptor token_pos_; |
4534 const AbstractType& type_; | 4546 const AbstractType& type_; |
4535 const Class& instantiator_class_; | 4547 const Class& instantiator_class_; |
4536 | 4548 |
4537 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); | 4549 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); |
4538 }; | 4550 }; |
4539 | 4551 |
4540 | 4552 |
4541 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1, Throws> { | 4553 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1, Throws> { |
4542 public: | 4554 public: |
4543 InstantiateTypeArgumentsInstr(intptr_t token_pos, | 4555 InstantiateTypeArgumentsInstr(TokenDescriptor token_pos, |
4544 const TypeArguments& type_arguments, | 4556 const TypeArguments& type_arguments, |
4545 const Class& instantiator_class, | 4557 const Class& instantiator_class, |
4546 Value* instantiator) | 4558 Value* instantiator) |
4547 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4559 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
4548 token_pos_(token_pos), | 4560 token_pos_(token_pos), |
4549 type_arguments_(type_arguments), | 4561 type_arguments_(type_arguments), |
4550 instantiator_class_(instantiator_class) { | 4562 instantiator_class_(instantiator_class) { |
4551 ASSERT(type_arguments.IsZoneHandle()); | 4563 ASSERT(type_arguments.IsZoneHandle()); |
4552 SetInputAt(0, instantiator); | 4564 SetInputAt(0, instantiator); |
4553 } | 4565 } |
4554 | 4566 |
4555 DECLARE_INSTRUCTION(InstantiateTypeArguments) | 4567 DECLARE_INSTRUCTION(InstantiateTypeArguments) |
4556 | 4568 |
4557 Value* instantiator() const { return inputs_[0]; } | 4569 Value* instantiator() const { return inputs_[0]; } |
4558 const TypeArguments& type_arguments() const { | 4570 const TypeArguments& type_arguments() const { |
4559 return type_arguments_; | 4571 return type_arguments_; |
4560 } | 4572 } |
4561 const Class& instantiator_class() const { return instantiator_class_; } | 4573 const Class& instantiator_class() const { return instantiator_class_; } |
4562 virtual intptr_t token_pos() const { return token_pos_; } | 4574 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4563 | 4575 |
4564 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4576 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4565 | 4577 |
4566 virtual bool CanDeoptimize() const { return true; } | 4578 virtual bool CanDeoptimize() const { return true; } |
4567 | 4579 |
4568 virtual EffectSet Effects() const { return EffectSet::None(); } | 4580 virtual EffectSet Effects() const { return EffectSet::None(); } |
4569 | 4581 |
4570 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4582 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
4571 | 4583 |
4572 private: | 4584 private: |
4573 const intptr_t token_pos_; | 4585 const TokenDescriptor token_pos_; |
4574 const TypeArguments& type_arguments_; | 4586 const TypeArguments& type_arguments_; |
4575 const Class& instantiator_class_; | 4587 const Class& instantiator_class_; |
4576 | 4588 |
4577 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); | 4589 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); |
4578 }; | 4590 }; |
4579 | 4591 |
4580 | 4592 |
4581 class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { | 4593 class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { |
4582 public: | 4594 public: |
4583 AllocateContextInstr(intptr_t token_pos, | 4595 AllocateContextInstr(TokenDescriptor token_pos, |
4584 intptr_t num_context_variables) | 4596 intptr_t num_context_variables) |
4585 : token_pos_(token_pos), | 4597 : token_pos_(token_pos), |
4586 num_context_variables_(num_context_variables) { } | 4598 num_context_variables_(num_context_variables) { } |
4587 | 4599 |
4588 DECLARE_INSTRUCTION(AllocateContext) | 4600 DECLARE_INSTRUCTION(AllocateContext) |
4589 virtual CompileType ComputeType() const; | 4601 virtual CompileType ComputeType() const; |
4590 | 4602 |
4591 virtual intptr_t token_pos() const { return token_pos_; } | 4603 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4592 intptr_t num_context_variables() const { return num_context_variables_; } | 4604 intptr_t num_context_variables() const { return num_context_variables_; } |
4593 | 4605 |
4594 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4606 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4595 | 4607 |
4596 virtual bool CanDeoptimize() const { return false; } | 4608 virtual bool CanDeoptimize() const { return false; } |
4597 | 4609 |
4598 virtual EffectSet Effects() const { return EffectSet::None(); } | 4610 virtual EffectSet Effects() const { return EffectSet::None(); } |
4599 | 4611 |
4600 private: | 4612 private: |
4601 const intptr_t token_pos_; | 4613 const TokenDescriptor token_pos_; |
4602 const intptr_t num_context_variables_; | 4614 const intptr_t num_context_variables_; |
4603 | 4615 |
4604 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); | 4616 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); |
4605 }; | 4617 }; |
4606 | 4618 |
4607 | 4619 |
4608 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { | 4620 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { |
4609 public: | 4621 public: |
4610 InitStaticFieldInstr(Value* input, const Field& field) | 4622 InitStaticFieldInstr(Value* input, const Field& field) |
4611 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), | 4623 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), |
4612 field_(field) { | 4624 field_(field) { |
4613 SetInputAt(0, input); | 4625 SetInputAt(0, input); |
4614 } | 4626 } |
4615 | 4627 |
4616 virtual intptr_t token_pos() const { return field_.token_pos(); } | 4628 virtual TokenDescriptor token_pos() const { |
| 4629 return TokenDescriptor(field_.token_pos()); |
| 4630 } |
4617 const Field& field() const { return field_; } | 4631 const Field& field() const { return field_; } |
4618 | 4632 |
4619 DECLARE_INSTRUCTION(InitStaticField) | 4633 DECLARE_INSTRUCTION(InitStaticField) |
4620 | 4634 |
4621 virtual bool CanDeoptimize() const { return true; } | 4635 virtual bool CanDeoptimize() const { return true; } |
4622 virtual EffectSet Effects() const { return EffectSet::All(); } | 4636 virtual EffectSet Effects() const { return EffectSet::All(); } |
4623 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 4637 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
4624 | 4638 |
4625 private: | 4639 private: |
4626 const Field& field_; | 4640 const Field& field_; |
4627 | 4641 |
4628 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); | 4642 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); |
4629 }; | 4643 }; |
4630 | 4644 |
4631 | 4645 |
4632 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { | 4646 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { |
4633 public: | 4647 public: |
4634 CloneContextInstr(intptr_t token_pos, Value* context_value) | 4648 CloneContextInstr(TokenDescriptor token_pos, Value* context_value) |
4635 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 4649 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
4636 token_pos_(token_pos) { | 4650 token_pos_(token_pos) { |
4637 SetInputAt(0, context_value); | 4651 SetInputAt(0, context_value); |
4638 } | 4652 } |
4639 | 4653 |
4640 virtual intptr_t token_pos() const { return token_pos_; } | 4654 virtual TokenDescriptor token_pos() const { return token_pos_; } |
4641 Value* context_value() const { return inputs_[0]; } | 4655 Value* context_value() const { return inputs_[0]; } |
4642 | 4656 |
4643 DECLARE_INSTRUCTION(CloneContext) | 4657 DECLARE_INSTRUCTION(CloneContext) |
4644 virtual CompileType ComputeType() const; | 4658 virtual CompileType ComputeType() const; |
4645 | 4659 |
4646 virtual bool CanDeoptimize() const { return true; } | 4660 virtual bool CanDeoptimize() const { return true; } |
4647 | 4661 |
4648 virtual EffectSet Effects() const { return EffectSet::None(); } | 4662 virtual EffectSet Effects() const { return EffectSet::None(); } |
4649 | 4663 |
4650 private: | 4664 private: |
4651 const intptr_t token_pos_; | 4665 const TokenDescriptor token_pos_; |
4652 | 4666 |
4653 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); | 4667 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); |
4654 }; | 4668 }; |
4655 | 4669 |
4656 | 4670 |
4657 class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { | 4671 class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { |
4658 public: | 4672 public: |
4659 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) | 4673 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) |
4660 : TemplateInstruction(deopt_id), licm_hoisted_(false) { | 4674 : TemplateInstruction(deopt_id), licm_hoisted_(false) { |
4661 SetInputAt(0, left); | 4675 SetInputAt(0, left); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4761 ASSERT(idx == 0); | 4775 ASSERT(idx == 0); |
4762 return from_representation(); | 4776 return from_representation(); |
4763 } | 4777 } |
4764 | 4778 |
4765 virtual bool AttributesEqual(Instruction* other) const { | 4779 virtual bool AttributesEqual(Instruction* other) const { |
4766 return other->AsBox()->from_representation() == from_representation(); | 4780 return other->AsBox()->from_representation() == from_representation(); |
4767 } | 4781 } |
4768 | 4782 |
4769 Definition* Canonicalize(FlowGraph* flow_graph); | 4783 Definition* Canonicalize(FlowGraph* flow_graph); |
4770 | 4784 |
4771 virtual intptr_t token_pos() const { | 4785 virtual TokenDescriptor token_pos() const { |
4772 return ClassifyingTokenPositions::kBox; | 4786 return TokenDescriptor::kBox; |
4773 } | 4787 } |
4774 | 4788 |
4775 protected: | 4789 protected: |
4776 BoxInstr(Representation from_representation, Value* value) | 4790 BoxInstr(Representation from_representation, Value* value) |
4777 : from_representation_(from_representation) { | 4791 : from_representation_(from_representation) { |
4778 SetInputAt(0, value); | 4792 SetInputAt(0, value); |
4779 } | 4793 } |
4780 | 4794 |
4781 private: | 4795 private: |
4782 intptr_t ValueOffset() const { | 4796 intptr_t ValueOffset() const { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4887 virtual bool AttributesEqual(Instruction* other) const { | 4901 virtual bool AttributesEqual(Instruction* other) const { |
4888 return representation() == other->AsUnbox()->representation(); | 4902 return representation() == other->AsUnbox()->representation(); |
4889 } | 4903 } |
4890 | 4904 |
4891 Definition* Canonicalize(FlowGraph* flow_graph); | 4905 Definition* Canonicalize(FlowGraph* flow_graph); |
4892 | 4906 |
4893 virtual intptr_t DeoptimizationTarget() const { | 4907 virtual intptr_t DeoptimizationTarget() const { |
4894 return GetDeoptId(); | 4908 return GetDeoptId(); |
4895 } | 4909 } |
4896 | 4910 |
4897 virtual intptr_t token_pos() const { | 4911 virtual TokenDescriptor token_pos() const { |
4898 return ClassifyingTokenPositions::kBox; | 4912 return TokenDescriptor::kBox; |
4899 } | 4913 } |
4900 | 4914 |
4901 protected: | 4915 protected: |
4902 UnboxInstr(Representation representation, | 4916 UnboxInstr(Representation representation, |
4903 Value* value, | 4917 Value* value, |
4904 intptr_t deopt_id) | 4918 intptr_t deopt_id) |
4905 : TemplateDefinition(deopt_id), | 4919 : TemplateDefinition(deopt_id), |
4906 representation_(representation) { | 4920 representation_(representation) { |
4907 SetInputAt(0, value); | 4921 SetInputAt(0, value); |
4908 } | 4922 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); | 5221 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); |
5208 }; | 5222 }; |
5209 | 5223 |
5210 | 5224 |
5211 class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5225 class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5212 public: | 5226 public: |
5213 BinaryDoubleOpInstr(Token::Kind op_kind, | 5227 BinaryDoubleOpInstr(Token::Kind op_kind, |
5214 Value* left, | 5228 Value* left, |
5215 Value* right, | 5229 Value* right, |
5216 intptr_t deopt_id, | 5230 intptr_t deopt_id, |
5217 intptr_t token_pos) | 5231 TokenDescriptor token_pos) |
5218 : TemplateDefinition(deopt_id), | 5232 : TemplateDefinition(deopt_id), |
5219 op_kind_(op_kind), | 5233 op_kind_(op_kind), |
5220 token_pos_(token_pos) { | 5234 token_pos_(token_pos) { |
5221 SetInputAt(0, left); | 5235 SetInputAt(0, left); |
5222 SetInputAt(1, right); | 5236 SetInputAt(1, right); |
5223 } | 5237 } |
5224 | 5238 |
5225 Value* left() const { return inputs_[0]; } | 5239 Value* left() const { return inputs_[0]; } |
5226 Value* right() const { return inputs_[1]; } | 5240 Value* right() const { return inputs_[1]; } |
5227 | 5241 |
5228 Token::Kind op_kind() const { return op_kind_; } | 5242 Token::Kind op_kind() const { return op_kind_; } |
5229 | 5243 |
5230 virtual intptr_t token_pos() const { return token_pos_; } | 5244 virtual TokenDescriptor token_pos() const { return token_pos_; } |
5231 | 5245 |
5232 virtual void PrintOperandsTo(BufferFormatter* f) const; | 5246 virtual void PrintOperandsTo(BufferFormatter* f) const; |
5233 | 5247 |
5234 virtual bool CanDeoptimize() const { return false; } | 5248 virtual bool CanDeoptimize() const { return false; } |
5235 | 5249 |
5236 virtual Representation representation() const { | 5250 virtual Representation representation() const { |
5237 return kUnboxedDouble; | 5251 return kUnboxedDouble; |
5238 } | 5252 } |
5239 | 5253 |
5240 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 5254 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
(...skipping 11 matching lines...) Expand all Loading... |
5252 virtual CompileType ComputeType() const; | 5266 virtual CompileType ComputeType() const; |
5253 | 5267 |
5254 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 5268 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
5255 | 5269 |
5256 virtual bool AttributesEqual(Instruction* other) const { | 5270 virtual bool AttributesEqual(Instruction* other) const { |
5257 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); | 5271 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); |
5258 } | 5272 } |
5259 | 5273 |
5260 private: | 5274 private: |
5261 const Token::Kind op_kind_; | 5275 const Token::Kind op_kind_; |
5262 const intptr_t token_pos_; | 5276 const TokenDescriptor token_pos_; |
5263 | 5277 |
5264 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 5278 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
5265 }; | 5279 }; |
5266 | 5280 |
5267 | 5281 |
5268 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5282 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5269 public: | 5283 public: |
5270 BinaryFloat32x4OpInstr(Token::Kind op_kind, | 5284 BinaryFloat32x4OpInstr(Token::Kind op_kind, |
5271 Value* left, | 5285 Value* left, |
5272 Value* right, | 5286 Value* right, |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7158 | 7172 |
7159 private: | 7173 private: |
7160 const Token::Kind op_kind_; | 7174 const Token::Kind op_kind_; |
7161 | 7175 |
7162 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); | 7176 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); |
7163 }; | 7177 }; |
7164 | 7178 |
7165 | 7179 |
7166 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { | 7180 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { |
7167 public: | 7181 public: |
7168 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) | 7182 CheckStackOverflowInstr(TokenDescriptor token_pos, intptr_t loop_depth) |
7169 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), | 7183 : TemplateInstruction(Thread::Current()->GetNextDeoptId()), |
7170 token_pos_(token_pos), | 7184 token_pos_(token_pos), |
7171 loop_depth_(loop_depth) { | 7185 loop_depth_(loop_depth) { |
7172 } | 7186 } |
7173 | 7187 |
7174 virtual intptr_t token_pos() const { return token_pos_; } | 7188 virtual TokenDescriptor token_pos() const { return token_pos_; } |
7175 bool in_loop() const { return loop_depth_ > 0; } | 7189 bool in_loop() const { return loop_depth_ > 0; } |
7176 intptr_t loop_depth() const { return loop_depth_; } | 7190 intptr_t loop_depth() const { return loop_depth_; } |
7177 | 7191 |
7178 DECLARE_INSTRUCTION(CheckStackOverflow) | 7192 DECLARE_INSTRUCTION(CheckStackOverflow) |
7179 | 7193 |
7180 virtual bool CanDeoptimize() const { return true; } | 7194 virtual bool CanDeoptimize() const { return true; } |
7181 | 7195 |
7182 virtual EffectSet Effects() const { return EffectSet::None(); } | 7196 virtual EffectSet Effects() const { return EffectSet::None(); } |
7183 | 7197 |
7184 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7198 virtual void PrintOperandsTo(BufferFormatter* f) const; |
7185 | 7199 |
7186 private: | 7200 private: |
7187 const intptr_t token_pos_; | 7201 const TokenDescriptor token_pos_; |
7188 const intptr_t loop_depth_; | 7202 const intptr_t loop_depth_; |
7189 | 7203 |
7190 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); | 7204 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); |
7191 }; | 7205 }; |
7192 | 7206 |
7193 | 7207 |
7194 // TODO(vegorov): remove this instruction in favor of Int32ToDouble. | 7208 // TODO(vegorov): remove this instruction in favor of Int32ToDouble. |
7195 class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7209 class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7196 public: | 7210 public: |
7197 SmiToDoubleInstr(Value* value, intptr_t token_pos) | 7211 SmiToDoubleInstr(Value* value, TokenDescriptor token_pos) |
7198 : token_pos_(token_pos) { | 7212 : token_pos_(token_pos) { |
7199 SetInputAt(0, value); | 7213 SetInputAt(0, value); |
7200 } | 7214 } |
7201 | 7215 |
7202 Value* value() const { return inputs_[0]; } | 7216 Value* value() const { return inputs_[0]; } |
7203 virtual intptr_t token_pos() const { return token_pos_; } | 7217 virtual TokenDescriptor token_pos() const { return token_pos_; } |
7204 | 7218 |
7205 DECLARE_INSTRUCTION(SmiToDouble) | 7219 DECLARE_INSTRUCTION(SmiToDouble) |
7206 virtual CompileType ComputeType() const; | 7220 virtual CompileType ComputeType() const; |
7207 | 7221 |
7208 virtual Representation representation() const { | 7222 virtual Representation representation() const { |
7209 return kUnboxedDouble; | 7223 return kUnboxedDouble; |
7210 } | 7224 } |
7211 | 7225 |
7212 virtual bool CanDeoptimize() const { return false; } | 7226 virtual bool CanDeoptimize() const { return false; } |
7213 | 7227 |
7214 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7228 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7215 | 7229 |
7216 private: | 7230 private: |
7217 const intptr_t token_pos_; | 7231 const TokenDescriptor token_pos_; |
7218 | 7232 |
7219 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 7233 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
7220 }; | 7234 }; |
7221 | 7235 |
7222 | 7236 |
7223 class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7237 class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7224 public: | 7238 public: |
7225 explicit Int32ToDoubleInstr(Value* value) { | 7239 explicit Int32ToDoubleInstr(Value* value) { |
7226 SetInputAt(0, value); | 7240 SetInputAt(0, value); |
7227 } | 7241 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7454 private: | 7468 private: |
7455 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); | 7469 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); |
7456 }; | 7470 }; |
7457 | 7471 |
7458 | 7472 |
7459 class InvokeMathCFunctionInstr : public PureDefinition { | 7473 class InvokeMathCFunctionInstr : public PureDefinition { |
7460 public: | 7474 public: |
7461 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, | 7475 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, |
7462 intptr_t deopt_id, | 7476 intptr_t deopt_id, |
7463 MethodRecognizer::Kind recognized_kind, | 7477 MethodRecognizer::Kind recognized_kind, |
7464 intptr_t token_pos); | 7478 TokenDescriptor token_pos); |
7465 | 7479 |
7466 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); | 7480 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); |
7467 | 7481 |
7468 const RuntimeEntry& TargetFunction() const; | 7482 const RuntimeEntry& TargetFunction() const; |
7469 | 7483 |
7470 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } | 7484 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
7471 | 7485 |
7472 virtual intptr_t token_pos() const { return token_pos_; } | 7486 virtual TokenDescriptor token_pos() const { return token_pos_; } |
7473 | 7487 |
7474 DECLARE_INSTRUCTION(InvokeMathCFunction) | 7488 DECLARE_INSTRUCTION(InvokeMathCFunction) |
7475 virtual CompileType ComputeType() const; | 7489 virtual CompileType ComputeType() const; |
7476 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7490 virtual void PrintOperandsTo(BufferFormatter* f) const; |
7477 | 7491 |
7478 virtual bool CanDeoptimize() const { return false; } | 7492 virtual bool CanDeoptimize() const { return false; } |
7479 | 7493 |
7480 virtual Representation representation() const { | 7494 virtual Representation representation() const { |
7481 return kUnboxedDouble; | 7495 return kUnboxedDouble; |
7482 } | 7496 } |
(...skipping 24 matching lines...) Expand all Loading... |
7507 static const intptr_t kObjectTempIndex = 1; | 7521 static const intptr_t kObjectTempIndex = 1; |
7508 static const intptr_t kDoubleTempIndex = 2; | 7522 static const intptr_t kDoubleTempIndex = 2; |
7509 | 7523 |
7510 private: | 7524 private: |
7511 virtual void RawSetInputAt(intptr_t i, Value* value) { | 7525 virtual void RawSetInputAt(intptr_t i, Value* value) { |
7512 (*inputs_)[i] = value; | 7526 (*inputs_)[i] = value; |
7513 } | 7527 } |
7514 | 7528 |
7515 ZoneGrowableArray<Value*>* inputs_; | 7529 ZoneGrowableArray<Value*>* inputs_; |
7516 const MethodRecognizer::Kind recognized_kind_; | 7530 const MethodRecognizer::Kind recognized_kind_; |
7517 const intptr_t token_pos_; | 7531 const TokenDescriptor token_pos_; |
7518 | 7532 |
7519 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); | 7533 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); |
7520 }; | 7534 }; |
7521 | 7535 |
7522 | 7536 |
7523 class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7537 class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7524 public: | 7538 public: |
7525 // Extract the Nth output register from value. | 7539 // Extract the Nth output register from value. |
7526 ExtractNthOutputInstr(Value* value, | 7540 ExtractNthOutputInstr(Value* value, |
7527 intptr_t n, | 7541 intptr_t n, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7668 MergedMathInstr::Kind kind_; | 7682 MergedMathInstr::Kind kind_; |
7669 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); | 7683 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); |
7670 }; | 7684 }; |
7671 | 7685 |
7672 | 7686 |
7673 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { | 7687 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { |
7674 public: | 7688 public: |
7675 CheckClassInstr(Value* value, | 7689 CheckClassInstr(Value* value, |
7676 intptr_t deopt_id, | 7690 intptr_t deopt_id, |
7677 const ICData& unary_checks, | 7691 const ICData& unary_checks, |
7678 intptr_t token_pos); | 7692 TokenDescriptor token_pos); |
7679 | 7693 |
7680 DECLARE_INSTRUCTION(CheckClass) | 7694 DECLARE_INSTRUCTION(CheckClass) |
7681 | 7695 |
7682 virtual bool CanDeoptimize() const { return true; } | 7696 virtual bool CanDeoptimize() const { return true; } |
7683 | 7697 |
7684 virtual intptr_t token_pos() const { return token_pos_; } | 7698 virtual TokenDescriptor token_pos() const { return token_pos_; } |
7685 | 7699 |
7686 Value* value() const { return inputs_[0]; } | 7700 Value* value() const { return inputs_[0]; } |
7687 | 7701 |
7688 const ICData& unary_checks() const { return unary_checks_; } | 7702 const ICData& unary_checks() const { return unary_checks_; } |
7689 | 7703 |
7690 const GrowableArray<intptr_t>& cids() const { return cids_; } | 7704 const GrowableArray<intptr_t>& cids() const { return cids_; } |
7691 | 7705 |
7692 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7706 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
7693 | 7707 |
7694 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7708 virtual void PrintOperandsTo(BufferFormatter* f) const; |
(...skipping 15 matching lines...) Expand all Loading... |
7710 virtual bool AttributesEqual(Instruction* other) const; | 7724 virtual bool AttributesEqual(Instruction* other) const; |
7711 | 7725 |
7712 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7726 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
7713 | 7727 |
7714 static bool IsImmutableClassId(intptr_t cid); | 7728 static bool IsImmutableClassId(intptr_t cid); |
7715 | 7729 |
7716 private: | 7730 private: |
7717 const ICData& unary_checks_; | 7731 const ICData& unary_checks_; |
7718 GrowableArray<intptr_t> cids_; // Sorted, lowest first. | 7732 GrowableArray<intptr_t> cids_; // Sorted, lowest first. |
7719 bool licm_hoisted_; | 7733 bool licm_hoisted_; |
7720 const intptr_t token_pos_; | 7734 const TokenDescriptor token_pos_; |
7721 | 7735 |
7722 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); | 7736 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); |
7723 }; | 7737 }; |
7724 | 7738 |
7725 | 7739 |
7726 class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { | 7740 class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { |
7727 public: | 7741 public: |
7728 CheckSmiInstr(Value* value, intptr_t deopt_id, intptr_t token_pos) | 7742 CheckSmiInstr(Value* value, intptr_t deopt_id, TokenDescriptor token_pos) |
7729 : TemplateInstruction(deopt_id), | 7743 : TemplateInstruction(deopt_id), |
7730 token_pos_(token_pos), | 7744 token_pos_(token_pos), |
7731 licm_hoisted_(false) { | 7745 licm_hoisted_(false) { |
7732 SetInputAt(0, value); | 7746 SetInputAt(0, value); |
7733 } | 7747 } |
7734 | 7748 |
7735 Value* value() const { return inputs_[0]; } | 7749 Value* value() const { return inputs_[0]; } |
7736 virtual intptr_t token_pos() const { return token_pos_; } | 7750 virtual TokenDescriptor token_pos() const { return token_pos_; } |
7737 | 7751 |
7738 DECLARE_INSTRUCTION(CheckSmi) | 7752 DECLARE_INSTRUCTION(CheckSmi) |
7739 | 7753 |
7740 virtual bool CanDeoptimize() const { return true; } | 7754 virtual bool CanDeoptimize() const { return true; } |
7741 | 7755 |
7742 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7756 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
7743 | 7757 |
7744 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7758 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7745 | 7759 |
7746 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7760 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
7747 | 7761 |
7748 private: | 7762 private: |
7749 const intptr_t token_pos_; | 7763 const TokenDescriptor token_pos_; |
7750 bool licm_hoisted_; | 7764 bool licm_hoisted_; |
7751 | 7765 |
7752 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7766 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
7753 }; | 7767 }; |
7754 | 7768 |
7755 | 7769 |
7756 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { | 7770 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { |
7757 public: | 7771 public: |
7758 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) | 7772 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) |
7759 : TemplateInstruction(deopt_id), cid_(cid) { | 7773 : TemplateInstruction(deopt_id), cid_(cid) { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8175 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8189 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8176 UNIMPLEMENTED(); \ | 8190 UNIMPLEMENTED(); \ |
8177 return NULL; \ | 8191 return NULL; \ |
8178 } \ | 8192 } \ |
8179 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8193 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8180 | 8194 |
8181 | 8195 |
8182 } // namespace dart | 8196 } // namespace dart |
8183 | 8197 |
8184 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8198 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |