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

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

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

Powered by Google App Engine
This is Rietveld 408576698