Index: runtime/vm/intrinsifier.cc |
diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc |
index 76e9b63e3837d2e84946d741a7591e7ede01bdb0..9b8308cc3b0d5549ac4f1c6e31b9e94a5f55f265 100644 |
--- a/runtime/vm/intrinsifier.cc |
+++ b/runtime/vm/intrinsifier.cc |
@@ -217,6 +217,8 @@ static intptr_t CidForRepresentation(Representation rep) { |
return kDoubleCid; |
case kUnboxedFloat32x4: |
return kFloat32x4Cid; |
+ case kUnboxedUint32: |
+ return kDynamicCid; // smi or mint. |
default: |
UNREACHABLE(); |
return kIllegalCid; |
@@ -448,6 +450,60 @@ bool Intrinsifier::Build_ExternalUint8ArraySetIndexed(FlowGraph* flow_graph) { |
} |
+bool Intrinsifier::Build_Uint32ArraySetIndexed(FlowGraph* flow_graph) { |
+ GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
+ TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
+ BlockBuilder builder(flow_graph, normal_entry); |
+ |
+ Definition* value = builder.AddParameter(1); |
+ Definition* index = builder.AddParameter(2); |
+ Definition* array = builder.AddParameter(3); |
+ |
+ PrepareIndexedOp(&builder, array, index, TypedData::length_offset()); |
+ |
+ Definition* unboxed_value = |
+ builder.AddUnboxInstr(kUnboxedUint32, new Value(value)); |
+ |
+ builder.AddInstruction( |
+ new StoreIndexedInstr(new Value(array), |
+ new Value(index), |
+ new Value(unboxed_value), |
+ kNoStoreBarrier, |
+ 4, // index scale |
+ kTypedDataUint32ArrayCid, |
+ Isolate::kNoDeoptId, |
+ builder.TokenPos())); |
+ // Return null. |
+ Definition* null_def = builder.AddNullDefinition(); |
+ builder.AddIntrinsicReturn(new Value(null_def)); |
+ return true; |
+} |
+ |
+ |
+bool Intrinsifier::Build_Uint32ArrayGetIndexed(FlowGraph* flow_graph) { |
+ GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
+ TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
+ BlockBuilder builder(flow_graph, normal_entry); |
+ |
+ Definition* index = builder.AddParameter(1); |
+ Definition* array = builder.AddParameter(2); |
+ |
+ PrepareIndexedOp(&builder, array, index, TypedData::length_offset()); |
+ |
+ Definition* unboxed_value = builder.AddDefinition( |
+ new LoadIndexedInstr(new Value(array), |
+ new Value(index), |
+ 4, // index scale |
+ kTypedDataUint32ArrayCid, |
+ Isolate::kNoDeoptId, |
+ builder.TokenPos())); |
+ Definition* result = builder.AddDefinition( |
+ BoxInstr::Create(kUnboxedUint32, new Value(unboxed_value))); |
+ builder.AddIntrinsicReturn(new Value(result)); |
+ return true; |
+} |
+ |
+ |
bool Intrinsifier::Build_Float64ArraySetIndexed(FlowGraph* flow_graph) { |
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; |