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

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

Issue 23604024: Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('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/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 __ mov(result, left); 2616 __ mov(result, left);
2617 } 2617 }
2618 break; 2618 break;
2619 } else if (value == -1) { 2619 } else if (value == -1) {
2620 // Check the corner case of dividing the 'MIN_SMI' with -1, in which 2620 // Check the corner case of dividing the 'MIN_SMI' with -1, in which
2621 // case we cannot negate the result. 2621 // case we cannot negate the result.
2622 __ BranchEqual(left, 0x80000000, deopt); 2622 __ BranchEqual(left, 0x80000000, deopt);
2623 __ subu(result, ZR, left); 2623 __ subu(result, ZR, left);
2624 break; 2624 break;
2625 } 2625 }
2626 ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value))); 2626 ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
2627 const intptr_t shift_count = 2627 const intptr_t shift_count =
2628 Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize; 2628 Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
2629 ASSERT(kSmiTagSize == 1); 2629 ASSERT(kSmiTagSize == 1);
2630 __ sra(TMP, left, 31); 2630 __ sra(TMP, left, 31);
2631 ASSERT(shift_count > 1); // 1, -1 case handled above. 2631 ASSERT(shift_count > 1); // 1, -1 case handled above.
2632 Register temp = locs()->temp(0).reg(); 2632 Register temp = locs()->temp(0).reg();
2633 __ srl(TMP, TMP, 32 - shift_count); 2633 __ srl(TMP, TMP, 32 - shift_count);
2634 __ addu(temp, left, TMP); 2634 __ addu(temp, left, TMP);
2635 ASSERT(shift_count > 0); 2635 ASSERT(shift_count > 0);
2636 __ sra(result, temp, shift_count); 2636 __ sra(result, temp, shift_count);
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 compiler->GenerateCall(token_pos(), 4137 compiler->GenerateCall(token_pos(),
4138 &label, 4138 &label,
4139 PcDescriptors::kOther, 4139 PcDescriptors::kOther,
4140 locs()); 4140 locs());
4141 __ Drop(2); // Discard type arguments and receiver. 4141 __ Drop(2); // Discard type arguments and receiver.
4142 } 4142 }
4143 4143
4144 } // namespace dart 4144 } // namespace dart
4145 4145
4146 #endif // defined TARGET_ARCH_MIPS 4146 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698