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

Unified Diff: runtime/lib/bigint.dart

Issue 580903004: Make sure Bigint._digits is always a Uint32List (instead of sometimes null). (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/object.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/bigint.dart
===================================================================
--- runtime/lib/bigint.dart (revision 40444)
+++ runtime/lib/bigint.dart (working copy)
@@ -70,8 +70,14 @@
int get _used native "Bigint_getUsed";
void set _used(int used) native "Bigint_setUsed";
Uint32List get _digits native "Bigint_getDigits";
- void set _digits(Uint32List digits) native "Bigint_setDigits";
+ void set _digits(Uint32List digits) {
+ // The VM expects digits_ to be a Uint32List.
+ assert(digits != null);
+ _set_digits(digits);
+ }
regis 2014/09/18 20:18:22 If I understand correctly, this indirection only v
srdjan 2014/09/18 20:59:18 Inliner eliminates the indirection; I will add thi
+ void _set_digits(Uint32List digits) native "Bigint_setDigits";
+
// Factory returning an instance initialized to value 0.
factory _Bigint() native "Bigint_allocate";
@@ -203,10 +209,8 @@
var digits = _digits;
if (length > 0 && (digits == null || length > digits.length)) {
regis 2014/09/18 20:18:22 You should remove the term digits == null.
srdjan 2014/09/18 20:59:18 Done.
var new_digits = new Uint32List(length + EXTRA_DIGITS);
- if (digits != null) {
- for (var i = _used; --i >= 0; ) {
- new_digits[i] = digits[i];
- }
+ for (var i = _used; --i >= 0; ) {
+ new_digits[i] = digits[i];
}
_digits = new_digits;
}
@@ -987,7 +991,7 @@
if (_neg) throw "negative shift amount"; // TODO(regis): What exception?
assert(DIGIT_BITS == 32); // Otherwise this code needs to be revised.
var shift;
- if (_used > 2 || (_used == 2 && _digits[1] > 0x10000000)) {
+ if ((_used > 2) || ((_used == 2) && (_digits[1] > 0x10000000))) {
regis 2014/09/18 20:18:22 My understanding is that we only use extra parenth
srdjan 2014/09/18 20:59:18 I think we should use it in all VM related code (i
if (other < 0) {
return -1;
} else {
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698