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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_mips.cc ('k') | runtime/vm/utils_test.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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 break; 2599 break;
2600 } else if (value == -1) { 2600 } else if (value == -1) {
2601 // Check the corner case of dividing the 'MIN_SMI' with -1, in which 2601 // Check the corner case of dividing the 'MIN_SMI' with -1, in which
2602 // case we cannot negate the result. 2602 // case we cannot negate the result.
2603 __ cmpq(left, Immediate(0x8000000000000000)); 2603 __ cmpq(left, Immediate(0x8000000000000000));
2604 __ j(EQUAL, deopt); 2604 __ j(EQUAL, deopt);
2605 __ negq(left); 2605 __ negq(left);
2606 break; 2606 break;
2607 } 2607 }
2608 2608
2609 ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value))); 2609 ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
2610 const intptr_t shift_count = 2610 const intptr_t shift_count =
2611 Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize; 2611 Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
2612 ASSERT(kSmiTagSize == 1); 2612 ASSERT(kSmiTagSize == 1);
2613 Register temp = locs()->temp(0).reg(); 2613 Register temp = locs()->temp(0).reg();
2614 __ movq(temp, left); 2614 __ movq(temp, left);
2615 __ sarq(temp, Immediate(63)); 2615 __ sarq(temp, Immediate(63));
2616 ASSERT(shift_count > 1); // 1, -1 case handled above. 2616 ASSERT(shift_count > 1); // 1, -1 case handled above.
2617 __ shrq(temp, Immediate(64 - shift_count)); 2617 __ shrq(temp, Immediate(64 - shift_count));
2618 __ addq(left, temp); 2618 __ addq(left, temp);
2619 ASSERT(shift_count > 0); 2619 ASSERT(shift_count > 0);
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 PcDescriptors::kOther, 4881 PcDescriptors::kOther,
4882 locs()); 4882 locs());
4883 __ Drop(2); // Discard type arguments and receiver. 4883 __ Drop(2); // Discard type arguments and receiver.
4884 } 4884 }
4885 4885
4886 } // namespace dart 4886 } // namespace dart
4887 4887
4888 #undef __ 4888 #undef __
4889 4889
4890 #endif // defined TARGET_ARCH_X64 4890 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698