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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 ICData::ZoneHandle( 1457 ICData::ZoneHandle(
1458 call->ic_data()->AsUnaryClassChecksForArgNr(0)), 1458 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
1459 call->deopt_id(), 1459 call->deopt_id(),
1460 call->env(), 1460 call->env(),
1461 call); 1461 call);
1462 intptr_t mask = 0; 1462 intptr_t mask = 0;
1463 if (getter == MethodRecognizer::kFloat32x4Shuffle) { 1463 if (getter == MethodRecognizer::kFloat32x4Shuffle) {
1464 ASSERT(call->ArgumentCount() == 2); 1464 ASSERT(call->ArgumentCount() == 2);
1465 // Extract shuffle mask. 1465 // Extract shuffle mask.
1466 Definition* mask_definition = call->ArgumentAt(1); 1466 Definition* mask_definition = call->ArgumentAt(1);
1467 if (!mask_definition->IsConstant()) {
1468 // Not a constant.
1469 return false;
1470 }
1467 ASSERT(mask_definition->IsConstant()); 1471 ASSERT(mask_definition->IsConstant());
1468 ConstantInstr* constant_instruction = mask_definition->AsConstant(); 1472 ConstantInstr* constant_instruction = mask_definition->AsConstant();
1469 const Object& constant_mask = constant_instruction->value(); 1473 const Object& constant_mask = constant_instruction->value();
1474 if (!constant_mask.IsSmi()) {
1475 // Not a smi.
1476 return false;
1477 }
1470 ASSERT(constant_mask.IsSmi()); 1478 ASSERT(constant_mask.IsSmi());
1471 mask = Smi::Cast(constant_mask).Value(); 1479 mask = Smi::Cast(constant_mask).Value();
1472 ASSERT(mask >= 0); 1480 if (mask < 0 || mask > 255) {
1473 ASSERT(mask <= 255); 1481 // Not a valid mask.
1482 return false;
1483 }
1474 } 1484 }
1475 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr( 1485 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr(
1476 getter, 1486 getter,
1477 new Value(call->ArgumentAt(0)), 1487 new Value(call->ArgumentAt(0)),
1478 mask, 1488 mask,
1479 call->deopt_id()); 1489 call->deopt_id());
1480 ReplaceCall(call, instr); 1490 ReplaceCall(call, instr);
1481 return true; 1491 return true;
1482 } 1492 }
1483 1493
(...skipping 5925 matching lines...) Expand 10 before | Expand all | Expand 10 after
7409 } 7419 }
7410 7420
7411 // Insert materializations at environment uses. 7421 // Insert materializations at environment uses.
7412 for (intptr_t i = 0; i < exits.length(); i++) { 7422 for (intptr_t i = 0; i < exits.length(); i++) {
7413 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7423 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7414 } 7424 }
7415 } 7425 }
7416 7426
7417 7427
7418 } // namespace dart 7428 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698