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= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/532133002 Patch from Chunyang Dai <chunyang.dai@intel.com>. git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23632 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d0c3652d96
commit
327d2389cc
@ -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::GetCode(CodeDesc* desc) {
|
||||
|
||||
|
||||
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);
|
||||
|
@ -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 @@ void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
|
||||
// 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)));
|
||||
|
@ -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 @@ void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) {
|
||||
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 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
|
||||
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 {
|
||||
|
@ -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 @@ void MacroAssembler::EnterExitFrameEpilogue(int argc) {
|
||||
// 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 @@ void MacroAssembler::BooleanBitTest(Register object,
|
||||
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 @@ void MacroAssembler::CheckStackAlignment() {
|
||||
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 @@ void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
|
||||
// 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user