Lines Matching refs:instr
620 HInstruction* instr = HInstruction::cast(value);
621 VisitInstruction(instr);
629 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
632 instr->set_result(result);
633 return instr;
639 LTemplateInstruction<1, I, T>* instr) {
640 return Define(instr,
647 LTemplateInstruction<1, I, T>* instr,
649 return Define(instr,
656 LTemplateInstruction<1, I, T>* instr) {
657 return Define(instr,
663 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
665 return Define(instr, ToUnallocated(reg));
671 LTemplateInstruction<1, I, T>* instr,
673 return Define(instr, ToUnallocated(reg));
677 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
681 instr->set_environment(CreateEnvironment(hydrogen_env,
684 return instr;
688 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
694 instr->VerifyCall();
696 instr->MarkAsCall();
697 instr = AssignPointerMap(instr);
704 instruction_pending_deoptimization_environment_ = instr;
715 if (needs_environment && !instr->HasEnvironment()) {
716 instr = AssignEnvironment(instr);
719 return instr;
723 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
724 ASSERT(!instr->HasPointerMap());
725 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
726 return instr;
757 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
758 return new(zone()) LLabel(instr->block());
762 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
763 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
767 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
773 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
779 HBitwiseBinaryOperation* instr) {
780 if (instr->representation().IsSmiOrInteger32()) {
781 ASSERT(instr->left()->representation().Equals(instr->representation()));
782 ASSERT(instr->right()->representation().Equals(instr->representation()));
783 LOperand* left = UseRegisterAtStart(instr->left());
785 HValue* right_value = instr->right();
795 if (instr->representation().IsSmi() && constant_value > 0) {
796 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
806 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
808 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
816 return DoArithmeticT(op, instr);
822 HArithmeticBinaryOperation* instr) {
823 ASSERT(instr->representation().IsDouble());
824 ASSERT(instr->left()->representation().IsDouble());
825 ASSERT(instr->right()->representation().IsDouble());
827 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
828 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
830 return MarkAsCall(DefineSameAsFirst(result), instr);
832 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
833 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
841 HBinaryOperation* instr) {
842 HValue* left = instr->left();
843 HValue* right = instr->right();
846 LOperand* context = UseFixed(instr->context(), esi);
851 return MarkAsCall(DefineFixed(result, eax), instr);
926 LInstruction* instr = NULL;
929 instr = DefineAsRegister(new(zone()) LDummy());
931 instr = DefineAsRegister(new(zone())
941 instr = current->CompileToLithium(this);
947 if (instr != NULL) {
950 instr->set_hydrogen_value(current);
963 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
966 for (UseIterator it(instr); !it.Done(); it.Advance()) {
970 if (instr->Output() != NULL) {
971 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
973 for (TempIterator it(instr); !it.Done(); it.Advance()) {
981 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
982 instr = AssignPointerMap(instr);
984 if (FLAG_stress_environments && !instr->HasEnvironment()) {
985 instr = AssignEnvironment(instr);
987 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && instr->IsGoto() &&
988 LGoto::cast(instr)->jumps_to_join()) {
997 chunk_->AddInstruction(instr, current_block_);
1087 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1088 return new(zone()) LGoto(instr->FirstSuccessor());
1092 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1093 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1096 ToBooleanStub::Types expected = instr->expected_input_types();
1101 HValue* value = instr->value();
1123 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
1128 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1129 ASSERT(instr->value()->representation().IsTagged());
1130 LOperand* value = UseRegisterAtStart(instr->value());
1147 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1148 LOperand* left = UseFixed(instr->left(), InstanceofStub::left());
1149 LOperand* right = UseFixed(instr->right(), InstanceofStub::right());
1150 LOperand* context = UseFixed(instr->context(), esi);
1152 return MarkAsCall(DefineFixed(result, eax), instr);
1157 HInstanceOfKnownGlobal* instr) {
1160 UseFixed(instr->context(), esi),
1161 UseFixed(instr->left(), InstanceofStub::left()),
1163 return MarkAsCall(DefineFixed(result, eax), instr);
1167 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1168 LOperand* receiver = UseRegister(instr->receiver());
1169 LOperand* function = UseRegisterAtStart(instr->function());
1177 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1178 LOperand* function = UseFixed(instr->function(), edi);
1179 LOperand* receiver = UseFixed(instr->receiver(), eax);
1180 LOperand* length = UseFixed(instr->length(), ebx);
1181 LOperand* elements = UseFixed(instr->elements(), ecx);
1186 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1190 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1191 LOperand* argument = UseAny(instr->argument());
1205 HInnerAllocatedObject* instr) {
1206 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1207 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1213 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1214 return instr->HasNoUses()
1220 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1221 if (instr->HasNoUses()) return NULL;
1231 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1232 LOperand* context = UseRegisterAtStart(instr->value());
1237 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1238 LOperand* context = UseFixed(instr->context(), esi);
1239 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1243 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1244 LOperand* context = UseRegisterAtStart(instr->value());
1249 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1250 LOperand* global_object = UseRegisterAtStart(instr->value());
1256 HCallConstantFunction* instr) {
1257 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr);
1261 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1262 LOperand* context = UseFixed(instr->context(), esi);
1263 LOperand* function = UseFixed(instr->function(), edi);
1265 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1269 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1270 switch (instr->op()) {
1271 case kMathFloor: return DoMathFloor(instr);
1272 case kMathRound: return DoMathRound(instr);
1273 case kMathAbs: return DoMathAbs(instr);
1274 case kMathLog: return DoMathLog(instr);
1275 case kMathSin: return DoMathSin(instr);
1276 case kMathCos: return DoMathCos(instr);
1277 case kMathTan: return DoMathTan(instr);
1278 case kMathExp: return DoMathExp(instr);
1279 case kMathSqrt: return DoMathSqrt(instr);
1280 case kMathPowHalf: return DoMathPowHalf(instr);
1288 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1289 LOperand* input = UseRegisterAtStart(instr->value());
1295 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1296 LOperand* input = UseRegister(instr->value());
1303 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1304 LOperand* context = UseAny(instr->context()); // Deferred use.
1305 LOperand* input = UseRegisterAtStart(instr->value());
1311 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1312 ASSERT(instr->representation().IsDouble());
1313 ASSERT(instr->value()->representation().IsDouble());
1314 LOperand* input = UseRegisterAtStart(instr->value());
1320 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1321 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1323 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1327 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1328 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1330 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1334 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1335 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1337 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1341 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1342 ASSERT(instr->representation().IsDouble());
1343 ASSERT(instr->value()->representation().IsDouble());
1344 LOperand* value = UseTempRegister(instr->value());
1352 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1353 LOperand* input = UseRegisterAtStart(instr->value());
1359 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1360 LOperand* input = UseRegisterAtStart(instr->value());
1367 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1368 ASSERT(instr->key()->representation().IsTagged());
1369 LOperand* context = UseFixed(instr->context(), esi);
1370 LOperand* key = UseFixed(instr->key(), ecx);
1372 return MarkAsCall(DefineFixed(result, eax), instr);
1376 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1377 LOperand* context = UseFixed(instr->context(), esi);
1379 return MarkAsCall(DefineFixed(result, eax), instr);
1383 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1384 LOperand* context = UseFixed(instr->context(), esi);
1386 return MarkAsCall(DefineFixed(result, eax), instr);
1390 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1391 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
1395 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1396 LOperand* context = UseFixed(instr->context(), esi);
1397 LOperand* constructor = UseFixed(instr->constructor(), edi);
1399 return MarkAsCall(DefineFixed(result, eax), instr);
1403 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1404 LOperand* context = UseFixed(instr->context(), esi);
1405 LOperand* constructor = UseFixed(instr->constructor(), edi);
1407 return MarkAsCall(DefineFixed(result, eax), instr);
1411 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1412 LOperand* context = UseFixed(instr->context(), esi);
1413 LOperand* function = UseFixed(instr->function(), edi);
1416 if (instr->IsTailCall()) return result;
1417 return MarkAsCall(result, instr);
1421 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1422 LOperand* context = UseFixed(instr->context(), esi);
1423 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr);
1427 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1428 return DoShift(Token::ROR, instr);
1432 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1433 return DoShift(Token::SHR, instr);
1437 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1438 return DoShift(Token::SAR, instr);
1442 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1443 return DoShift(Token::SHL, instr);
1447 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1448 if (instr->representation().IsSmiOrInteger32()) {
1449 ASSERT(instr->left()->representation().Equals(instr->representation()));
1450 ASSERT(instr->right()->representation().Equals(instr->representation()));
1451 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32));
1453 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1454 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1457 return DoArithmeticT(instr->op(), instr);
1462 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1463 if (instr->representation().IsSmiOrInteger32()) {
1464 ASSERT(instr->left()->representation().Equals(instr->representation()));
1465 ASSERT(instr->right()->representation().Equals(instr->representation()));
1466 if (instr->HasPowerOf2Divisor()) {
1467 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1468 LOperand* value = UseRegisterAtStart(instr->left());
1470 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1476 LOperand* dividend = UseFixed(instr->left(), eax);
1477 LOperand* divisor = UseRegister(instr->right());
1480 } else if (instr->representation().IsDouble()) {
1481 return DoArithmeticD(Token::DIV, instr);
1483 return DoArithmeticT(Token::DIV, instr);
1507 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1508 HValue* right = instr->right();
1514 LOperand* dividend = UseFixed(instr->left(), eax);
1515 LOperand* divisor = UseRegister(instr->right());
1524 LOperand* dividend = UseRegister(instr->left());
1529 LOperand* dividend = divisor_si < -1 ? UseTempRegister(instr->left()) :
1530 UseRegisterAtStart(instr->left());
1536 LOperand* dividend = UseFixed(instr->left(), eax);
1545 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1546 HValue* left = instr->left();
1547 HValue* right = instr->right();
1548 if (instr->representation().IsSmiOrInteger32()) {
1549 ASSERT(instr->left()->representation().Equals(instr->representation()));
1550 ASSERT(instr->right()->representation().Equals(instr->representation()));
1552 if (instr->HasPowerOf2Divisor()) {
1559 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1573 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1575 instr->CanBeZero() &&
1576 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1580 } else if (instr->representation().IsDouble()) {
1581 return DoArithmeticD(Token::MOD, instr);
1583 return DoArithmeticT(Token::MOD, instr);
1588 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1589 if (instr->representation().IsSmiOrInteger32()) {
1590 ASSERT(instr->left()->representation().Equals(instr->representation()));
1591 ASSERT(instr->right()->representation().Equals(instr->representation()));
1592 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1593 LOperand* right = UseOrConstant(instr->BetterRightOperand());
1595 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1599 if (instr->CheckFlag(HValue::kCanOverflow) ||
1600 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1604 } else if (instr->representation().IsDouble()) {
1605 return DoArithmeticD(Token::MUL, instr);
1607 return DoArithmeticT(Token::MUL, instr);
1612 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1613 if (instr->representation().IsSmiOrInteger32()) {
1614 ASSERT(instr->left()->representation().Equals(instr->representation()));
1615 ASSERT(instr->right()->representation().Equals(instr->representation()));
1616 LOperand* left = UseRegisterAtStart(instr->left());
1617 LOperand* right = UseOrConstantAtStart(instr->right());
1620 if (instr->CheckFlag(HValue::kCanOverflow)) {
1624 } else if (instr->representation().IsDouble()) {
1625 return DoArithmeticD(Token::SUB, instr);
1627 return DoArithmeticT(Token::SUB, instr);
1632 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1633 if (instr->representation().IsSmiOrInteger32()) {
1634 ASSERT(instr->left()->representation().Equals(instr->representation()));
1635 ASSERT(instr->right()->representation().Equals(instr->representation()));
1640 bool use_lea = LAddI::UseLea(instr);
1641 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1642 HValue* right_candidate = instr->BetterRightOperand();
1647 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1655 } else if (instr->representation().IsDouble()) {
1656 return DoArithmeticD(Token::ADD, instr);
1657 } else if (instr->representation().IsExternal()) {
1658 ASSERT(instr->left()->representation().IsExternal());
1659 ASSERT(instr->right()->representation().IsInteger32());
1660 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1661 bool use_lea = LAddI::UseLea(instr);
1662 LOperand* left = UseRegisterAtStart(instr->left());
1663 HValue* right_candidate = instr->right();
1673 return DoArithmeticT(Token::ADD, instr);
1678 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1681 if (instr->representation().IsSmiOrInteger32()) {
1682 ASSERT(instr->left()->representation().Equals(instr->representation()));
1683 ASSERT(instr->right()->representation().Equals(instr->representation()));
1684 left = UseRegisterAtStart(instr->BetterLeftOperand());
1685 right = UseOrConstantAtStart(instr->BetterRightOperand());
1687 ASSERT(instr->representation().IsDouble());
1688 ASSERT(instr->left()->representation().IsDouble());
1689 ASSERT(instr->right()->representation().IsDouble());
1690 left = UseRegisterAtStart(instr->left());
1691 right = UseRegisterAtStart(instr->right());
1698 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1699 ASSERT(instr->representation().IsDouble());
1702 Representation exponent_type = instr->right()->representation();
1703 ASSERT(instr->left()->representation().IsDouble());
1704 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1706 UseFixedDouble(instr->right(), xmm1) :
1707 UseFixed(instr->right(), eax);
1709 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1714 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1715 ASSERT(instr->left()->representation().IsSmiOrTagged());
1716 ASSERT(instr->right()->representation().IsSmiOrTagged());
1717 LOperand* context = UseFixed(instr->context(), esi);
1718 LOperand* left = UseFixed(instr->left(), edx);
1719 LOperand* right = UseFixed(instr->right(), eax);
1721 return MarkAsCall(DefineFixed(result, eax), instr);
1726 HCompareNumericAndBranch* instr) {
1727 Representation r = instr->representation();
1729 ASSERT(instr->left()->representation().Equals(r));
1730 ASSERT(instr->right()->representation().Equals(r));
1731 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1732 LOperand* right = UseOrConstantAtStart(instr->right());
1736 ASSERT(instr->left()->representation().IsDouble());
1737 ASSERT(instr->right()->representation().IsDouble());
1740 if (CanBeImmediateConstant(instr->left()) &&
1741 CanBeImmediateConstant(instr->right())) {
1744 left = UseConstant(instr->left());
1745 right = UseConstant(instr->right());
1747 left = UseRegisterAtStart(instr->left());
1748 right = UseRegisterAtStart(instr->right());
1756 HCompareObjectEqAndBranch* instr) {
1757 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1759 LOperand* left = UseRegisterAtStart(instr->left());
1760 LOperand* right = UseOrConstantAtStart(instr->right());
1766 HCompareHoleAndBranch* instr) {
1767 LOperand* value = UseRegisterAtStart(instr->value());
1773 HCompareMinusZeroAndBranch* instr) {
1774 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1776 LOperand* value = UseRegister(instr->value());
1782 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1783 ASSERT(instr->value()->representation().IsSmiOrTagged());
1785 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1789 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1790 ASSERT(instr->value()->representation().IsTagged());
1792 return new(zone()) LIsStringAndBranch(UseRegister(instr->value()), temp);
1796 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1797 ASSERT(instr->value()->representation().IsTagged());
1798 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1803 HIsUndetectableAndBranch* instr) {
1804 ASSERT(instr->value()->representation().IsTagged());
1806 UseRegisterAtStart(instr->value()), TempRegister());
1811 HStringCompareAndBranch* instr) {
1812 ASSERT(instr->left()->representation().IsTagged());
1813 ASSERT(instr->right()->representation().IsTagged());
1814 LOperand* context = UseFixed(instr->context(), esi);
1815 LOperand* left = UseFixed(instr->left(), edx);
1816 LOperand* right = UseFixed(instr->right(), eax);
1821 return MarkAsCall(result, instr);
1826 HHasInstanceTypeAndBranch* instr) {
1827 ASSERT(instr->value()->representation().IsTagged());
1829 UseRegisterAtStart(instr->value()),
1835 HGetCachedArrayIndex* instr) {
1836 ASSERT(instr->value()->representation().IsTagged());
1837 LOperand* value = UseRegisterAtStart(instr->value());
1844 HHasCachedArrayIndexAndBranch* instr) {
1845 ASSERT(instr->value()->representation().IsTagged());
1847 UseRegisterAtStart(instr->value()));
1852 HClassOfTestAndBranch* instr) {
1853 ASSERT(instr->value()->representation().IsTagged());
1854 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1860 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1861 LOperand* map = UseRegisterAtStart(instr->value());
1866 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1867 LOperand* object = UseRegisterAtStart(instr->value());
1872 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1873 LOperand* object = UseRegister(instr->value());
1879 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1880 LOperand* date = UseFixed(instr->value(), eax);
1882 new(zone()) LDateField(date, FixedTemp(ecx), instr->index());
1883 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1887 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1888 LOperand* string = UseRegisterAtStart(instr->string());
1889 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1894 LOperand* LChunkBuilder::GetSeqStringSetCharOperand(HSeqStringSetChar* instr) {
1895 if (instr->encoding() == String::ONE_BYTE_ENCODING) {
1897 return UseFixed(instr->value(), eax);
1899 return UseFixedOrConstant(instr->value(), eax);
1903 return UseRegisterAtStart(instr->value());
1905 return UseRegisterOrConstantAtStart(instr->value());
1911 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1912 LOperand* string = UseRegisterAtStart(instr->string());
1914 ? UseRegisterAtStart(instr->index())
1915 : UseRegisterOrConstantAtStart(instr->index());
1916 LOperand* value = GetSeqStringSetCharOperand(instr);
1917 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), esi) : NULL;
1921 result = MarkAsCall(result, instr);
1927 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1929 UseRegisterOrConstantAtStart(instr->index()),
1930 UseAtStart(instr->length())));
1935 HBoundsCheckBaseIndexInformation* instr) {
1941 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1948 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1949 LOperand* context = UseFixed(instr->context(), esi);
1950 LOperand* value = UseFixed(instr->value(), eax);
1951 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1955 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1968 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1969 Representation from = instr->from();
1970 Representation to = instr->to();
1973 LOperand* value = UseRegister(instr->value());
1983 LOperand* value = UseRegister(instr->value());
1989 HValue* val = instr->value();
1997 HValue* val = instr->value();
2002 bool truncating = instr->CanTruncateToInt32();
2013 LOperand* value = UseRegisterAtStart(instr->value());
2021 LOperand* value = UseRegister(instr->value());
2026 bool truncating = instr->CanTruncateToInt32();
2029 UseTempRegister(instr->value()) : UseRegister(instr->value());
2037 HValue* val = instr->value();
2051 HValue* val = instr->value();
2062 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
2065 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
2068 new(zone()) LInteger32ToDouble(Use(instr->value())));
2077 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
2078 LOperand* value = UseAtStart(instr->value());
2083 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
2084 LOperand* value = UseRegisterAtStart(instr->value());
2089 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
2090 LOperand* value = UseRegisterAtStart(instr->value());
2097 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
2102 LOperand* value = instr->object_in_new_space()
2103 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value());
2108 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
2110 if (!instr->CanOmitMapChecks()) {
2111 value = UseRegisterAtStart(instr->value());
2112 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
2115 if (!instr->CanOmitMapChecks()) {
2117 if (instr->has_migration_target()) return AssignPointerMap(result);
2123 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2124 HValue* value = instr->value();
2142 LOperand* value = UseRegister(instr->value());
2152 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2153 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), esi) : NULL;
2154 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
2156 UseFixed(instr->value(), eax), context, parameter_count);
2160 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2161 Representation r = instr->representation();
2167 double value = instr->DoubleValue();
2182 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2184 return instr->RequiresHoleCheck()
2190 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2191 LOperand* context = UseFixed(instr->context(), esi);
2192 LOperand* global_object = UseFixed(instr->global_object(), edx);
2195 return MarkAsCall(DefineFixed(result, eax), instr);
2199 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2201 new(zone()) LStoreGlobalCell(UseRegister(instr->value()));
2202 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2206 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2207 LOperand* context = UseFixed(instr->context(), esi);
2208 LOperand* global_object = UseFixed(instr->global_object(), edx);
2209 LOperand* value = UseFixed(instr->value(), eax);
2212 return MarkAsCall(result, instr);
2216 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2217 LOperand* context = UseRegisterAtStart(instr->value());
2220 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2224 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2227 LOperand* context = UseRegister(instr->context());
2228 if (instr->NeedsWriteBarrier()) {
2229 value = UseTempRegister(instr->value());
2232 value = UseRegister(instr->value());
2236 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2240 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2241 LOperand* obj = (instr->access().IsExternalMemory() &&
2242 instr->access().offset() == 0)
2243 ? UseRegisterOrConstantAtStart(instr->object())
2244 : UseRegisterAtStart(instr->object());
2249 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2250 LOperand* context = UseFixed(instr->context(), esi);
2251 LOperand* object = UseFixed(instr->object(), edx);
2253 return MarkAsCall(DefineFixed(result, eax), instr);
2258 HLoadFunctionPrototype* instr) {
2260 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()),
2265 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2271 HLoadExternalArrayPointer* instr) {
2272 LOperand* input = UseRegisterAtStart(instr->value());
2277 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2278 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2279 ElementsKind elements_kind = instr->elements_kind();
2281 instr->key()->representation(), elements_kind);
2283 ? UseTempRegister(instr->key())
2284 : UseRegisterOrConstantAtStart(instr->key());
2287 if (!instr->is_external()) {
2288 LOperand* obj = UseRegisterAtStart(instr->elements());
2292 (instr->representation().IsInteger32() &&
2295 (instr->representation().IsDouble() &&
2298 LOperand* external_pointer = UseRegister(instr->elements());
2303 bool can_deoptimize = instr->RequiresHoleCheck() ||
2311 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2312 LOperand* context = UseFixed(instr->context(), esi);
2313 LOperand* object = UseFixed(instr->object(), edx);
2314 LOperand* key = UseFixed(instr->key(), ecx);
2318 return MarkAsCall(DefineFixed(result, eax), instr);
2322 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
2323 ElementsKind elements_kind = instr->elements_kind();
2331 return UseFixed(instr->value(), eax);
2336 return UseRegisterAtStart(instr->value());
2339 return UseRegister(instr->value());
2343 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2344 if (!instr->is_external()) {
2345 ASSERT(instr->elements()->representation().IsTagged());
2346 ASSERT(instr->key()->representation().IsInteger32() ||
2347 instr->key()->representation().IsSmi());
2349 if (instr->value()->representation().IsDouble()) {
2350 LOperand* object = UseRegisterAtStart(instr->elements());
2352 val = UseRegisterAtStart(instr->value());
2353 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2356 ASSERT(instr->value()->representation().IsSmiOrTagged());
2357 bool needs_write_barrier = instr->NeedsWriteBarrier();
2359 LOperand* obj = UseRegister(instr->elements());
2363 val = UseTempRegister(instr->value());
2364 key = UseTempRegister(instr->key());
2366 val = UseRegisterOrConstantAtStart(instr->value());
2367 key = UseRegisterOrConstantAtStart(instr->key());
2373 ElementsKind elements_kind = instr->elements_kind();
2375 (instr->value()->representation().IsInteger32() &&
2378 (instr->value()->representation().IsDouble() &&
2381 ASSERT(instr->elements()->representation().IsExternal());
2383 LOperand* external_pointer = UseRegister(instr->elements());
2384 LOperand* val = GetStoreKeyedValueOperand(instr);
2386 instr->key()->representation(), elements_kind);
2388 ? UseTempRegister(instr->key())
2389 : UseRegisterOrConstantAtStart(instr->key());
2396 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2397 LOperand* context = UseFixed(instr->context(), esi);
2398 LOperand* object = UseFixed(instr->object(), edx);
2399 LOperand* key = UseFixed(instr->key(), ecx);
2400 LOperand* value = UseFixed(instr->value(), eax);
2402 ASSERT(instr->object()->representation().IsTagged());
2403 ASSERT(instr
2404 ASSERT(instr->value()->representation().IsTagged());
2408 return MarkAsCall(result, instr);
2413 HTransitionElementsKind* instr) {
2414 LOperand* object = UseRegister(instr->object());
2415 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2416 LOperand* object = UseRegister(instr->object());
2424 LOperand* context = UseFixed(instr->context(), esi);
2433 HTrapAllocationMemento* instr) {
2434 LOperand* object = UseRegister(instr->object());
2442 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2443 bool is_in_object = instr->access().IsInobject();
2444 bool is_external_location = instr->access().IsExternalMemory() &&
2445 instr->access().offset() == 0;
2446 bool needs_write_barrier = instr->NeedsWriteBarrier();
2447 bool needs_write_barrier_for_map = instr->has_transition() &&
2448 instr->NeedsWriteBarrierForMap();
2453 ? UseRegister(instr->object())
2454 : UseTempRegister(instr->object());
2459 obj = UseRegisterOrConstant(instr->object());
2462 ? UseRegister(instr->object())
2463 : UseRegisterAtStart(instr->object());
2466 bool can_be_constant = instr->value()->IsConstant() &&
2467 HConstant::cast(instr->value())->NotInNewSpace() &&
2468 !(FLAG_track_double_fields && instr->field_representation().IsDouble());
2471 if (instr->field_representation().IsInteger8() ||
2472 instr->field_representation().IsUInteger8()) {
2475 val = UseFixed(instr->value(), eax);
2477 val = UseTempRegister(instr->value());
2479 val = UseRegisterOrConstant(instr->value());
2480 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) {
2481 val = UseTempRegister(instr->value());
2483 instr->field_representation().IsDouble()) {
2484 val = UseRegisterAtStart(instr->value());
2486 val = UseRegister(instr->value());
2500 instr->field_representation().IsHeapObject()) {
2501 if (!instr->value()->type().IsHeapObject()) {
2509 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2510 LOperand* context = UseFixed(instr->context(), esi);
2511 LOperand* object = UseFixed(instr->object(), edx);
2512 LOperand* value = UseFixed(instr->value(), eax);
2516 return MarkAsCall(result, instr);
2520 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2521 LOperand* context = UseFixed(instr->context(), esi);
2523 ? UseFixed(instr->left(), edx)
2524 : UseOrConstantAtStart(instr->left());
2526 ? UseFixed(instr->right(), eax)
2527 : UseOrConstantAtStart(instr->right());
2529 return MarkAsCall(DefineFixed(string_add, eax), instr);
2533 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2534 LOperand* string = UseTempRegister(instr->string());
2535 LOperand* index = UseTempRegister(instr->index());
2536 LOperand* context = UseAny(instr->context());
2543 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2544 LOperand* char_code = UseRegister(instr->value());
2545 LOperand* context = UseAny(instr->context());
2552 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2554 LOperand* context = UseAny(instr->context());
2555 LOperand* size = instr->size()->IsConstant()
2556 ? UseConstant(instr->size())
2557 : UseTempRegister(instr->size());
2564 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2565 LOperand* context = UseFixed(instr->context(), esi);
2567 DefineFixed(new(zone()) LRegExpLiteral(context), eax), instr);
2571 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2572 LOperand* context = UseFixed(instr->context(), esi);
2574 DefineFixed(new(zone()) LFunctionLiteral(context), eax), instr);
2578 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2581 current_block_->last_environment()->set_ast_id(instr->ast_id());
2586 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2588 if (instr->kind() == HParameter::STACK_PARAMETER) {
2589 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2595 int index = static_cast<int>(instr->index());
2602 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2605 int env_index = instr->index();
2607 if (instr->environment()->is_parameter_index(env_index)) {
2610 spill_index = env_index - instr->environment()->first_local_index();
2625 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2626 LOperand* context = UseFixed(instr->context(), esi);
2628 return MarkAsCall(DefineFixed(result, eax), instr);
2632 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2641 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2642 instr->ReplayEnvironment(current_block_->last_environment());
2649 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2651 LOperand* args = UseRegister(instr->arguments());
2654 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2655 length = UseRegisterOrConstant(instr->length());
2656 index = UseOrConstant(instr->index());
2658 length = UseTempRegister(instr->length());
2659 index = Use(instr->index());
2665 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2666 LOperand* object = UseFixed(instr->value(), eax);
2668 return MarkAsCall(DefineFixed(result, eax), instr);
2672 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2673 LOperand* context = UseFixed(instr->context(), esi);
2674 LOperand* value = UseAtStart(instr->value());
2676 return MarkAsCall(DefineFixed(result, eax), instr);
2680 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2681 LInstruction* goto_instr = CheckElideControlInstruction(instr);
2683 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2688 HIsConstructCallAndBranch* instr) {
2693 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2694 instr->ReplayEnvironment(current_block_->last_environment());
2699 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
2715 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2717 if (instr->is_function_entry()) {
2718 LOperand* context = UseFixed(instr->context(), esi);
2719 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2721 ASSERT(instr->is_backwards_branch());
2722 LOperand* context = UseAny(instr->context());
2729 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2732 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2733 instr->arguments_count(),
2734 instr->function(),
2736 instr->inlining_kind(),
2737 instr->undefined_receiver());
2739 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2740 inner->Bind(instr->arguments_var(), instr->arguments_object());
2742 inner->set_entry(instr);
2744 chunk_->AddInlinedClosure(instr->closure());
2749 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2757 ASSERT(instr->argument_delta() == -argument_count);
2767 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2768 LOperand* context = UseFixed(instr->context(), esi);
2769 LOperand* object = UseFixed(instr->enumerable(), eax);
2771 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
2775 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2776 LOperand* map = UseRegister(instr->map());
2782 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2783 LOperand* value = UseRegisterAtStart(instr->value());
2784 LOperand* map = UseRegisterAtStart(instr->map());
2789 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2790 LOperand* object = UseRegister(instr->object());
2791 LOperand* index = UseTempRegister(instr->index());