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

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

Issue 1197263002: Fix crash in modPow (issue 23693); various bigint knowledge missing. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: c Created 5 years, 6 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
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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/constant_propagator.h" 8 #include "vm/constant_propagator.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 1649
1650 1650
1651 RawInteger* BinaryIntegerOpInstr::Evaluate(const Integer& left, 1651 RawInteger* BinaryIntegerOpInstr::Evaluate(const Integer& left,
1652 const Integer& right) const { 1652 const Integer& right) const {
1653 Integer& result = Integer::Handle(); 1653 Integer& result = Integer::Handle();
1654 1654
1655 switch (op_kind()) { 1655 switch (op_kind()) {
1656 case Token::kTRUNCDIV: 1656 case Token::kTRUNCDIV:
1657 case Token::kMOD: 1657 case Token::kMOD:
1658 // Check right value for zero. 1658 // Check right value for zero.
1659 if (right.AsInt64Value() == 0) { 1659 if (right.IsSmi() && right.AsInt64Value() == 0) {
1660 break; // Will throw. 1660 break; // Will throw.
1661 } 1661 }
1662 // Fall through. 1662 // Fall through.
1663 case Token::kADD: 1663 case Token::kADD:
1664 case Token::kSUB: 1664 case Token::kSUB:
1665 case Token::kMUL: { 1665 case Token::kMUL: {
1666 result = left.ArithmeticOp(op_kind(), right); 1666 result = left.ArithmeticOp(op_kind(), right);
1667 break; 1667 break;
1668 } 1668 }
1669 case Token::kSHL: 1669 case Token::kSHL:
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 case Token::kTRUNCDIV: return 0; 3636 case Token::kTRUNCDIV: return 0;
3637 case Token::kMOD: return 1; 3637 case Token::kMOD: return 1;
3638 default: UNIMPLEMENTED(); return -1; 3638 default: UNIMPLEMENTED(); return -1;
3639 } 3639 }
3640 } 3640 }
3641 3641
3642 3642
3643 #undef __ 3643 #undef __
3644 3644
3645 } // namespace dart 3645 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698