| Index: src/x64/lithium-x64.cc
|
| diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
|
| index d4e29f67054c5263bb6a542587eec1d9aa8b332d..d42d3824e2f37d2b9ee94888e0d4c8bbcc8eb286 100644
|
| --- a/src/x64/lithium-x64.cc
|
| +++ b/src/x64/lithium-x64.cc
|
| @@ -857,10 +857,12 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
|
| 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);
|
| @@ -950,6 +952,9 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* 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());
|
| return new(zone()) LCmpMapAndBranch(value);
|
| @@ -1049,30 +1054,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(), rsi);
|
| 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(), rdi);
|
| @@ -1119,6 +1106,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;
|
| @@ -1156,6 +1144,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());
|
| @@ -1201,9 +1196,7 @@ LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
|
| LOperand* context = UseFixed(instr->context(), rsi);
|
| LOperand* function = UseFixed(instr->function(), rdi);
|
| LCallFunction* call = new(zone()) LCallFunction(context, function);
|
| - LInstruction* result = DefineFixed(call, rax);
|
| - if (instr->IsTailCall()) return result;
|
| - return MarkAsCall(result, instr);
|
| + return MarkAsCall(DefineFixed(call, rax), instr);
|
| }
|
|
|
|
|
| @@ -1253,12 +1246,12 @@ 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, UseOrConstant(instr->right()), NULL);
|
| - return AssignEnvironment(DefineSameAsFirst(div));
|
| + return AssignEnvironment(DefineAsRegister(div));
|
| }
|
| // The temporary operand is necessary to ensure that right is not allocated
|
| // into rdx.
|
| @@ -1275,25 +1268,6 @@ LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
|
| }
|
|
|
|
|
| -HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) {
|
| - if (divisor->IsConstant() &&
|
| - HConstant::cast(divisor)->HasInteger32Value()) {
|
| - HConstant* constant_val = HConstant::cast(divisor);
|
| - return constant_val->CopyToRepresentation(Representation::Integer32(),
|
| - divisor->block()->zone());
|
| - }
|
| - // 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();
|
| - }
|
| - return NULL;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
|
| HValue* right = instr->right();
|
| if (!right->IsConstant()) {
|
| @@ -1336,7 +1310,7 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
| if (instr->representation().IsSmiOrInteger32()) {
|
| ASSERT(left->representation().Equals(instr->representation()));
|
| ASSERT(right->representation().Equals(instr->representation()));
|
| - if (instr->HasPowerOf2Divisor()) {
|
| + if (instr->RightIsPowerOf2()) {
|
| ASSERT(!right->CanBeZero());
|
| LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
|
| UseOrConstant(right),
|
| @@ -1641,19 +1615,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);
|
| - return DefineSameAsFirst(result);
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
|
| LOperand* object = UseFixed(instr->value(), rax);
|
| LDateField* result = new(zone()) LDateField(object, instr->index());
|
| @@ -1707,13 +1668,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
|
| - LOperand* context = UseFixed(instr->context(), rsi);
|
| - LOperand* value = UseFixed(instr->value(), rax);
|
| - return MarkAsCall(new(zone()) LThrow(context, value), instr);
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
|
| return NULL;
|
| }
|
| @@ -2010,13 +1964,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().IsInteger32());
|
| ElementsKind elements_kind = instr->elements_kind();
|
| @@ -2038,7 +1985,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|
|
| DefineAsRegister(result);
|
| bool can_deoptimize = instr->RequiresHoleCheck() ||
|
| - (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ||
|
| + (elements_kind == EXTERNAL_UINT32_ELEMENTS) ||
|
| (elements_kind == UINT32_ELEMENTS);
|
| // An unsigned int array load might overflow and cause a deopt, make sure it
|
| // has an environment.
|
| @@ -2099,8 +2046,8 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
| (instr->is_external() &&
|
| instr->elements()->representation().IsExternal()));
|
| bool val_is_temp_register =
|
| - elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
|
| - elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
|
| + elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
| + elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| elements_kind == FLOAT32_ELEMENTS;
|
| LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
|
| : UseRegister(instr->value());
|
| @@ -2228,12 +2175,8 @@ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
|
|
|
| LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
|
| LOperand* context = UseFixed(instr->context(), rsi);
|
| - LOperand* left = FLAG_new_string_add
|
| - ? UseFixed(instr->left(), rdx)
|
| - : UseOrConstantAtStart(instr->left());
|
| - LOperand* right = FLAG_new_string_add
|
| - ? UseFixed(instr->right(), rax)
|
| - : UseOrConstantAtStart(instr->right());
|
| + LOperand* left = UseFixed(instr->left(), rdx);
|
| + LOperand* right = UseFixed(instr->right(), rax);
|
| return MarkAsCall(
|
| DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr);
|
| }
|
|
|