Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: runtime/vm/intrinsifier.cc

Issue 1372863003: VM: Add uint32 array intrinsics. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/method_recognizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698