MIPS: Introduce intrinsics for double values in Javascript.

Port r19704 (120500a)

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

BUG=
R=plind44@gmail.com

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19732 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
palfia@homejinni.com 2014-03-07 22:08:20 +00:00
parent e18b575c6e
commit ef8ab12f53
3 changed files with 62 additions and 0 deletions

View File

@ -5183,6 +5183,25 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
}
void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
DoubleRegister value_reg = ToDoubleRegister(instr->value());
Register result_reg = ToRegister(instr->result());
if (instr->hydrogen()->bits() == HDoubleBits::HIGH) {
__ FmoveHigh(result_reg, value_reg);
} else {
__ FmoveLow(result_reg, value_reg);
}
}
void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
Register hi_reg = ToRegister(instr->hi());
Register lo_reg = ToRegister(instr->lo());
DoubleRegister result_reg = ToDoubleRegister(instr->result());
__ Move(result_reg, lo_reg, hi_reg);
}
void LCodeGen::DoAllocate(LAllocate* instr) {
class DeferredAllocate V8_FINAL : public LDeferredCode {
public:

View File

@ -1868,6 +1868,20 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
}
LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
HValue* value = instr->value();
ASSERT(value->representation().IsDouble());
return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value)));
}
LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
LOperand* lo = UseRegister(instr->lo());
LOperand* hi = UseRegister(instr->hi());
return DefineAsRegister(new(zone()) LConstructDouble(hi, lo));
}
LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
LOperand* context = info()->IsStub()
? UseFixed(instr->context(), cp)

View File

@ -80,6 +80,7 @@ class LCodeGen;
V(ConstantI) \
V(ConstantS) \
V(ConstantT) \
V(ConstructDouble) \
V(Context) \
V(DateField) \
V(DebugBreak) \
@ -87,6 +88,7 @@ class LCodeGen;
V(Deoptimize) \
V(DivI) \
V(DoubleToI) \
V(DoubleBits) \
V(DoubleToSmi) \
V(Drop) \
V(Dummy) \
@ -2360,6 +2362,33 @@ class LClampTToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 1> {
};
class LDoubleBits V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDoubleBits(LOperand* value) {
inputs_[0] = value;
}
LOperand* value() { return inputs_[0]; }
DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
};
class LConstructDouble V8_FINAL : public LTemplateInstruction<1, 2, 0> {
public:
LConstructDouble(LOperand* hi, LOperand* lo) {
inputs_[0] = hi;
inputs_[1] = lo;
}
LOperand* hi() { return inputs_[0]; }
LOperand* lo() { return inputs_[1]; }
DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
};
class LAllocate V8_FINAL : public LTemplateInstruction<1, 2, 2> {
public:
LAllocate(LOperand* context,