Home | History | Annotate | Download | only in mips

Lines Matching refs:instr

186 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
563 HInstruction* instr = HInstruction::cast(value);
564 VisitInstruction(instr);
572 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
575 instr->set_result(result);
576 return instr;
582 LTemplateInstruction<1, I, T>* instr) {
583 return Define(instr,
590 LTemplateInstruction<1, I, T>* instr, int index) {
591 return Define(instr,
598 LTemplateInstruction<1, I, T>* instr) {
599 instr,
606 LTemplateInstruction<1, I, T>* instr, Register reg) {
607 return Define(instr, ToUnallocated(reg));
613 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) {
614 return Define(instr, ToUnallocated(reg));
618 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
622 instr->set_environment(CreateEnvironment(hydrogen_env,
625 return instr;
629 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
634 instr->VerifyCall();
636 instr->MarkAsCall();
637 instr = AssignPointerMap(instr);
644 instruction_pending_deoptimization_environment_ = instr;
655 if (needs_environment && !instr->HasEnvironment()) {
656 instr = AssignEnvironment(instr);
659 return instr;
663 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
664 ASSERT(!instr->HasPointerMap());
665 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
666 return instr;
697 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
698 return new(zone()) LLabel(instr->block());
702 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
703 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
707 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
713 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
719 HBitwiseBinaryOperation* instr) {
720 if (instr->representation().IsSmiOrInteger32()) {
721 ASSERT(instr->left()->representation().Equals(instr->representation()));
722 ASSERT(instr->right()->representation().Equals(instr->representation()));
723 LOperand* left = UseRegisterAtStart(instr->left());
725 HValue* right_value = instr->right();
735 if (instr->representation().IsSmi() && constant_value > 0) {
736 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
746 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
748 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
756 return DoArithmeticT(op, instr);
762 HArithmeticBinaryOperation* instr) {
763 ASSERT(instr->representation().IsDouble());
764 ASSERT(instr->left()->representation().IsDouble());
765 ASSERT(instr->right()->representation().IsDouble());
767 LOperand* left = UseFixedDouble(instr->left(), f2);
768 LOperand* right = UseFixedDouble(instr->right(), f4);
773 return MarkAsCall(DefineFixedDouble(result, f2), instr);
775 LOperand* left = UseRegisterAtStart(instr->left());
776 LOperand* right = UseRegisterAtStart(instr->right());
784 HBinaryOperation* instr) {
785 HValue* left = instr->left();
786 HValue* right = instr->right();
789 LOperand* context = UseFixed(instr->context(), cp);
794 return MarkAsCall(DefineFixed(result, v0), instr);
870 LInstruction* instr = NULL;
873 instr = DefineAsRegister(new(zone()) LDummy());
875 instr = DefineAsRegister(new(zone())
885 instr = current->CompileToLithium(this);
891 if (instr != NULL) {
894 instr->set_hydrogen_value(current);
907 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
910 for (UseIterator it(instr); !it.Done(); it.Advance()) {
914 if (instr->Output() != NULL) {
915 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
917 for (TempIterator it(instr); !it.Done(); it.Advance()) {
925 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
926 instr = AssignPointerMap(instr);
928 if (FLAG_stress_environments && !instr->HasEnvironment()) {
929 instr = AssignEnvironment(instr);
931 chunk_->AddInstruction(instr, current_block_);
1021 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1022 return new(zone()) LGoto(instr->FirstSuccessor());
1026 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1027 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1030 HValue* value = instr->value();
1037 ToBooleanStub::Types expected = instr->expected_input_types();
1046 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1047 ASSERT(instr->value()->representation().IsTagged());
1048 LOperand* value = UseRegisterAtStart(instr->value());
1067 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1068 LOperand* context = UseFixed(instr->context(), cp);
1070 new(zone()) LInstanceOf(context, UseFixed(instr->left(), a0),
1071 UseFixed(instr->right(), a1));
1072 return MarkAsCall(DefineFixed(result, v0), instr);
1077 HInstanceOfKnownGlobal* instr) {
1080 UseFixed(instr->context(), cp),
1081 UseFixed(instr->left(), a0),
1083 return MarkAsCall(DefineFixed(result, v0), instr);
1087 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1088 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1089 LOperand* function = UseRegisterAtStart(instr->function());
1095 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1096 LOperand* function = UseFixed(instr->function(), a1);
1097 LOperand* receiver = UseFixed(instr->receiver(), a0);
1098 LOperand* length = UseFixed(instr->length(), a2);
1099 LOperand* elements = UseFixed(instr->elements(), a3);
1104 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1108 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1109 LOperand* argument = Use(instr->argument());
1123 HInnerAllocatedObject* instr) {
1124 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1125 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1131 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1132 return instr->HasNoUses()
1138 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1139 if (instr->HasNoUses()) return NULL;
1149 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1150 LOperand* context = UseRegisterAtStart(instr->value());
1155 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1156 LOperand* context = UseFixed(instr->context(), cp);
1157 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1161 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1162 LOperand* context = UseRegisterAtStart(instr->value());
1167 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1168 LOperand* global_object = UseRegisterAtStart(instr->value());
1174 HCallConstantFunction* instr) {
1175 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr);
1179 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1180 LOperand* context = UseFixed(instr->context(), cp);
1181 LOperand* function = UseFixed(instr->function(), a1);
1183 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1187 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1188 switch (instr->op()) {
1189 case kMathFloor: return DoMathFloor(instr);
1190 case kMathRound: return DoMathRound(instr);
1191 case kMathAbs: return DoMathAbs(instr);
1192 case kMathLog: return DoMathLog(instr);
1193 case kMathSin: return DoMathSin(instr);
1194 case kMathCos: return DoMathCos(instr);
1195 case kMathTan: return DoMathTan(instr);
1196 case kMathExp: return DoMathExp(instr);
1197 case kMathSqrt: return DoMathSqrt(instr);
1198 case kMathPowHalf: return DoMathPowHalf(instr);
1206 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1207 LOperand* input = UseFixedDouble(instr->value(), f4);
1209 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1213 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1214 LOperand* input = UseFixedDouble(instr->value(), f4);
1216 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1220 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1221 LOperand* input = UseFixedDouble(instr->value(), f4);
1223 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1227 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1228 LOperand* input = UseFixedDouble(instr->value(), f4);
1230 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1234 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1235 ASSERT(instr->representation().IsDouble());
1236 ASSERT(instr->value()->representation().IsDouble());
1237 LOperand* input = UseRegister(instr->value());
1246 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1248 LOperand* input = UseFixedDouble(instr->value(), f8);
1255 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1256 Representation r = instr->value()->representation();
1259 : UseFixed(instr->context(), cp);
1260 LOperand* input = UseRegister(instr->value());
1266 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1267 LOperand* input = UseRegister(instr->value());
1274 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1275 LOperand* input = UseRegister(instr->value());
1281 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1282 LOperand* input = UseRegister(instr->value());
1289 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1290 ASSERT(instr->key()->representation().IsTagged());
1291 LOperand* context = UseFixed(instr->context(), cp);
1292 LOperand* key = UseFixed(instr->key(), a2);
1294 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr);
1298 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1299 LOperand* context = UseFixed(instr->context(), cp);
1300 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr);
1304 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1305 LOperand* context = UseFixed(instr->context(), cp);
1306 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), v0), instr);
1310 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1311 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr);
1315 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1316 LOperand* context = UseFixed(instr->context(), cp);
1317 LOperand* constructor = UseFixed(instr->constructor(), a1);
1319 return MarkAsCall(DefineFixed(result, v0), instr);
1323 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1324 LOperand* context = UseFixed(instr->context(), cp);
1325 LOperand* constructor = UseFixed(instr->constructor(), a1);
1327 return MarkAsCall(DefineFixed(result, v0), instr);
1331 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1332 LOperand* context = UseFixed(instr->context(), cp);
1333 LOperand* function = UseFixed(instr->function(), a1);
1336 if (instr->IsTailCall()) return result;
1337 return MarkAsCall(result, instr);
1341 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1342 LOperand* context = UseFixed(instr->context(), cp);
1343 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr);
1347 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1348 return DoShift(Token::ROR, instr);
1352 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1353 return DoShift(Token::SHR, instr);
1357 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1358 return DoShift(Token::SAR, instr);
1362 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1363 return DoShift(Token::SHL, instr);
1367 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1368 if (instr->representation().IsSmiOrInteger32()) {
1369 ASSERT(instr->left()->representation().Equals(instr->representation()));
1370 ASSERT(instr->right()->representation().Equals(instr->representation()));
1371 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32));
1373 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1374 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1377 return DoArithmeticT(instr->op(), instr);
1382 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1383 if (instr->representation().IsSmiOrInteger32()) {
1384 ASSERT(instr->left()->representation().Equals(instr->representation()));
1385 ASSERT(instr->right()->representation().Equals(instr->representation()));
1386 LOperand* dividend = UseRegister(instr->left());
1387 LOperand* divisor = UseRegister(instr->right());
1390 } else if (instr->representation().IsDouble()) {
1391 return DoArithmeticD(Token::DIV, instr);
1393 return DoArithmeticT(Token::DIV, instr);
1439 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1440 HValue* right = instr->right();
1441 LOperand* dividend = UseRegister(instr->left());
1449 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1450 HValue* left = instr->left();
1451 HValue* right = instr->right();
1452 if (instr->representation().IsSmiOrInteger32()) {
1453 ASSERT(instr->left()->representation().Equals(instr->representation()));
1454 ASSERT(instr->right()->representation().Equals(instr->representation()));
1455 if (instr->HasPowerOf2Divisor()) {
1461 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1474 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1478 } else if (instr->representation().IsDouble()) {
1479 return DoArithmeticD(Token::MOD, instr);
1481 return DoArithmeticT(Token::MOD, instr);
1486 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1487 if (instr->representation().IsSmiOrInteger32()) {
1488 ASSERT(instr->left()->representation().Equals(instr->representation()));
1489 ASSERT(instr->right()->representation().Equals(instr->representation()));
1490 HValue* left = instr->BetterLeftOperand();
1491 HValue* right = instr->BetterRightOperand();
1494 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1495 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1527 } else if (instr->representation().IsDouble()) {
1529 if (instr->UseCount() == 1 && instr->uses().value()->IsAdd()) {
1530 HAdd* add = HAdd::cast(instr->uses().value());
1531 if (instr == add->left()) {
1536 if (instr == add->right() && !add->left()->IsMul()) {
1543 return DoArithmeticD(Token::MUL, instr);
1545 return DoArithmeticT(Token::MUL, instr);
1550 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1551 if (instr->representation().IsSmiOrInteger32()) {
1552 ASSERT(instr->left()->representation().Equals(instr->representation()));
1553 ASSERT(instr->right()->representation().Equals(instr->representation()));
1554 LOperand* left = UseRegisterAtStart(instr->left());
1555 LOperand* right = UseOrConstantAtStart(instr->right());
1558 if (instr->CheckFlag(HValue::kCanOverflow)) {
1562 } else if (instr->representation().IsDouble()) {
1563 return DoArithmeticD(Token::SUB, instr);
1565 return DoArithmeticT(Token::SUB, instr);
1579 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1580 if (instr->representation().IsSmiOrInteger32()) {
1581 ASSERT(instr->left()->representation().Equals(instr->representation()));
1582 ASSERT(instr->right()->representation().Equals(instr->representation()));
1583 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1584 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1587 if (instr->CheckFlag(HValue::kCanOverflow)) {
1591 } else if (instr->representation().IsExternal()) {
1592 ASSERT(instr->left()->representation().IsExternal());
1593 ASSERT(instr->right()->representation().IsInteger32());
1594 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1595 LOperand* left = UseRegisterAtStart(instr->left());
1596 LOperand* right = UseOrConstantAtStart(instr->right());
1600 } else if (instr->representation().IsDouble()) {
1602 if (instr->left()->IsMul())
1603 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1605 if (instr->right()->IsMul()) {
1606 ASSERT(!instr->left()->IsMul());
1607 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1610 return DoArithmeticD(Token::ADD, instr);
1612 return DoArithmeticT(Token::ADD, instr);
1617 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1620 if (instr->representation().IsSmiOrInteger32()) {
1621 ASSERT(instr->left()->representation().Equals(instr->representation()));
1622 ASSERT(instr->right()->representation().Equals(instr->representation()));
1623 left = UseRegisterAtStart(instr->BetterLeftOperand());
1624 right = UseOrConstantAtStart(instr->BetterRightOperand());
1626 ASSERT(instr->representation().IsDouble());
1627 ASSERT(instr->left()->representation().IsDouble());
1628 ASSERT(instr->right()->representation().IsDouble());
1629 left = UseRegisterAtStart(instr->left());
1630 right = UseRegisterAtStart(instr->right());
1636 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1637 ASSERT(instr->representation().IsDouble());
1640 Representation exponent_type = instr->right()->representation();
1641 ASSERT(instr->left()->representation().IsDouble());
1642 LOperand* left = UseFixedDouble(instr->left(), f2);
1644 UseFixedDouble(instr->right(), f4) :
1645 UseFixed(instr->right(), a2);
1648 instr,
1653 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1654 ASSERT(instr->left()->representation().IsTagged());
1655 ASSERT(instr->right()->representation().IsTagged());
1656 LOperand* context = UseFixed(instr->context(), cp);
1657 LOperand* left = UseFixed(instr->left(), a1);
1658 LOperand* right = UseFixed(instr->right(), a0);
1660 return MarkAsCall(DefineFixed(result, v0), instr);
1665 HCompareNumericAndBranch* instr) {
1666 Representation r = instr->representation();
1668 ASSERT(instr->left()->representation().Equals(r));
1669 ASSERT(instr->right()->representation().Equals(r));
1670 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1671 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1675 ASSERT(instr->left()->representation().IsDouble());
1676 ASSERT(instr->right()->representation().IsDouble());
1677 LOperand* left = UseRegisterAtStart(instr->left());
1678 LOperand* right = UseRegisterAtStart(instr->right());
1685 HCompareObjectEqAndBranch* instr) {
1686 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1688 LOperand* left = UseRegisterAtStart(instr->left());
1689 LOperand* right = UseRegisterAtStart(instr->right());
1695 HCompareHoleAndBranch* instr) {
1696 LOperand* value = UseRegisterAtStart(instr->value());
1702 HCompareMinusZeroAndBranch* instr) {
1703 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1705 LOperand* value = UseRegister(instr->value());
1711 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1712 ASSERT(instr->value()->representation().IsTagged());
1714 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1719 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1720 ASSERT(instr->value()->representation().IsTagged());
1722 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1727 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1728 ASSERT(instr->value()->representation().IsTagged());
1729 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1734 HIsUndetectableAndBranch* instr) {
1735 ASSERT(instr->value()->representation().IsTagged());
1737 UseRegisterAtStart(instr->value()), TempRegister());
1742 HStringCompareAndBranch* instr) {
1743 ASSERT(instr->left()->representation().IsTagged());
1744 ASSERT(instr->right()->representation().IsTagged());
1745 LOperand* context = UseFixed(instr->context(), cp);
1746 LOperand* left = UseFixed(instr->left(), a1);
1747 LOperand* right = UseFixed(instr->right(), a0);
1750 return MarkAsCall(result, instr);
1755 HHasInstanceTypeAndBranch* instr) {
1756 ASSERT(instr->value()->representation().IsTagged());
1757 LOperand* value = UseRegisterAtStart(instr->value());
1763 HGetCachedArrayIndex* instr) {
1764 ASSERT(instr->value()->representation().IsTagged());
1765 LOperand* value = UseRegisterAtStart(instr->value());
1772 HHasCachedArrayIndexAndBranch* instr) {
1773 ASSERT(instr->value()->representation().IsTagged());
1775 UseRegisterAtStart(instr->value()));
1780 HClassOfTestAndBranch* instr) {
1781 ASSERT(instr->value()->representation().IsTagged());
1782 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1787 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1788 LOperand* map = UseRegisterAtStart(instr->value());
1793 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1794 LOperand* object = UseRegisterAtStart(instr->value());
1799 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1800 LOperand* object = UseRegister(instr->value());
1806 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1807 LOperand* object = UseFixed(instr->value(), a0);
1809 new(zone()) LDateField(object, FixedTemp(a1), instr->index());
1810 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1814 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1815 LOperand* string = UseRegisterAtStart(instr->string());
1816 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1821 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1822 LOperand* string = UseRegisterAtStart(instr->string());
1824 ? UseRegisterAtStart(instr->index())
1825 : UseRegisterOrConstantAtStart(instr->index());
1826 LOperand* value = UseRegisterAtStart(instr->value());
1827 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL;
1832 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1833 LOperand* value = UseRegisterOrConstantAtStart(instr->index());
1834 LOperand* length = UseRegister(instr->length());
1840 HBoundsCheckBaseIndexInformation* instr) {
1846 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1853 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1854 LOperand* context = UseFixed(instr->context(), cp);
1855 LOperand* value = UseFixed(instr->value(), a0);
1856 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1860 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1873 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1874 Representation from = instr->from();
1875 Representation to = instr->to();
1878 LOperand* value = UseRegister(instr->value());
1885 LOperand* value = UseRegister(instr->value());
1889 HValue* val = instr->value();
1899 HValue* val = instr->value();
1917 LOperand* value = UseRegister(instr->value());
1928 LOperand* value = UseRegister(instr->value());
1933 LOperand* value = UseRegister(instr->value());
1940 HValue* val = instr->value();
1952 HValue* val = instr->value();
1963 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1965 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
1968 new(zone()) LInteger32ToDouble(Use(instr->value())));
1977 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1978 LOperand* value = UseRegisterAtStart(instr->value());
1983 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1984 LOperand* value = UseRegisterAtStart(instr->value());
1989 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1990 LOperand* value = UseRegisterAtStart(instr->value());
1996 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
1997 LOperand* value = UseRegisterAtStart(instr->value());
2002 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
2004 if (!instr->CanOmitMapChecks()) {
2005 value = UseRegisterAtStart(instr->value());
2006 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
2009 if (!instr->CanOmitMapChecks()) {
2011 if (instr->has_migration_target()) return AssignPointerMap(result);
2017 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2018 HValue* value = instr->value();
2036 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2038 ? UseFixed(instr->context(), cp)
2040 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
2041 return new(zone()) LReturn(UseFixed(instr->value(), v0), context,
2046 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2047 Representation r = instr->representation();
2065 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2067 return instr->RequiresHoleCheck()
2073 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2074 LOperand* context = UseFixed(instr->context(), cp);
2075 LOperand* global_object = UseFixed(instr->global_object(), a0);
2078 return MarkAsCall(DefineFixed(result, v0), instr);
2082 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2083 LOperand* value = UseRegister(instr->value());
2086 return instr->RequiresHoleCheck()
2092 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2093 LOperand* context = UseFixed(instr->context(), cp);
2094 LOperand* global_object = UseFixed(instr->global_object(), a1);
2095 LOperand* value = UseFixed(instr->value(), a0);
2098 return MarkAsCall(result, instr);
2102 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2103 LOperand* context = UseRegisterAtStart(instr->value());
2106 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2110 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2113 if (instr->NeedsWriteBarrier()) {
2114 context = UseTempRegister(instr->context());
2115 value = UseTempRegister(instr->value());
2117 context = UseRegister(instr->context());
2118 value = UseRegister(instr->value());
2121 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2125 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2126 LOperand* obj = UseRegisterAtStart(instr->object());
2131 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2132 LOperand* context = UseFixed(instr->context(), cp);
2133 LOperand* object = UseFixed(instr->object(), a0);
2136 return MarkAsCall(result, instr);
2141 HLoadFunctionPrototype* instr) {
2143 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2147 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2153 HLoadExternalArrayPointer* instr) {
2154 LOperand* input = UseRegisterAtStart(instr->value());
2159 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2160 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2161 ElementsKind elements_kind = instr->elements_kind();
2162 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2165 if (!instr->is_external()) {
2167 if (instr->representation().IsDouble()) {
2168 obj = UseRegister(instr->elements());
2170 ASSERT(instr->representation().IsSmiOrTagged());
2171 obj = UseRegisterAtStart(instr->elements());
2176 (instr->representation().IsInteger32() &&
2179 (instr->representation().IsDouble() &&
2182 LOperand* external_pointer = UseRegister(instr->elements());
2189 bool can_deoptimize = instr->RequiresHoleCheck() ||
2195 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2196 LOperand* context = UseFixed(instr->context(), cp);
2197 LOperand* object = UseFixed(instr->object(), a1);
2198 LOperand* key = UseFixed(instr->key(), a0);
2202 return MarkAsCall(result, instr);
2206 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2207 if (!instr->is_external()) {
2208 ASSERT(instr->elements()->representation().IsTagged());
2209 bool needs_write_barrier = instr->NeedsWriteBarrier();
2214 if (instr->value()->representation().IsDouble()) {
2215 object = UseRegisterAtStart(instr->elements());
2216 key = UseRegisterOrConstantAtStart(instr->key());
2217 val = UseRegister(instr->value());
2219 ASSERT(instr->value()->representation().IsSmiOrTagged());
2221 object = UseTempRegister(instr->elements());
2222 val = UseTempRegister(instr->value());
2223 key = UseTempRegister(instr->key());
2225 object = UseRegisterAtStart(instr->elements());
2226 val = UseRegisterAtStart(instr->value());
2227 key = UseRegisterOrConstantAtStart(instr->key());
2235 (instr->value()->representation().IsInteger32() &&
2236 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) &&
2237 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) ||
2238 (instr->value()->representation().IsDouble() &&
2239 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) ||
2240 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS))));
2241 ASSERT(instr->elements()->representation().IsExternal());
2242 LOperand* val = UseRegister(instr->value());
2243 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2244 LOperand* external_pointer = UseRegister(instr->elements());
2250 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2251 LOperand* context = UseFixed(instr->context(), cp);
2252 LOperand* obj = UseFixed(instr->object(), a2);
2253 LOperand* key = UseFixed(instr->key(), a1);
2254 LOperand* val = UseFixed(instr->value(), a0);
2256 ASSERT(instr->object()->representation().IsTagged());
2257 ASSERT(instr->key()->representation().IsTagged());
2258 ASSERT(instr->value()->representation().IsTagged());
2261 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr);
2266 HTransitionElementsKind* instr) {
2267 LOperand* object = UseRegister(instr->object());
2268 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2274 LOperand* context = UseFixed(instr->context(), cp);
2283 HTrapAllocationMemento* instr) {
2284 LOperand* object = UseRegister(instr->object());
2292 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2293 bool is_in_object = instr->access().IsInobject();
2294 bool needs_write_barrier = instr->NeedsWriteBarrier();
2295 bool needs_write_barrier_for_map = instr->has_transition() &&
2296 instr->NeedsWriteBarrierForMap();
2301 ? UseRegister(instr->object())
2302 : UseTempRegister(instr->object());
2305 ? UseRegister(instr->object())
2306 : UseRegisterAtStart(instr->object());
2311 (FLAG_track_fields && instr->field_representation().IsSmi())) {
2312 val = UseTempRegister(instr->value());
2314 instr->field_representation().IsDouble()) {
2315 val = UseRegisterAtStart(instr->value());
2317 val = UseRegister(instr->value());
2325 instr->field_representation().IsHeapObject()) {
2326 if (!instr->value()->type().IsHeapObject()) {
2334 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2335 LOperand* context = UseFixed(instr->context(), cp);
2336 LOperand* obj = UseFixed(instr->object(), a1);
2337 LOperand* val = UseFixed(instr->value(), a0);
2340 return MarkAsCall(result, instr);
2344 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2345 LOperand* context = UseFixed(instr->context(), cp);
2347 ? UseFixed(instr->left(), a1)
2348 : UseRegisterAtStart(instr->left());
2350 ? UseFixed(instr->right(), a0)
2351 : UseRegisterAtStart(instr->right());
2354 instr);
2358 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2359 LOperand* string = UseTempRegister(instr->string());
2360 LOperand* index = UseTempRegister(instr->index());
2361 LOperand* context = UseAny(instr->context());
2368 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2369 LOperand* char_code = UseRegister(instr->value());
2370 LOperand* context = UseAny(instr->context());
2377 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2379 LOperand* context = UseAny(instr->context());
2380 LOperand* size = instr->size()->IsConstant()
2381 ? UseConstant(instr->size())
2382 : UseTempRegister(instr->size());
2390 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2391 LOperand* context = UseFixed(instr->context(), cp);
2393 DefineFixed(new(zone()) LRegExpLiteral(context), v0), instr);
2397 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2398 LOperand* context = UseFixed(instr->context(), cp);
2400 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr);
2404 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2407 current_block_->last_environment()->set_ast_id(instr->ast_id());
2412 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2414 if (instr->kind() == HParameter::STACK_PARAMETER) {
2415 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2421 int index = static_cast<int>(instr->index());
2428 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2431 int env_index = instr->index();
2433 if (instr
2436 spill_index = env_index - instr->environment()->first_local_index();
2446 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2447 LOperand* context = UseFixed(instr->context(), cp);
2448 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr);
2452 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2461 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2462 instr->ReplayEnvironment(current_block_->last_environment());
2469 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2471 LOperand* args = UseRegister(instr->arguments());
2472 LOperand* length = UseRegisterOrConstantAtStart(instr->length());
2473 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
2478 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2479 LOperand* object = UseFixed(instr->value(), a0);
2481 return MarkAsCall(DefineFixed(result, v0), instr);
2485 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2486 LOperand* context = UseFixed(instr->context(), cp);
2487 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0));
2488 return MarkAsCall(DefineFixed(result, v0), instr);
2492 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2493 LInstruction* goto_instr = CheckElideControlInstruction(instr);
2496 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2501 HIsConstructCallAndBranch* instr) {
2506 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2507 instr->ReplayEnvironment(current_block_->last_environment());
2511 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2527 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2528 if (instr->is_function_entry()) {
2529 LOperand* context = UseFixed(instr->context(), cp);
2530 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2532 ASSERT(instr->is_backwards_branch());
2533 LOperand* context = UseAny(instr->context());
2540 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2543 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2544 instr->arguments_count(),
2545 instr->function(),
2547 instr->inlining_kind(),
2548 instr->undefined_receiver());
2550 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2551 inner->Bind(instr->arguments_var(), instr->arguments_object());
2553 inner->set_entry(instr);
2555 chunk_->AddInlinedClosure(instr->closure());
2560 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2568 ASSERT(instr->argument_delta() == -argument_count);
2579 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2580 LOperand* context = UseFixed(instr->context(), cp);
2581 LOperand* object = UseFixed(instr->enumerable(), a0);
2583 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
2587 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2588 LOperand* map = UseRegister(instr->map());
2593 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2594 LOperand* value = UseRegisterAtStart(instr->value());
2595 LOperand* map = UseRegisterAtStart(instr->map());
2600 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2601 LOperand* object = UseRegister(instr->object());
2602 LOperand* index = UseRegister(instr->index());