Removed dead WriteInt32ToHeapNumberStub.

R=mvstanton@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#25241}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25241 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5ec10fc9
......@@ -234,61 +234,6 @@ void DoubleToIStub::Generate(MacroAssembler* masm) {
}
void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(
Isolate* isolate) {
WriteInt32ToHeapNumberStub stub1(isolate, r1, r0, r2);
WriteInt32ToHeapNumberStub stub2(isolate, r2, r0, r3);
stub1.GetCode();
stub2.GetCode();
}
// See comment for class.
void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
Label max_negative_int;
// the_int_ has the answer which is a signed int32 but not a Smi.
// We test for the special value that has a different exponent. This test
// has the neat side effect of setting the flags according to the sign.
STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
__ cmp(the_int(), Operand(0x80000000u));
__ b(eq, &max_negative_int);
// Set up the correct exponent in scratch_. All non-Smi int32s have the same.
// A non-Smi integer is 1.xxx * 2^30 so the exponent is 30 (biased).
uint32_t non_smi_exponent =
(HeapNumber::kExponentBias + 30) << HeapNumber::kExponentShift;
__ mov(scratch(), Operand(non_smi_exponent));
// Set the sign bit in scratch_ if the value was negative.
__ orr(scratch(), scratch(), Operand(HeapNumber::kSignMask), LeaveCC, cs);
// Subtract from 0 if the value was negative.
__ rsb(the_int(), the_int(), Operand::Zero(), LeaveCC, cs);
// We should be masking the implict first digit of the mantissa away here,
// but it just ends up combining harmlessly with the last digit of the
// exponent that happens to be 1. The sign bit is 0 so we shift 10 to get
// the most significant 1 to hit the last bit of the 12 bit sign and exponent.
DCHECK(((1 << HeapNumber::kExponentShift) & non_smi_exponent) != 0);
const int shift_distance = HeapNumber::kNonMantissaBitsInTopWord - 2;
__ orr(scratch(), scratch(), Operand(the_int(), LSR, shift_distance));
__ str(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kExponentOffset));
__ mov(scratch(), Operand(the_int(), LSL, 32 - shift_distance));
__ str(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kMantissaOffset));
__ Ret();
__ bind(&max_negative_int);
// The max negative int32 is stored as a positive number in the mantissa of
// a double because it uses a sign bit instead of using two's complement.
// The actual mantissa bits stored are all 0 because the implicit most
// significant 1 bit is not stored.
non_smi_exponent += 1 << HeapNumber::kExponentShift;
__ mov(ip, Operand(HeapNumber::kSignMask | non_smi_exponent));
__ str(ip, FieldMemOperand(the_heap_number(), HeapNumber::kExponentOffset));
__ mov(ip, Operand::Zero());
__ str(ip, FieldMemOperand(the_heap_number(), HeapNumber::kMantissaOffset));
__ Ret();
}
// Handle the case where the lhs and rhs are the same object.
// Equality is almost reflexive (everything but NaN), so this is a test
// for "identity and not NaN".
......@@ -967,7 +912,6 @@ bool CEntryStub::NeedsImmovableCode() {
void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
CEntryStub::GenerateAheadOfTime(isolate);
WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate);
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
......
......@@ -46,44 +46,6 @@ class StringHelper : public AllStatic {
};
// This stub can convert a signed int32 to a heap number (double). It does
// not work for int32s that are in Smi range! No GC occurs during this stub
// so you don't have to set up the frame.
class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
public:
WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
Register the_heap_number, Register scratch)
: PlatformCodeStub(isolate) {
minor_key_ = IntRegisterBits::encode(the_int.code()) |
HeapNumberRegisterBits::encode(the_heap_number.code()) |
ScratchRegisterBits::encode(scratch.code());
}
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
private:
Register the_int() const {
return Register::from_code(IntRegisterBits::decode(minor_key_));
}
Register the_heap_number() const {
return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
}
Register scratch() const {
return Register::from_code(ScratchRegisterBits::decode(minor_key_));
}
// Minor key encoding in 16 bits.
class IntRegisterBits: public BitField<int, 0, 4> {};
class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
class ScratchRegisterBits: public BitField<int, 8, 4> {};
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
DEFINE_PLATFORM_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
};
class RecordWriteStub: public PlatformCodeStub {
public:
RecordWriteStub(Isolate* isolate,
......
......@@ -92,9 +92,7 @@ namespace internal {
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
#define CODE_STUB_LIST_ARM(V) \
V(DirectCEntry) \
V(WriteInt32ToHeapNumber)
#define CODE_STUB_LIST_ARM(V) V(DirectCEntry)
#else
#define CODE_STUB_LIST_ARM(V)
......@@ -113,17 +111,15 @@ namespace internal {
// List of code stubs only used on MIPS platforms.
#if V8_TARGET_ARCH_MIPS
#define CODE_STUB_LIST_MIPS(V) \
V(DirectCEntry) \
V(RestoreRegistersState) \
V(StoreRegistersState) \
V(WriteInt32ToHeapNumber)
#define CODE_STUB_LIST_MIPS(V) \
V(DirectCEntry) \
V(RestoreRegistersState) \
V(StoreRegistersState)
#elif V8_TARGET_ARCH_MIPS64
#define CODE_STUB_LIST_MIPS(V) \
V(DirectCEntry) \
V(RestoreRegistersState) \
V(StoreRegistersState) \
V(WriteInt32ToHeapNumber)
#define CODE_STUB_LIST_MIPS(V) \
V(DirectCEntry) \
V(RestoreRegistersState) \
V(StoreRegistersState)
#else
#define CODE_STUB_LIST_MIPS(V)
#endif
......
......@@ -272,66 +272,6 @@ void DoubleToIStub::Generate(MacroAssembler* masm) {
}
void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(
Isolate* isolate) {
WriteInt32ToHeapNumberStub stub1(isolate, a1, v0, a2, a3);
WriteInt32ToHeapNumberStub stub2(isolate, a2, v0, a3, a0);
stub1.GetCode();
stub2.GetCode();
}
// See comment for class, this does NOT work for int32's that are in Smi range.
void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
Label max_negative_int;
// the_int_ has the answer which is a signed int32 but not a Smi.
// We test for the special value that has a different exponent.
STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
// Test sign, and save for later conditionals.
__ And(sign(), the_int(), Operand(0x80000000u));
__ Branch(&max_negative_int, eq, the_int(), Operand(0x80000000u));
// Set up the correct exponent in scratch_. All non-Smi int32s have the same.
// A non-Smi integer is 1.xxx * 2^30 so the exponent is 30 (biased).
uint32_t non_smi_exponent =
(HeapNumber::kExponentBias + 30) << HeapNumber::kExponentShift;
__ li(scratch(), Operand(non_smi_exponent));
// Set the sign bit in scratch_ if the value was negative.
__ or_(scratch(), scratch(), sign());
// Subtract from 0 if the value was negative.
__ subu(at, zero_reg, the_int());
__ Movn(the_int(), at, sign());
// We should be masking the implict first digit of the mantissa away here,
// but it just ends up combining harmlessly with the last digit of the
// exponent that happens to be 1. The sign bit is 0 so we shift 10 to get
// the most significant 1 to hit the last bit of the 12 bit sign and exponent.
DCHECK(((1 << HeapNumber::kExponentShift) & non_smi_exponent) != 0);
const int shift_distance = HeapNumber::kNonMantissaBitsInTopWord - 2;
__ srl(at, the_int(), shift_distance);
__ or_(scratch(), scratch(), at);
__ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kExponentOffset));
__ sll(scratch(), the_int(), 32 - shift_distance);
__ Ret(USE_DELAY_SLOT);
__ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kMantissaOffset));
__ bind(&max_negative_int);
// The max negative int32 is stored as a positive number in the mantissa of
// a double because it uses a sign bit instead of using two's complement.
// The actual mantissa bits stored are all 0 because the implicit most
// significant 1 bit is not stored.
non_smi_exponent += 1 << HeapNumber::kExponentShift;
__ li(scratch(), Operand(HeapNumber::kSignMask | non_smi_exponent));
__ sw(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kExponentOffset));
__ mov(scratch(), zero_reg);
__ Ret(USE_DELAY_SLOT);
__ sw(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kMantissaOffset));
}
// Handle the case where the lhs and rhs are the same object.
// Equality is almost reflexive (everything but NaN), so this is a test
// for "identity and not NaN".
......@@ -1058,7 +998,6 @@ bool CEntryStub::NeedsImmovableCode() {
void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
CEntryStub::GenerateAheadOfTime(isolate);
WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate);
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
......
......@@ -73,55 +73,6 @@ class RestoreRegistersStateStub: public PlatformCodeStub {
};
// This stub can convert a signed int32 to a heap number (double). It does
// not work for int32s that are in Smi range! No GC occurs during this stub
// so you don't have to set up the frame.
class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
public:
WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
Register the_heap_number, Register scratch,
Register scratch2)
: PlatformCodeStub(isolate) {
minor_key_ = IntRegisterBits::encode(the_int.code()) |
HeapNumberRegisterBits::encode(the_heap_number.code()) |
ScratchRegisterBits::encode(scratch.code()) |
SignRegisterBits::encode(scratch2.code());
DCHECK(IntRegisterBits::is_valid(the_int.code()));
DCHECK(HeapNumberRegisterBits::is_valid(the_heap_number.code()));
DCHECK(ScratchRegisterBits::is_valid(scratch.code()));
DCHECK(SignRegisterBits::is_valid(scratch2.code()));
}
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
private:
Register the_int() const {
return Register::from_code(IntRegisterBits::decode(minor_key_));
}
Register the_heap_number() const {
return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
}
Register scratch() const {
return Register::from_code(ScratchRegisterBits::decode(minor_key_));
}
Register sign() const {
return Register::from_code(SignRegisterBits::decode(minor_key_));
}
// Minor key encoding in 16 bits.
class IntRegisterBits: public BitField<int, 0, 4> {};
class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
class ScratchRegisterBits: public BitField<int, 8, 4> {};
class SignRegisterBits: public BitField<int, 12, 4> {};
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
DEFINE_PLATFORM_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
};
class RecordWriteStub: public PlatformCodeStub {
public:
RecordWriteStub(Isolate* isolate,
......
......@@ -268,66 +268,6 @@ void DoubleToIStub::Generate(MacroAssembler* masm) {
}
void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(
Isolate* isolate) {
WriteInt32ToHeapNumberStub stub1(isolate, a1, v0, a2, a3);
WriteInt32ToHeapNumberStub stub2(isolate, a2, v0, a3, a0);
stub1.GetCode();
stub2.GetCode();
}
// See comment for class, this does NOT work for int32's that are in Smi range.
void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
Label max_negative_int;
// the_int_ has the answer which is a signed int32 but not a Smi.
// We test for the special value that has a different exponent.
STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
// Test sign, and save for later conditionals.
__ And(sign(), the_int(), Operand(0x80000000u));
__ Branch(&max_negative_int, eq, the_int(), Operand(0x80000000u));
// Set up the correct exponent in scratch_. All non-Smi int32s have the same.
// A non-Smi integer is 1.xxx * 2^30 so the exponent is 30 (biased).
uint32_t non_smi_exponent =
(HeapNumber::kExponentBias + 30) << HeapNumber::kExponentShift;
__ li(scratch(), Operand(non_smi_exponent));
// Set the sign bit in scratch_ if the value was negative.
__ or_(scratch(), scratch(), sign());
// Subtract from 0 if the value was negative.
__ subu(at, zero_reg, the_int());
__ Movn(the_int(), at, sign());
// We should be masking the implict first digit of the mantissa away here,
// but it just ends up combining harmlessly with the last digit of the
// exponent that happens to be 1. The sign bit is 0 so we shift 10 to get
// the most significant 1 to hit the last bit of the 12 bit sign and exponent.
DCHECK(((1 << HeapNumber::kExponentShift) & non_smi_exponent) != 0);
const int shift_distance = HeapNumber::kNonMantissaBitsInTopWord - 2;
__ srl(at, the_int(), shift_distance);
__ or_(scratch(), scratch(), at);
__ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kExponentOffset));
__ sll(scratch(), the_int(), 32 - shift_distance);
__ Ret(USE_DELAY_SLOT);
__ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kMantissaOffset));
__ bind(&max_negative_int);
// The max negative int32 is stored as a positive number in the mantissa of
// a double because it uses a sign bit instead of using two's complement.
// The actual mantissa bits stored are all 0 because the implicit most
// significant 1 bit is not stored.
non_smi_exponent += 1 << HeapNumber::kExponentShift;
__ li(scratch(), Operand(HeapNumber::kSignMask | non_smi_exponent));
__ sw(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kExponentOffset));
__ mov(scratch(), zero_reg);
__ Ret(USE_DELAY_SLOT);
__ sw(scratch(),
FieldMemOperand(the_heap_number(), HeapNumber::kMantissaOffset));
}
// Handle the case where the lhs and rhs are the same object.
// Equality is almost reflexive (everything but NaN), so this is a test
// for "identity and not NaN".
......@@ -1053,7 +993,6 @@ bool CEntryStub::NeedsImmovableCode() {
void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
CEntryStub::GenerateAheadOfTime(isolate);
WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate);
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
......
......@@ -73,56 +73,6 @@ class RestoreRegistersStateStub: public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(RestoreRegistersState, PlatformCodeStub);
};
// This stub can convert a signed int32 to a heap number (double). It does
// not work for int32s that are in Smi range! No GC occurs during this stub
// so you don't have to set up the frame.
class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
public:
WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
Register the_heap_number, Register scratch,
Register scratch2)
: PlatformCodeStub(isolate) {
minor_key_ = IntRegisterBits::encode(the_int.code()) |
HeapNumberRegisterBits::encode(the_heap_number.code()) |
ScratchRegisterBits::encode(scratch.code()) |
SignRegisterBits::encode(scratch2.code());
DCHECK(IntRegisterBits::is_valid(the_int.code()));
DCHECK(HeapNumberRegisterBits::is_valid(the_heap_number.code()));
DCHECK(ScratchRegisterBits::is_valid(scratch.code()));
DCHECK(SignRegisterBits::is_valid(scratch2.code()));
}
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
private:
void Generate(MacroAssembler* masm);
Register the_int() const {
return Register::from_code(IntRegisterBits::decode(minor_key_));
}
Register the_heap_number() const {
return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
}
Register scratch() const {
return Register::from_code(ScratchRegisterBits::decode(minor_key_));
}
Register sign() const {
return Register::from_code(SignRegisterBits::decode(minor_key_));
}
// Minor key encoding in 16 bits.
class IntRegisterBits: public BitField<int, 0, 4> {};
class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
class ScratchRegisterBits: public BitField<int, 8, 4> {};
class SignRegisterBits: public BitField<int, 12, 4> {};
DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
DEFINE_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
};
class RecordWriteStub: public PlatformCodeStub {
public:
......
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