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

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

Issue 626223002: Add unboxed Mint for X64 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 5885 matching lines...) Expand 10 before | Expand all | Expand 10 after
5896 5896
5897 Label* deopt = NULL; 5897 Label* deopt = NULL;
5898 if (CanDeoptimize()) { 5898 if (CanDeoptimize()) {
5899 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); 5899 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp);
5900 } 5900 }
5901 if (locs()->in(1).IsConstant()) { 5901 if (locs()->in(1).IsConstant()) {
5902 // Code for a constant shift amount. 5902 // Code for a constant shift amount.
5903 ASSERT(locs()->in(1).constant().IsSmi()); 5903 ASSERT(locs()->in(1).constant().IsSmi());
5904 const int32_t shift = 5904 const int32_t shift =
5905 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; 5905 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1;
5906 if ((shift < 0) || (shift > kMintShiftCountLimit)) {
5907 __ jmp(deopt);
5908 return;
5909 } else if (shift == 0) {
5910 // Nothing to do for zero shift amount.
5911 return;
5912 }
5913 switch (op_kind()) { 5906 switch (op_kind()) {
5914 case Token::kSHR: { 5907 case Token::kSHR: {
5915 if (shift > 31) { 5908 if (shift > 31) {
5916 __ movl(left_lo, left_hi); // Shift by 32. 5909 __ movl(left_lo, left_hi); // Shift by 32.
5917 __ sarl(left_hi, Immediate(31)); // Sign extend left hi. 5910 __ sarl(left_hi, Immediate(31)); // Sign extend left hi.
5918 if (shift > 32) { 5911 if (shift > 32) {
5919 __ sarl(left_lo, Immediate(shift - 32)); 5912 __ sarl(left_lo, Immediate(shift - 32));
5920 } 5913 }
5921 } else { 5914 } else {
5922 __ shrd(left_lo, left_hi, Immediate(shift)); 5915 __ shrd(left_lo, left_hi, Immediate(shift));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6131 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); 6124 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp);
6132 6125
6133 if (locs()->in(1).IsConstant()) { 6126 if (locs()->in(1).IsConstant()) {
6134 // Shifter is constant. 6127 // Shifter is constant.
6135 6128
6136 const Object& constant = locs()->in(1).constant(); 6129 const Object& constant = locs()->in(1).constant();
6137 ASSERT(constant.IsSmi()); 6130 ASSERT(constant.IsSmi());
6138 const intptr_t shift_value = Smi::Cast(constant).Value(); 6131 const intptr_t shift_value = Smi::Cast(constant).Value();
6139 6132
6140 // Check constant shift value. 6133 // Check constant shift value.
6141 if (shift_value == 0) { 6134 if (shift_value > kShifterLimit) {
Vyacheslav Egorov (Google) 2014/10/07 12:03:50 Ditto.
Cutch 2014/10/21 17:42:11 Done.
6142 // Nothing to do.
6143 } else if (shift_value < 0) {
6144 // Invalid shift value.
6145 __ jmp(deopt);
6146 } else if (shift_value > kShifterLimit) {
6147 // Result is 0. 6135 // Result is 0.
6148 __ xorl(left, left); 6136 __ xorl(left, left);
6149 } else { 6137 } else {
6150 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). 6138 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit).
6151 switch (op_kind()) { 6139 switch (op_kind()) {
6152 case Token::kSHR: 6140 case Token::kSHR:
6153 __ shrl(left, Immediate(shift_value)); 6141 __ shrl(left, Immediate(shift_value));
6154 break; 6142 break;
6155 case Token::kSHL: 6143 case Token::kSHL:
6156 __ shll(left, Immediate(shift_value)); 6144 __ shll(left, Immediate(shift_value));
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
6785 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6773 __ movl(EDX, Immediate(kInvalidObjectPointer));
6786 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6774 __ movl(EDX, Immediate(kInvalidObjectPointer));
6787 #endif 6775 #endif
6788 } 6776 }
6789 6777
6790 } // namespace dart 6778 } // namespace dart
6791 6779
6792 #undef __ 6780 #undef __
6793 6781
6794 #endif // defined TARGET_ARCH_IA32 6782 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698