Revision: 23632
Author:   [email protected]
Date:     Wed Sep  3 07:48:57 2014 UTC
Log:      X87:  First step to cleanup the power-of-2 mess

port r23617.

original commit message:

   First step to cleanup the power-of-2 mess

BUG=
[email protected]

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

Patch from Chunyang Dai <[email protected]>.
https://code.google.com/p/v8/source/detail?r=23632

Modified:
 /branches/bleeding_edge/src/x87/assembler-x87.cc
 /branches/bleeding_edge/src/x87/code-stubs-x87.cc
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc
 /branches/bleeding_edge/src/x87/macro-assembler-x87.cc

=======================================
--- /branches/bleeding_edge/src/x87/assembler-x87.cc Thu Aug 7 08:20:00 2014 UTC +++ /branches/bleeding_edge/src/x87/assembler-x87.cc Wed Sep 3 07:48:57 2014 UTC
@@ -38,6 +38,7 @@

 #if V8_TARGET_ARCH_X87

+#include "src/base/bits.h"
 #include "src/base/cpu.h"
 #include "src/disassembler.h"
 #include "src/macro-assembler.h"
@@ -266,7 +267,7 @@


 void Assembler::Align(int m) {
-  DCHECK(IsPowerOf2(m));
+  DCHECK(base::bits::IsPowerOfTwo32(m));
   int mask = m - 1;
   int addr = pc_offset();
   Nop((m - (addr & mask)) & mask);
=======================================
--- /branches/bleeding_edge/src/x87/code-stubs-x87.cc Wed Sep 3 04:18:06 2014 UTC +++ /branches/bleeding_edge/src/x87/code-stubs-x87.cc Wed Sep 3 07:48:57 2014 UTC
@@ -6,6 +6,7 @@

 #if V8_TARGET_ARCH_X87

+#include "src/base/bits.h"
 #include "src/bootstrapper.h"
 #include "src/code-stubs.h"
 #include "src/codegen.h"
@@ -2508,7 +2509,7 @@
   // Fast case of Heap::LookupSingleCharacterStringFromCode.
   STATIC_ASSERT(kSmiTag == 0);
   STATIC_ASSERT(kSmiShiftSize == 0);
-  DCHECK(IsPowerOf2(String::kMaxOneByteCharCode + 1));
+  DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCode + 1));
   __ test(code_,
           Immediate(kSmiTagMask |
                     ((~String::kMaxOneByteCharCode) << kSmiTagSize)));
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Tue Sep 2 07:07:52 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Wed Sep 3 07:48:57 2014 UTC
@@ -6,6 +6,7 @@

 #if V8_TARGET_ARCH_X87

+#include "src/base/bits.h"
 #include "src/code-stubs.h"
 #include "src/codegen.h"
 #include "src/deoptimizer.h"
@@ -1411,7 +1412,7 @@
   Register dividend = ToRegister(instr->dividend());
   int32_t divisor = instr->divisor();
   Register result = ToRegister(instr->result());
-  DCHECK(divisor == kMinInt || IsPowerOf2(Abs(divisor)));
+  DCHECK(divisor == kMinInt || base::bits::IsPowerOfTwo32(Abs(divisor)));
   DCHECK(!result.is(dividend));

   // Check for (0 / -x) that will produce negative zero.
@@ -4870,8 +4871,8 @@
     uint8_t tag;
     instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);

-    if (IsPowerOf2(mask)) {
-      DCHECK(tag == 0 || IsPowerOf2(tag));
+    if (base::bits::IsPowerOfTwo32(mask)) {
+      DCHECK(tag == 0 || base::bits::IsPowerOfTwo32(tag));
       __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask);
       DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment());
     } else {
=======================================
--- /branches/bleeding_edge/src/x87/macro-assembler-x87.cc Wed Sep 3 04:18:06 2014 UTC +++ /branches/bleeding_edge/src/x87/macro-assembler-x87.cc Wed Sep 3 07:48:57 2014 UTC
@@ -6,6 +6,7 @@

 #if V8_TARGET_ARCH_X87

+#include "src/base/bits.h"
 #include "src/bootstrapper.h"
 #include "src/codegen.h"
 #include "src/cpu-profiler.h"
@@ -895,7 +896,7 @@
   // Get the required frame alignment for the OS.
   const int kFrameAlignment = base::OS::ActivationFrameAlignment();
   if (kFrameAlignment > 0) {
-    DCHECK(IsPowerOf2(kFrameAlignment));
+    DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment));
     and_(esp, -kFrameAlignment);
   }

@@ -1827,7 +1828,7 @@
                                     int field_offset,
                                     int bit_index) {
   bit_index += kSmiTagSize + kSmiShiftSize;
-  DCHECK(IsPowerOf2(kBitsPerByte));
+  DCHECK(base::bits::IsPowerOfTwo32(kBitsPerByte));
   int byte_index = bit_index / kBitsPerByte;
   int byte_bit_index = bit_index & (kBitsPerByte - 1);
   test_b(FieldOperand(object, field_offset + byte_index),
@@ -2668,7 +2669,7 @@
   int frame_alignment = base::OS::ActivationFrameAlignment();
   int frame_alignment_mask = frame_alignment - 1;
   if (frame_alignment > kPointerSize) {
-    DCHECK(IsPowerOf2(frame_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
     Label alignment_as_expected;
     test(esp, Immediate(frame_alignment_mask));
     j(zero, &alignment_as_expected);
@@ -2898,7 +2899,7 @@
     // and the original value of esp.
     mov(scratch, esp);
     sub(esp, Immediate((num_arguments + 1) * kPointerSize));
-    DCHECK(IsPowerOf2(frame_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
     and_(esp, -frame_alignment);
     mov(Operand(esp, num_arguments * kPointerSize), scratch);
   } else {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to