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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 12041005: Optimize loads and stores to Int32Array and Uint32Array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 17337)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -597,7 +597,28 @@
return false;
}
break;
-
+ case kInt32ArrayCid:
+ case kUint32ArrayCid: {
+ // Check if elements fit into a smi or the platform supports unboxed
+ // mints.
+ if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) {
+ return false;
+ }
+ // Check that value is always smi (or mint, if the platform has unboxed
+ // mints (ia32 with at least SSE 4.1)
Kevin Millikin (Google) 2013/01/21 15:16:01 The lack of period (and the unbalanced parens
Florian Schneider 2013/01/21 16:03:25 Done.
+ value_check = call->ic_data()->AsUnaryClassChecksForArgNr(2);
Kevin Millikin (Google) 2013/01/21 15:16:01 ArgNr? Srsly?
+ for (intptr_t i = 0; i < value_check.NumberOfChecks(); i++) {
+ intptr_t cid = value_check.GetReceiverClassIdAt(i);
+ if (FlowGraphCompiler::SupportsUnboxedMints()) {
+ if ((cid != kSmiCid) && (cid != kMintCid)) {
+ return false;
+ }
+ } else if (cid != kSmiCid) {
+ return false;
+ }
+ }
+ break;
+ }
case kFloat32ArrayCid:
case kFloat64ArrayCid: {
// Check that value is always double.
@@ -645,6 +666,8 @@
case kUint8ClampedArrayCid:
case kInt16ArrayCid:
case kUint16ArrayCid:
+ case kInt32ArrayCid:
+ case kUint32ArrayCid:
ASSERT(value_type.IsIntType());
// Fall through.
case kFloat32ArrayCid:
@@ -677,22 +700,20 @@
// Check if store barrier is needed.
bool needs_store_barrier = true;
if (!value_check.IsNull()) {
- ASSERT(value_check.NumberOfChecks() == 1);
- if (value_check.GetReceiverClassIdAt(0) == kSmiCid) {
+ needs_store_barrier = false;
+ if (value_check.NumberOfChecks() == 1 &&
+ value_check.GetReceiverClassIdAt(0) == kSmiCid) {
InsertBefore(call,
new CheckSmiInstr(value->Copy(), call->deopt_id()),
call->env(),
Definition::kEffect);
- needs_store_barrier = false;
} else {
- ASSERT(value_check.GetReceiverClassIdAt(0) == kDoubleCid);
InsertBefore(call,
new CheckClassInstr(value->Copy(),
call->deopt_id(),
value_check),
call->env(),
Definition::kEffect);
- needs_store_barrier = false;
}
}
@@ -720,8 +741,15 @@
case kExternalUint8ArrayCid:
case kInt16ArrayCid:
case kUint16ArrayCid:
- // Acceptable load index classes.
break;
+ case kInt32ArrayCid:
+ case kUint32ArrayCid:
+ // Check if elements fit into a smi or the platform supports unboxed
+ // mints.
+ if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) {
+ return false;
+ }
+ break;
default:
return false;
}

Powered by Google App Engine
This is Rietveld 408576698