OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/aot_optimizer.h" | 5 #include "vm/aot_optimizer.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // to megamorphic call. | 202 // to megamorphic call. |
203 return false; | 203 return false; |
204 } | 204 } |
205 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); | 205 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); |
206 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); | 206 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); |
207 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { | 207 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { |
208 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); | 208 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); |
209 } | 209 } |
210 | 210 |
211 const Token::Kind op_kind = call->token_kind(); | 211 const Token::Kind op_kind = call->token_kind(); |
212 if (Token::IsRelationalOperator(op_kind) || | 212 if (FLAG_guess_icdata_cid) { |
213 Token::IsEqualityOperator(op_kind) || Token::IsBinaryOperator(op_kind)) { | 213 if (Token::IsBinaryBitwiseOperator(op_kind)) { |
214 // Guess cid: if one of the inputs is a number assume that the other | 214 class_ids[0] = kSmiCid; |
215 // is a number of same type. | 215 class_ids[1] = kSmiCid; |
216 if (FLAG_guess_icdata_cid) { | 216 } |
| 217 if (Token::IsRelationalOperator(op_kind) || |
| 218 Token::IsEqualityOperator(op_kind) || |
| 219 Token::IsBinaryOperator(op_kind)) { |
| 220 // Guess cid: if one of the inputs is a number assume that the other |
| 221 // is a number of same type. |
217 const intptr_t cid_0 = class_ids[0]; | 222 const intptr_t cid_0 = class_ids[0]; |
218 const intptr_t cid_1 = class_ids[1]; | 223 const intptr_t cid_1 = class_ids[1]; |
219 if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) { | 224 if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) { |
220 class_ids[0] = cid_1; | 225 class_ids[0] = cid_1; |
221 } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) { | 226 } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) { |
222 class_ids[1] = cid_0; | 227 class_ids[1] = cid_0; |
223 } | 228 } |
224 } | 229 } |
225 } | 230 } |
226 | 231 |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 Definition* left = instr->ArgumentAt(0); | 1794 Definition* left = instr->ArgumentAt(0); |
1790 Definition* right = instr->ArgumentAt(1); | 1795 Definition* right = instr->ArgumentAt(1); |
1791 CheckedSmiComparisonInstr* smi_op = new (Z) | 1796 CheckedSmiComparisonInstr* smi_op = new (Z) |
1792 CheckedSmiComparisonInstr(instr->token_kind(), new (Z) Value(left), | 1797 CheckedSmiComparisonInstr(instr->token_kind(), new (Z) Value(left), |
1793 new (Z) Value(right), instr); | 1798 new (Z) Value(right), instr); |
1794 ReplaceCall(instr, smi_op); | 1799 ReplaceCall(instr, smi_op); |
1795 return; | 1800 return; |
1796 } | 1801 } |
1797 break; | 1802 break; |
1798 } | 1803 } |
| 1804 case Token::kSHL: |
| 1805 case Token::kSHR: |
1799 case Token::kBIT_OR: | 1806 case Token::kBIT_OR: |
1800 case Token::kBIT_XOR: | 1807 case Token::kBIT_XOR: |
1801 case Token::kBIT_AND: | 1808 case Token::kBIT_AND: |
1802 case Token::kADD: | 1809 case Token::kADD: |
1803 case Token::kSUB: | 1810 case Token::kSUB: |
1804 case Token::kMUL: { | 1811 case Token::kMUL: { |
1805 if (HasOnlyTwoOf(*instr->ic_data(), kSmiCid) || | 1812 if (HasOnlyTwoOf(*instr->ic_data(), kSmiCid) || |
1806 HasLikelySmiOperand(instr)) { | 1813 HasLikelySmiOperand(instr)) { |
1807 Definition* left = instr->ArgumentAt(0); | 1814 Definition* left = instr->ArgumentAt(0); |
1808 Definition* right = instr->ArgumentAt(1); | 1815 Definition* right = instr->ArgumentAt(1); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 FlowGraph::kEffect); | 2173 FlowGraph::kEffect); |
2167 current_iterator()->RemoveCurrentFromGraph(); | 2174 current_iterator()->RemoveCurrentFromGraph(); |
2168 } | 2175 } |
2169 } | 2176 } |
2170 } | 2177 } |
2171 } | 2178 } |
2172 | 2179 |
2173 #endif // DART_PRECOMPILER | 2180 #endif // DART_PRECOMPILER |
2174 | 2181 |
2175 } // namespace dart | 2182 } // namespace dart |
OLD | NEW |