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 89f4f55b0a8321d19931a912f5798a2f9dcde2f0..56e5551a21301f8d3ff05c25bdd84b13dcc12a69 100644 |
| --- a/runtime/vm/flow_graph_optimizer.cc |
| +++ b/runtime/vm/flow_graph_optimizer.cc |
| @@ -1050,6 +1050,10 @@ static intptr_t MethodKindToCid(MethodRecognizer::Kind kind) { |
| case MethodRecognizer::kInt32x4ArraySetIndexed: |
| return kTypedDataInt32x4ArrayCid; |
| + case MethodRecognizer::kFloat64x2ArrayGetIndexed: |
| + case MethodRecognizer::kFloat64x2ArraySetIndexed: |
| + return kTypedDataFloat64x2ArrayCid; |
| + |
| default: |
| break; |
| } |
| @@ -1175,6 +1179,13 @@ bool FlowGraphOptimizer::InlineSetIndexed( |
| ASSERT(value_type.IsInstantiated()); |
| break; |
| } |
| + case kTypedDataFloat64x2ArrayCid: { |
| + type_args = instantiator = flow_graph_->constant_null(); |
| + ASSERT((array_cid != kTypedDataFloat64x2ArrayCid) || |
| + value_type.IsFloat64x2Type()); |
| + ASSERT(value_type.IsInstantiated()); |
| + break; |
| + } |
| default: |
| // TODO(fschneider): Add support for other array types. |
| UNREACHABLE(); |
| @@ -1262,7 +1273,10 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| case MethodRecognizer::kUint16ArrayGetIndexed: |
| return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); |
| case MethodRecognizer::kFloat32x4ArrayGetIndexed: |
| - if (!ShouldInlineSimd()) return false; |
| + case MethodRecognizer::kFloat64x2ArrayGetIndexed: |
| + if (!ShouldInlineSimd()) { |
| + return false; |
| + } |
| return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); |
| case MethodRecognizer::kInt32ArrayGetIndexed: |
| case MethodRecognizer::kUint32ArrayGetIndexed: |
| @@ -1284,13 +1298,17 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| case MethodRecognizer::kExternalUint8ClampedArraySetIndexed: |
| case MethodRecognizer::kInt16ArraySetIndexed: |
| case MethodRecognizer::kUint16ArraySetIndexed: |
| - if (!ArgIsAlways(kSmiCid, ic_data, 2)) return false; |
| + if (!ArgIsAlways(kSmiCid, ic_data, 2)) { |
| + return false; |
| + } |
|
Florian Schneider
2014/02/20 15:54:44
I think reformatting like this make the code less
|
| value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| &ic_data, value_check, entry, last); |
| case MethodRecognizer::kInt32ArraySetIndexed: |
| case MethodRecognizer::kUint32ArraySetIndexed: |
| - if (!CanUnboxInt32()) return false; |
| + 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). |
| value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| @@ -1306,14 +1324,31 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| case MethodRecognizer::kFloat32ArraySetIndexed: |
| case MethodRecognizer::kFloat64ArraySetIndexed: |
| // Check that value is always double. |
| - if (!ArgIsAlways(kDoubleCid, ic_data, 2)) return false; |
| + if (!ArgIsAlways(kDoubleCid, ic_data, 2)) { |
| + return false; |
| + } |
| value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| &ic_data, value_check, entry, last); |
| case MethodRecognizer::kFloat32x4ArraySetIndexed: |
| - if (!ShouldInlineSimd()) return false; |
| + if (!ShouldInlineSimd()) { |
|
Florian Schneider
2014/02/20 15:54:44
Why? It does not improve readability in my view.
|
| + return false; |
| + } |
| // Check that value is always a Float32x4. |
| - if (!ArgIsAlways(kFloat32x4Cid, ic_data, 2)) return false; |
| + if (!ArgIsAlways(kFloat32x4Cid, ic_data, 2)) { |
| + return false; |
| + } |
| + value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| + return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| + &ic_data, 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); |
| return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| &ic_data, value_check, entry, last); |
| @@ -1334,12 +1369,16 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| kTypedDataUint16ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseGetInt32: |
| - if (!CanUnboxInt32()) return false; |
| + if (!CanUnboxInt32()) { |
| + return false; |
| + } |
| return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| kTypedDataInt32ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseGetUint32: |
| - if (!CanUnboxInt32()) return false; |
| + if (!CanUnboxInt32()) { |
| + return false; |
| + } |
| return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| kTypedDataUint32ArrayCid, |
| ic_data, entry, last); |
| @@ -1352,12 +1391,16 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| kTypedDataFloat64ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseGetFloat32x4: |
| - if (!ShouldInlineSimd()) return false; |
| + if (!ShouldInlineSimd()) { |
| + return false; |
| + } |
| return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| kTypedDataFloat32x4ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseGetInt32x4: |
| - if (!ShouldInlineSimd()) return false; |
| + if (!ShouldInlineSimd()) { |
| + return false; |
| + } |
| return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| kTypedDataInt32x4ArrayCid, |
| ic_data, entry, last); |
| @@ -1378,12 +1421,16 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| kTypedDataUint16ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseSetInt32: |
| - if (!CanUnboxInt32()) return false; |
| + if (!CanUnboxInt32()) { |
| + return false; |
| + } |
| return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| kTypedDataInt32ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseSetUint32: |
| - if (!CanUnboxInt32()) return false; |
| + if (!CanUnboxInt32()) { |
| + return false; |
| + } |
| return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| kTypedDataUint32ArrayCid, |
| ic_data, entry, last); |
| @@ -1396,12 +1443,16 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| kTypedDataFloat64ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseSetFloat32x4: |
| - if (!ShouldInlineSimd()) return false; |
| + if (!ShouldInlineSimd()) { |
| + return false; |
| + } |
| return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| kTypedDataFloat32x4ArrayCid, |
| ic_data, entry, last); |
| case MethodRecognizer::kByteArrayBaseSetInt32x4: |
| - if (!ShouldInlineSimd()) return false; |
| + if (!ShouldInlineSimd()) { |
| + return false; |
| + } |
| return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| kTypedDataInt32x4ArrayCid, |
| ic_data, entry, last); |
| @@ -7670,6 +7721,28 @@ void ConstantPropagator::VisitBoxFloat32x4(BoxFloat32x4Instr* instr) { |
| } |
| +void ConstantPropagator::VisitUnboxFloat64x2(UnboxFloat64x2Instr* instr) { |
| + const Object& value = instr->value()->definition()->constant_value(); |
| + if (IsNonConstant(value)) { |
| + SetValue(instr, non_constant_); |
| + } else if (IsConstant(value)) { |
| + // TODO(kmillikin): Handle conversion. |
| + SetValue(instr, non_constant_); |
| + } |
| +} |
| + |
| + |
| +void ConstantPropagator::VisitBoxFloat64x2(BoxFloat64x2Instr* instr) { |
| + const Object& value = instr->value()->definition()->constant_value(); |
| + if (IsNonConstant(value)) { |
| + SetValue(instr, non_constant_); |
| + } else if (IsConstant(value)) { |
| + // TODO(kmillikin): Handle conversion. |
| + SetValue(instr, non_constant_); |
| + } |
| +} |
| + |
| + |
| void ConstantPropagator::VisitUnboxInt32x4(UnboxInt32x4Instr* instr) { |
| const Object& value = instr->value()->definition()->constant_value(); |
| if (IsNonConstant(value)) { |