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

Unified Diff: runtime/vm/assembler_arm.cc

Issue 2379733002: Recognize and optimize a.runtimeType == b.runtimeType pattern. (Closed)
Patch Set: port to all arch, make AOT opt non-speculative Created 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/assembler_arm.cc
diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc
index e768806218f9d0692675e28bcf3fffddfdc1c0e4..f1b49f03ce34d49ee7c1a29f4a1db87a64795dcd 100644
--- a/runtime/vm/assembler_arm.cc
+++ b/runtime/vm/assembler_arm.cc
@@ -3017,6 +3017,32 @@ void Assembler::SubImmediateSetFlags(Register rd, Register rn, int32_t value,
}
+void Assembler::SubImmediate(Register rd, Register rn, int32_t value,
+ Condition cond) {
regis 2016/10/08 09:10:37 Why do you need this new flavor? Since you are not
Vyacheslav Egorov (Google) 2016/10/24 20:23:02 Done.
+ Operand o;
+ if (Operand::CanHold(value, &o)) {
+ // Handles value == kMinInt32.
+ sub(rd, rn, o, cond);
+ } else if (Operand::CanHold(-value, &o)) {
+ ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
+ add(rd, rn, o, cond);
+ } else {
+ ASSERT(rn != IP);
+ if (Operand::CanHold(~value, &o)) {
+ mvn(IP, o, cond);
+ sub(rd, rn, Operand(IP), cond);
+ } else if (Operand::CanHold(~(-value), &o)) {
+ ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
+ mvn(IP, o, cond);
+ add(rd, rn, Operand(IP), cond);
+ } else {
+ LoadDecodableImmediate(IP, value, cond);
+ sub(rd, rn, Operand(IP), cond);
+ }
+ }
+}
+
+
void Assembler::AndImmediate(Register rd, Register rs, int32_t imm,
Condition cond) {
Operand o;

Powered by Google App Engine
This is Rietveld 408576698