Commit 94621761 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Consolidate SMI functions into one area for X64

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16418 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1083d1f8
...@@ -958,7 +958,10 @@ void MacroAssembler::Set(const Operand& dst, int64_t x) { ...@@ -958,7 +958,10 @@ void MacroAssembler::Set(const Operand& dst, int64_t x) {
} }
bool MacroAssembler::IsUnsafeInt(const int x) { // ----------------------------------------------------------------------------
// Smi tagging, untagging and tag detection.
bool MacroAssembler::IsUnsafeInt(const int32_t x) {
static const int kMaxBits = 17; static const int kMaxBits = 17;
return !is_intn(x, kMaxBits); return !is_intn(x, kMaxBits);
} }
...@@ -989,9 +992,6 @@ void MacroAssembler::SafePush(Smi* src) { ...@@ -989,9 +992,6 @@ void MacroAssembler::SafePush(Smi* src) {
} }
// ----------------------------------------------------------------------------
// Smi tagging, untagging and tag detection.
Register MacroAssembler::GetSmiConstant(Smi* source) { Register MacroAssembler::GetSmiConstant(Smi* source) {
int value = source->value(); int value = source->value();
if (value == 0) { if (value == 0) {
...@@ -2196,6 +2196,17 @@ void MacroAssembler::AddSmiField(Register dst, const Operand& src) { ...@@ -2196,6 +2196,17 @@ void MacroAssembler::AddSmiField(Register dst, const Operand& src) {
} }
void MacroAssembler::Push(Smi* source) {
intptr_t smi = reinterpret_cast<intptr_t>(source);
if (is_int32(smi)) {
push(Immediate(static_cast<int32_t>(smi)));
} else {
Register constant = GetSmiConstant(source);
push(constant);
}
}
void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) { void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) {
movq(scratch, src); movq(scratch, src);
// High bits. // High bits.
...@@ -2220,6 +2231,14 @@ void MacroAssembler::PopInt64AsTwoSmis(Register dst, Register scratch) { ...@@ -2220,6 +2231,14 @@ void MacroAssembler::PopInt64AsTwoSmis(Register dst, Register scratch) {
} }
void MacroAssembler::Test(const Operand& src, Smi* source) {
testl(Operand(src, kIntSize), Immediate(source->value()));
}
// ----------------------------------------------------------------------------
void MacroAssembler::JumpIfNotString(Register object, void MacroAssembler::JumpIfNotString(Register object,
Register object_map, Register object_map,
Label* not_string, Label* not_string,
...@@ -2459,17 +2478,6 @@ void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) { ...@@ -2459,17 +2478,6 @@ void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) {
} }
void MacroAssembler::Push(Smi* source) {
intptr_t smi = reinterpret_cast<intptr_t>(source);
if (is_int32(smi)) {
push(Immediate(static_cast<int32_t>(smi)));
} else {
Register constant = GetSmiConstant(source);
push(constant);
}
}
void MacroAssembler::Drop(int stack_elements) { void MacroAssembler::Drop(int stack_elements) {
if (stack_elements > 0) { if (stack_elements > 0) {
addq(rsp, Immediate(stack_elements * kPointerSize)); addq(rsp, Immediate(stack_elements * kPointerSize));
...@@ -2477,11 +2485,6 @@ void MacroAssembler::Drop(int stack_elements) { ...@@ -2477,11 +2485,6 @@ void MacroAssembler::Drop(int stack_elements) {
} }
void MacroAssembler::Test(const Operand& src, Smi* source) {
testl(Operand(src, kIntSize), Immediate(source->value()));
}
void MacroAssembler::TestBit(const Operand& src, int bits) { void MacroAssembler::TestBit(const Operand& src, int bits) {
int byte_offset = bits / kBitsPerByte; int byte_offset = bits / kBitsPerByte;
int bit_in_byte = bits & (kBitsPerByte - 1); int bit_in_byte = bits & (kBitsPerByte - 1);
......
...@@ -375,6 +375,11 @@ class MacroAssembler: public Assembler { ...@@ -375,6 +375,11 @@ class MacroAssembler: public Assembler {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Smi tagging, untagging and operations on tagged smis. // Smi tagging, untagging and operations on tagged smis.
// Support for constant splitting.
bool IsUnsafeInt(const int32_t x);
void SafeMove(Register dst, Smi* src);
void SafePush(Smi* src);
void InitializeSmiConstantRegister() { void InitializeSmiConstantRegister() {
movq(kSmiConstantRegister, movq(kSmiConstantRegister,
reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)), reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)),
...@@ -782,11 +787,6 @@ class MacroAssembler: public Assembler { ...@@ -782,11 +787,6 @@ class MacroAssembler: public Assembler {
// Move if the registers are not identical. // Move if the registers are not identical.
void Move(Register target, Register source); void Move(Register target, Register source);
// Support for constant splitting.
bool IsUnsafeInt(const int x);
void SafeMove(Register dst, Smi* src);
void SafePush(Smi* src);
// Bit-field support. // Bit-field support.
void TestBit(const Operand& dst, int bit_index); void TestBit(const Operand& dst, int bit_index);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment