| Index: src/arm/lithium-arm.cc
|
| diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
|
| index 3002ba95bdea57d120c45729d55e244bd30e745a..3242b19ac7ae046ad03ca408c4701cd1057ce113 100644
|
| --- a/src/arm/lithium-arm.cc
|
| +++ b/src/arm/lithium-arm.cc
|
| @@ -840,17 +840,18 @@ void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) {
|
| void LChunkBuilder::VisitInstruction(HInstruction* current) {
|
| HInstruction* old_current = current_instruction_;
|
| current_instruction_ = current;
|
| - if (current->has_position()) position_ = current->position();
|
|
|
| LInstruction* instr = NULL;
|
| if (current->CanReplaceWithDummyUses()) {
|
| if (current->OperandCount() == 0) {
|
| instr = DefineAsRegister(new(zone()) LDummy());
|
| } else {
|
| + ASSERT(!current->OperandAt(0)->IsControlInstruction());
|
| instr = DefineAsRegister(new(zone())
|
| LDummyUse(UseAny(current->OperandAt(0))));
|
| }
|
| for (int i = 1; i < current->OperandCount(); ++i) {
|
| + if (current->OperandAt(i)->IsControlInstruction()) continue;
|
| LInstruction* dummy =
|
| new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
|
| dummy->set_hydrogen_value(current);
|
| @@ -940,6 +941,9 @@ LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
|
| + LInstruction* goto_instr = CheckElideControlInstruction(instr);
|
| + if (goto_instr != NULL) return goto_instr;
|
| +
|
| ASSERT(instr->value()->representation().IsTagged());
|
| LOperand* value = UseRegisterAtStart(instr->value());
|
| LOperand* temp = TempRegister();
|
| @@ -1042,30 +1046,12 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
|
| - LOperand* context = UseRegisterAtStart(instr->value());
|
| - return DefineAsRegister(new(zone()) LOuterContext(context));
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
|
| LOperand* context = UseFixed(instr->context(), cp);
|
| return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
|
| - LOperand* context = UseRegisterAtStart(instr->value());
|
| - return DefineAsRegister(new(zone()) LGlobalObject(context));
|
| -}
|
| -
|
| -
|
| -LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
|
| - LOperand* global_object = UseRegisterAtStart(instr->value());
|
| - return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoCallJSFunction(
|
| HCallJSFunction* instr) {
|
| LOperand* function = UseFixed(instr->function(), r1);
|
| @@ -1112,6 +1098,7 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
|
| case kMathExp: return DoMathExp(instr);
|
| case kMathSqrt: return DoMathSqrt(instr);
|
| case kMathPowHalf: return DoMathPowHalf(instr);
|
| + case kMathClz32: return DoMathClz32(instr);
|
| default:
|
| UNREACHABLE();
|
| return NULL;
|
| @@ -1153,6 +1140,13 @@ LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
|
| }
|
|
|
|
|
| +LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseRegisterAtStart(instr->value());
|
| + LMathClz32* result = new(zone()) LMathClz32(input);
|
| + return DefineAsRegister(result);
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
|
| ASSERT(instr->representation().IsDouble());
|
| ASSERT(instr->value()->representation().IsDouble());
|
| @@ -1199,9 +1193,7 @@ LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
|
| LOperand* context = UseFixed(instr->context(), cp);
|
| LOperand* function = UseFixed(instr->function(), r1);
|
| LCallFunction* call = new(zone()) LCallFunction(context, function);
|
| - LInstruction* result = DefineFixed(call, r0);
|
| - if (instr->IsTailCall()) return result;
|
| - return MarkAsCall(result, instr);
|
| + return MarkAsCall(DefineFixed(call, r0), instr);
|
| }
|
|
|
|
|
| @@ -1250,9 +1242,9 @@ LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
|
| if (instr->representation().IsSmiOrInteger32()) {
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| - if (instr->HasPowerOf2Divisor()) {
|
| + if (instr->RightIsPowerOf2()) {
|
| ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
|
| - LOperand* value = UseRegisterAtStart(instr->left());
|
| + LOperand* value = UseRegister(instr->left());
|
| LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL);
|
| return AssignEnvironment(DefineAsRegister(div));
|
| }
|
| @@ -1296,43 +1288,25 @@ bool LChunkBuilder::HasMagicNumberForDivisor(int32_t divisor) {
|
| }
|
|
|
|
|
| -HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) {
|
| - if (CpuFeatures::IsSupported(SUDIV)) {
|
| - // A value with an integer representation does not need to be transformed.
|
| - if (divisor->representation().IsInteger32()) {
|
| - return divisor;
|
| - // A change from an integer32 can be replaced by the integer32 value.
|
| - } else if (divisor->IsChange() &&
|
| - HChange::cast(divisor)->from().IsInteger32()) {
|
| - return HChange::cast(divisor)->value();
|
| - }
|
| - }
|
| -
|
| - if (divisor->IsConstant() && HConstant::cast(divisor)->HasInteger32Value()) {
|
| - HConstant* constant_val = HConstant::cast(divisor);
|
| - int32_t int32_val = constant_val->Integer32Value();
|
| - if (LChunkBuilder::HasMagicNumberForDivisor(int32_val) ||
|
| - CpuFeatures::IsSupported(SUDIV)) {
|
| - return constant_val->CopyToRepresentation(Representation::Integer32(),
|
| - divisor->block()->zone());
|
| - }
|
| - }
|
| -
|
| - return NULL;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
|
| + // LMathFloorOfDiv can only handle a subset of divisors, so fall
|
| + // back to a flooring division in all other cases.
|
| HValue* right = instr->right();
|
| + if (!right->IsInteger32Constant() ||
|
| + (!CpuFeatures::IsSupported(SUDIV) &&
|
| + !HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value()))) {
|
| + LOperand* dividend = UseRegister(instr->left());
|
| + LOperand* divisor = UseRegister(right);
|
| + LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4);
|
| + LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
|
| + return AssignEnvironment(DefineAsRegister(div));
|
| + }
|
| +
|
| LOperand* dividend = UseRegister(instr->left());
|
| LOperand* divisor = CpuFeatures::IsSupported(SUDIV)
|
| ? UseRegister(right)
|
| : UseOrConstant(right);
|
| LOperand* remainder = TempRegister();
|
| - ASSERT(CpuFeatures::IsSupported(SUDIV) ||
|
| - (right->IsConstant() &&
|
| - HConstant::cast(right)->HasInteger32Value() &&
|
| - HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value())));
|
| return AssignEnvironment(DefineAsRegister(
|
| new(zone()) LMathFloorOfDiv(dividend, divisor, remainder)));
|
| }
|
| @@ -1344,7 +1318,7 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
| if (instr->representation().IsSmiOrInteger32()) {
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| - if (instr->HasPowerOf2Divisor()) {
|
| + if (instr->RightIsPowerOf2()) {
|
| ASSERT(!right->CanBeZero());
|
| LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
|
| UseConstant(right));
|
| @@ -1739,19 +1713,6 @@ LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
|
| - LOperand* object = UseRegisterAtStart(instr->value());
|
| - return DefineAsRegister(new(zone()) LElementsKind(object));
|
| -}
|
| -
|
| -
|
| -LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
|
| - LOperand* object = UseRegister(instr->value());
|
| - LValueOf* result = new(zone()) LValueOf(object, TempRegister());
|
| - return DefineAsRegister(result);
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
|
| LOperand* object = UseFixed(instr->value(), r0);
|
| LDateField* result =
|
| @@ -1799,13 +1760,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
|
| - LOperand* context = UseFixed(instr->context(), cp);
|
| - LOperand* value = UseFixed(instr->value(), r0);
|
| - return MarkAsCall(new(zone()) LThrow(context, value), instr);
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
|
| return NULL;
|
| }
|
| @@ -2087,13 +2041,6 @@ LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
|
| - HLoadExternalArrayPointer* instr) {
|
| - LOperand* input = UseRegisterAtStart(instr->value());
|
| - return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
| ASSERT(instr->key()->representation().IsSmiOrInteger32());
|
| ElementsKind elements_kind = instr->elements_kind();
|
| @@ -2123,7 +2070,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
| // An unsigned int array load might overflow and cause a deopt, make sure it
|
| // has an environment.
|
| bool can_deoptimize = instr->RequiresHoleCheck() ||
|
| - elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS ||
|
| + elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
| elements_kind == UINT32_ELEMENTS;
|
| return can_deoptimize ? AssignEnvironment(result) : result;
|
| }
|
| @@ -2280,12 +2227,8 @@ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
|
|
|
| LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
|
| LOperand* context = UseFixed(instr->context(), cp);
|
| - LOperand* left = FLAG_new_string_add
|
| - ? UseFixed(instr->left(), r1)
|
| - : UseRegisterAtStart(instr->left());
|
| - LOperand* right = FLAG_new_string_add
|
| - ? UseFixed(instr->right(), r0)
|
| - : UseRegisterAtStart(instr->right());
|
| + LOperand* left = UseFixed(instr->left(), r1);
|
| + LOperand* right = UseFixed(instr->right(), r0);
|
| return MarkAsCall(
|
| DefineFixed(new(zone()) LStringAdd(context, left, right), r0),
|
| instr);
|
|
|