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

Unified Diff: runtime/lib/integers.dart

Issue 1913663002: vm: Generate 'and' instruction for Smi values. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
Index: runtime/lib/integers.dart
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart
index a103f23872837cd41f31e826acc10c6a75a835e6..b38ac44ba5f118293d0411354e831333a476c6e4 100644
--- a/runtime/lib/integers.dart
+++ b/runtime/lib/integers.dart
@@ -63,6 +63,7 @@ abstract class _IntegerImplementation {
num remainder(num other) {
return other._remainderFromInteger(this);
}
+ int _bitAndFromSmi(int other) native "Integer_bitAndFromInteger";
int _bitAndFromInteger(int other) native "Integer_bitAndFromInteger";
int _bitOrFromInteger(int other) native "Integer_bitOrFromInteger";
int _bitXorFromInteger(int other) native "Integer_bitXorFromInteger";
@@ -413,6 +414,9 @@ class _Smi extends _IntegerImplementation implements int {
int operator ~() native "Smi_bitNegate";
int get bitLength native "Smi_bitLength";
+ int operator &(int other) => other._bitAndFromSmi(this);
+
+ int _bitAndFromSmi(int other) native "Smi_bitAndFromSmi";
int _shrFromInt(int other) native "Smi_shrFromInt";
int _shlFromInt(int other) native "Smi_shlFromInt";
@@ -610,6 +614,8 @@ class _Mint extends _IntegerImplementation implements int {
int operator ~() native "Mint_bitNegate";
int get bitLength native "Mint_bitLength";
+ int _bitAndFromSmi(int other) => _bitAndFromInteger(other);
+
// Shift by mint exceeds range that can be handled by the VM.
int _shrFromInt(int other) {
if (other < 0) {

Powered by Google App Engine
This is Rietveld 408576698