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

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

Issue 353513002: Use range information for optimizing integer boxing and fix bug in range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.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) 2012, 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 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 14 matching lines...) Expand all
25 // Returns false if integer is in wrong representation, e.g., as is a Bigint 25 // Returns false if integer is in wrong representation, e.g., as is a Bigint
26 // when it could have been a Smi. 26 // when it could have been a Smi.
27 static bool CheckInteger(const Integer& i) { 27 static bool CheckInteger(const Integer& i) {
28 if (i.IsBigint()) { 28 if (i.IsBigint()) {
29 const Bigint& bigint = Bigint::Cast(i); 29 const Bigint& bigint = Bigint::Cast(i);
30 return !BigintOperations::FitsIntoSmi(bigint) && 30 return !BigintOperations::FitsIntoSmi(bigint) &&
31 !BigintOperations::FitsIntoInt64(bigint); 31 !BigintOperations::FitsIntoInt64(bigint);
32 } 32 }
33 if (i.IsMint()) { 33 if (i.IsMint()) {
34 const Mint& mint = Mint::Cast(i); 34 const Mint& mint = Mint::Cast(i);
35 return !Smi::IsValid64(mint.value()); 35 return !Smi::IsValid(mint.value());
36 } 36 }
37 return true; 37 return true;
38 } 38 }
39 39
40 40
41 static int BitLengthInt64(int64_t value) { 41 static int BitLengthInt64(int64_t value) {
42 value ^= value >> (8 * sizeof(value) - 1); // flip bits if negative. 42 value ^= value >> (8 * sizeof(value) - 1); // flip bits if negative.
43 return value == 0 ? 0 : Utils::HighestBit(value) + 1; 43 return value == 0 ? 0 : Utils::HighestBit(value) + 1;
44 } 44 }
45 45
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // Use the preallocated out of memory exception to avoid calling 441 // Use the preallocated out of memory exception to avoid calling
442 // into dart code or allocating any code. 442 // into dart code or allocating any code.
443 const Instance& exception = 443 const Instance& exception =
444 Instance::Handle(isolate->object_store()->out_of_memory()); 444 Instance::Handle(isolate->object_store()->out_of_memory());
445 Exceptions::Throw(isolate, exception); 445 Exceptions::Throw(isolate, exception);
446 UNREACHABLE(); 446 UNREACHABLE();
447 return 0; 447 return 0;
448 } 448 }
449 449
450 } // namespace dart 450 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698