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

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 19564014: Add all 256 shuffle methods to Float32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 1461
1462 1462
1463 bool FlowGraphOptimizer::InlineFloat32x4Getter(InstanceCallInstr* call, 1463 bool FlowGraphOptimizer::InlineFloat32x4Getter(InstanceCallInstr* call,
1464 MethodRecognizer::Kind getter) { 1464 MethodRecognizer::Kind getter) {
1465 AddCheckClass(call->ArgumentAt(0), 1465 AddCheckClass(call->ArgumentAt(0),
1466 ICData::ZoneHandle( 1466 ICData::ZoneHandle(
1467 call->ic_data()->AsUnaryClassChecksForArgNr(0)), 1467 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
1468 call->deopt_id(), 1468 call->deopt_id(),
1469 call->env(), 1469 call->env(),
1470 call); 1470 call);
1471 intptr_t mask = 0;
1472 if (getter == MethodRecognizer::kFloat32x4Shuffle) {
1473 ASSERT(call->ArgumentCount() == 2);
1474 // Extract shuffle mask.
1475 Definition* mask_definition = call->ArgumentAt(1);
1476 ASSERT(mask_definition->IsConstant());
1477 ConstantInstr* constant_instruction = mask_definition->AsConstant();
1478 const Object& constant_mask = constant_instruction->value();
1479 ASSERT(constant_mask.IsSmi());
1480 mask = Smi::Cast(constant_mask).Value();
1481 ASSERT(mask >= 0);
1482 ASSERT(mask <= 255);
1483 }
1471 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr( 1484 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr(
1472 getter, 1485 getter,
1473 new Value(call->ArgumentAt(0)), 1486 new Value(call->ArgumentAt(0)),
1487 mask,
1474 call->deopt_id()); 1488 call->deopt_id());
1475 ReplaceCall(call, instr); 1489 ReplaceCall(call, instr);
1476 return true; 1490 return true;
1477 } 1491 }
1478 1492
1479 1493
1480 bool FlowGraphOptimizer::InlineUint32x4Getter(InstanceCallInstr* call, 1494 bool FlowGraphOptimizer::InlineUint32x4Getter(InstanceCallInstr* call,
1481 MethodRecognizer::Kind getter) { 1495 MethodRecognizer::Kind getter) {
1482 AddCheckClass(call->ArgumentAt(0), 1496 AddCheckClass(call->ArgumentAt(0),
1483 ICData::ZoneHandle( 1497 ICData::ZoneHandle(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 } 1568 }
1555 InlineStringLengthGetter(call); 1569 InlineStringLengthGetter(call);
1556 return true; 1570 return true;
1557 case MethodRecognizer::kStringBaseIsEmpty: 1571 case MethodRecognizer::kStringBaseIsEmpty:
1558 if (!ic_data.HasOneTarget()) { 1572 if (!ic_data.HasOneTarget()) {
1559 // Target is not only StringBase_get_isEmpty. 1573 // Target is not only StringBase_get_isEmpty.
1560 return false; 1574 return false;
1561 } 1575 }
1562 InlineStringIsEmptyGetter(call); 1576 InlineStringIsEmptyGetter(call);
1563 return true; 1577 return true;
1564 case MethodRecognizer::kFloat32x4ShuffleXXXX:
1565 case MethodRecognizer::kFloat32x4ShuffleYYYY:
1566 case MethodRecognizer::kFloat32x4ShuffleZZZZ:
1567 case MethodRecognizer::kFloat32x4ShuffleWWWW:
1568 case MethodRecognizer::kFloat32x4ShuffleX: 1578 case MethodRecognizer::kFloat32x4ShuffleX:
1569 case MethodRecognizer::kFloat32x4ShuffleY: 1579 case MethodRecognizer::kFloat32x4ShuffleY:
1570 case MethodRecognizer::kFloat32x4ShuffleZ: 1580 case MethodRecognizer::kFloat32x4ShuffleZ:
1571 case MethodRecognizer::kFloat32x4ShuffleW: 1581 case MethodRecognizer::kFloat32x4ShuffleW:
1572 if (!ic_data.HasReceiverClassId(kFloat32x4Cid) || 1582 if (!ic_data.HasReceiverClassId(kFloat32x4Cid) ||
1573 !ic_data.HasOneTarget()) { 1583 !ic_data.HasOneTarget()) {
1574 return false; 1584 return false;
1575 } 1585 }
1576 return InlineFloat32x4Getter(call, recognized_kind); 1586 return InlineFloat32x4Getter(call, recognized_kind);
1577 case MethodRecognizer::kUint32x4GetFlagX: 1587 case MethodRecognizer::kUint32x4GetFlagX:
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 ICData::ZoneHandle( 2038 ICData::ZoneHandle(
2029 call->ic_data()->AsUnaryClassChecksForArgNr(0)), 2039 call->ic_data()->AsUnaryClassChecksForArgNr(0)),
2030 call->deopt_id(), 2040 call->deopt_id(),
2031 call->env(), 2041 call->env(),
2032 call); 2042 call);
2033 Float32x4ToUint32x4Instr* cast = 2043 Float32x4ToUint32x4Instr* cast =
2034 new Float32x4ToUint32x4Instr(new Value(left), call->deopt_id()); 2044 new Float32x4ToUint32x4Instr(new Value(left), call->deopt_id());
2035 ReplaceCall(call, cast); 2045 ReplaceCall(call, cast);
2036 return true; 2046 return true;
2037 } 2047 }
2048 case MethodRecognizer::kFloat32x4Shuffle: {
2049 return InlineFloat32x4Getter(call, recognized_kind);
2050 }
2038 default: 2051 default:
2039 return false; 2052 return false;
2040 } 2053 }
2041 } 2054 }
2042 2055
2043 2056
2044 bool FlowGraphOptimizer::TryInlineUint32x4Method( 2057 bool FlowGraphOptimizer::TryInlineUint32x4Method(
2045 InstanceCallInstr* call, 2058 InstanceCallInstr* call,
2046 MethodRecognizer::Kind recognized_kind) { 2059 MethodRecognizer::Kind recognized_kind) {
2047 ASSERT(call->HasICData()); 2060 ASSERT(call->HasICData());
(...skipping 5134 matching lines...) Expand 10 before | Expand all | Expand 10 after
7182 7195
7183 // Insert materializations at environment uses. 7196 // Insert materializations at environment uses.
7184 const Class& cls = Class::Handle(alloc->constructor().Owner()); 7197 const Class& cls = Class::Handle(alloc->constructor().Owner());
7185 for (intptr_t i = 0; i < exits.length(); i++) { 7198 for (intptr_t i = 0; i < exits.length(); i++) {
7186 CreateMaterializationAt(exits[i], alloc, cls, *fields); 7199 CreateMaterializationAt(exits[i], alloc, cls, *fields);
7187 } 7200 }
7188 } 7201 }
7189 7202
7190 7203
7191 } // namespace dart 7204 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698