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

Side by Side Diff: runtime/lib/integers.dart

Issue 9114054: Port a couple more stubs to x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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/lib/integers.cc ('k') | runtime/vm/bigint_operations.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // TODO(srdjan): fix limitations. 5 // TODO(srdjan): fix limitations.
6 // - shift amount must be a Smi. 6 // - shift amount must be a Smi.
7 class IntegerImplementation { 7 class IntegerImplementation {
8 factory IntegerImplementation._uninstantiable() { 8 factory IntegerImplementation._uninstantiable() {
9 throw const UnsupportedOperationException( 9 throw const UnsupportedOperationException(
10 "IntegerImplementation can only be allocated by the VM"); 10 "IntegerImplementation can only be allocated by the VM");
11 } 11 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Represents integers that cannot be represented by Smi but fit into 64bits. 175 // Represents integers that cannot be represented by Smi but fit into 64bits.
176 class Mint extends IntegerImplementation implements int { 176 class Mint extends IntegerImplementation implements int {
177 factory Mint._uninstantiable() { 177 factory Mint._uninstantiable() {
178 throw const UnsupportedOperationException( 178 throw const UnsupportedOperationException(
179 "Mint can only be allocated by the VM"); 179 "Mint can only be allocated by the VM");
180 } 180 }
181 int hashCode() { 181 int hashCode() {
182 return this; 182 return this;
183 } 183 }
184 int operator ~() native "Mint_bitNegate"; 184 int operator ~() native "Mint_bitNegate";
185
186 // Shift by mint exceeds range that can be handled by the VM.
187 int sarFromInt(int other) {
188 if (other < 0) {
189 return -1;
190 } else {
191 return 0;
192 }
193 }
194 int shlFromInt(int other) {
195 throw const OutOfMemoryException();
196 }
185 } 197 }
186 198
187 // A number that can be represented as Smi or Mint will never be represented as 199 // A number that can be represented as Smi or Mint will never be represented as
188 // Bigint. 200 // Bigint.
189 class Bigint extends IntegerImplementation implements int { 201 class Bigint extends IntegerImplementation implements int {
190 factory Bigint._uninstantiable() { 202 factory Bigint._uninstantiable() {
191 throw const UnsupportedOperationException( 203 throw const UnsupportedOperationException(
192 "Bigint can only be allocated by the VM"); 204 "Bigint can only be allocated by the VM");
193 } 205 }
194 int hashCode() { 206 int hashCode() {
195 return this; 207 return this;
196 } 208 }
197 int operator ~() native "Bigint_bitNegate"; 209 int operator ~() native "Bigint_bitNegate";
198 210
199 // Shift by bigint exceeds range that can be handled by the VM. 211 // Shift by bigint exceeds range that can be handled by the VM.
200 int sarFromInt(int other) { 212 int sarFromInt(int other) {
201 if (other < 0) { 213 if (other < 0) {
202 return -1; 214 return -1;
203 } else { 215 } else {
204 return 0; 216 return 0;
205 } 217 }
206 } 218 }
207 int shlFromInt(int other) { 219 int shlFromInt(int other) {
208 throw const OutOfMemoryException(); 220 throw const OutOfMemoryException();
209 } 221 }
210 } 222 }
OLDNEW
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/vm/bigint_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698