Lines Matching refs:instr

588     HInstruction* instr = HInstruction::cast(value);
589 VisitInstruction(instr);
597 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
600 instr->set_result(result);
601 return instr;
607 LTemplateInstruction<1, I, T>* instr) {
608 return Define(instr,
615 LTemplateInstruction<1, I, T>* instr,
617 return Define(instr,
624 LTemplateInstruction<1, I, T>* instr) {
625 return Define(instr,
631 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
633 return Define(instr, ToUnallocated(reg));
639 LTemplateInstruction<1, I, T>* instr,
641 return Define(instr, ToUnallocated(reg));
645 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
649 instr->set_environment(CreateEnvironment(hydrogen_env,
652 return instr;
656 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
662 instr->VerifyCall();
664 instr->MarkAsCall();
665 instr = AssignPointerMap(instr);
672 instruction_pending_deoptimization_environment_ = instr;
683 if (needs_environment && !instr->HasEnvironment()) {
684 instr = AssignEnvironment(instr);
687 return instr;
691 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
692 ASSERT(!instr->HasPointerMap());
693 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone()));
694 return instr;
725 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
726 return new(zone()) LLabel(instr->block());
730 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
731 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
735 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
741 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
747 HBitwiseBinaryOperation* instr) {
748 if (instr->representation().IsTagged()) {
749 ASSERT(instr->left()->representation().IsSmiOrTagged());
750 ASSERT(instr->right()->representation().IsSmiOrTagged());
752 LOperand* context = UseFixed(instr->context(), esi);
753 LOperand* left = UseFixed(instr->left(), edx);
754 LOperand* right = UseFixed(instr->right(), eax);
756 return MarkAsCall(DefineFixed(result, eax), instr);
759 ASSERT(instr->representation().IsSmiOrInteger32());
760 ASSERT(instr->left()->representation().Equals(instr->representation()));
761 ASSERT(instr->right()->representation().Equals(instr->representation()));
762 LOperand* left = UseRegisterAtStart(instr->left());
764 HValue* right_value = instr->right();
774 if (instr->representation().IsSmi() && constant_value > 0) {
775 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
790 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
792 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
808 HArithmeticBinaryOperation* instr) {
809 ASSERT(instr->representation().IsDouble());
810 ASSERT(instr->left()->representation().IsDouble());
811 ASSERT(instr->right()->representation().IsDouble());
813 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
814 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
821 HArithmeticBinaryOperation* instr) {
827 HValue* left = instr->left();
828 HValue* right = instr->right();
831 LOperand* context = UseFixed(instr->context(), esi);
836 return MarkAsCall(DefineFixed(result, eax), instr);
911 LInstruction* instr = current->CompileToLithium(this);
913 if (instr != NULL) {
925 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
928 for (UseIterator it(instr); !it.Done(); it.Advance()) {
932 if (instr->Output() != NULL) {
933 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
935 for (TempIterator it(instr); !it.Done(); it.Advance()) {
943 instr->set_position(position_);
944 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
945 instr = AssignPointerMap(instr);
947 if (FLAG_stress_environments && !instr->HasEnvironment()) {
948 instr = AssignEnvironment(instr);
950 instr->set_hydrogen_value(current);
951 chunk_->AddInstruction(instr, current_block_);
1041 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1042 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
1046 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1047 HValue* value = instr->value();
1052 ? instr->FirstSuccessor()
1053 : instr->SecondSuccessor();
1057 ToBooleanStub::Types expected = instr->expected_input_types();
1083 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
1088 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1089 ASSERT(instr->value()->representation().IsTagged());
1090 LOperand* value = UseRegisterAtStart(instr->value());
1107 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1108 LOperand* left = UseFixed(instr->left(), InstanceofStub::left());
1109 LOperand* right = UseFixed(instr->right(), InstanceofStub::right());
1110 LOperand* context = UseFixed(instr->context(), esi);
1112 return MarkAsCall(DefineFixed(result, eax), instr);
1117 HInstanceOfKnownGlobal* instr) {
1120 UseFixed(instr->context(), esi),
1121 UseFixed(instr->left(), InstanceofStub::left()),
1123 return MarkAsCall(DefineFixed(result, eax), instr);
1127 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) {
1128 LOperand* object = UseRegisterAtStart(instr->object());
1133 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1134 LOperand* receiver = UseRegister(instr->receiver());
1135 LOperand* function = UseRegisterAtStart(instr->function());
1143 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1144 LOperand* function = UseFixed(instr->function(), edi);
1145 LOperand* receiver = UseFixed(instr->receiver(), eax);
1146 LOperand* length = UseFixed(instr->length(), ebx);
1147 LOperand* elements = UseFixed(instr->elements(), ecx);
1152 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1156 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1158 LOperand* argument = UseAny(instr->argument());
1172 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1173 return instr->HasNoUses()
1179 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1180 if (instr->HasNoUses()) return NULL;
1190 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1191 LOperand* context = UseRegisterAtStart(instr->value());
1196 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1197 LOperand* context = UseFixed(instr->context(), esi);
1198 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1202 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1203 LOperand* context = UseRegisterAtStart(instr->value());
1208 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1209 LOperand* global_object = UseRegisterAtStart(instr->value());
1215 HCallConstantFunction* instr) {
1216 argument_count_ -= instr->argument_count();
1217 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr);
1221 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1222 LOperand* context = UseFixed(instr->context(), esi);
1223 LOperand* function = UseFixed(instr->function(), edi);
1224 argument_count_ -= instr->argument_count();
1226 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1230 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1231 switch (instr->op()) {
1232 case kMathFloor: return DoMathFloor(instr);
1233 case kMathRound: return DoMathRound(instr);
1234 case kMathAbs: return DoMathAbs(instr);
1235 case kMathLog: return DoMathLog(instr);
1236 case kMathSin: return DoMathSin(instr);
1237 case kMathCos: return DoMathCos(instr);
1238 case kMathTan: return DoMathTan(instr);
1239 case kMathExp: return DoMathExp(instr);
1240 case kMathSqrt: return DoMathSqrt(instr);
1241 case kMathPowHalf: return DoMathPowHalf(instr);
1249 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1250 LOperand* input = UseRegisterAtStart(instr->value());
1256 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1257 LOperand* context = UseAny(instr->context());
1258 LOperand* input = UseRegister(instr->value());
1265 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1266 LOperand* context = UseAny(instr->context()); // Deferred use.
1267 LOperand* input = UseRegisterAtStart(instr->value());
1273 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1274 ASSERT(instr->representation().IsDouble());
1275 ASSERT(instr->value()->representation().IsDouble());
1276 LOperand* input = UseRegisterAtStart(instr->value());
1282 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1283 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1285 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1289 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1290 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1292 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1296 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1297 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1299 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1303 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1304 ASSERT(instr->representation().IsDouble());
1305 ASSERT(instr->value()->representation().IsDouble());
1306 LOperand* value = UseTempRegister(instr->value());
1314 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1315 LOperand* input = UseRegisterAtStart(instr->value());
1321 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1322 LOperand* context = UseAny(instr->context());
1323 LOperand* input = UseRegisterAtStart(instr->value());
1330 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1331 ASSERT(instr->key()->representation().IsTagged());
1332 LOperand* context = UseFixed(instr->context(), esi);
1333 LOperand* key = UseFixed(instr->key(), ecx);
1334 argument_count_ -= instr->argument_count();
1336 return MarkAsCall(DefineFixed(result, eax), instr);
1340 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1341 LOperand* context = UseFixed(instr->context(), esi);
1342 argument_count_ -= instr->argument_count();
1344 return MarkAsCall(DefineFixed(result, eax), instr);
1348 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1349 LOperand* context = UseFixed(instr->context(), esi);
1350 argument_count_ -= instr->argument_count();
1352 return MarkAsCall(DefineFixed(result, eax), instr);
1356 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1357 argument_count_ -= instr->argument_count();
1358 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
1362 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1363 LOperand* context = UseFixed(instr->context(), esi);
1364 LOperand* constructor = UseFixed(instr->constructor(), edi);
1365 argument_count_ -= instr->argument_count();
1367 return MarkAsCall(DefineFixed(result, eax), instr);
1371 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1372 LOperand* context = UseFixed(instr->context(), esi);
1373 LOperand* constructor = UseFixed(instr->constructor(), edi);
1374 argument_count_ -= instr->argument_count();
1376 return MarkAsCall(DefineFixed(result, eax), instr);
1380 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1381 LOperand* context = UseFixed(instr->context(), esi);
1382 LOperand* function = UseFixed(instr->function(), edi);
1383 argument_count_ -= instr->argument_count();
1385 return MarkAsCall(DefineFixed(result, eax), instr);
1389 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1390 argument_count_ -= instr->argument_count();
1391 LOperand* context = UseFixed(instr->context(), esi);
1392 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr);
1396 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1397 return DoShift(Token::ROR, instr);
1401 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1402 return DoShift(Token::SHR, instr);
1406 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1407 return DoShift(Token::SAR, instr);
1411 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1412 return DoShift(Token::SHL, instr);
1416 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1417 if (instr->representation().IsSmiOrInteger32()) {
1418 ASSERT(instr->left()->representation().Equals(instr->representation()));
1419 ASSERT(instr->right()->representation().Equals(instr->representation()));
1421 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1422 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1425 ASSERT(instr->representation().IsSmiOrTagged());
1426 ASSERT(instr->left()->representation().IsSmiOrTagged());
1427 ASSERT(instr->right()->representation().IsSmiOrTagged());
1429 LOperand* context = UseFixed(instr->context(), esi);
1430 LOperand* left = UseFixed(instr->left(), edx);
1431 LOperand* right = UseFixed(instr->right(), eax);
1433 new(zone()) LArithmeticT(instr->op(), context, left, right);
1434 return MarkAsCall(DefineFixed(result, eax), instr);
1439 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1440 if (instr->representation().IsDouble()) {
1441 return DoArithmeticD(Token::DIV, instr);
1442 } else if (instr->representation().IsSmiOrInteger32()) {
1443 ASSERT(instr->left()->representation().Equals(instr->representation()));
1444 ASSERT(instr->right()->representation().Equals(instr->representation()));
1445 if (instr->HasPowerOf2Divisor()) {
1446 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1447 LOperand* value = UseRegisterAtStart(instr->left());
1449 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1455 LOperand* dividend = UseFixed(instr->left(), eax);
1456 LOperand* divisor = UseRegister(instr->right());
1460 ASSERT(instr->representation().IsTagged());
1461 return DoArithmeticT(Token::DIV, instr);
1485 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1486 HValue* right = instr->right();
1492 LOperand* dividend = UseFixed(instr->left(), eax);
1493 LOperand* divisor = UseRegister(instr->right());
1502 LOperand* dividend = UseRegister(instr->left());
1507 LOperand* dividend = divisor_si < -1 ? UseTempRegister(instr->left()) :
1508 UseRegisterAtStart(instr->left());
1514 LOperand* dividend = UseFixed(instr->left(), eax);
1523 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1524 HValue* left = instr->left();
1525 HValue* right = instr->right();
1526 if (instr->representation().IsSmiOrInteger32()) {
1527 ASSERT(instr->left()->representation().Equals(instr->representation()));
1528 ASSERT(instr->right()->representation().Equals(instr->representation()));
1530 if (instr->HasPowerOf2Divisor()) {
1537 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1540 } else if (instr->fixed_right_arg().has_value) {
1555 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1557 instr->CanBeZero() &&
1558 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1562 } else if (instr->representation().IsSmiOrTagged()) {
1563 return DoArithmeticT(Token::MOD, instr);
1565 ASSERT(instr->representation().IsDouble());
1572 return MarkAsCall(DefineFixedDouble(mod, xmm1), instr);
1577 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1578 if (instr->representation().IsSmiOrInteger32()) {
1579 ASSERT(instr->left()->representation().Equals(instr->representation()));
1580 ASSERT(instr->right()->representation().Equals(instr->representation()));
1581 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1582 LOperand* right = UseOrConstant(instr->BetterRightOperand());
1584 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1588 if (instr->CheckFlag(HValue::kCanOverflow) ||
1589 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1593 } else if (instr->representation().IsDouble()) {
1594 return DoArithmeticD(Token::MUL, instr);
1596 ASSERT(instr->representation().IsTagged());
1597 return DoArithmeticT(Token::MUL, instr);
1602 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1603 if (instr->representation().IsSmiOrInteger32()) {
1604 ASSERT(instr->left()->representation().Equals(instr->representation()));
1605 ASSERT(instr->right()->representation().Equals(instr->representation()));
1606 LOperand* left = UseRegisterAtStart(instr->left());
1607 LOperand* right = UseOrConstantAtStart(instr->right());
1610 if (instr->CheckFlag(HValue::kCanOverflow)) {
1614 } else if (instr->representation().IsDouble()) {
1615 return DoArithmeticD(Token::SUB, instr);
1617 ASSERT(instr->representation().IsSmiOrTagged());
1618 return DoArithmeticT(Token::SUB, instr);
1623 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1624 if (instr->representation().IsSmiOrInteger32()) {
1625 ASSERT(instr->left()->representation().Equals(instr->representation()));
1626 ASSERT(instr->right()->representation().Equals(instr->representation()));
1631 bool use_lea = LAddI::UseLea(instr);
1632 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1633 HValue* right_candidate = instr->BetterRightOperand();
1638 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1646 } else if (instr->representation().IsDouble()) {
1647 return DoArithmeticD(Token::ADD, instr);
1649 ASSERT(instr->representation().IsSmiOrTagged());
1650 return DoArithmeticT(Token::ADD, instr);
1655 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1658 if (instr->representation().IsSmiOrInteger32()) {
1659 ASSERT(instr->left()->representation().Equals(instr->representation()));
1660 ASSERT(instr->right()->representation().Equals(instr->representation()));
1661 left = UseRegisterAtStart(instr->BetterLeftOperand());
1662 right = UseOrConstantAtStart(instr->BetterRightOperand());
1664 ASSERT(instr->representation().IsDouble());
1665 ASSERT(instr->left()->representation().IsDouble());
1666 ASSERT(instr->right()->representation().IsDouble());
1667 left = UseRegisterAtStart(instr->left());
1668 right = UseRegisterAtStart(instr->right());
1675 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1676 ASSERT(instr->representation().IsDouble());
1679 Representation exponent_type = instr->right()->representation();
1680 ASSERT(instr->left()->representation().IsDouble());
1681 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1683 UseFixedDouble(instr->right(), xmm1) :
1684 UseFixed(instr->right(), eax);
1686 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1691 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1692 ASSERT(instr->representation().IsDouble());
1693 ASSERT(instr->global_object()->representation().IsSmiOrTagged());
1694 LOperand* global_object = UseFixed(instr->global_object(), eax);
1696 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1700 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1701 ASSERT(instr->left()->representation().IsSmiOrTagged());
1702 ASSERT(instr->right()->representation().IsSmiOrTagged());
1703 LOperand* context = UseFixed(instr->context(), esi);
1704 LOperand* left = UseFixed(instr->left(), edx);
1705 LOperand* right = UseFixed(instr->right(), eax);
1707 return MarkAsCall(DefineFixed(result, eax), instr);
1712 HCompareNumericAndBranch* instr) {
1713 Representation r = instr->representation();
1715 ASSERT(instr->left()->representation().Equals(r));
1716 ASSERT(instr->right()->representation().Equals(r));
1717 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1718 LOperand* right = UseOrConstantAtStart(instr->right());
1722 ASSERT(instr->left()->representation().IsDouble());
1723 ASSERT(instr->right()->representation().IsDouble());
1726 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1727 left = UseRegisterOrConstantAtStart(instr->left());
1728 right = UseRegisterOrConstantAtStart(instr->right());
1730 left = UseRegisterAtStart(instr->left());
1731 right = UseRegisterAtStart(instr->right());
1739 HCompareObjectEqAndBranch* instr) {
1740 LOperand* left = UseRegisterAtStart(instr->left());
1741 LOperand* right = UseOrConstantAtStart(instr->right());
1747 HCompareHoleAndBranch* instr) {
1748 LOperand* object = UseRegisterAtStart(instr->object());
1753 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1754 ASSERT(instr->value()->representation().IsSmiOrTagged());
1756 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1760 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1761 ASSERT(instr->value()->representation().IsTagged());
1763 return new(zone()) LIsStringAndBranch(UseRegister(instr->value()), temp);
1767 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1768 ASSERT(instr->value()->representation().IsTagged());
1769 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1774 HIsUndetectableAndBranch* instr) {
1775 ASSERT(instr->value()->representation().IsTagged());
1777 UseRegisterAtStart(instr->value()), TempRegister());
1782 HStringCompareAndBranch* instr) {
1783 ASSERT(instr->left()->representation().IsTagged());
1784 ASSERT(instr->right()->representation().IsTagged());
1785 LOperand* context = UseFixed(instr->context(), esi);
1786 LOperand* left = UseFixed(instr->left(), edx);
1787 LOperand* right = UseFixed(instr->right(), eax);
1792 return MarkAsCall(result, instr);
1797 HHasInstanceTypeAndBranch* instr) {
1798 ASSERT(instr->value()->representation().IsTagged());
1800 UseRegisterAtStart(instr->value()),
1806 HGetCachedArrayIndex* instr) {
1807 ASSERT(instr->value()->representation().IsTagged());
1808 LOperand* value = UseRegisterAtStart(instr->value());
1815 HHasCachedArrayIndexAndBranch* instr) {
1816 ASSERT(instr->value()->representation().IsTagged());
1818 UseRegisterAtStart(instr->value()));
1823 HClassOfTestAndBranch* instr) {
1824 ASSERT(instr->value()->representation().IsTagged());
1825 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1831 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1832 LOperand* map = UseRegisterAtStart(instr->value());
1837 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1838 LOperand* object = UseRegisterAtStart(instr->value());
1843 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1844 LOperand* object = UseRegister(instr->value());
1850 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1851 LOperand* date = UseFixed(instr->value(), eax);
1853 new(zone()) LDateField(date, FixedTemp(ecx), instr->index());
1854 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1858 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1859 LOperand* string = UseRegister(instr->string());
1860 LOperand* index = UseRegister(instr->index());
1862 LOperand* value = UseFixed(instr->value(), ecx);
1864 new(zone()) LSeqStringSetChar(instr->encoding(), string, index, value);
1869 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1871 UseRegisterOrConstantAtStart(instr->index()),
1872 UseAtStart(instr->length())));
1877 HBoundsCheckBaseIndexInformation* instr) {
1883 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1884 LOperand* context = UseFixed(instr->context(), esi);
1885 LOperand* value = UseFixed(instr->value(), eax);
1886 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1890 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1903 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1904 Representation from = instr->from();
1905 Representation to = instr->to();
1908 LOperand* value = UseRegister(instr->value());
1919 LOperand* value = UseRegister(instr->value());
1921 LOperand* temp = instr->deoptimize_on_minus_zero()
1927 HValue* val = instr->value();
1935 if (instr->value()->type().IsSmi()) {
1936 LOperand* value = UseRegister(instr->value());
1939 bool truncating = instr->CanTruncateToInt32();
1941 LOperand* value = UseRegister(instr->value());
1949 LOperand* value = UseFixed(instr->value(), ecx);
1960 LOperand* value = UseRegisterAtStart(instr->value());
1968 LOperand* value = UseRegister(instr->value());
1973 bool truncating = instr->CanTruncateToInt32();
1976 UseTempRegister(instr->value()) : UseRegister(instr->value());
1984 HValue* val = instr->value();
1998 HValue* val = instr->value();
2009 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
2012 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
2015 new(zone()) LInteger32ToDouble(Use(instr->value())));
2024 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
2025 LOperand* value = UseAtStart(instr->value());
2030 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
2031 LOperand* value = UseRegisterAtStart(instr->value());
2036 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) {
2038 LIsNumberAndBranch(UseRegisterOrConstantAtStart(instr->value()));
2042 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
2043 LOperand* value = UseRegisterAtStart(instr->value());
2050 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
2055 LOperand* value = instr->target_in_new_space()
2056 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value());
2061 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
2063 if (!instr->CanOmitMapChecks()) {
2064 value = UseRegisterAtStart(instr->value());
2065 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
2068 if (!instr->CanOmitMapChecks()) {
2070 if (instr->has_migration_target()) return AssignPointerMap(result);
2076 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2077 HValue* value = instr->value();
2095 LOperand* value = UseRegister(instr->value());
2105 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2107 ? UseFixed(instr->context(), esi)
2109 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
2110 return new(zone()) LReturn(UseFixed(instr->value(), eax), context,
2115 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2116 Representation r = instr->representation();
2122 double value = instr->DoubleValue();
2137 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2139 return instr->RequiresHoleCheck()
2145 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2146 LOperand* context = UseFixed(instr->context(), esi);
2147 LOperand* global_object = UseFixed(instr->global_object(), edx);
2150 return MarkAsCall(DefineFixed(result, eax), instr);
2154 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2156 new(zone()) LStoreGlobalCell(UseRegister(instr->value()));
2157 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2161 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2162 LOperand* context = UseFixed(instr->context(), esi);
2163 LOperand* global_object = UseFixed(instr->global_object(), edx);
2164 LOperand* value = UseFixed(instr->value(), eax);
2167 return MarkAsCall(result, instr);
2171 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2172 LOperand* context = UseRegisterAtStart(instr->value());
2175 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2179 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2182 LOperand* context = UseRegister(instr->context());
2183 if (instr->NeedsWriteBarrier()) {
2184 value = UseTempRegister(instr->value());
2187 value = UseRegister(instr->value());
2191 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2195 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2196 LOperand* obj = (instr->access().IsExternalMemory() &&
2197 instr->access().offset() == 0)
2198 ? UseRegisterOrConstantAtStart(instr->object())
2199 : UseRegisterAtStart(instr->object());
2204 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2205 LOperand* context = UseFixed(instr->context(), esi);
2206 LOperand* object = UseFixed(instr->object(), edx);
2208 return MarkAsCall(DefineFixed(result, eax), instr);
2213 HLoadFunctionPrototype* instr) {
2215 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()),
2221 HLoadExternalArrayPointer* instr) {
2222 LOperand* input = UseRegisterAtStart(instr->value());
2227 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2228 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2229 ElementsKind elements_kind = instr->elements_kind();
2231 instr->key()->representation(), elements_kind);
2233 ? UseTempRegister(instr->key())
2234 : UseRegisterOrConstantAtStart(instr->key());
2237 if (!instr->is_external()) {
2238 LOperand* obj = UseRegisterAtStart(instr->elements());
2242 (instr->representation().IsInteger32() &&
2245 (instr->representation().IsDouble() &&
2248 LOperand* external_pointer = UseRegister(instr->elements());
2253 bool can_deoptimize = instr->RequiresHoleCheck() ||
2261 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2262 LOperand* context = UseFixed(instr->context(), esi);
2263 LOperand* object = UseFixed(instr->object(), edx);
2264 LOperand* key = UseFixed(instr->key(), ecx);
2268 return MarkAsCall(DefineFixed(result, eax), instr);
2272 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
2273 ElementsKind elements_kind = instr->elements_kind();
2281 return UseFixed(instr->value(), eax);
2286 return UseRegisterAtStart(instr->value());
2289 return UseRegister(instr->value());
2293 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2294 if (!instr->is_external()) {
2295 ASSERT(instr->elements()->representation().IsTagged());
2296 ASSERT(instr->key()->representation().IsInteger32() ||
2297 instr->key()->representation().IsSmi());
2299 if (instr->value()->representation().IsDouble()) {
2300 LOperand* object = UseRegisterAtStart(instr->elements());
2302 val = UseRegisterAtStart(instr->value());
2303 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2306 ASSERT(instr->value()->representation().IsSmiOrTagged());
2307 bool needs_write_barrier = instr->NeedsWriteBarrier();
2309 LOperand* obj = UseRegister(instr->elements());
2313 val = UseTempRegister(instr->value());
2314 key = UseTempRegister(instr->key());
2316 val = UseRegisterOrConstantAtStart(instr->value());
2317 key = UseRegisterOrConstantAtStart(instr->key());
2323 ElementsKind elements_kind = instr->elements_kind();
2325 (instr->value()->representation().IsInteger32() &&
2328 (instr->value()->representation().IsDouble() &&
2331 ASSERT(instr->elements()->representation().IsExternal());
2333 LOperand* external_pointer = UseRegister(instr->elements());
2334 LOperand* val = GetStoreKeyedValueOperand(instr);
2336 instr->key()->representation(), elements_kind);
2338 ? UseTempRegister(instr->key())
2339 : UseRegisterOrConstantAtStart(instr->key());
2346 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2347 LOperand* context = UseFixed(instr->context(), esi);
2348 LOperand* object = UseFixed(instr->object(), edx);
2349 LOperand* key = UseFixed(instr->key(), ecx);
2350 LOperand* value = UseFixed(instr->value(), eax);
2352 ASSERT(instr->object()->representation().IsTagged());
2353 ASSERT(instr->key()->representation().IsTagged());
2354 ASSERT(instr->value()->representation().IsTagged());
2358 return MarkAsCall(result, instr);
2363 HTransitionElementsKind* instr) {
2364 LOperand* object = UseRegister(instr->object());
2365 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2366 LOperand* object = UseRegister(instr->object());
2374 LOperand* context = UseRegister(instr->context());
2383 HTrapAllocationMemento* instr) {
2384 LOperand* object = UseRegister(instr->object());
2392 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2393 bool is_in_object = instr->access().IsInobject();
2394 bool is_external_location = instr->access().IsExternalMemory() &&
2395 instr->access().offset() == 0;
2396 bool needs_write_barrier = instr->NeedsWriteBarrier();
2397 bool needs_write_barrier_for_map = instr->has_transition() &&
2398 instr->NeedsWriteBarrierForMap();
2403 ? UseRegister(instr->object())
2404 : UseTempRegister(instr->object());
2409 obj = UseRegisterOrConstant(instr->object());
2412 ? UseRegister(instr->object())
2413 : UseRegisterAtStart(instr->object());
2416 bool can_be_constant = instr->value()->IsConstant() &&
2417 HConstant::cast(instr->value())->NotInNewSpace() &&
2418 !(FLAG_track_double_fields && instr->field_representation().IsDouble());
2422 val = UseTempRegister(instr->value());
2424 val = UseRegisterOrConstant(instr->value());
2425 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) {
2426 val = UseTempRegister(instr->value());
2428 instr->field_representation().IsDouble()) {
2429 val = UseRegisterAtStart(instr->value());
2431 val = UseRegister(instr->value());
2445 instr->field_representation().IsHeapObject()) {
2446 if (!instr->value()->type().IsHeapObject()) {
2454 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2455 LOperand* context = UseFixed(instr->context(), esi);
2456 LOperand* object = UseFixed(instr->object(), edx);
2457 LOperand* value = UseFixed(instr->value(), eax);
2461 return MarkAsCall(result, instr);
2465 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2466 LOperand* context = UseFixed(instr->context(), esi);
2467 LOperand* left = UseOrConstantAtStart(instr->left());
2468 LOperand* right = UseOrConstantAtStart(instr->right());
2470 return MarkAsCall(DefineFixed(string_add, eax), instr);
2474 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2475 LOperand* string = UseTempRegister(instr->string());
2476 LOperand* index = UseTempRegister(instr->index());
2477 LOperand* context = UseAny(instr->context());
2484 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2485 LOperand* char_code = UseRegister(instr->value());
2486 LOperand* context = UseAny(instr->context());
2493 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2495 LOperand* context = UseAny(instr->context());
2496 LOperand* size = instr->size()->IsConstant()
2497 ? UseConstant(instr->size())
2498 : UseTempRegister(instr->size());
2505 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2506 LOperand* context = UseFixed(instr->context(), esi);
2508 DefineFixed(new(zone()) LRegExpLiteral(context), eax), instr);
2512 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2513 LOperand* context = UseFixed(instr->context(), esi);
2515 DefineFixed(new(zone()) LFunctionLiteral(context), eax), instr);
2519 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2522 current_block_->last_environment()->set_ast_id(instr->ast_id());
2527 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2529 if (instr->kind() == HParameter::STACK_PARAMETER) {
2530 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2536 int index = static_cast<int>(instr->index());
2543 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2553 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2554 LOperand* context = UseFixed(instr->context(), esi);
2555 argument_count_ -= instr->argument_count();
2557 return MarkAsCall(DefineFixed(result, eax), instr);
2561 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2570 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2576 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2578 LOperand* args = UseRegister(instr->arguments());
2581 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2582 length = UseRegisterOrConstant(instr->length());
2583 index = UseOrConstant(instr->index());
2585 length = UseTempRegister(instr->length());
2586 index = Use(instr->index());
2592 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2593 LOperand* object = UseFixed(instr->value(), eax);
2595 return MarkAsCall(DefineFixed(result, eax), instr);
2599 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2600 LOperand* context = UseFixed(instr->context(), esi);
2601 LOperand* value = UseAtStart(instr->value());
2603 return MarkAsCall(DefineFixed(result, eax), instr);
2607 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2608 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2613 HIsConstructCallAndBranch* instr) {
2618 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2622 env->set_ast_id(instr->ast_id());
2624 env->Drop(instr->pop_count());
2625 for (int i = instr->values()->length() - 1; i >= 0; --i) {
2626 HValue* value = instr->values()->at(i);
2627 if (instr->HasAssignedIndexAt(i)) {
2628 env->Bind(instr->GetAssignedIndexAt(i), value);
2637 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
2653 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2655 if (instr->is_function_entry()) {
2656 LOperand* context = UseFixed(instr->context(), esi);
2657 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2659 ASSERT(instr->is_backwards_branch());
2660 LOperand* context = UseAny(instr->context());
2667 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2670 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2671 instr->arguments_count(),
2672 instr->function(),
2674 instr->inlining_kind(),
2675 instr->undefined_receiver());
2677 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2678 inner->Bind(instr->arguments_var(), instr->arguments_object());
2680 inner->set_entry(instr);
2682 chunk_->AddInlinedClosure(instr->closure());
2687 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2705 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2706 LOperand* context = UseFixed(instr->context(), esi);
2707 LOperand* object = UseFixed(instr->enumerable(), eax);
2709 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
2713 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2714 LOperand* map = UseRegister(instr->map());
2720 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2721 LOperand* value = UseRegisterAtStart(instr->value());
2722 LOperand* map = UseRegisterAtStart(instr->map());
2727 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2728 LOperand* object = UseRegister(instr->object());
2729 LOperand* index = UseTempRegister(instr->index());