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

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
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 8c8df78dbe70b2b0c3c16b92adc7e0d8e6ccb479..17de58772e2a8e493a54f0e03864541283c737a9 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -1479,13 +1479,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,
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698