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

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

Issue 616983003: Disable 2 intrinsics causing optimizer issues (under investigation). (Closed) Base URL: http://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
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_arm.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // Copyright 2009 The Go Authors. All rights reserved. 5 // Copyright 2009 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style 6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file. 7 // license that can be found in the LICENSE file.
8 8
9 /* 9 /*
10 * Copyright (c) 2003-2005 Tom Wu 10 * Copyright (c) 2003-2005 Tom Wu
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } else if (_neg) { 407 } else if (_neg) {
408 r = -1; 408 r = -1;
409 } else { 409 } else {
410 r = 1; 410 r = 1;
411 } 411 }
412 return r; 412 return r;
413 } 413 }
414 414
415 // r_digits[0..used] = digits[0..used-1] + a_digits[0..a_used-1]. 415 // r_digits[0..used] = digits[0..used-1] + a_digits[0..a_used-1].
416 // used >= a_used > 0. 416 // used >= a_used > 0.
417 static void _add(Uint32List digits, int used, 417 static void _absAdd(Uint32List digits, int used,
418 Uint32List a_digits, int a_used, 418 Uint32List a_digits, int a_used,
419 Uint32List r_digits) { 419 Uint32List r_digits) {
420 var c = 0; 420 var c = 0;
421 for (var i = 0; i < a_used; i++) { 421 for (var i = 0; i < a_used; i++) {
422 c += digits[i] + a_digits[i]; 422 c += digits[i] + a_digits[i];
423 r_digits[i] = c & DIGIT_MASK; 423 r_digits[i] = c & DIGIT_MASK;
424 c >>= DIGIT_BITS; 424 c >>= DIGIT_BITS;
425 } 425 }
426 for (var i = a_used; i < used; i++) { 426 for (var i = a_used; i < used; i++) {
427 c += digits[i]; 427 c += digits[i];
428 r_digits[i] = c & DIGIT_MASK; 428 r_digits[i] = c & DIGIT_MASK;
429 c >>= DIGIT_BITS; 429 c >>= DIGIT_BITS;
430 } 430 }
431 r_digits[used] = c; 431 r_digits[used] = c;
432 } 432 }
433 433
434 // r_digits[0..used-1] = digits[0..used-1] - a_digits[0..a_used-1]. 434 // r_digits[0..used-1] = digits[0..used-1] - a_digits[0..a_used-1].
435 // used >= a_used > 0. 435 // used >= a_used > 0.
436 static void _sub(Uint32List digits, int used, 436 static void _absSub(Uint32List digits, int used,
437 Uint32List a_digits, int a_used, 437 Uint32List a_digits, int a_used,
438 Uint32List r_digits) { 438 Uint32List r_digits) {
439 var c = 0; 439 var c = 0;
440 for (var i = 0; i < a_used; i++) { 440 for (var i = 0; i < a_used; i++) {
441 c += digits[i] - a_digits[i]; 441 c += digits[i] - a_digits[i];
442 r_digits[i] = c & DIGIT_MASK; 442 r_digits[i] = c & DIGIT_MASK;
443 c >>= DIGIT_BITS; 443 c >>= DIGIT_BITS;
444 } 444 }
445 for (var i = a_used; i < used; i++) { 445 for (var i = a_used; i < used; i++) {
446 c += digits[i]; 446 c += digits[i];
447 r_digits[i] = c & DIGIT_MASK; 447 r_digits[i] = c & DIGIT_MASK;
448 c >>= DIGIT_BITS; 448 c >>= DIGIT_BITS;
(...skipping 12 matching lines...) Expand all
461 // Set r to 0. 461 // Set r to 0.
462 r._neg = false; 462 r._neg = false;
463 r._used = 0; 463 r._used = 0;
464 return; 464 return;
465 } 465 }
466 if (a_used == 0) { 466 if (a_used == 0) {
467 _copyTo(r); 467 _copyTo(r);
468 return; 468 return;
469 } 469 }
470 r._ensureLength(used + 1); 470 r._ensureLength(used + 1);
471 _add(_digits, used, a._digits, a_used, r._digits); 471 _absAdd(_digits, used, a._digits, a_used, r._digits);
472 r._used = used + 1; 472 r._used = used + 1;
473 r._clamp(); 473 r._clamp();
474 } 474 }
475 475
476 // r = abs(this) - abs(a), with abs(this) >= abs(a). 476 // r = abs(this) - abs(a), with abs(this) >= abs(a).
477 void _absSubTo(_Bigint a, _Bigint r) { 477 void _absSubTo(_Bigint a, _Bigint r) {
478 assert(_absCompareTo(a) >= 0); 478 assert(_absCompareTo(a) >= 0);
479 var used = _used; 479 var used = _used;
480 if (used == 0) { 480 if (used == 0) {
481 // Set r to 0. 481 // Set r to 0.
482 r._neg = false; 482 r._neg = false;
483 r._used = 0; 483 r._used = 0;
484 return; 484 return;
485 } 485 }
486 var a_used = a._used; 486 var a_used = a._used;
487 if (a_used == 0) { 487 if (a_used == 0) {
488 _copyTo(r); 488 _copyTo(r);
489 return; 489 return;
490 } 490 }
491 r._ensureLength(used); 491 r._ensureLength(used);
492 _sub(_digits, used, a._digits, a_used, r._digits); 492 _absSub(_digits, used, a._digits, a_used, r._digits);
493 r._used = used; 493 r._used = used;
494 r._clamp(); 494 r._clamp();
495 } 495 }
496 496
497 // r = abs(this) & abs(a). 497 // r = abs(this) & abs(a).
498 void _absAndTo(_Bigint a, _Bigint r) { 498 void _absAndTo(_Bigint a, _Bigint r) {
499 var r_used = (_used < a._used) ? _used : a._used; 499 var r_used = (_used < a._used) ? _used : a._used;
500 r._ensureLength(r_used); 500 r._ensureLength(r_used);
501 var digits = _digits; 501 var digits = _digits;
502 var a_digits = a._digits; 502 var a_digits = a._digits;
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 void _sqrTo(_Bigint x, _Bigint r) { 1441 void _sqrTo(_Bigint x, _Bigint r) {
1442 x._sqrTo(r); 1442 x._sqrTo(r);
1443 _reduce(r); 1443 _reduce(r);
1444 } 1444 }
1445 1445
1446 void _mulTo(_Bigint x, _Bigint y, _Bigint r) { 1446 void _mulTo(_Bigint x, _Bigint y, _Bigint r) {
1447 x._mulTo(y, r); 1447 x._mulTo(y, r);
1448 _reduce(r); 1448 _reduce(r);
1449 } 1449 }
1450 } 1450 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698