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

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

Issue 1820653002: VM library tweaks to avoid megamorphic calls in dart2js (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « runtime/lib/bool_patch.dart ('k') | runtime/lib/string_patch.dart » ('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 class _IntegerImplementation extends _Num { 5 class _IntegerImplementation extends _Num {
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; 9 Type get runtimeType => int;
10 10
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 403 }
404 return _binaryGcd(x, y, false); 404 return _binaryGcd(x, y, false);
405 } 405 }
406 } 406 }
407 407
408 class _Smi extends _IntegerImplementation implements int { 408 class _Smi extends _IntegerImplementation implements int {
409 factory _Smi._uninstantiable() { 409 factory _Smi._uninstantiable() {
410 throw new UnsupportedError( 410 throw new UnsupportedError(
411 "_Smi can only be allocated by the VM"); 411 "_Smi can only be allocated by the VM");
412 } 412 }
413 int get _identityHashCode { 413 int get _identityHashCode => this;
414 return this; 414 int get hashCode => this;
415 }
416 int operator ~() native "Smi_bitNegate"; 415 int operator ~() native "Smi_bitNegate";
417 int get bitLength native "Smi_bitLength"; 416 int get bitLength native "Smi_bitLength";
418 417
419 int _shrFromInt(int other) native "Smi_shrFromInt"; 418 int _shrFromInt(int other) native "Smi_shrFromInt";
420 int _shlFromInt(int other) native "Smi_shlFromInt"; 419 int _shlFromInt(int other) native "Smi_shlFromInt";
421 420
422 /** 421 /**
423 * The digits of '00', '01', ... '99' as a single array. 422 * The digits of '00', '01', ... '99' as a single array.
424 * 423 *
425 * Get the digits of `n`, with `0 <= n < 100`, as 424 * Get the digits of `n`, with `0 <= n < 100`, as
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 return result; 600 return result;
602 } 601 }
603 } 602 }
604 603
605 // Represents integers that cannot be represented by Smi but fit into 64bits. 604 // Represents integers that cannot be represented by Smi but fit into 64bits.
606 class _Mint extends _IntegerImplementation implements int { 605 class _Mint extends _IntegerImplementation implements int {
607 factory _Mint._uninstantiable() { 606 factory _Mint._uninstantiable() {
608 throw new UnsupportedError( 607 throw new UnsupportedError(
609 "_Mint can only be allocated by the VM"); 608 "_Mint can only be allocated by the VM");
610 } 609 }
611 int get _identityHashCode { 610 int get _identityHashCode => this;
612 return this; 611 int get hashCode => this;
613 }
614 int operator ~() native "Mint_bitNegate"; 612 int operator ~() native "Mint_bitNegate";
615 int get bitLength native "Mint_bitLength"; 613 int get bitLength native "Mint_bitLength";
616 614
617 // Shift by mint exceeds range that can be handled by the VM. 615 // Shift by mint exceeds range that can be handled by the VM.
618 int _shrFromInt(int other) { 616 int _shrFromInt(int other) {
619 if (other < 0) { 617 if (other < 0) {
620 return -1; 618 return -1;
621 } else { 619 } else {
622 return 0; 620 return 0;
623 } 621 }
624 } 622 }
625 int _shlFromInt(int other) native "Mint_shlFromInt"; 623 int _shlFromInt(int other) native "Mint_shlFromInt";
626 } 624 }
OLDNEW
« no previous file with comments | « runtime/lib/bool_patch.dart ('k') | runtime/lib/string_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698