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

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

Issue 296453013: Fix bug with optimized try-catch and unboxed values. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « no previous file | tests/language/try_catch_optimized3_test.dart » ('j') | 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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 StubCode::DebugStepCheckEntryPoint()); 1627 StubCode::DebugStepCheckEntryPoint());
1628 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 1628 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
1629 } 1629 }
1630 1630
1631 1631
1632 Instruction* DebugStepCheckInstr::Canonicalize(FlowGraph* flow_graph) { 1632 Instruction* DebugStepCheckInstr::Canonicalize(FlowGraph* flow_graph) {
1633 return NULL; 1633 return NULL;
1634 } 1634 }
1635 1635
1636 1636
1637 static bool HasTryBlockUse(Value* use_list) {
1638 for (Value::Iterator it(use_list); !it.Done(); it.Advance()) {
1639 Value* use = it.Current();
1640 if (use->instruction()->MayThrow() &&
1641 use->instruction()->GetBlock()->InsideTryBlock()) {
1642 return true;
1643 }
1644 }
1645 return false;
1646 }
1647
1648
1637 Definition* BoxDoubleInstr::Canonicalize(FlowGraph* flow_graph) { 1649 Definition* BoxDoubleInstr::Canonicalize(FlowGraph* flow_graph) {
1638 if (input_use_list() == NULL) { 1650 if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) {
1639 // Environments can accomodate any representation. No need to box. 1651 // Environments can accomodate any representation. No need to box.
1640 return value()->definition(); 1652 return value()->definition();
1641 } 1653 }
1642 1654
1643 // Fold away BoxDouble(UnboxDouble(v)) if value is known to be double. 1655 // Fold away BoxDouble(UnboxDouble(v)) if value is known to be double.
1644 UnboxDoubleInstr* defn = value()->definition()->AsUnboxDouble(); 1656 UnboxDoubleInstr* defn = value()->definition()->AsUnboxDouble();
1645 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kDoubleCid)) { 1657 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kDoubleCid)) {
1646 return defn->value()->definition(); 1658 return defn->value()->definition();
1647 } 1659 }
1648 1660
(...skipping 14 matching lines...) Expand all
1663 UnboxedConstantInstr* uc = new UnboxedConstantInstr(c->value()); 1675 UnboxedConstantInstr* uc = new UnboxedConstantInstr(c->value());
1664 flow_graph->InsertBefore(this, uc, NULL, Definition::kValue); 1676 flow_graph->InsertBefore(this, uc, NULL, Definition::kValue);
1665 return uc; 1677 return uc;
1666 } 1678 }
1667 1679
1668 return this; 1680 return this;
1669 } 1681 }
1670 1682
1671 1683
1672 Definition* BoxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) { 1684 Definition* BoxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1673 if (input_use_list() == NULL) { 1685 if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) {
1674 // Environments can accomodate any representation. No need to box. 1686 // Environments can accomodate any representation. No need to box.
1675 return value()->definition(); 1687 return value()->definition();
1676 } 1688 }
1677 1689
1678 // Fold away BoxFloat32x4(UnboxFloat32x4(v)). 1690 // Fold away BoxFloat32x4(UnboxFloat32x4(v)).
1679 UnboxFloat32x4Instr* defn = value()->definition()->AsUnboxFloat32x4(); 1691 UnboxFloat32x4Instr* defn = value()->definition()->AsUnboxFloat32x4();
1680 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat32x4Cid)) { 1692 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat32x4Cid)) {
1681 return defn->value()->definition(); 1693 return defn->value()->definition();
1682 } 1694 }
1683 1695
1684 return this; 1696 return this;
1685 } 1697 }
1686 1698
1687 1699
1688 Definition* UnboxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) { 1700 Definition* UnboxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1689 // Fold away UnboxFloat32x4(BoxFloat32x4(v)). 1701 // Fold away UnboxFloat32x4(BoxFloat32x4(v)).
1690 BoxFloat32x4Instr* defn = value()->definition()->AsBoxFloat32x4(); 1702 BoxFloat32x4Instr* defn = value()->definition()->AsBoxFloat32x4();
1691 return (defn != NULL) ? defn->value()->definition() : this; 1703 return (defn != NULL) ? defn->value()->definition() : this;
1692 } 1704 }
1693 1705
1694 1706
1695 Definition* BoxFloat64x2Instr::Canonicalize(FlowGraph* flow_graph) { 1707 Definition* BoxFloat64x2Instr::Canonicalize(FlowGraph* flow_graph) {
1696 if (input_use_list() == NULL) { 1708 if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) {
1697 // Environments can accomodate any representation. No need to box. 1709 // Environments can accomodate any representation. No need to box.
1698 return value()->definition(); 1710 return value()->definition();
1699 } 1711 }
1700 1712
1701 // Fold away BoxFloat64x2(UnboxFloat64x2(v)). 1713 // Fold away BoxFloat64x2(UnboxFloat64x2(v)).
1702 UnboxFloat64x2Instr* defn = value()->definition()->AsUnboxFloat64x2(); 1714 UnboxFloat64x2Instr* defn = value()->definition()->AsUnboxFloat64x2();
1703 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat64x2Cid)) { 1715 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat64x2Cid)) {
1704 return defn->value()->definition(); 1716 return defn->value()->definition();
1705 } 1717 }
1706 1718
1707 return this; 1719 return this;
1708 } 1720 }
1709 1721
1710 1722
1711 Definition* UnboxFloat64x2Instr::Canonicalize(FlowGraph* flow_graph) { 1723 Definition* UnboxFloat64x2Instr::Canonicalize(FlowGraph* flow_graph) {
1712 // Fold away UnboxFloat64x2(BoxFloat64x2(v)). 1724 // Fold away UnboxFloat64x2(BoxFloat64x2(v)).
1713 BoxFloat64x2Instr* defn = value()->definition()->AsBoxFloat64x2(); 1725 BoxFloat64x2Instr* defn = value()->definition()->AsBoxFloat64x2();
1714 return (defn != NULL) ? defn->value()->definition() : this; 1726 return (defn != NULL) ? defn->value()->definition() : this;
1715 } 1727 }
1716 1728
1717 1729
1718 1730
1719 Definition* BoxInt32x4Instr::Canonicalize(FlowGraph* flow_graph) { 1731 Definition* BoxInt32x4Instr::Canonicalize(FlowGraph* flow_graph) {
1720 if (input_use_list() == NULL) { 1732 if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) {
1721 // Environments can accomodate any representation. No need to box. 1733 // Environments can accomodate any representation. No need to box.
1722 return value()->definition(); 1734 return value()->definition();
1723 } 1735 }
1724 1736
1725 // Fold away BoxInt32x4(UnboxInt32x4(v)). 1737 // Fold away BoxInt32x4(UnboxInt32x4(v)).
1726 UnboxInt32x4Instr* defn = value()->definition()->AsUnboxInt32x4(); 1738 UnboxInt32x4Instr* defn = value()->definition()->AsUnboxInt32x4();
1727 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kInt32x4Cid)) { 1739 if ((defn != NULL) && (defn->value()->Type()->ToCid() == kInt32x4Cid)) {
1728 return defn->value()->definition(); 1740 return defn->value()->definition();
1729 } 1741 }
1730 1742
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
3424 case Token::kTRUNCDIV: return 0; 3436 case Token::kTRUNCDIV: return 0;
3425 case Token::kMOD: return 1; 3437 case Token::kMOD: return 1;
3426 default: UNIMPLEMENTED(); return -1; 3438 default: UNIMPLEMENTED(); return -1;
3427 } 3439 }
3428 } 3440 }
3429 3441
3430 3442
3431 #undef __ 3443 #undef __
3432 3444
3433 } // namespace dart 3445 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/try_catch_optimized3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698