Index: runtime/vm/flow_graph_optimizer.cc |
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
index b92f4a9f1acc916b0ceab94ee80a742072d7bd71..a3f14d1205ae0e7a7a42610561c873444fca90dd 100644 |
--- a/runtime/vm/flow_graph_optimizer.cc |
+++ b/runtime/vm/flow_graph_optimizer.cc |
@@ -1364,8 +1364,27 @@ bool FlowGraphOptimizer::InlineSetIndexed( |
stored_value, |
NULL, |
FlowGraph::kValue); |
+ } else if (array_cid == kTypedDataInt32ArrayCid) { |
+ stored_value = new(I) UnboxInt32Instr( |
+ new(I) Value(stored_value), |
+ call->deopt_id()); |
+ stored_value->AsUnboxIntN()->mark_truncating(); |
+ cursor = flow_graph()->AppendTo(cursor, |
+ stored_value, |
+ call->env(), |
+ FlowGraph::kValue); |
+ } else if (array_cid == kTypedDataUint32ArrayCid) { |
+ stored_value = new(I) UnboxUint32Instr( |
+ new(I) Value(stored_value), |
+ call->deopt_id()); |
+ ASSERT(stored_value->AsUnboxIntN()->is_truncating()); |
+ cursor = flow_graph()->AppendTo(cursor, |
+ stored_value, |
+ call->env(), |
+ FlowGraph::kValue); |
} |
+ |
Florian Schneider
2014/09/11 09:38:53
Remove extra \n.
Vyacheslav Egorov (Google)
2014/09/11 11:49:17
Done.
|
const intptr_t index_scale = Instance::ElementSizeFor(array_cid); |
*last = new(I) StoreIndexedInstr(new(I) Value(array), |
new(I) Value(index), |
@@ -1446,17 +1465,10 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
&ic_data, value_check, entry, last); |
case MethodRecognizer::kInt32ArraySetIndexed: |
case MethodRecognizer::kUint32ArraySetIndexed: |
- if (!CanUnboxInt32()) { |
- return false; |
- } |
// Check that value is always smi or mint, if the platform has unboxed |
// mints (ia32 with at least SSE 4.1). |
Florian Schneider
2014/09/11 09:38:53
This comment is now out of date.
Vyacheslav Egorov (Google)
2014/09/11 11:49:17
Done.
|
value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
- if (FlowGraphCompiler::SupportsUnboxedMints()) { |
- if (!HasOnlySmiOrMint(value_check)) { |
- return false; |
- } |
- } else if (!HasOnlyOneSmi(value_check)) { |
+ if (!HasOnlySmiOrMint(value_check)) { |
return false; |
} |
return InlineSetIndexed(kind, target, call, receiver, token_pos, |
@@ -1570,16 +1582,10 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
kTypedDataUint16ArrayCid, |
ic_data, entry, last); |
case MethodRecognizer::kByteArrayBaseSetInt32: |
- if (!CanUnboxInt32()) { |
- return false; |
- } |
return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
kTypedDataInt32ArrayCid, |
ic_data, entry, last); |
case MethodRecognizer::kByteArrayBaseSetUint32: |
- if (!CanUnboxInt32()) { |
- return false; |
- } |
return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
kTypedDataUint32ArrayCid, |
ic_data, entry, last); |
@@ -3722,7 +3728,7 @@ bool FlowGraphOptimizer::InlineByteArrayViewStore(const Function& target, |
case kTypedDataUint32ArrayCid: |
// Prevent excessive deoptimization, assume full 32 bits used, and therefore |
// generate Mint on 32-bit architectures. |
- if (kSmiBits >= 32) { |
+ if (kSmiBits >= 32) { |
value_check = ICData::New(flow_graph_->parsed_function().function(), |
i_call->function_name(), |
Object::empty_array(), // Dummy args. descr. |
@@ -3780,6 +3786,24 @@ bool FlowGraphOptimizer::InlineByteArrayViewStore(const Function& target, |
stored_value, |
NULL, |
FlowGraph::kValue); |
+ } else if (view_cid == kTypedDataInt32ArrayCid) { |
+ stored_value = new(I) UnboxInt32Instr( |
+ new(I) Value(stored_value), |
+ call->deopt_id()); |
+ stored_value->AsUnboxIntN()->mark_truncating(); |
+ cursor = flow_graph()->AppendTo(cursor, |
+ stored_value, |
+ call->env(), |
+ FlowGraph::kValue); |
+ } else if (view_cid == kTypedDataUint32ArrayCid) { |
+ stored_value = new(I) UnboxUint32Instr( |
+ new(I) Value(stored_value), |
+ call->deopt_id()); |
+ ASSERT(stored_value->AsUnboxIntN()->is_truncating()); |
+ cursor = flow_graph()->AppendTo(cursor, |
+ stored_value, |
+ call->env(), |
+ FlowGraph::kValue); |
} |
StoreBarrierType needs_store_barrier = kNoStoreBarrier; |
@@ -8283,15 +8307,11 @@ void ConstantPropagator::HandleBinaryOp(Definition* instr, |
} |
case Token::kSHL: |
case Token::kSHR: |
- if (left.IsSmi() && right.IsSmi()) { |
+ if (left.IsSmi() && |
+ right.IsSmi() && |
+ (Smi::Cast(right).Value() >= 0)) { |
Instance& result = Integer::ZoneHandle(I, |
Smi::Cast(left_int).ShiftOp(op_kind, Smi::Cast(right_int))); |
- if (result.IsNull()) { |
- // TODO(regis): A bigint operation is required. Invoke dart? |
- // Punt for now. |
- SetValue(instr, non_constant_); |
- break; |
- } |
result = result.CheckAndCanonicalize(NULL); |
ASSERT(!result.IsNull()); |
SetValue(instr, result); |