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

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

Issue 2453463006: Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."" (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « runtime/lib/double.dart ('k') | runtime/lib/object.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 abstract class _IntegerImplementation { 5 abstract class _IntegerImplementation {
6 // The Dart class _Bigint extending _IntegerImplementation requires a 6 // The Dart class _Bigint extending _IntegerImplementation requires a
7 // default constructor. 7 // default constructor.
8 8
9 Type get runtimeType => int;
10
11 num operator +(num other) { 9 num operator +(num other) {
12 var result = other._addFromInteger(this); 10 var result = other._addFromInteger(this);
13 if (result != null) return result; 11 if (result != null) return result;
14 return other._toBigint()._addFromInteger(this); 12 return other._toBigint()._addFromInteger(this);
15 } 13 }
16 num operator -(num other) { 14 num operator -(num other) {
17 var result = other._subFromInteger(this); 15 var result = other._subFromInteger(this);
18 if (result != null) return result; 16 if (result != null) return result;
19 return other._toBigint()._subFromInteger(this); 17 return other._toBigint()._subFromInteger(this);
20 } 18 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // Shift by mint exceeds range that can be handled by the VM. 616 // Shift by mint exceeds range that can be handled by the VM.
619 int _shrFromInt(int other) { 617 int _shrFromInt(int other) {
620 if (other < 0) { 618 if (other < 0) {
621 return -1; 619 return -1;
622 } else { 620 } else {
623 return 0; 621 return 0;
624 } 622 }
625 } 623 }
626 int _shlFromInt(int other) native "Mint_shlFromInt"; 624 int _shlFromInt(int other) native "Mint_shlFromInt";
627 } 625 }
OLDNEW
« no previous file with comments | « runtime/lib/double.dart ('k') | runtime/lib/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698