Revision: 23626
Author: [email protected]
Date: Tue Sep 2 17:21:24 2014 UTC
Log: MIPS: First step to cleanup the power-of-2 mess.
Port r23617 (1ad2f2a)
TEST=base-unittests,cctest,mjsunit
BUG=
[email protected]
Review URL: https://codereview.chromium.org/519283005
https://code.google.com/p/v8/source/detail?r=23626
Modified:
/branches/bleeding_edge/src/mips/assembler-mips.cc
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc
/branches/bleeding_edge/src/mips64/assembler-mips64.cc
/branches/bleeding_edge/src/mips64/code-stubs-mips64.cc
/branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc
/branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc
/branches/bleeding_edge/src/mips64/regexp-macro-assembler-mips64.cc
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.cc Tue Aug 12 19:04:15
2014 UTC
+++ /branches/bleeding_edge/src/mips/assembler-mips.cc Tue Sep 2 17:21:24
2014 UTC
@@ -37,6 +37,7 @@
#if V8_TARGET_ARCH_MIPS
+#include "src/base/bits.h"
#include "src/base/cpu.h"
#include "src/mips/assembler-mips-inl.h"
#include "src/serialize.h"
@@ -339,7 +340,7 @@
void Assembler::Align(int m) {
- DCHECK(m >= 4 && IsPowerOf2(m));
+ DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m));
while ((pc_offset() & (m - 1)) != 0) {
nop();
}
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Sep 2 15:03:27
2014 UTC
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Sep 2 17:21:24
2014 UTC
@@ -6,6 +6,7 @@
#if V8_TARGET_ARCH_MIPS
+#include "src/base/bits.h"
#include "src/bootstrapper.h"
#include "src/code-stubs.h"
#include "src/codegen.h"
@@ -3108,7 +3109,7 @@
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiShiftSize == 0);
- DCHECK(IsPowerOf2(String::kMaxOneByteCharCode + 1));
+ DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCode + 1));
__ And(t0,
code_,
Operand(kSmiTagMask |
@@ -4613,7 +4614,7 @@
int frame_alignment = masm->ActivationFrameAlignment();
if (frame_alignment > kPointerSize) {
__ mov(s5, sp);
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
__ And(sp, sp, Operand(-frame_alignment));
}
__ Subu(sp, sp, kCArgsSlotsSize);
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Tue Sep 2
07:07:52 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Tue Sep 2
17:21:24 2014 UTC
@@ -27,6 +27,7 @@
#include "src/v8.h"
+#include "src/base/bits.h"
#include "src/code-stubs.h"
#include "src/hydrogen-osr.h"
#include "src/mips/lithium-codegen-mips.h"
@@ -1201,7 +1202,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.
@@ -1514,18 +1515,18 @@
int32_t mask = constant >> 31;
uint32_t constant_abs = (constant + mask) ^ mask;
- if (IsPowerOf2(constant_abs)) {
+ if (base::bits::IsPowerOfTwo32(constant_abs)) {
int32_t shift = WhichPowerOf2(constant_abs);
__ sll(result, left, shift);
// Correct the sign of the result if the constant is negative.
if (constant < 0) __ Subu(result, zero_reg, result);
- } else if (IsPowerOf2(constant_abs - 1)) {
+ } else if (base::bits::IsPowerOfTwo32(constant_abs - 1)) {
int32_t shift = WhichPowerOf2(constant_abs - 1);
__ sll(scratch, left, shift);
__ Addu(result, scratch, left);
// Correct the sign of the result if the constant is negative.
if (constant < 0) __ Subu(result, zero_reg, result);
- } else if (IsPowerOf2(constant_abs + 1)) {
+ } else if (base::bits::IsPowerOfTwo32(constant_abs + 1)) {
int32_t shift = WhichPowerOf2(constant_abs + 1);
__ sll(scratch, left, shift);
__ Subu(result, scratch, left);
@@ -5100,8 +5101,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));
__ And(at, scratch, mask);
DeoptimizeIf(tag == 0 ? ne : eq, instr->environment(),
at, Operand(zero_reg));
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Tue Sep 2
15:03:27 2014 UTC
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Tue Sep 2
17:21:24 2014 UTC
@@ -8,6 +8,7 @@
#if V8_TARGET_ARCH_MIPS
+#include "src/base/bits.h"
#include "src/bootstrapper.h"
#include "src/codegen.h"
#include "src/cpu-profiler.h"
@@ -4961,7 +4962,7 @@
// The stack must be allign to 0 modulo 8 for stores with sdc1.
DCHECK(kDoubleSize == frame_alignment);
if (frame_alignment > 0) {
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
And(sp, sp, Operand(-frame_alignment)); // Align stack.
}
int space = FPURegister::kMaxNumRegisters * kDoubleSize;
@@ -4979,7 +4980,7 @@
DCHECK(stack_space >= 0);
Subu(sp, sp, Operand((stack_space + 2) * kPointerSize));
if (frame_alignment > 0) {
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
And(sp, sp, Operand(-frame_alignment)); // Align stack.
}
@@ -5074,7 +5075,7 @@
if (frame_alignment > kPointerSize) {
Label alignment_as_expected;
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
andi(at, sp, frame_alignment_mask);
Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
// Don't use Check here, as it will call Runtime_Abort re-entering
here.
@@ -5475,7 +5476,7 @@
// and the original value of sp.
mov(scratch, sp);
Subu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
And(sp, sp, Operand(-frame_alignment));
sw(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
} else {
@@ -5532,7 +5533,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;
And(at, sp, Operand(frame_alignment_mask));
Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
=======================================
--- /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Mon
Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Tue
Sep 2 17:21:24 2014 UTC
@@ -1046,7 +1046,7 @@
// Align the stack pointer and save the original sp value on the stack.
__ mov(scratch, sp);
__ Subu(sp, sp, Operand(kPointerSize));
- DCHECK(IsPowerOf2(stack_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(stack_alignment));
__ And(sp, sp, Operand(-stack_alignment));
__ sw(scratch, MemOperand(sp));
=======================================
--- /branches/bleeding_edge/src/mips64/assembler-mips64.cc Wed Aug 6
19:30:03 2014 UTC
+++ /branches/bleeding_edge/src/mips64/assembler-mips64.cc Tue Sep 2
17:21:24 2014 UTC
@@ -318,7 +318,7 @@
void Assembler::Align(int m) {
- DCHECK(m >= 4 && IsPowerOf2(m));
+ DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m));
while ((pc_offset() & (m - 1)) != 0) {
nop();
}
=======================================
--- /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Tue Sep 2
15:03:27 2014 UTC
+++ /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Tue Sep 2
17:21:24 2014 UTC
@@ -3140,7 +3140,7 @@
DCHECK(!a4.is(code_));
STATIC_ASSERT(kSmiTag == 0);
- DCHECK(IsPowerOf2(String::kMaxOneByteCharCode + 1));
+ DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCode + 1));
__ And(a4,
code_,
Operand(kSmiTagMask |
@@ -4650,7 +4650,7 @@
int frame_alignment = masm->ActivationFrameAlignment();
if (frame_alignment > kPointerSize) {
__ mov(s5, sp);
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
__ And(sp, sp, Operand(-frame_alignment));
}
=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Tue Sep 2
07:07:52 2014 UTC
+++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Tue Sep 2
17:21:24 2014 UTC
@@ -1156,7 +1156,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.
@@ -1480,18 +1480,18 @@
int32_t mask = constant >> 31;
uint32_t constant_abs = (constant + mask) ^ mask;
- if (IsPowerOf2(constant_abs)) {
+ if (base::bits::IsPowerOfTwo32(constant_abs)) {
int32_t shift = WhichPowerOf2(constant_abs);
__ dsll(result, left, shift);
// Correct the sign of the result if the constant is negative.
if (constant < 0) __ Dsubu(result, zero_reg, result);
- } else if (IsPowerOf2(constant_abs - 1)) {
+ } else if (base::bits::IsPowerOfTwo32(constant_abs - 1)) {
int32_t shift = WhichPowerOf2(constant_abs - 1);
__ dsll(scratch, left, shift);
__ Daddu(result, scratch, left);
// Correct the sign of the result if the constant is negative.
if (constant < 0) __ Dsubu(result, zero_reg, result);
- } else if (IsPowerOf2(constant_abs + 1)) {
+ } else if (base::bits::IsPowerOfTwo32(constant_abs + 1)) {
int32_t shift = WhichPowerOf2(constant_abs + 1);
__ dsll(scratch, left, shift);
__ Dsubu(result, scratch, left);
@@ -5139,8 +5139,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));
__ And(at, scratch, mask);
DeoptimizeIf(tag == 0 ? ne : eq, instr->environment(),
at, Operand(zero_reg));
=======================================
--- /branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc Tue Sep 2
15:03:27 2014 UTC
+++ /branches/bleeding_edge/src/mips64/macro-assembler-mips64.cc Tue Sep 2
17:21:24 2014 UTC
@@ -4868,7 +4868,7 @@
DCHECK(stack_space >= 0);
Dsubu(sp, sp, Operand((stack_space + 2) * kPointerSize));
if (frame_alignment > 0) {
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
And(sp, sp, Operand(-frame_alignment)); // Align stack.
}
@@ -4966,7 +4966,7 @@
if (frame_alignment > kPointerSize) {
Label alignment_as_expected;
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
andi(at, sp, frame_alignment_mask);
Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
// Don't use Check here, as it will call Runtime_Abort re-entering
here.
@@ -5430,7 +5430,7 @@
// and the original value of sp.
mov(scratch, sp);
Dsubu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
- DCHECK(IsPowerOf2(frame_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
And(sp, sp, Operand(-frame_alignment));
sd(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
} else {
@@ -5487,7 +5487,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;
And(at, sp, Operand(frame_alignment_mask));
Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
=======================================
--- /branches/bleeding_edge/src/mips64/regexp-macro-assembler-mips64.cc Mon
Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/mips64/regexp-macro-assembler-mips64.cc Tue
Sep 2 17:21:24 2014 UTC
@@ -1092,7 +1092,7 @@
// Align the stack pointer and save the original sp value on the stack.
__ mov(scratch, sp);
__ Dsubu(sp, sp, Operand(kPointerSize));
- DCHECK(IsPowerOf2(stack_alignment));
+ DCHECK(base::bits::IsPowerOfTwo32(stack_alignment));
__ And(sp, sp, Operand(-stack_alignment));
__ sd(scratch, MemOperand(sp));
--
--
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.