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

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

Issue 512933002: Use PassiveObject were possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « no previous file | runtime/vm/code_generator.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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 2
3 #include "vm/bigint_operations.h" 3 #include "vm/bigint_operations.h"
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "platform/utils.h" 6 #include "platform/utils.h"
7 7
8 #include "vm/double_internals.h" 8 #include "vm/double_internals.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if ((-1.0 < d) && (d < 1.0)) { 215 if ((-1.0 < d) && (d < 1.0)) {
216 // Shortcut for small numbers. Also makes the right-shift below 216 // Shortcut for small numbers. Also makes the right-shift below
217 // well specified. 217 // well specified.
218 Smi& zero = Smi::Handle(Smi::New(0)); 218 Smi& zero = Smi::Handle(Smi::New(0));
219 return NewFromSmi(zero, space); 219 return NewFromSmi(zero, space);
220 } 220 }
221 DoubleInternals internals = DoubleInternals(d); 221 DoubleInternals internals = DoubleInternals(d);
222 if (internals.IsSpecial()) { 222 if (internals.IsSpecial()) {
223 const Array& exception_arguments = Array::Handle(Array::New(1)); 223 const Array& exception_arguments = Array::Handle(Array::New(1));
224 exception_arguments.SetAt( 224 exception_arguments.SetAt(
225 0, Object::Handle(String::New("BigintOperations::NewFromDouble"))); 225 0,
226 PassiveObject::Handle(String::New("BigintOperations::NewFromDouble")));
226 Exceptions::ThrowByType(Exceptions::kInternalError, exception_arguments); 227 Exceptions::ThrowByType(Exceptions::kInternalError, exception_arguments);
227 } 228 }
228 uint64_t significand = internals.Significand(); 229 uint64_t significand = internals.Significand();
229 intptr_t exponent = internals.Exponent(); 230 intptr_t exponent = internals.Exponent();
230 intptr_t sign = internals.Sign(); 231 intptr_t sign = internals.Sign();
231 if (exponent <= 0) { 232 if (exponent <= 0) {
232 significand >>= -exponent; 233 significand >>= -exponent;
233 exponent = 0; 234 exponent = 0;
234 } else if (exponent <= 10) { 235 } else if (exponent <= 10) {
235 // A double significand has at most 53 bits. The following shift will 236 // A double significand has at most 53 bits. The following shift will
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 intptr_t BigintOperations::CountBits(Chunk digit) { 1859 intptr_t BigintOperations::CountBits(Chunk digit) {
1859 intptr_t result = 0; 1860 intptr_t result = 0;
1860 while (digit != 0) { 1861 while (digit != 0) {
1861 digit >>= 1; 1862 digit >>= 1;
1862 result++; 1863 result++;
1863 } 1864 }
1864 return result; 1865 return result;
1865 } 1866 }
1866 1867
1867 } // namespace dart 1868 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698