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

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: xxx Created 4 years, 6 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 | « runtime/lib/integers.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/integers.dart
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart
index a7722b06b30d7290d45e957e9cabbca60dccfe23..b86b71cad6a0da13b8183e16be9c577272fcac29 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";
@@ -412,6 +413,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";
@@ -609,6 +613,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) {
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698