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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 13818006: Unboxed load/store indexed of Float32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 0c87164d50cdb1757452f06e8ede26be4f110d52..1a2ab0bc28c9a052fb65eaf73c82eccddd6221a9 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -363,6 +363,14 @@ void FlowGraphOptimizer::InsertConversion(Representation from,
} else {
converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
}
+ } else if ((from == kTagged) && (to == kUnboxedFloat32x4)) {
+ ASSERT((deopt_target != NULL) ||
+ (use->Type()->ToCid() == kFloat32x4Cid));
+ const intptr_t deopt_id = (deopt_target != NULL) ?
+ deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
+ converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id);
+ } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) {
+ converted = new BoxFloat32x4Instr(use->CopyWithType(), NULL);
}
ASSERT(converted != NULL);
use->BindTo(converted);
@@ -880,6 +888,7 @@ bool FlowGraphOptimizer::TryReplaceWithLoadIndexed(InstanceCallInstr* call) {
case kGrowableObjectArrayCid:
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
+ case kTypedDataFloat32x4ArrayCid:
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
case kTypedDataUint8ClampedArrayCid:
@@ -1470,6 +1479,7 @@ static bool IsSupportedByteArrayViewCid(intptr_t cid) {
case kTypedDataUint32ArrayCid:
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
+ case kTypedDataFloat32x4ArrayCid:
return true;
default:
return false;
@@ -1603,6 +1613,9 @@ bool FlowGraphOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) {
case MethodRecognizer::kByteArrayBaseGetFloat64:
return BuildByteArrayViewLoad(
call, class_ids[0], kTypedDataFloat64ArrayCid);
+ case MethodRecognizer::kByteArrayBaseGetFloat32x4:
+ return BuildByteArrayViewLoad(
+ call, class_ids[0], kTypedDataFloat32x4ArrayCid);
// ByteArray setters.
case MethodRecognizer::kByteArrayBaseSetInt8:
@@ -1629,6 +1642,9 @@ bool FlowGraphOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) {
case MethodRecognizer::kByteArrayBaseSetFloat64:
return BuildByteArrayViewStore(
call, class_ids[0], kTypedDataFloat64ArrayCid);
+ case MethodRecognizer::kByteArrayBaseSetFloat32x4:
+ return BuildByteArrayViewStore(
+ call, class_ids[0], kTypedDataFloat32x4ArrayCid);
default:
// Unsupported method.
return false;
@@ -1711,6 +1727,15 @@ bool FlowGraphOptimizer::BuildByteArrayViewStore(
value_check.AddReceiverCheck(kDoubleCid, Function::Handle());
break;
}
+ case kTypedDataFloat32x4ArrayCid: {
+ // Check that value is always Float32x4.
+ value_check = ICData::New(Function::Handle(),
+ String::Handle(),
+ Isolate::kNoDeoptId,
+ 1);
+ value_check.AddReceiverCheck(kFloat32x4Cid, Function::Handle());
+ break;
+ }
default:
// Array cids are already checked in the caller.
UNREACHABLE();
@@ -4354,6 +4379,28 @@ void ConstantPropagator::VisitBoxDouble(BoxDoubleInstr* instr) {
}
+void ConstantPropagator::VisitUnboxFloat32x4(UnboxFloat32x4Instr* 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::VisitBoxFloat32x4(BoxFloat32x4Instr* 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::Analyze() {
GraphEntryInstr* entry = graph_->graph_entry();
reachable_->Add(entry->preorder_number());

Powered by Google App Engine
This is Rietveld 408576698