| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // to megamorphic call. | 209 // to megamorphic call. |
| 210 return false; | 210 return false; |
| 211 } | 211 } |
| 212 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); | 212 GrowableArray<intptr_t> class_ids(call->ic_data()->NumArgsTested()); |
| 213 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); | 213 ASSERT(call->ic_data()->NumArgsTested() <= call->ArgumentCount()); |
| 214 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { | 214 for (intptr_t i = 0; i < call->ic_data()->NumArgsTested(); i++) { |
| 215 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); | 215 class_ids.Add(call->PushArgumentAt(i)->value()->Type()->ToCid()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 const Token::Kind op_kind = call->token_kind(); | 218 const Token::Kind op_kind = call->token_kind(); |
| 219 if (Token::IsRelationalOperator(op_kind) || | 219 if (FLAG_guess_icdata_cid) { |
| 220 Token::IsEqualityOperator(op_kind) || | 220 if (Token::IsBinaryBitwiseOperator(op_kind)) { |
| 221 Token::IsBinaryOperator(op_kind)) { | 221 class_ids[0] = kSmiCid; |
| 222 // Guess cid: if one of the inputs is a number assume that the other | 222 class_ids[1] = kSmiCid; |
| 223 // is a number of same type. | 223 } |
| 224 if (FLAG_guess_icdata_cid) { | 224 if (Token::IsRelationalOperator(op_kind) || |
| 225 Token::IsEqualityOperator(op_kind) || |
| 226 Token::IsBinaryOperator(op_kind)) { |
| 227 // Guess cid: if one of the inputs is a number assume that the other |
| 228 // is a number of same type. |
| 225 const intptr_t cid_0 = class_ids[0]; | 229 const intptr_t cid_0 = class_ids[0]; |
| 226 const intptr_t cid_1 = class_ids[1]; | 230 const intptr_t cid_1 = class_ids[1]; |
| 227 if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) { | 231 if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) { |
| 228 class_ids[0] = cid_1; | 232 class_ids[0] = cid_1; |
| 229 } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) { | 233 } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) { |
| 230 class_ids[1] = cid_0; | 234 class_ids[1] = cid_0; |
| 231 } | 235 } |
| 232 } | 236 } |
| 233 } | 237 } |
| 234 | 238 |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 CheckedSmiComparisonInstr* smi_op = | 1932 CheckedSmiComparisonInstr* smi_op = |
| 1929 new(Z) CheckedSmiComparisonInstr(instr->token_kind(), | 1933 new(Z) CheckedSmiComparisonInstr(instr->token_kind(), |
| 1930 new(Z) Value(left), | 1934 new(Z) Value(left), |
| 1931 new(Z) Value(right), | 1935 new(Z) Value(right), |
| 1932 instr); | 1936 instr); |
| 1933 ReplaceCall(instr, smi_op); | 1937 ReplaceCall(instr, smi_op); |
| 1934 return; | 1938 return; |
| 1935 } | 1939 } |
| 1936 break; | 1940 break; |
| 1937 } | 1941 } |
| 1942 case Token::kSHL: |
| 1943 case Token::kSHR: |
| 1938 case Token::kBIT_OR: | 1944 case Token::kBIT_OR: |
| 1939 case Token::kBIT_XOR: | 1945 case Token::kBIT_XOR: |
| 1940 case Token::kBIT_AND: | 1946 case Token::kBIT_AND: |
| 1941 case Token::kADD: | 1947 case Token::kADD: |
| 1942 case Token::kSUB: | 1948 case Token::kSUB: |
| 1943 case Token::kMUL: { | 1949 case Token::kMUL: { |
| 1944 if (HasOnlyTwoOf(*instr->ic_data(), kSmiCid) || | 1950 if (HasOnlyTwoOf(*instr->ic_data(), kSmiCid) || |
| 1945 HasLikelySmiOperand(instr)) { | 1951 HasLikelySmiOperand(instr)) { |
| 1946 Definition* left = instr->ArgumentAt(0); | 1952 Definition* left = instr->ArgumentAt(0); |
| 1947 Definition* right = instr->ArgumentAt(1); | 1953 Definition* right = instr->ArgumentAt(1); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 check->env(), FlowGraph::kEffect); | 2348 check->env(), FlowGraph::kEffect); |
| 2343 current_iterator()->RemoveCurrentFromGraph(); | 2349 current_iterator()->RemoveCurrentFromGraph(); |
| 2344 } | 2350 } |
| 2345 } | 2351 } |
| 2346 } | 2352 } |
| 2347 } | 2353 } |
| 2348 | 2354 |
| 2349 #endif // DART_PRECOMPILER | 2355 #endif // DART_PRECOMPILER |
| 2350 | 2356 |
| 2351 } // namespace dart | 2357 } // namespace dart |
| OLD | NEW |