Lines Matching refs:instr
558 HInstruction* instr = HInstruction::cast(value);
559 VisitInstruction(instr);
567 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
570 instr->set_result(result);
571 return instr;
577 LTemplateInstruction<1, I, T>* instr) {
578 return Define(instr,
585 LTemplateInstruction<1, I, T>* instr, int index) {
586 return Define(instr,
593 LTemplateInstruction<1, I, T>* instr) {
594 return Define(instr,
601 LTemplateInstruction<1, I, T>* instr, Register reg) {
602 return Define(instr, ToUnallocated(reg));
608 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) {
609 return Define(instr, ToUnallocated(reg));
613 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
617 instr->set_environment(CreateEnvironment(hydrogen_env,
620 return instr;
624 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
629 instr->VerifyCall();
631 instr->MarkAsCall();
632 instr = AssignPointerMap(instr);
639 instruction_pending_deoptimization_environment_ = instr;
650 if (needs_environment && !instr->HasEnvironment()) {
651 instr = AssignEnvironment(instr);
654 return instr;
658 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
659 ASSERT(!instr->HasPointerMap());
660 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
661 return instr;
692 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
693 return new(zone()) LLabel(instr->block());
697 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
698 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
702 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
708 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
714 HBitwiseBinaryOperation* instr) {
715 if (instr->representation().IsSmiOrInteger32()) {
716 ASSERT(instr->left()->representation().Equals(instr->representation()));
717 ASSERT(instr->right()->representation().Equals(instr->representation()));
718 LOperand* left = UseRegisterAtStart(instr->left());
720 HValue* right_value = instr->right();
730 if (instr->representation().IsSmi() && constant_value > 0) {
731 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
741 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
743 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
751 return DoArithmeticT(op, instr);
757 HArithmeticBinaryOperation* instr) {
758 ASSERT(instr->representation().IsDouble());
759 ASSERT(instr->left()->representation().IsDouble());
760 ASSERT(instr->right()->representation().IsDouble());
762 LOperand* left = UseFixedDouble(instr->left(), d0);
763 LOperand* right = UseFixedDouble(instr->right(), d1);
765 return MarkAsCall(DefineFixedDouble(result, d0), instr);
767 LOperand* left = UseRegisterAtStart(instr->left());
768 LOperand* right = UseRegisterAtStart(instr->right());
776 HBinaryOperation* instr) {
777 HValue* left = instr->left();
778 HValue* right = instr->right();
781 LOperand* context = UseFixed(instr->context(), cp);
786 return MarkAsCall(DefineFixed(result, r0), instr);
862 LInstruction* instr = NULL;
865 instr = DefineAsRegister(new(zone()) LDummy());
867 instr = DefineAsRegister(new(zone())
877 instr = current->CompileToLithium(this);
883 if (instr != NULL) {
886 instr->set_hydrogen_value(current);
899 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
902 for (UseIterator it(instr); !it.Done(); it.Advance()) {
906 if (instr->Output() != NULL) {
907 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
909 for (TempIterator it(instr); !it.Done(); it.Advance()) {
917 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
918 instr = AssignPointerMap(instr);
920 if (FLAG_stress_environments && !instr->HasEnvironment()) {
921 instr = AssignEnvironment(instr);
923 chunk_->AddInstruction(instr, current_block_);
1013 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1014 return new(zone()) LGoto(instr->FirstSuccessor());
1018 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1019 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1022 HValue* value = instr->value();
1029 ToBooleanStub::Types expected = instr->expected_input_types();
1038 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
1043 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1044 ASSERT(instr->value()->representation().IsTagged());
1045 LOperand* value = UseRegisterAtStart(instr->value());
1051 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* instr) {
1053 LOperand* value = UseRegister(instr->value());
1064 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1065 LOperand* context = UseFixed(instr->context(), cp);
1067 new(zone()) LInstanceOf(context, UseFixed(instr->left(), r0),
1068 UseFixed(instr->right(), r1));
1069 return MarkAsCall(DefineFixed(result, r0), instr);
1074 HInstanceOfKnownGlobal* instr) {
1077 UseFixed(instr->context(), cp),
1078 UseFixed(instr->left(), r0),
1080 return MarkAsCall(DefineFixed(result, r0), instr);
1084 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1085 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1086 LOperand* function = UseRegisterAtStart(instr->function());
1092 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1093 LOperand* function = UseFixed(instr->function(), r1);
1094 LOperand* receiver = UseFixed(instr->receiver(), r0);
1095 LOperand* length = UseFixed(instr->length(), r2);
1096 LOperand* elements = UseFixed(instr->elements(), r3);
1101 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
1105 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1106 LOperand* argument = Use(instr->argument());
1120 HInnerAllocatedObject* instr) {
1121 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1122 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1128 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1129 return instr->HasNoUses()
1135 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1136 if (instr->HasNoUses()) return NULL;
1146 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1147 LOperand* context = UseRegisterAtStart(instr->value());
1152 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1153 LOperand* context = UseFixed(instr->context(), cp);
1154 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1158 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1159 LOperand* context = UseRegisterAtStart(instr->value());
1164 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1165 LOperand* global_object = UseRegisterAtStart(instr->value());
1171 HCallConstantFunction* instr) {
1172 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr);
1176 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1177 LOperand* context = UseFixed(instr->context(), cp);
1178 LOperand* function = UseFixed(instr->function(), r1);
1180 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1184 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1185 switch (instr->op()) {
1186 case kMathFloor: return DoMathFloor(instr);
1187 case kMathRound: return DoMathRound(instr);
1188 case kMathAbs: return DoMathAbs(instr);
1189 case kMathLog: return DoMathLog(instr);
1190 case kMathSin: return DoMathSin(instr);
1191 case kMathCos: return DoMathCos(instr);
1192 case kMathTan: return DoMathTan(instr);
1193 case kMathExp: return DoMathExp(instr);
1194 case kMathSqrt: return DoMathSqrt(instr);
1195 case kMathPowHalf: return DoMathPowHalf(instr);
1203 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1204 LOperand* input = UseRegister(instr->value());
1210 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1211 LOperand* input = UseRegister(instr->value());
1218 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1219 Representation r = instr->value()->representation();
1222 : UseFixed(instr->context(), cp);
1223 LOperand* input = UseRegister(instr->value());
1229 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1230 LOperand* input = UseFixedDouble(instr->value(), d2);
1232 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1236 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1237 LOperand* input = UseFixedDouble(instr->value(), d2);
1239 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1243 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1244 LOperand* input = UseFixedDouble(instr->value(), d2);
1246 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1250 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1251 LOperand* input = UseFixedDouble(instr->value(), d2);
1253 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1257 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1258 ASSERT(instr->representation().IsDouble());
1259 ASSERT(instr->value()->representation().IsDouble());
1260 LOperand* input = UseRegister(instr->value());
1269 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1270 LOperand* input = UseRegisterAtStart(instr->value());
1276 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1277 LOperand* input = UseRegisterAtStart(instr->value());
1283 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1284 ASSERT(instr->key()->representation().IsTagged());
1285 LOperand* context = UseFixed(instr->context(), cp);
1286 LOperand* key = UseFixed(instr->key(), r2);
1288 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr);
1292 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1293 LOperand* context = UseFixed(instr->context(), cp);
1294 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr);
1298 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1299 LOperand* context = UseFixed(instr->context(), cp);
1300 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr);
1304 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1305 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr);
1309 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1310 LOperand* context = UseFixed(instr->context(), cp);
1311 LOperand* constructor = UseFixed(instr->constructor(), r1);
1313 return MarkAsCall(DefineFixed(result, r0), instr);
1317 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1318 LOperand* context = UseFixed(instr->context(), cp);
1319 LOperand* constructor = UseFixed(instr->constructor(), r1);
1321 return MarkAsCall(DefineFixed(result, r0), instr);
1325 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1326 LOperand* context = UseFixed(instr->context(), cp);
1327 LOperand* function = UseFixed(instr->function(), r1);
1330 if (instr->IsTailCall()) return result;
1331 return MarkAsCall(result, instr);
1335 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1336 LOperand* context = UseFixed(instr->context(), cp);
1337 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr);
1341 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1342 return DoShift(Token::ROR, instr);
1346 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1347 return DoShift(Token::SHR, instr);
1351 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1352 return DoShift(Token::SAR, instr);
1356 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1357 return DoShift(Token::SHL, instr);
1361 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1362 if (instr->representation().IsSmiOrInteger32()) {
1363 ASSERT(instr->left()->representation().Equals(instr->representation()));
1364 ASSERT(instr->right()->representation().Equals(instr->representation()));
1365 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32));
1367 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1368 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1371 return DoArithmeticT(instr->op(), instr);
1376 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1377 if (instr->representation().IsSmiOrInteger32()) {
1378 ASSERT(instr->left()->representation().Equals(instr->representation()));
1379 ASSERT(instr->right()->representation().Equals(instr->representation()));
1380 if (instr->HasPowerOf2Divisor()) {
1381 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1382 LOperand* value = UseRegisterAtStart(instr->left());
1383 LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL);
1386 LOperand* dividend = UseRegister(instr->left());
1387 LOperand* divisor = UseRegister(instr->right());
1391 } else if (instr->representation().IsDouble()) {
1392 return DoArithmeticD(Token::DIV, instr);
1394 return DoArithmeticT(Token::DIV, instr);
1452 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1453 HValue* right = instr->right();
1454 LOperand* dividend = UseRegister(instr->left());
1468 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1469 HValue* left = instr->left();
1470 HValue* right = instr->right();
1471 if (instr->representation().IsSmiOrInteger32()) {
1472 ASSERT(instr->left()->representation().Equals(instr->representation()));
1473 ASSERT(instr->right()->representation().Equals(instr->representation()));
1474 if (instr->HasPowerOf2Divisor()) {
1480 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1490 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1492 instr->CanBeZero() &&
1493 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1504 instr->CanBeZero() &&
1505 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1509 } else if (instr->representation().IsDouble()) {
1510 return DoArithmeticD(Token::MOD, instr);
1512 return DoArithmeticT(Token::MOD, instr);
1517 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1518 instr->representation().IsSmiOrInteger32()) {
1519 ASSERT(instr->left()->representation().Equals(instr->representation()));
1520 ASSERT(instr->right()->representation().Equals(instr->representation()));
1521 HValue* left = instr->BetterLeftOperand();
1522 HValue* right = instr->BetterRightOperand();
1525 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1526 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1558 } else if (instr->representation().IsDouble()) {
1559 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() ||
1560 instr->uses().value()->IsSub())) {
1561 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value());
1563 if (use->IsAdd() && instr == use->left()) {
1568 if (instr == use->right() && use->IsAdd() && !use->left()->IsMul()) {
1573 if (instr == use->right() && use->IsSub()) {
1580 return DoArithmeticD(Token::MUL, instr);
1582 return DoArithmeticT(Token::MUL, instr);
1587 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1588 if (instr->representation().IsSmiOrInteger32()) {
1589 ASSERT(instr->left()->representation().Equals(instr->representation()));
1590 ASSERT(instr->right()->representation().Equals(instr->representation()));
1592 if (instr->left()->IsConstant()) {
1594 return DoRSub(instr);
1597 LOperand* left = UseRegisterAtStart(instr->left());
1598 LOperand* right = UseOrConstantAtStart(instr->right());
1601 if (instr->CheckFlag(HValue::kCanOverflow)) {
1605 } else if (instr->representation().IsDouble()) {
1606 if (instr->right()->IsMul()) {
1607 return DoMultiplySub(instr->left(), HMul::cast(instr->right()));
1610 return DoArithmeticD(Token::SUB, instr);
1612 return DoArithmeticT(Token::SUB, instr);
1617 LInstruction* LChunkBuilder::DoRSub(HSub* instr) {
1618 ASSERT(instr->representation().IsSmiOrInteger32());
1619 ASSERT(instr->left()->representation().Equals(instr->representation()));
1620 ASSERT(instr->right()->representation().Equals(instr->representation()));
1624 LOperand* left = UseRegisterAtStart(instr->right());
1625 LOperand* right = UseOrConstantAtStart(instr->left());
1628 if (instr->CheckFlag(HValue::kCanOverflow)) {
1655 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1656 if (instr->representation().IsSmiOrInteger32()) {
1657 ASSERT(instr->left()->representation().Equals(instr->representation()));
1658 ASSERT(instr->right()->representation().Equals(instr->representation()));
1659 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1660 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1663 if (instr->CheckFlag(HValue::kCanOverflow)) {
1667 } else if (instr->representation().IsExternal()) {
1668 ASSERT(instr->left()->representation().IsExternal());
1669 ASSERT(instr->right()->representation().IsInteger32());
1670 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1671 LOperand* left = UseRegisterAtStart(instr->left());
1672 LOperand* right = UseOrConstantAtStart(instr->right());
1676 } else if (instr->representation().IsDouble()) {
1677 if (instr->left()->IsMul()) {
1678 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1681 if (instr->right()->IsMul()) {
1682 ASSERT(!instr->left()->IsMul());
1683 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1686 return DoArithmeticD(Token::ADD, instr);
1688 return DoArithmeticT(Token::ADD, instr);
1693 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1696 if (instr->representation().IsSmiOrInteger32()) {
1697 ASSERT(instr->left()->representation().Equals(instr->representation()));
1698 ASSERT(instr->right()->representation().Equals(instr->representation()));
1699 left = UseRegisterAtStart(instr->BetterLeftOperand());
1700 right = UseOrConstantAtStart(instr->BetterRightOperand());
1702 ASSERT(instr->representation().IsDouble());
1703 ASSERT(instr->left()->representation().IsDouble());
1704 ASSERT(instr->right()->representation().IsDouble());
1705 left = UseRegisterAtStart(instr->left());
1706 right = UseRegisterAtStart(instr->right());
1712 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1713 ASSERT(instr->representation().IsDouble());
1716 Representation exponent_type = instr->right()->representation();
1717 ASSERT(instr->left()->representation().IsDouble());
1718 LOperand* left = UseFixedDouble(instr->left(), d0);
1720 UseFixedDouble(instr->right(), d1) :
1721 UseFixed(instr->right(), r2);
1724 instr,
1729 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1730 ASSERT(instr->left()->representation().IsTagged());
1731 ASSERT(instr->right()->representation().IsTagged());
1732 LOperand* context = UseFixed(instr->context(), cp);
1733 LOperand* left = UseFixed(instr->left(), r1);
1734 LOperand* right = UseFixed(instr->right(), r0);
1736 return MarkAsCall(DefineFixed(result, r0), instr);
1741 HCompareNumericAndBranch* instr) {
1742 Representation r = instr->representation();
1744 ASSERT(instr->left()->representation().Equals(r));
1745 ASSERT(instr->right()->representation().Equals(r));
1746 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1747 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1751 ASSERT(instr->left()->representation().IsDouble());
1752 ASSERT(instr->right()->representation().IsDouble());
1753 LOperand* left = UseRegisterAtStart(instr->left());
1754 LOperand* right = UseRegisterAtStart(instr->right());
1761 HCompareObjectEqAndBranch* instr) {
1762 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1764 LOperand* left = UseRegisterAtStart(instr->left());
1765 LOperand* right = UseRegisterAtStart(instr->right());
1771 HCompareHoleAndBranch* instr) {
1772 LOperand* value = UseRegisterAtStart(instr->value());
1778 HCompareMinusZeroAndBranch* instr) {
1779 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1781 LOperand* value = UseRegister(instr->value());
1787 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1788 ASSERT(instr->value()->representation().IsTagged());
1789 LOperand* value = UseRegisterAtStart(instr->value());
1795 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1796 ASSERT(instr->value()->representation().IsTagged());
1797 LOperand* value = UseRegisterAtStart(instr->value());
1803 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1804 ASSERT(instr->value()->representation().IsTagged());
1805 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1810 HIsUndetectableAndBranch* instr) {
1811 ASSERT(instr->value()->representation().IsTagged());
1812 LOperand* value = UseRegisterAtStart(instr->value());
1818 HStringCompareAndBranch* instr) {
1819 ASSERT(instr->left()->representation().IsTagged());
1820 ASSERT(instr->right()->representation().IsTagged());
1821 LOperand* context = UseFixed(instr->context(), cp);
1822 LOperand* left = UseFixed(instr->left(), r1);
1823 LOperand* right = UseFixed(instr->right(), r0);
1826 return MarkAsCall(result, instr);
1831 HHasInstanceTypeAndBranch* instr) {
1832 ASSERT(instr->value()->representation().IsTagged());
1833 LOperand* value = UseRegisterAtStart(instr->value());
1839 HGetCachedArrayIndex* instr) {
1840 ASSERT(instr->value()->representation().IsTagged());
1841 LOperand* value = UseRegisterAtStart(instr->value());
1848 HHasCachedArrayIndexAndBranch* instr) {
1849 ASSERT(instr->value()->representation().IsTagged());
1851 UseRegisterAtStart(instr->value()));
1856 HClassOfTestAndBranch* instr) {
1857 ASSERT(instr->value()->representation().IsTagged());
1858 LOperand* value = UseRegister(instr->value());
1863 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1864 LOperand* map = UseRegisterAtStart(instr->value());
1869 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1870 LOperand* object = UseRegisterAtStart(instr->value());
1875 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1876 LOperand* object = UseRegister(instr->value());
1882 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1883 LOperand* object = UseFixed(instr->value(), r0);
1885 new(zone()) LDateField(object, FixedTemp(r1), instr->index());
1886 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
1890 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1891 LOperand* string = UseRegisterAtStart(instr->string());
1892 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1897 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1898 LOperand* string = UseRegisterAtStart(instr->string());
1900 ? UseRegisterAtStart(instr->index())
1901 : UseRegisterOrConstantAtStart(instr->index());
1902 LOperand* value = UseRegisterAtStart(instr->value());
1903 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL;
1908 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1909 LOperand* value = UseRegisterOrConstantAtStart(instr->index());
1910 LOperand* length = UseRegister(instr->length());
1916 HBoundsCheckBaseIndexInformation* instr) {
1922 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1929 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1930 LOperand* context = UseFixed(instr->context(), cp);
1931 LOperand* value = UseFixed(instr->value(), r0);
1932 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1936 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1949 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1950 Representation from = instr->from();
1951 Representation to = instr->to();
1954 LOperand* value = UseRegister(instr->value());
1961 LOperand* value = UseRegister(instr->value());
1965 HValue* val = instr->value();
1975 HValue* val = instr->value();
1993 LOperand* value = UseRegister(instr->value());
2004 LOperand* value = UseRegister(instr->value());
2009 LOperand* value = UseRegister(instr->value());
2016 HValue* val = instr->value();
2028 HValue* val = instr->value();
2039 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
2041 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
2044 new(zone()) LInteger32ToDouble(Use(instr->value())));
2053 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
2054 LOperand* value = UseRegisterAtStart(instr->value());
2059 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
2060 LOperand* value = UseRegisterAtStart(instr->value());
2065 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
2066 LOperand* value = UseRegisterAtStart(instr->value());
2072 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
2073 LOperand* value = UseRegisterAtStart(instr->value());
2078 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
2080 if (!instr->CanOmitMapChecks()) {
2081 value = UseRegisterAtStart(instr->value());
2082 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
2085 if (!instr->CanOmitMapChecks()) {
2087 if (instr->has_migration_target()) return AssignPointerMap(result);
2093 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2094 HValue* value = instr->value();
2111 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2113 ? UseFixed(instr->context(), cp)
2115 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
2116 return new(zone()) LReturn(UseFixed(instr->value(), r0), context,
2121 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2122 Representation r = instr->representation();
2140 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2142 return instr->RequiresHoleCheck()
2148 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2149 LOperand* context = UseFixed(instr->context(), cp);
2150 LOperand* global_object = UseFixed(instr->global_object(), r0);
2153 return MarkAsCall(DefineFixed(result, r0), instr);
2157 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2158 LOperand* value = UseRegister(instr->value());
2161 return instr->RequiresHoleCheck()
2167 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2168 LOperand* context = UseFixed(instr->context(), cp);
2169 LOperand* global_object = UseFixed(instr->global_object(), r1);
2170 LOperand* value = UseFixed(instr->value(), r0);
2173 return MarkAsCall(result, instr);
2177 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2178 LOperand* context = UseRegisterAtStart(instr->value());
2181 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2185 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2188 if (instr->NeedsWriteBarrier()) {
2189 context = UseTempRegister(instr->context());
2190 value = UseTempRegister(instr->value());
2192 context = UseRegister(instr->context());
2193 value = UseRegister(instr->value());
2196 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2200 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2201 LOperand* obj = UseRegisterAtStart(instr->object());
2206 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2207 LOperand* context = UseFixed(instr->context(), cp);
2208 LOperand* object = UseFixed(instr->object(), r0);
2211 return MarkAsCall(result, instr);
2216 HLoadFunctionPrototype* instr) {
2218 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2222 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2228 HLoadExternalArrayPointer* instr) {
2229 LOperand* input = UseRegisterAtStart(instr->value());
2234 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2235 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2236 ElementsKind elements_kind = instr->elements_kind();
2237 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2240 if (!instr->is_external()) {
2242 if (instr->representation().IsDouble()) {
2243 obj = UseRegister(instr->elements());
2245 ASSERT(instr->representation().IsSmiOrTagged());
2246 obj = UseRegisterAtStart(instr->elements());
2251 (instr->representation().IsInteger32() &&
2254 (instr->representation().IsDouble() &&
2257 LOperand* external_pointer = UseRegister(instr->elements());
2264 bool can_deoptimize = instr->RequiresHoleCheck() ||
2270 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2271 LOperand* context = UseFixed(instr->context(), cp);
2272 LOperand* object = UseFixed(instr->object(), r1);
2273 LOperand* key = UseFixed(instr->key(), r0);
2277 return MarkAsCall(result, instr);
2281 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2282 if (!instr->is_external()) {
2283 ASSERT(instr->elements()->representation().IsTagged());
2284 bool needs_write_barrier = instr->NeedsWriteBarrier();
2289 if (instr->value()->representation().IsDouble()) {
2290 object = UseRegisterAtStart(instr->elements());
2291 val = UseRegister(instr->value());
2292 key = UseRegisterOrConstantAtStart(instr->key());
2294 ASSERT(instr->value()->representation().IsSmiOrTagged());
2296 object = UseTempRegister(instr->elements());
2297 val = UseTempRegister(instr->value());
2298 key = UseTempRegister(instr->key());
2300 object = UseRegisterAtStart(instr->elements());
2301 val = UseRegisterAtStart(instr->value());
2302 key = UseRegisterOrConstantAtStart(instr->key());
2310 (instr->value()->representation().IsInteger32() &&
2311 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) &&
2312 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) ||
2313 (instr->value()->representation().IsDouble() &&
2314 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) ||
2315 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS))));
2316 ASSERT(instr->elements()->representation().IsExternal());
2317 LOperand* val = UseRegister(instr->value());
2318 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2319 LOperand* external_pointer = UseRegister(instr->elements());
2324 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2325 LOperand* context = UseFixed(instr->context(), cp);
2326 LOperand* obj = UseFixed(instr->object(), r2);
2327 LOperand* key = UseFixed(instr->key(), r1);
2328 LOperand* val = UseFixed(instr->value(), r0);
2330 ASSERT(instr->object()->representation().IsTagged());
2331 ASSERT(instr->key()->representation().IsTagged());
2332 ASSERT(instr->value()->representation().IsTagged());
2335 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr);
2340 HTransitionElementsKind* instr) {
2341 LOperand* object = UseRegister(instr->object());
2342 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2348 LOperand* context = UseFixed(instr->context(), cp);
2357 HTrapAllocationMemento* instr) {
2358 LOperand* object = UseRegister(instr->object());
2366 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2367 bool is_in_object = instr->access().IsInobject();
2368 bool needs_write_barrier = instr->NeedsWriteBarrier();
2369 bool needs_write_barrier_for_map = instr->has_transition() &&
2370 instr->NeedsWriteBarrierForMap();
2375 ? UseRegister(instr->object())
2376 : UseTempRegister(instr->object());
2379 ? UseRegister(instr->object())
2380 : UseRegisterAtStart(instr->object());
2385 (FLAG_track_fields && instr->field_representation().IsSmi())) {
2386 val = UseTempRegister(instr->value());
2388 instr->field_representation().IsDouble()) {
2389 val = UseRegisterAtStart(instr->value());
2391 val = UseRegister(instr->value());
2399 instr->field_representation().IsHeapObject()) {
2400 if (!instr->value()->type().IsHeapObject()) {
2408 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2409 LOperand* context = UseFixed(instr->context(), cp);
2410 LOperand* obj = UseFixed(instr->object(), r1);
2411 LOperand* val = UseFixed(instr->value(), r0);
2414 return MarkAsCall(result, instr);
2418 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2419 LOperand* context = UseFixed(instr->context(), cp);
2421 ? UseFixed(instr->left(), r1)
2422 : UseRegisterAtStart(instr->left());
2424 ? UseFixed(instr->right(), r0)
2425 : UseRegisterAtStart(instr->right());
2428 instr);
2432 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2433 LOperand* string = UseTempRegister(instr->string());
2434 LOperand* index = UseTempRegister(instr->index());
2435 LOperand* context = UseAny(instr->context());
2442 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2443 LOperand* char_code = UseRegister(instr->value());
2444 LOperand* context = UseAny(instr->context());
2451 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2453 LOperand* context = UseAny(instr->context());
2454 LOperand* size = instr->size()->IsConstant()
2455 ? UseConstant(instr->size())
2456 : UseTempRegister(instr->size());
2464 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2465 LOperand* context = UseFixed(instr->context(), cp);
2467 DefineFixed(new(zone()) LRegExpLiteral(context), r0), instr);
2471 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2472 LOperand* context = UseFixed(instr->context(), cp);
2474 DefineFixed(new(zone()) LFunctionLiteral(context), r0), instr);
2478 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2481 current_block_->last_environment()->set_ast_id(instr->ast_id());
2486 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2488 if (instr->kind() == HParameter::STACK_PARAMETER) {
2489 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2495 int index = static_cast<int>(instr->index());
2502 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2505 int env_index = instr->index();
2507 if (instr->environment()->is_parameter_index(env_index)) {
2510 spill_index = env_index - instr->environment()->first_local_index();
2520 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2521 LOperand* context = UseFixed(instr->context(), cp);
2522 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), r0), instr);
2526 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2535 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2536 instr->ReplayEnvironment(current_block_->last_environment());
2543 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2545 LOperand* args = UseRegister(instr->arguments());
2546 LOperand* length = UseRegisterOrConstantAtStart(instr->length());
2547 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
2552 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2553 LOperand* object = UseFixed(instr->value(), r0);
2555 return MarkAsCall(DefineFixed(result, r0), instr);
2559 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2560 LOperand* context = UseFixed(instr->context(), cp);
2561 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0));
2562 return MarkAsCall(DefineFixed(result, r0), instr);
2566 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2567 LInstruction* goto_instr = CheckElideControlInstruction(instr);
2570 return new(zone()) LTypeofIsAndBranch(UseRegister(instr->value()));
2575 HIsConstructCallAndBranch* instr) {
2580 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2581 instr->ReplayEnvironment(current_block_->last_environment());
2585 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2601 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2602 if (instr->is_function_entry()) {
2603 LOperand* context = UseFixed(instr->context(), cp);
2604 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2606 ASSERT(instr->is_backwards_branch());
2607 LOperand* context = UseAny(instr->context());
2614 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2617 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2618 instr->arguments_count(),
2619 instr->function(),
2621 instr->inlining_kind(),
2622 instr->undefined_receiver());
2624 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2625 inner->Bind(instr->arguments_var(), instr->arguments_object());
2627 inner->set_entry(instr);
2629 chunk_->AddInlinedClosure(instr->closure());
2634 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2642 ASSERT(instr->argument_delta() == -argument_count);
2653 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2654 LOperand* context = UseFixed(instr->context(), cp);
2655 LOperand* object = UseFixed(instr->enumerable(), r0);
2657 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
2661 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2662 LOperand* map = UseRegister(instr->map());
2667 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2668 LOperand* value = UseRegisterAtStart(instr->value());
2669 LOperand* map = UseRegisterAtStart(instr->map());
2674 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2675 LOperand* object = UseRegister(instr->object());
2676 LOperand* index = UseRegister(instr->index());