ARM64: Minor improvement in LCodeGen::DoCheckInstanceType.
authorbaptiste.afsa@arm.com <baptiste.afsa@arm.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 25 Mar 2014 13:45:17 +0000 (13:45 +0000)
committerbaptiste.afsa@arm.com <baptiste.afsa@arm.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 25 Mar 2014 13:45:17 +0000 (13:45 +0000)
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/207453008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20248 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm64/lithium-codegen-arm64.cc
src/arm64/lithium-codegen-arm64.h

index 2f344e5c0e0f500ab5edcba16806eb3bd97a9452..41ae711b4155da67b57589a697c28d7622905d48 100644 (file)
@@ -1078,18 +1078,18 @@ void LCodeGen::DeoptimizeIfNotZero(Register rt, LEnvironment* environment) {
 
 void LCodeGen::DeoptimizeIfNegative(Register rt, LEnvironment* environment) {
   int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit;
-  DeoptimizeBranch(environment, reg_bit_set, rt, sign_bit);
+  DeoptimizeIfBitSet(rt, sign_bit, environment);
 }
 
 
 void LCodeGen::DeoptimizeIfSmi(Register rt,
                                LEnvironment* environment) {
-  DeoptimizeBranch(environment, reg_bit_clear, rt, MaskToBit(kSmiTagMask));
+  DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), environment);
 }
 
 
 void LCodeGen::DeoptimizeIfNotSmi(Register rt, LEnvironment* environment) {
-  DeoptimizeBranch(environment, reg_bit_set, rt, MaskToBit(kSmiTagMask));
+  DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), environment);
 }
 
 
@@ -1116,6 +1116,20 @@ void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input,
 }
 
 
+void LCodeGen::DeoptimizeIfBitSet(Register rt,
+                                  int bit,
+                                  LEnvironment* environment) {
+  DeoptimizeBranch(environment, reg_bit_set, rt, bit);
+}
+
+
+void LCodeGen::DeoptimizeIfBitClear(Register rt,
+                                    int bit,
+                                    LEnvironment* environment) {
+  DeoptimizeBranch(environment, reg_bit_clear, rt, bit);
+}
+
+
 void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) {
   if (!info()->IsStub()) {
     // Ensure that we have enough space after the previous lazy-bailout
@@ -2184,10 +2198,11 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
 
     if (IsPowerOf2(mask)) {
       ASSERT((tag == 0) || (tag == mask));
-      // TODO(all): We might be able to use tbz/tbnz if we can guarantee that
-      // the deopt handler is reachable by a tbz instruction.
-      __ Tst(scratch, mask);
-      DeoptimizeIf(tag == 0 ? ne : eq, instr->environment());
+      if (tag == 0) {
+        DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr->environment());
+      } else {
+        DeoptimizeIfBitClear(scratch, MaskToBit(mask), instr->environment());
+      }
     } else {
       if (tag == 0) {
         __ Tst(scratch, mask);
index d98e89ca180aeaa79d027d8021f5b5257d858d50..b1d8b70d5beb09171a5cb2be10d12bc21cc719bc 100644 (file)
@@ -237,6 +237,8 @@ class LCodeGen: public LCodeGenBase {
                            Heap::RootListIndex index,
                            LEnvironment* environment);
   void DeoptimizeIfMinusZero(DoubleRegister input, LEnvironment* environment);
+  void DeoptimizeIfBitSet(Register rt, int bit, LEnvironment* environment);
+  void DeoptimizeIfBitClear(Register rt, int bit, LEnvironment* environment);
   void ApplyCheckIf(Condition cc, LBoundsCheck* check);
 
   MemOperand PrepareKeyedExternalArrayOperand(Register key,