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

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

Issue 23144003: Fold Box(Unbox(v)) and Unbox(Box(v)) for Float32x4 and Uint32x4 (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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 } 1420 }
1421 1421
1422 1422
1423 Definition* UnboxDoubleInstr::Canonicalize(FlowGraph* flow_graph) { 1423 Definition* UnboxDoubleInstr::Canonicalize(FlowGraph* flow_graph) {
1424 // Fold away UnboxDouble(BoxDouble(v)). 1424 // Fold away UnboxDouble(BoxDouble(v)).
1425 BoxDoubleInstr* defn = value()->definition()->AsBoxDouble(); 1425 BoxDoubleInstr* defn = value()->definition()->AsBoxDouble();
1426 return (defn != NULL) ? defn->value()->definition() : this; 1426 return (defn != NULL) ? defn->value()->definition() : this;
1427 } 1427 }
1428 1428
1429 1429
1430 Definition* BoxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1431 if (input_use_list() == NULL) {
1432 // Environments can accomodate any representation. No need to box.
1433 return value()->definition();
1434 }
1435
1436 // Fold away BoxFloat32x4(UnboxFloat32x4(v)).
1437 UnboxFloat32x4Instr* defn = value()->definition()->AsUnboxFloat32x4();
1438 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat32x4Cid)) {
1439 return defn->value()->definition();
1440 }
1441
1442 return this;
1443 }
1444
1445
1446 Definition* UnboxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1447 // Fold away UnboxFloat32x4(BoxFloat32x4(v)).
1448 BoxFloat32x4Instr* defn = value()->definition()->AsBoxFloat32x4();
1449 return (defn != NULL) ? defn->value()->definition() : this;
1450 }
1451
1452
1453 Definition* BoxUint32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1454 if (input_use_list() == NULL) {
1455 // Environments can accomodate any representation. No need to box.
1456 return value()->definition();
1457 }
1458
1459 // Fold away BoxUint32x4(UnboxUint32x4(v)).
1460 UnboxUint32x4Instr* defn = value()->definition()->AsUnboxUint32x4();
1461 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kUint32x4Cid)) {
1462 return defn->value()->definition();
1463 }
1464
1465 return this;
1466 }
1467
1468
1469 Definition* UnboxUint32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1470 // Fold away UnboxUint32x4(BoxUint32x4(v)).
1471 BoxUint32x4Instr* defn = value()->definition()->AsBoxUint32x4();
1472 return (defn != NULL) ? defn->value()->definition() : this;
1473 }
1474
1475
1430 Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) { 1476 Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) {
1431 // Only handle strict-compares. 1477 // Only handle strict-compares.
1432 if (comparison()->IsStrictCompare()) { 1478 if (comparison()->IsStrictCompare()) {
1433 Definition* replacement = comparison()->Canonicalize(flow_graph); 1479 Definition* replacement = comparison()->Canonicalize(flow_graph);
1434 if ((replacement == comparison()) || (replacement == NULL)) { 1480 if ((replacement == comparison()) || (replacement == NULL)) {
1435 return this; 1481 return this;
1436 } 1482 }
1437 ComparisonInstr* comp = replacement->AsComparison(); 1483 ComparisonInstr* comp = replacement->AsComparison();
1438 if ((comp == NULL) || comp->CanDeoptimize()) { 1484 if ((comp == NULL) || comp->CanDeoptimize()) {
1439 return this; 1485 return this;
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 default: 2647 default:
2602 UNREACHABLE(); 2648 UNREACHABLE();
2603 } 2649 }
2604 return kPowRuntimeEntry; 2650 return kPowRuntimeEntry;
2605 } 2651 }
2606 2652
2607 2653
2608 #undef __ 2654 #undef __
2609 2655
2610 } // namespace dart 2656 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698