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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 23134002: Replace shuffle getters with shuffle method and masks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 d1a855507f4a45269cfd66267aaa73cbb1a37f80..6d08fb8bf8e2c127da2f9e68d08c3054df5a3c22 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -1464,13 +1464,23 @@ bool FlowGraphOptimizer::InlineFloat32x4Getter(InstanceCallInstr* call,
ASSERT(call->ArgumentCount() == 2);
// Extract shuffle mask.
Definition* mask_definition = call->ArgumentAt(1);
+ if (!mask_definition->IsConstant()) {
+ // Not a constant.
+ return false;
+ }
ASSERT(mask_definition->IsConstant());
ConstantInstr* constant_instruction = mask_definition->AsConstant();
const Object& constant_mask = constant_instruction->value();
+ if (!constant_mask.IsSmi()) {
+ // Not a smi.
+ return false;
+ }
ASSERT(constant_mask.IsSmi());
mask = Smi::Cast(constant_mask).Value();
- ASSERT(mask >= 0);
- ASSERT(mask <= 255);
+ if (mask < 0 || mask > 255) {
+ // Not a valid mask.
+ return false;
+ }
}
Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr(
getter,

Powered by Google App Engine
This is Rietveld 408576698