Commit cdcee29e authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

LoadUint32() doesn't need a scratch register.

R=jarin@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21476 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b2fc4595
...@@ -4447,10 +4447,7 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { ...@@ -4447,10 +4447,7 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
LOperand* input = instr->value(); LOperand* input = instr->value();
LOperand* output = instr->result(); LOperand* output = instr->result();
LOperand* temp = instr->temp(); __ LoadUint32(ToDoubleRegister(output), ToRegister(input));
__ LoadUint32(ToDoubleRegister(output),
ToRegister(input),
ToDoubleRegister(temp));
} }
...@@ -4461,8 +4458,8 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) { ...@@ -4461,8 +4458,8 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
LNumberTagI* instr) LNumberTagI* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() V8_OVERRIDE { virtual void Generate() V8_OVERRIDE {
codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), codegen()->DoDeferredNumberTagIU(
NULL, SIGNED_INT32); instr_, instr_->value(), instr_->temp(), SIGNED_INT32);
} }
virtual LInstruction* instr() V8_OVERRIDE { return instr_; } virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
private: private:
...@@ -4487,8 +4484,8 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4487,8 +4484,8 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() V8_OVERRIDE { virtual void Generate() V8_OVERRIDE {
codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), codegen()->DoDeferredNumberTagIU(
instr_->temp2(), UNSIGNED_INT32); instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32);
} }
virtual LInstruction* instr() V8_OVERRIDE { return instr_; } virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
private: private:
...@@ -4510,12 +4507,11 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4510,12 +4507,11 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
LOperand* value, LOperand* value,
LOperand* temp1, LOperand* temp,
LOperand* temp2,
IntegerSignedness signedness) { IntegerSignedness signedness) {
Label done, slow; Label done, slow;
Register reg = ToRegister(value); Register reg = ToRegister(value);
Register tmp = ToRegister(temp1); Register tmp = ToRegister(temp);
XMMRegister xmm_scratch = double_scratch0(); XMMRegister xmm_scratch = double_scratch0();
if (signedness == SIGNED_INT32) { if (signedness == SIGNED_INT32) {
...@@ -4526,7 +4522,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, ...@@ -4526,7 +4522,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
__ xor_(reg, 0x80000000); __ xor_(reg, 0x80000000);
__ Cvtsi2sd(xmm_scratch, Operand(reg)); __ Cvtsi2sd(xmm_scratch, Operand(reg));
} else { } else {
__ LoadUint32(xmm_scratch, reg, ToDoubleRegister(temp2)); __ LoadUint32(xmm_scratch, reg);
} }
if (FLAG_inline_new) { if (FLAG_inline_new) {
......
...@@ -95,8 +95,7 @@ class LCodeGen: public LCodeGenBase { ...@@ -95,8 +95,7 @@ class LCodeGen: public LCodeGenBase {
enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 }; enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
void DoDeferredNumberTagIU(LInstruction* instr, void DoDeferredNumberTagIU(LInstruction* instr,
LOperand* value, LOperand* value,
LOperand* temp1, LOperand* temp,
LOperand* temp2,
IntegerSignedness signedness); IntegerSignedness signedness);
void DoDeferredTaggedToI(LTaggedToI* instr, Label* done); void DoDeferredTaggedToI(LTaggedToI* instr, Label* done);
......
...@@ -1941,17 +1941,14 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1941,17 +1941,14 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} else if (from.IsInteger32()) { } else if (from.IsInteger32()) {
info()->MarkAsDeferredCalling(); info()->MarkAsDeferredCalling();
if (to.IsTagged()) { if (to.IsTagged()) {
LOperand* value = UseRegister(val);
if (!instr->CheckFlag(HValue::kCanOverflow)) { if (!instr->CheckFlag(HValue::kCanOverflow)) {
LOperand* value = UseRegister(val);
return DefineSameAsFirst(new(zone()) LSmiTag(value)); return DefineSameAsFirst(new(zone()) LSmiTag(value));
} else if (val->CheckFlag(HInstruction::kUint32)) { } else if (val->CheckFlag(HInstruction::kUint32)) {
LOperand* value = UseRegister(val); LOperand* temp = TempRegister();
LOperand* temp1 = TempRegister(); LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
LOperand* temp2 = FixedTemp(xmm1);
LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
return AssignPointerMap(DefineSameAsFirst(result)); return AssignPointerMap(DefineSameAsFirst(result));
} else { } else {
LOperand* value = UseRegister(val);
LOperand* temp = TempRegister(); LOperand* temp = TempRegister();
LNumberTagI* result = new(zone()) LNumberTagI(value, temp); LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
return AssignPointerMap(DefineSameAsFirst(result)); return AssignPointerMap(DefineSameAsFirst(result));
...@@ -1966,9 +1963,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1966,9 +1963,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} else { } else {
ASSERT(to.IsDouble()); ASSERT(to.IsDouble());
if (val->CheckFlag(HInstruction::kUint32)) { if (val->CheckFlag(HInstruction::kUint32)) {
LOperand* temp = FixedTemp(xmm1); return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
return DefineAsRegister(
new(zone()) LUint32ToDouble(UseRegister(val), temp));
} else { } else {
return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val)));
} }
......
...@@ -1997,15 +1997,13 @@ class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> { ...@@ -1997,15 +1997,13 @@ class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
}; };
class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 1> { class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public: public:
explicit LUint32ToDouble(LOperand* value, LOperand* temp) { explicit LUint32ToDouble(LOperand* value) {
inputs_[0] = value; inputs_[0] = value;
temps_[0] = temp;
} }
LOperand* value() { return inputs_[0]; } LOperand* value() { return inputs_[0]; }
LOperand* temp() { return temps_[0]; }
DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
}; };
...@@ -2025,17 +2023,15 @@ class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 1> { ...@@ -2025,17 +2023,15 @@ class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
}; };
class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 2> { class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 1> {
public: public:
LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) { LNumberTagU(LOperand* value, LOperand* temp) {
inputs_[0] = value; inputs_[0] = value;
temps_[0] = temp1; temps_[0] = temp;
temps_[1] = temp2;
} }
LOperand* value() { return inputs_[0]; } LOperand* value() { return inputs_[0]; }
LOperand* temp1() { return temps_[0]; } LOperand* temp() { return temps_[0]; }
LOperand* temp2() { return temps_[1]; }
DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
}; };
......
...@@ -375,16 +375,14 @@ void MacroAssembler::TaggedToI(Register result_reg, ...@@ -375,16 +375,14 @@ void MacroAssembler::TaggedToI(Register result_reg,
void MacroAssembler::LoadUint32(XMMRegister dst, void MacroAssembler::LoadUint32(XMMRegister dst,
Register src, Register src) {
XMMRegister scratch) {
Label done; Label done;
cmp(src, Immediate(0)); cmp(src, Immediate(0));
ExternalReference uint32_bias = ExternalReference uint32_bias =
ExternalReference::address_of_uint32_bias(); ExternalReference::address_of_uint32_bias();
movsd(scratch, Operand::StaticVariable(uint32_bias));
Cvtsi2sd(dst, src); Cvtsi2sd(dst, src);
j(not_sign, &done, Label::kNear); j(not_sign, &done, Label::kNear);
addsd(dst, scratch); addsd(dst, Operand::StaticVariable(uint32_bias));
bind(&done); bind(&done);
} }
......
...@@ -465,7 +465,7 @@ class MacroAssembler: public Assembler { ...@@ -465,7 +465,7 @@ class MacroAssembler: public Assembler {
j(not_carry, is_smi); j(not_carry, is_smi);
} }
void LoadUint32(XMMRegister dst, Register src, XMMRegister scratch); void LoadUint32(XMMRegister dst, Register src);
// Jump the register contains a smi. // Jump the register contains a smi.
inline void JumpIfSmi(Register value, inline void JumpIfSmi(Register value,
......
...@@ -4531,11 +4531,8 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { ...@@ -4531,11 +4531,8 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
LOperand* input = instr->value(); LOperand* input = instr->value();
LOperand* output = instr->result(); LOperand* output = instr->result();
LOperand* temp = instr->temp();
__ LoadUint32(ToDoubleRegister(output), __ LoadUint32(ToDoubleRegister(output), ToRegister(input));
ToRegister(input),
ToDoubleRegister(temp));
} }
...@@ -4582,8 +4579,7 @@ void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) { ...@@ -4582,8 +4579,7 @@ void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) {
// Load value into temp_xmm which will be preserved across potential call to // Load value into temp_xmm which will be preserved across potential call to
// runtime (MacroAssembler::EnterExitFrameEpilogue preserves only allocatable // runtime (MacroAssembler::EnterExitFrameEpilogue preserves only allocatable
// XMM registers on x64). // XMM registers on x64).
XMMRegister xmm_scratch = double_scratch0(); __ LoadUint32(temp_xmm, reg);
__ LoadUint32(temp_xmm, reg, xmm_scratch);
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ AllocateHeapNumber(reg, tmp, &slow); __ AllocateHeapNumber(reg, tmp, &slow);
......
...@@ -1904,9 +1904,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1904,9 +1904,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} else { } else {
ASSERT(to.IsDouble()); ASSERT(to.IsDouble());
if (val->CheckFlag(HInstruction::kUint32)) { if (val->CheckFlag(HInstruction::kUint32)) {
LOperand* temp = FixedTemp(xmm1); return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
return DefineAsRegister(
new(zone()) LUint32ToDouble(UseRegister(val), temp));
} else { } else {
LOperand* value = Use(val); LOperand* value = Use(val);
return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); return DefineAsRegister(new(zone()) LInteger32ToDouble(value));
......
...@@ -1967,15 +1967,13 @@ class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> { ...@@ -1967,15 +1967,13 @@ class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
}; };
class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 1> { class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public: public:
explicit LUint32ToDouble(LOperand* value, LOperand* temp) { explicit LUint32ToDouble(LOperand* value) {
inputs_[0] = value; inputs_[0] = value;
temps_[0] = temp;
} }
LOperand* value() { return inputs_[0]; } LOperand* value() { return inputs_[0]; }
LOperand* temp() { return temps_[0]; }
DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
}; };
......
...@@ -3323,8 +3323,7 @@ void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, ...@@ -3323,8 +3323,7 @@ void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg,
void MacroAssembler::LoadUint32(XMMRegister dst, void MacroAssembler::LoadUint32(XMMRegister dst,
Register src, Register src) {
XMMRegister scratch) {
if (FLAG_debug_code) { if (FLAG_debug_code) {
cmpq(src, Immediate(0xffffffff)); cmpq(src, Immediate(0xffffffff));
Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared); Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared);
......
...@@ -1004,7 +1004,7 @@ class MacroAssembler: public Assembler { ...@@ -1004,7 +1004,7 @@ class MacroAssembler: public Assembler {
MinusZeroMode minus_zero_mode, Label* lost_precision, MinusZeroMode minus_zero_mode, Label* lost_precision,
Label::Distance dst = Label::kFar); Label::Distance dst = Label::kFar);
void LoadUint32(XMMRegister dst, Register src, XMMRegister scratch); void LoadUint32(XMMRegister dst, Register src);
void LoadInstanceDescriptors(Register map, Register descriptors); void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map); void EnumLength(Register dst, Register map);
......
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