Lines Matching refs:instr

185 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
543 HInstruction* instr = HInstruction::cast(value);
544 VisitInstruction(instr);
552 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
555 instr->set_result(result);
556 return instr;
562 LTemplateInstruction<1, I, T>* instr) {
563 return Define(instr,
570 LTemplateInstruction<1, I, T>* instr, int index) {
571 return Define(instr,
578 LTemplateInstruction<1, I, T>* instr) {
579 return Define(instr,
586 LTemplateInstruction<1, I, T>* instr, Register reg) {
587 return Define(instr, ToUnallocated(reg));
593 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) {
594 return Define(instr, ToUnallocated(reg));
598 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
602 instr->set_environment(CreateEnvironment(hydrogen_env,
605 return instr;
609 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
614 instr->VerifyCall();
616 instr->MarkAsCall();
617 instr = AssignPointerMap(instr);
624 instruction_pending_deoptimization_environment_ = instr;
635 if (needs_environment && !instr->HasEnvironment()) {
636 instr = AssignEnvironment(instr);
639 return instr;
643 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
644 ASSERT(!instr->HasPointerMap());
645 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone()));
646 return instr;
677 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
678 return new(zone()) LLabel(instr->block());
682 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
683 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
687 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
693 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
699 HBitwiseBinaryOperation* instr) {
700 if (instr->representation().IsTagged()) {
701 ASSERT(instr->left()->representation().IsTagged());
702 ASSERT(instr->right()->representation().IsTagged());
704 LOperand* left = UseFixed(instr->left(), a1);
705 LOperand* right = UseFixed(instr->right(), a0);
707 return MarkAsCall(DefineFixed(result, v0), instr);
710 ASSERT(instr->representation().IsSmiOrInteger32());
711 ASSERT(instr->left()->representation().Equals(instr->representation()));
712 ASSERT(instr->right()->representation().Equals(instr->representation()));
713 LOperand* left = UseRegisterAtStart(instr->left());
715 HValue* right_value = instr->right();
725 if (instr->representation().IsSmi() && constant_value > 0) {
726 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
741 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
743 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
759 HArithmeticBinaryOperation* instr) {
760 ASSERT(instr->representation().IsDouble());
761 ASSERT(instr->left()->representation().IsDouble());
762 ASSERT(instr->right()->representation().IsDouble());
764 LOperand* left = UseRegisterAtStart(instr->left());
765 LOperand* right = UseRegisterAtStart(instr->right());
772 HArithmeticBinaryOperation* instr) {
778 HValue* left = instr->left();
779 HValue* right = instr->right();
786 return MarkAsCall(DefineFixed(result, v0), instr);
861 LInstruction* instr = current->CompileToLithium(this);
863 if (instr != NULL) {
875 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
878 for (UseIterator it(instr); !it.Done(); it.Advance()) {
882 if (instr->Output() != NULL) {
883 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
885 for (TempIterator it(instr); !it.Done(); it.Advance()) {
893 instr->set_position(position_);
894 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
895 instr = AssignPointerMap(instr);
897 if (FLAG_stress_environments && !instr->HasEnvironment()) {
898 instr = AssignEnvironment(instr);
900 instr->set_hydrogen_value(current);
901 chunk_->AddInstruction(instr, current_block_);
991 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
992 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
996 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
997 HValue* value = instr->value();
1000 ? instr->FirstSuccessor()
1001 : instr->SecondSuccessor();
1011 ToBooleanStub::Types expected = instr->expected_input_types();
1020 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1021 ASSERT(instr->value()->representation().IsTagged());
1022 LOperand* value = UseRegisterAtStart(instr->value());
1041 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1043 new(zone()) LInstanceOf(UseFixed(instr->left(), a0),
1044 UseFixed(instr->right(), a1));
1045 return MarkAsCall(DefineFixed(result, v0), instr);
1050 HInstanceOfKnownGlobal* instr) {
1052 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), a0),
1054 return MarkAsCall(DefineFixed(result, v0), instr);
1058 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) {
1059 LOperand* object = UseRegisterAtStart(instr->object());
1064 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1065 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1066 LOperand* function = UseRegisterAtStart(instr->function());
1072 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1073 LOperand* function = UseFixed(instr->function(), a1);
1074 LOperand* receiver = UseFixed(instr->receiver(), a0);
1075 LOperand* length = UseFixed(instr->length(), a2);
1076 LOperand* elements = UseFixed(instr->elements(), a3);
1081 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1085 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1087 LOperand* argument = Use(instr->argument());
1101 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1102 return instr->HasNoUses()
1108 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1110 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
1120 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1121 LOperand* context = UseRegisterAtStart(instr->value());
1126 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1127 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1131 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1132 LOperand* context = UseRegisterAtStart(instr->value());
1137 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1138 LOperand* global_object = UseRegisterAtStart(instr->value());
1144 HCallConstantFunction* instr) {
1145 argument_count_ -= instr->argument_count();
1146 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr);
1150 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1151 LOperand* function = UseFixed(instr->function(), a1);
1152 argument_count_ -= instr->argument_count();
1154 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1158 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1159 switch (instr->op()) {
1160 case kMathFloor: return DoMathFloor(instr);
1161 case kMathRound: return DoMathRound(instr);
1162 case kMathAbs: return DoMathAbs(instr);
1163 case kMathLog: return DoMathLog(instr);
1164 case kMathSin: return DoMathSin(instr);
1165 case kMathCos: return DoMathCos(instr);
1166 case kMathTan: return DoMathTan(instr);
1167 case kMathExp: return DoMathExp(instr);
1168 case kMathSqrt: return DoMathSqrt(instr);
1169 case kMathPowHalf: return DoMathPowHalf(instr);
1177 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1178 LOperand* input = UseFixedDouble(instr->value(), f4);
1180 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1184 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1185 LOperand* input = UseFixedDouble(instr->value(), f4);
1187 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1191 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1192 LOperand* input = UseFixedDouble(instr->value(), f4);
1194 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1198 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1199 LOperand* input = UseFixedDouble(instr->value(), f4);
1201 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1205 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1206 ASSERT(instr->representation().IsDouble());
1207 ASSERT(instr->value()->representation().IsDouble());
1208 LOperand* input = UseTempRegister(instr->value());
1217 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1219 LOperand* input = UseFixedDouble(instr->value(), f8);
1226 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1227 LOperand* input = UseRegister(instr->value());
1233 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1234 LOperand* input = UseRegister(instr->value());
1241 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1242 LOperand* input = UseRegister(instr->value());
1248 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1249 LOperand* input = UseRegister(instr->value());
1256 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1257 ASSERT(instr->key()->representation().IsTagged());
1258 argument_count_ -= instr->argument_count();
1259 LOperand* key = UseFixed(instr->key(), a2);
1260 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr);
1264 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1265 argument_count_ -= instr->argument_count();
1266 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, v0), instr);
1270 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1271 argument_count_ -= instr->argument_count();
1272 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, v0), instr);
1276 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1277 argument_count_ -= instr->argument_count();
1278 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr);
1282 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1283 LOperand* constructor = UseFixed(instr->constructor(), a1);
1284 argument_count_ -= instr->argument_count();
1286 return MarkAsCall(DefineFixed(result, v0), instr);
1290 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1291 LOperand* constructor = UseFixed(instr->constructor(), a1);
1292 argument_count_ -= instr->argument_count();
1294 return MarkAsCall(DefineFixed(result, v0), instr);
1298 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1299 LOperand* function = UseFixed(instr->function(), a1);
1300 argument_count_ -= instr->argument_count();
1302 instr);
1306 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1307 argument_count_ -= instr->argument_count();
1308 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, v0), instr);
1312 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1313 return DoShift(Token::ROR, instr);
1317 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1318 return DoShift(Token::SHR, instr);
1322 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1323 return DoShift(Token::SAR, instr);
1327 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1328 return DoShift(Token::SHL, instr);
1332 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1333 if (instr->representation().IsSmiOrInteger32()) {
1334 ASSERT(instr->left()->representation().Equals(instr->representation()));
1335 ASSERT(instr->right()->representation().Equals(instr->representation()));
1337 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1338 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1341 ASSERT(instr->representation().IsTagged());
1342 ASSERT(instr->left()->representation().IsTagged());
1343 ASSERT(instr->right()->representation().IsTagged());
1345 LOperand* left = UseFixed(instr->left(), a1);
1346 LOperand* right = UseFixed(instr->right(), a0);
1347 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1348 return MarkAsCall(DefineFixed(result, v0), instr);
1353 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1354 if (instr->representation().IsDouble()) {
1355 return DoArithmeticD(Token::DIV, instr);
1356 } else if (instr->representation().IsSmiOrInteger32()) {
1357 ASSERT(instr->left()->representation().Equals(instr->representation()));
1358 ASSERT(instr->right()->representation().Equals(instr->representation()));
1359 LOperand* dividend = UseRegister(instr->left());
1360 LOperand* divisor = UseRegister(instr->right());
1364 return DoArithmeticT(Token::DIV, instr);
1410 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1411 HValue* right = instr->right();
1412 LOperand* dividend = UseRegister(instr->left());
1420 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1421 HValue* left = instr->left();
1422 HValue* right = instr->right();
1423 if (instr->representation().IsSmiOrInteger32()) {
1424 ASSERT(instr->left()->representation().Equals(instr->representation()));
1425 ASSERT(instr->right()->representation().Equals(instr->representation()));
1426 if (instr->HasPowerOf2Divisor()) {
1432 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1435 } else if (instr->fixed_right_arg().has_value) {
1449 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1453 } else if (instr->representation().IsTagged()) {
1454 return DoArithmeticT(Token::MOD, instr);
1456 ASSERT(instr->representation().IsDouble());
1463 return MarkAsCall(DefineFixedDouble(mod, f2), instr);
1468 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1469 if (instr->representation().IsSmiOrInteger32()) {
1470 ASSERT(instr->left()->representation().Equals(instr->representation()));
1471 ASSERT(instr->right()->representation().Equals(instr->representation()));
1473 LOperand* right = UseOrConstant(instr->BetterRightOperand());
1475 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
1476 (instr->CheckFlag(HValue::kCanOverflow) ||
1478 left = UseRegister(instr->BetterLeftOperand());
1481 left = UseRegisterAtStart(instr->BetterLeftOperand());
1484 if (instr->CheckFlag(HValue::kCanOverflow) ||
1485 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1490 } else if (instr->representation().IsDouble()) {
1492 if (instr->UseCount() == 1 && instr->uses().value()->IsAdd()) {
1493 HAdd* add = HAdd::cast(instr->uses().value());
1494 if (instr == add->left()) {
1499 if (instr == add->right() && !add->left()->IsMul()) {
1506 return DoArithmeticD(Token::MUL, instr);
1508 return DoArithmeticT(Token::MUL, instr);
1513 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1514 if (instr->representation().IsSmiOrInteger32()) {
1515 ASSERT(instr->left()->representation().Equals(instr->representation()));
1516 ASSERT(instr->right()->representation().Equals(instr->representation()));
1517 LOperand* left = UseRegisterAtStart(instr->left());
1518 LOperand* right = UseOrConstantAtStart(instr->right());
1521 if (instr->CheckFlag(HValue::kCanOverflow)) {
1525 } else if (instr->representation().IsDouble()) {
1526 return DoArithmeticD(Token::SUB, instr);
1528 return DoArithmeticT(Token::SUB, instr);
1542 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1543 if (instr->representation().IsSmiOrInteger32()) {
1544 ASSERT(instr->left()->representation().Equals(instr->representation()));
1545 ASSERT(instr->right()->representation().Equals(instr->representation()));
1546 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1547 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1550 if (instr->CheckFlag(HValue::kCanOverflow)) {
1554 } else if (instr->representation().IsDouble()) {
1556 if (instr->left()->IsMul())
1557 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1559 if (instr->right()->IsMul()) {
1560 ASSERT(!instr->left()->IsMul());
1561 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1564 return DoArithmeticD(Token::ADD, instr);
1566 ASSERT(instr->representation().IsTagged());
1567 return DoArithmeticT(Token::ADD, instr);
1572 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1575 if (instr->representation().IsSmiOrInteger32()) {
1576 ASSERT(instr->left()->representation().Equals(instr->representation()));
1577 ASSERT(instr->right()->representation().Equals(instr->representation()));
1578 left = UseRegisterAtStart(instr->BetterLeftOperand());
1579 right = UseOrConstantAtStart(instr->BetterRightOperand());
1581 ASSERT(instr->representation().IsDouble());
1582 ASSERT(instr->left()->representation().IsDouble());
1583 ASSERT(instr->right()->representation().IsDouble());
1584 left = UseRegisterAtStart(instr->left());
1585 right = UseRegisterAtStart(instr->right());
1591 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1592 ASSERT(instr->representation().IsDouble());
1595 Representation exponent_type = instr->right()->representation();
1596 ASSERT(instr->left()->representation().IsDouble());
1597 LOperand* left = UseFixedDouble(instr->left(), f2);
1599 UseFixedDouble(instr->right(), f4) :
1600 UseFixed(instr->right(), a2);
1603 instr,
1608 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1609 ASSERT(instr->representation().IsDouble());
1610 ASSERT(instr->global_object()->representation().IsTagged());
1611 LOperand* global_object = UseFixed(instr->global_object(), a0);
1613 return MarkAsCall(DefineFixedDouble(result, f0), instr);
1617 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1618 ASSERT(instr->left()->representation().IsTagged());
1619 ASSERT(instr->right()->representation().IsTagged());
1620 LOperand* left = UseFixed(instr->left(), a1);
1621 LOperand* right = UseFixed(instr->right(), a0);
1623 return MarkAsCall(DefineFixed(result, v0), instr);
1628 HCompareNumericAndBranch* instr) {
1629 Representation r = instr->representation();
1631 ASSERT(instr->left()->representation().Equals(r));
1632 ASSERT(instr->right()->representation().Equals(r));
1633 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1634 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1638 ASSERT(instr->left()->representation().IsDouble());
1639 ASSERT(instr->right()->representation().IsDouble());
1640 LOperand* left = UseRegisterAtStart(instr->left());
1641 LOperand* right = UseRegisterAtStart(instr->right());
1648 HCompareObjectEqAndBranch* instr) {
1649 LOperand* left = UseRegisterAtStart(instr->left());
1650 LOperand* right = UseRegisterAtStart(instr->right());
1656 HCompareHoleAndBranch* instr) {
1657 LOperand* object = UseRegisterAtStart(instr->object());
1662 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1663 ASSERT(instr->value()->representation().IsTagged());
1665 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1670 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1671 ASSERT(instr->value()->representation().IsTagged());
1673 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1678 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1679 ASSERT(instr->value()->representation().IsTagged());
1680 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1685 HIsUndetectableAndBranch* instr) {
1686 ASSERT(instr->value()->representation().IsTagged());
1688 UseRegisterAtStart(instr->value()), TempRegister());
1693 HStringCompareAndBranch* instr) {
1694 ASSERT(instr->left()->representation().IsTagged());
1695 ASSERT(instr->right()->representation().IsTagged());
1696 LOperand* left = UseFixed(instr->left(), a1);
1697 LOperand* right = UseFixed(instr->right(), a0);
1700 return MarkAsCall(result, instr);
1705 HHasInstanceTypeAndBranch* instr) {
1706 ASSERT(instr->value()->representation().IsTagged());
1707 LOperand* value = UseRegisterAtStart(instr->value());
1713 HGetCachedArrayIndex* instr) {
1714 ASSERT(instr->value()->representation().IsTagged());
1715 LOperand* value = UseRegisterAtStart(instr->value());
1722 HHasCachedArrayIndexAndBranch* instr) {
1723 ASSERT(instr->value()->representation().IsTagged());
1725 UseRegisterAtStart(instr->value()));
1730 HClassOfTestAndBranch* instr) {
1731 ASSERT(instr->value()->representation().IsTagged());
1732 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1737 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1738 LOperand* map = UseRegisterAtStart(instr->value());
1743 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1744 LOperand* object = UseRegisterAtStart(instr->value());
1749 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1750 LOperand* object = UseRegister(instr->value());
1756 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1757 LOperand* object = UseFixed(instr->value(), a0);
1759 new(zone()) LDateField(object, FixedTemp(a1), instr->index());
1760 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1764 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1765 LOperand* string = UseRegister(instr->string());
1766 LOperand* index = UseRegister(instr->index());
1767 LOperand* value = UseTempRegister(instr->value());
1769 new(zone()) LSeqStringSetChar(instr->encoding(), string, index, value);
1774 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1775 LOperand* value = UseRegisterOrConstantAtStart(instr->index());
1776 LOperand* length = UseRegister(instr->length());
1782 HBoundsCheckBaseIndexInformation* instr) {
1788 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1789 LOperand* value = UseFixed(instr->value(), a0);
1790 return MarkAsCall(new(zone()) LThrow(value), instr);
1794 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1807 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1808 Representation from = instr->from();
1809 Representation to = instr->to();
1812 LOperand* value = UseRegister(instr->value());
1820 LOperand* value = UseRegister(instr->value());
1824 HValue* val = instr->value();
1834 if (instr->value()->type().IsSmi()) {
1835 value = UseRegisterAtStart(instr->value());
1838 value = UseRegister(instr->value());
1840 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1854 LOperand* value = UseRegister(instr->value());
1865 LOperand* value = UseRegister(instr->value());
1870 LOperand* value = UseRegister(instr->value());
1872 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1879 HValue* val = instr->value();
1891 HValue* val = instr->value();
1901 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1903 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
1906 new(zone()) LInteger32ToDouble(Use(instr->value())));
1915 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1916 LOperand* value = UseRegisterAtStart(instr->value());
1921 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1922 LOperand* value = UseRegisterAtStart(instr->value());
1927 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) {
1929 LIsNumberAndBranch(UseRegisterOrConstantAtStart(instr->value()));
1933 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1934 LOperand* value = UseRegisterAtStart(instr->value());
1940 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1941 LOperand* value = UseRegisterAtStart(instr->value());
1946 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1948 if (!instr->CanOmitMapChecks()) {
1949 value = UseRegisterAtStart(instr->value());
1950 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
1953 if (!instr->CanOmitMapChecks()) {
1955 if (instr->has_migration_target()) return AssignPointerMap(result);
1961 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1962 HValue* value = instr->value();
1980 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1981 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1982 return new(zone()) LReturn(UseFixed(instr->value(), v0),
1987 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1988 Representation r = instr->representation();
2006 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2008 return instr->RequiresHoleCheck()
2014 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2015 LOperand* global_object = UseFixed(instr->global_object(), a0);
2017 return MarkAsCall(DefineFixed(result, v0), instr);
2021 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2022 LOperand* value = UseRegister(instr->value());
2025 return instr->RequiresHoleCheck()
2031 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2032 LOperand* global_object = UseFixed(instr->global_object(), a1);
2033 LOperand* value = UseFixed(instr->value(), a0);
2036 return MarkAsCall(result, instr);
2040 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2041 LOperand* context = UseRegisterAtStart(instr->value());
2044 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2048 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2051 if (instr->NeedsWriteBarrier()) {
2052 context = UseTempRegister(instr->context());
2053 value = UseTempRegister(instr->value());
2055 context = UseRegister(instr->context());
2056 value = UseRegister(instr->value());
2059 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2063 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2064 LOperand* obj = UseRegisterAtStart(instr->object());
2069 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2070 LOperand* object = UseFixed(instr->object(), a0);
2072 return MarkAsCall(result, instr);
2077 HLoadFunctionPrototype* instr) {
2079 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2084 HLoadExternalArrayPointer* instr) {
2085 LOperand* input = UseRegisterAtStart(instr->value());
2090 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2091 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2092 ElementsKind elements_kind = instr->elements_kind();
2093 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2096 if (!instr->is_external()) {
2098 if (instr->representation().IsDouble()) {
2099 obj = UseTempRegister(instr->elements());
2101 ASSERT(instr->representation().IsSmiOrTagged());
2102 obj = UseRegisterAtStart(instr->elements());
2107 (instr->representation().IsInteger32() &&
2110 (instr->representation().IsDouble() &&
2113 LOperand* external_pointer = UseRegister(instr->elements());
2120 bool can_deoptimize = instr->RequiresHoleCheck() ||
2126 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2127 LOperand* object = UseFixed(instr->object(), a1);
2128 LOperand* key = UseFixed(instr->key(), a0);
2132 return MarkAsCall(result, instr);
2136 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2137 ElementsKind elements_kind = instr->elements_kind();
2139 if (!instr->is_external()) {
2140 ASSERT(instr->elements()->representation().IsTagged());
2141 bool needs_write_barrier = instr->NeedsWriteBarrier();
2146 if (instr->value()->representation().IsDouble()) {
2147 object = UseRegisterAtStart(instr->elements());
2148 key = UseRegisterOrConstantAtStart(instr->key());
2149 val = UseTempRegister(instr->value());
2151 ASSERT(instr->value()->representation().IsSmiOrTagged());
2152 object = UseTempRegister(instr->elements());
2153 val = needs_write_barrier ? UseTempRegister(instr->value())
2154 : UseRegisterAtStart(instr->value());
2155 key = needs_write_barrier ? UseTempRegister(instr->key())
2156 : UseRegisterOrConstantAtStart(instr->key());
2163 (instr->value()->representation().IsInteger32() &&
2166 (instr->value()->representation().IsDouble() &&
2169 ASSERT(instr->elements()->representation().IsExternal());
2173 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
2174 : UseRegister(instr->value());
2175 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2176 LOperand* external_pointer = UseRegister(instr->elements());
2182 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2183 LOperand* obj = UseFixed(instr->object(), a2);
2184 LOperand* key = UseFixed(instr->key(), a1);
2185 LOperand* val = UseFixed(instr->value(), a0);
2187 ASSERT(instr->object()->representation().IsTagged());
2188 ASSERT(instr->key()->representation().IsTagged());
2189 ASSERT(instr->value()->representation().IsTagged());
2191 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
2196 HTransitionElementsKind* instr) {
2197 LOperand* object = UseRegister(instr->object());
2198 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2212 HTrapAllocationMemento* instr) {
2213 LOperand* object = UseRegister(instr->object());
2221 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2222 bool is_in_object = instr->access().IsInobject();
2223 bool needs_write_barrier = instr->NeedsWriteBarrier();
2224 bool needs_write_barrier_for_map = instr->has_transition() &&
2225 instr->NeedsWriteBarrierForMap();
2230 ? UseRegister(instr->object())
2231 : UseTempRegister(instr->object());
2234 ? UseRegister(instr->object())
2235 : UseRegisterAtStart(instr->object());
2240 (FLAG_track_fields && instr->field_representation().IsSmi())) {
2241 val = UseTempRegister(instr->value());
2243 instr->field_representation().IsDouble()) {
2244 val = UseRegisterAtStart(instr->value());
2246 val = UseRegister(instr->value());
2254 instr->field_representation().IsHeapObject()) {
2255 if (!instr->value()->type().IsHeapObject()) {
2263 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2264 LOperand* obj = UseFixed(instr->object(), a1);
2265 LOperand* val = UseFixed(instr->value(), a0);
2268 return MarkAsCall(result, instr);
2272 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2273 LOperand* left = UseRegisterAtStart(instr->left());
2274 LOperand* right = UseRegisterAtStart(instr->right());
2276 instr);
2280 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2281 LOperand* string = UseTempRegister(instr->string());
2282 LOperand* index = UseTempRegister(instr->index());
2288 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2289 LOperand* char_code = UseRegister(instr->value());
2295 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2297 LOperand* size = instr->size()->IsConstant()
2298 ? UseConstant(instr->size())
2299 : UseTempRegister(instr->size());
2307 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2308 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, v0), instr);
2312 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2313 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, v0), instr);
2317 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2320 current_block_->last_environment()->set_ast_id(instr->ast_id());
2325 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2327 if (instr->kind() == HParameter::STACK_PARAMETER) {
2328 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2334 int index = static_cast<int>(instr->index());
2341 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2351 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2352 argument_count_ -= instr->argument_count();
2353 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr);
2357 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2366 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2372 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2374 LOperand* args = UseRegister(instr->arguments());
2377 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2378 length = UseRegisterOrConstant(instr->length());
2379 index = UseOrConstant(instr->index());
2381 length = UseTempRegister(instr->length());
2382 index = UseRegisterAtStart(instr->index());
2388 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2389 LOperand* object = UseFixed(instr->value(), a0);
2391 return MarkAsCall(DefineFixed(result, v0), instr);
2395 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2396 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), a0));
2397 return MarkAsCall(DefineFixed(result, v0), instr);
2401 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2402 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2407 HIsConstructCallAndBranch* instr) {
2412 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2416 env->set_ast_id(instr->ast_id());
2418 env->Drop(instr->pop_count());
2419 for (int i = instr->values()->length() - 1; i >= 0; --i) {
2420 HValue* value = instr->values()->at(i);
2421 if (instr->HasAssignedIndexAt(i)) {
2422 env->Bind(instr->GetAssignedIndexAt(i), value);
2430 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2446 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2447 if (instr->is_function_entry()) {
2448 return MarkAsCall(new(zone()) LStackCheck, instr);
2450 ASSERT(instr->is_backwards_branch());
2456 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2459 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2460 instr->arguments_count(),
2461 instr->function(),
2463 instr->inlining_kind(),
2464 instr->undefined_receiver());
2466 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2467 inner->Bind(instr->arguments_var(), instr->arguments_object());
2469 inner->set_entry(instr);
2471 chunk_->AddInlinedClosure(instr->closure());
2476 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2495 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2496 LOperand* object = UseFixed(instr->enumerable(), a0);
2498 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
2502 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2503 LOperand* map = UseRegister(instr->map());
2508 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2509 LOperand* value = UseRegisterAtStart(instr->value());
2510 LOperand* map = UseRegisterAtStart(instr->map());
2515 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2516 LOperand* object = UseRegister(instr->object());
2517 LOperand* index = UseRegister(instr->index());