| Index: src/x87/lithium-x87.cc
|
| diff --git a/src/ia32/lithium-ia32.cc b/src/x87/lithium-x87.cc
|
| similarity index 96%
|
| copy from src/ia32/lithium-ia32.cc
|
| copy to src/x87/lithium-x87.cc
|
| index 6c13443b4e2375da6b4e52c658a112d4d9213850..715c93622748f76736c26128c2989e416668af89 100644
|
| --- a/src/ia32/lithium-ia32.cc
|
| +++ b/src/x87/lithium-x87.cc
|
| @@ -4,11 +4,11 @@
|
|
|
| #include "v8.h"
|
|
|
| -#if V8_TARGET_ARCH_IA32
|
| +#if V8_TARGET_ARCH_X87
|
|
|
| #include "lithium-allocator-inl.h"
|
| -#include "ia32/lithium-ia32.h"
|
| -#include "ia32/lithium-codegen-ia32.h"
|
| +#include "x87/lithium-x87.h"
|
| +#include "x87/lithium-codegen-x87.h"
|
| #include "hydrogen-osr.h"
|
|
|
| namespace v8 {
|
| @@ -60,6 +60,17 @@ bool LInstruction::HasDoubleRegisterInput() {
|
| }
|
|
|
|
|
| +bool LInstruction::IsDoubleInput(X87Register reg, LCodeGen* cgen) {
|
| + for (int i = 0; i < InputCount(); i++) {
|
| + LOperand* op = InputAt(i);
|
| + if (op != NULL && op->IsDoubleRegister()) {
|
| + if (cgen->ToX87Register(op).is(reg)) return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| void LInstruction::PrintTo(StringStream* stream) {
|
| stream->Add("%s ", this->Mnemonic());
|
|
|
| @@ -473,22 +484,11 @@ LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
|
| }
|
|
|
|
|
| -LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) {
|
| - return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER,
|
| - XMMRegister::ToAllocationIndex(reg));
|
| -}
|
| -
|
| -
|
| LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) {
|
| return Use(value, ToUnallocated(fixed_register));
|
| }
|
|
|
|
|
| -LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) {
|
| - return Use(value, ToUnallocated(reg));
|
| -}
|
| -
|
| -
|
| LOperand* LChunkBuilder::UseRegister(HValue* value) {
|
| return Use(value, new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
|
| }
|
| @@ -616,13 +616,6 @@ LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr,
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineFixedDouble(
|
| - LTemplateResultInstruction<1>* instr,
|
| - XMMRegister reg) {
|
| - return Define(instr, ToUnallocated(reg));
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
|
| HEnvironment* hydrogen_env = current_block_->last_environment();
|
| int argument_index_accumulator = 0;
|
| @@ -689,13 +682,6 @@ LOperand* LChunkBuilder::FixedTemp(Register reg) {
|
| }
|
|
|
|
|
| -LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) {
|
| - LUnallocated* operand = ToUnallocated(reg);
|
| - ASSERT(operand->HasFixedPolicy());
|
| - return operand;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
|
| return new(zone()) LLabel(instr->block());
|
| }
|
| @@ -938,6 +924,15 @@ void LChunkBuilder::AddInstruction(LInstruction* instr,
|
| if (FLAG_stress_environments && !instr->HasEnvironment()) {
|
| instr = AssignEnvironment(instr);
|
| }
|
| + if (instr->IsGoto() && LGoto::cast(instr)->jumps_to_join()) {
|
| + // TODO(olivf) Since phis of spilled values are joined as registers
|
| + // (not in the stack slot), we need to allow the goto gaps to keep one
|
| + // x87 register alive. To ensure all other values are still spilled, we
|
| + // insert a fpu register barrier right before.
|
| + LClobberDoubles* clobber = new(zone()) LClobberDoubles(isolate());
|
| + clobber->set_hydrogen_value(hydrogen_val);
|
| + chunk_->AddInstruction(clobber, current_block_);
|
| + }
|
| chunk_->AddInstruction(instr, current_block_);
|
|
|
| if (instr->IsCall()) {
|
| @@ -1173,10 +1168,9 @@ LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
|
| - LOperand* input = UseRegister(instr->value());
|
| - LOperand* temp = FixedTemp(xmm4);
|
| - LMathRound* result = new(zone()) LMathRound(input, temp);
|
| - return AssignEnvironment(DefineAsRegister(result));
|
| + // Crankshaft is turned off for nosse2.
|
| + UNREACHABLE();
|
| + return NULL;
|
| }
|
|
|
|
|
| @@ -1617,18 +1611,9 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoPower(HPower* instr) {
|
| - ASSERT(instr->representation().IsDouble());
|
| - // We call a C function for double power. It can't trigger a GC.
|
| - // We need to use fixed result register for the call.
|
| - Representation exponent_type = instr->right()->representation();
|
| - ASSERT(instr->left()->representation().IsDouble());
|
| - LOperand* left = UseFixedDouble(instr->left(), xmm2);
|
| - LOperand* right = exponent_type.IsDouble() ?
|
| - UseFixedDouble(instr->right(), xmm1) :
|
| - UseFixed(instr->right(), eax);
|
| - LPower* result = new(zone()) LPower(left, right);
|
| - return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
|
| - CAN_DEOPTIMIZE_EAGERLY);
|
| + // Crankshaft is turned off for nosse2.
|
| + UNREACHABLE();
|
| + return NULL;
|
| }
|
|
|
|
|
| @@ -1907,10 +1892,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
|
| } else {
|
| LOperand* value = UseRegister(val);
|
| - bool truncating = instr->CanTruncateToInt32();
|
| - LOperand* xmm_temp = !truncating ? FixedTemp(xmm1) : NULL;
|
| - LInstruction* result =
|
| - DefineSameAsFirst(new(zone()) LTaggedToI(value, xmm_temp));
|
| + LInstruction* result = DefineSameAsFirst(new(zone()) LTaggedToI(value));
|
| if (!val->representation().IsSmi()) result = AssignEnvironment(result);
|
| return result;
|
| }
|
| @@ -1930,11 +1912,8 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| } else {
|
| ASSERT(to.IsInteger32());
|
| bool truncating = instr->CanTruncateToInt32();
|
| - bool needs_temp = !truncating;
|
| - LOperand* value = needs_temp ? UseTempRegister(val) : UseRegister(val);
|
| - LOperand* temp = needs_temp ? TempRegister() : NULL;
|
| - LInstruction* result =
|
| - DefineAsRegister(new(zone()) LDoubleToI(value, temp));
|
| + LOperand* value = UseRegister(val);
|
| + LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value));
|
| if (!truncating) result = AssignEnvironment(result);
|
| return result;
|
| }
|
| @@ -1946,9 +1925,8 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| return DefineSameAsFirst(new(zone()) LSmiTag(value));
|
| } else if (val->CheckFlag(HInstruction::kUint32)) {
|
| LOperand* value = UseRegister(val);
|
| - LOperand* temp1 = TempRegister();
|
| - LOperand* temp2 = FixedTemp(xmm1);
|
| - LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
|
| + LOperand* temp = TempRegister();
|
| + LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
|
| return AssignPointerMap(DefineSameAsFirst(result));
|
| } else {
|
| LOperand* value = UseRegister(val);
|
| @@ -1966,9 +1944,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| } else {
|
| ASSERT(to.IsDouble());
|
| if (val->CheckFlag(HInstruction::kUint32)) {
|
| - LOperand* temp = FixedTemp(xmm1);
|
| - return DefineAsRegister(
|
| - new(zone()) LUint32ToDouble(UseRegister(val), temp));
|
| + return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
|
| } else {
|
| return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val)));
|
| }
|
| @@ -2028,19 +2004,18 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
|
| HValue* value = instr->value();
|
| Representation input_rep = value->representation();
|
| if (input_rep.IsDouble()) {
|
| - LOperand* reg = UseRegister(value);
|
| - return DefineFixed(new(zone()) LClampDToUint8(reg), eax);
|
| + UNREACHABLE();
|
| + return NULL;
|
| } else if (input_rep.IsInteger32()) {
|
| LOperand* reg = UseFixed(value, eax);
|
| return DefineFixed(new(zone()) LClampIToUint8(reg), eax);
|
| } else {
|
| ASSERT(input_rep.IsSmiOrTagged());
|
| - LOperand* reg = UseFixed(value, eax);
|
| - // Register allocator doesn't (yet) support allocation of double
|
| - // temps. Reserve xmm1 explicitly.
|
| - LOperand* temp = FixedTemp(xmm1);
|
| - LClampTToUint8* result = new(zone()) LClampTToUint8(reg, temp);
|
| - return AssignEnvironment(DefineFixed(result, eax));
|
| + LOperand* value = UseRegister(instr->value());
|
| + LClampTToUint8NoSSE2* res =
|
| + new(zone()) LClampTToUint8NoSSE2(value, TempRegister(),
|
| + TempRegister(), TempRegister());
|
| + return AssignEnvironment(DefineFixed(res, ecx));
|
| }
|
| }
|
|
|
| @@ -2236,6 +2211,10 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
|
| return UseFixed(instr->value(), eax);
|
| }
|
|
|
| + if (IsDoubleOrFloatElementsKind(elements_kind)) {
|
| + return UseRegisterAtStart(instr->value());
|
| + }
|
| +
|
| return UseRegister(instr->value());
|
| }
|
|
|
| @@ -2684,4 +2663,4 @@ LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
|
|
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_TARGET_ARCH_IA32
|
| +#endif // V8_TARGET_ARCH_X87
|
|
|