Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
| index ee53c720bc33e2349c786fe03aa3ced02a6bd3c2..101f070146cb7ab9e081683a075d5c163ec3782f 100644 |
| --- a/runtime/vm/flow_graph_optimizer.cc |
| +++ b/runtime/vm/flow_graph_optimizer.cc |
| @@ -1403,9 +1403,6 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| // Recognized []= operators. |
| case MethodRecognizer::kObjectArraySetIndexed: |
| case MethodRecognizer::kGrowableArraySetIndexed: |
| - if (ArgIsAlways(kSmiCid, ic_data, 2)) { |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| - } |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| value_check, entry, last); |
| case MethodRecognizer::kInt8ArraySetIndexed: |
| @@ -1415,22 +1412,22 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| case MethodRecognizer::kExternalUint8ClampedArraySetIndexed: |
| case MethodRecognizer::kInt16ArraySetIndexed: |
| case MethodRecognizer::kUint16ArraySetIndexed: |
| - if (!ArgIsAlways(kSmiCid, ic_data, 2)) { |
| - return false; |
| - } |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| + // Optimistically assume Smi. |
| + // TODO(srdjan): Check deopt reason to prevent repeated deoptimizations. |
| + value_check = ic_data.AsUnaryClassChecksForCid(kSmiCid, target); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| value_check, entry, last); |
| case MethodRecognizer::kInt32ArraySetIndexed: |
| - case MethodRecognizer::kUint32ArraySetIndexed: |
| - // Check that value is always smi or mint. We use Int32/Uint32 unboxing |
| + case MethodRecognizer::kUint32ArraySetIndexed: { |
| + // Check that value is always Smi or Mint. We use Int32/Uint32 unboxing |
| // which can only deal unbox these values. |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| - if (!HasOnlySmiOrMint(value_check)) { |
| - return false; |
| - } |
| + GrowableArray<intptr_t> smi_mint_cids; |
|
Vyacheslav Egorov (Google)
2015/05/27 15:06:34
same TODO as above
srdjan
2015/05/27 19:10:57
Done.
|
| + smi_mint_cids.Add(kSmiCid); |
| + smi_mint_cids.Add(kMintCid); |
| + value_check = ic_data.AsUnaryClassChecksForCids(smi_mint_cids, target); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
|
Vyacheslav Egorov (Google)
2015/05/27 15:06:34
InlineSetIndexed has an interesting code inside
srdjan
2015/05/27 19:10:57
Thanks! Also removed AsUnaryClassChecksForCids
|
| value_check, entry, last); |
| + } |
| case MethodRecognizer::kInt64ArraySetIndexed: |
| if (!ShouldInlineInt64ArrayOps()) { |
| return false; |
| @@ -1442,33 +1439,22 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| if (!CanUnboxDouble()) { |
| return false; |
| } |
| - // Check that value is always double. |
| - if (!ArgIsAlways(kDoubleCid, ic_data, 2)) { |
| - return false; |
| - } |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| + value_check = ic_data.AsUnaryClassChecksForCid(kDoubleCid, target); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| value_check, entry, last); |
| case MethodRecognizer::kFloat32x4ArraySetIndexed: |
| if (!ShouldInlineSimd()) { |
| return false; |
| } |
| - // Check that value is always a Float32x4. |
| - if (!ArgIsAlways(kFloat32x4Cid, ic_data, 2)) { |
| - return false; |
| - } |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| + value_check = ic_data.AsUnaryClassChecksForCid(kFloat32x4Cid, target); |
| + |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| value_check, entry, last); |
| case MethodRecognizer::kFloat64x2ArraySetIndexed: |
| if (!ShouldInlineSimd()) { |
| return false; |
| } |
| - // Check that value is always a Float32x4. |
| - if (!ArgIsAlways(kFloat64x2Cid, ic_data, 2)) { |
| - return false; |
| - } |
| - value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| + value_check = ic_data.AsUnaryClassChecksForCid(kFloat64x2Cid, target); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| value_check, entry, last); |
| case MethodRecognizer::kByteArrayBaseGetInt8: |
| @@ -4535,17 +4521,6 @@ bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, |
| AddReceiverCheck(instr); |
| } |
| StoreBarrierType needs_store_barrier = kEmitStoreBarrier; |
| - if (ArgIsAlways(kSmiCid, *instr->ic_data(), 1)) { |
| - InsertBefore(instr, |
| - new(Z) CheckSmiInstr( |
| - new(Z) Value(instr->ArgumentAt(1)), |
| - instr->deopt_id(), |
| - instr->token_pos()), |
| - instr->env(), |
| - FlowGraph::kEffect); |
| - needs_store_barrier = kNoStoreBarrier; |
| - } |
| - |
| if (field.guarded_cid() != kDynamicCid) { |
| InsertBefore(instr, |
| new(Z) GuardFieldClassInstr( |