Home | History | Annotate | Download | only in mips

Lines Matching full:instr

166 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
505 HInstruction* instr = HInstruction::cast(value);
506 VisitInstruction(instr);
513 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
516 instr->set_result(result);
517 return instr;
522 LTemplateResultInstruction<1>* instr) {
523 return Define(instr,
529 LTemplateResultInstruction<1>* instr, int index) {
530 return Define(instr,
536 LTemplateResultInstruction<1>* instr) {
537 return Define(instr,
543 LTemplateResultInstruction<1>* instr, Register reg) {
544 return Define(instr, ToUnallocated(reg));
549 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
550 return Define(instr, ToUnallocated(reg));
554 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
556 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env);
560 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
565 instr->VerifyCall();
567 instr->MarkAsCall();
568 instr = AssignPointerMap(instr);
577 if (needs_environment && !instr->HasEnvironment()) {
578 instr = AssignEnvironment(instr);
580 instr->environment()->set_has_been_used();
583 return instr;
587 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
588 DCHECK(!instr->HasPointerMap());
589 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
590 return instr;
634 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
635 return new(zone()) LLabel(instr->block());
639 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
640 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
644 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
650 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
656 HBitwiseBinaryOperation* instr) {
657 if (instr->representation().IsSmiOrInteger32()) {
658 DCHECK(instr->left()->representation().Equals(instr->representation()));
659 DCHECK(instr->right()->representation().Equals(instr->representation()));
660 LOperand* left = UseRegisterAtStart(instr->left());
662 HValue* right_value = instr->right();
672 if (instr->representation().IsSmi() && constant_value > 0) {
673 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
682 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
689 return DoArithmeticT(op, instr);
695 HArithmeticBinaryOperation* instr) {
696 DCHECK(instr->representation().IsDouble());
697 DCHECK(instr->left()->representation().IsDouble());
698 DCHECK(instr->right()->representation().IsDouble());
700 LOperand* left = UseFixedDouble(instr->left(), f2);
701 LOperand* right = UseFixedDouble(instr->right(), f4);
706 return MarkAsCall(DefineFixedDouble(result, f2), instr);
708 LOperand* left = UseRegisterAtStart(instr->left());
709 LOperand* right = UseRegisterAtStart(instr->right());
717 HBinaryOperation* instr) {
718 HValue* left = instr->left();
719 HValue* right = instr->right();
722 LOperand* context = UseFixed(instr->context(), cp);
727 return MarkAsCall(DefineFixed(result, v0), instr);
802 LInstruction* instr = NULL;
805 instr = DefineAsRegister(new(zone()) LDummy());
808 instr = DefineAsRegister(new(zone())
823 instr = new(zone()) LGoto(successor);
825 instr = current->CompileToLithium(this);
832 if (instr != NULL) {
833 AddInstruction(instr, current);
840 void LChunkBuilder::AddInstruction(LInstruction* instr,
844 instr->set_hydrogen_value(hydrogen_val);
857 if (!(instr->ClobbersRegisters() &&
858 instr->ClobbersDoubleRegisters(isolate()))) {
861 for (UseIterator it(instr); !it.Done(); it.Advance()) {
865 if (instr->Output() != NULL) {
866 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
868 for (TempIterator it(instr); !it.Done(); it.Advance()) {
876 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
877 instr = AssignPointerMap(instr);
879 if (FLAG_stress_environments && !instr->HasEnvironment()) {
880 instr = AssignEnvironment(instr);
882 chunk_->AddInstruction(instr, current_block_);
884 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val);
888 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) {
891 result = MarkAsCall(result, instr);
897 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
898 return new(zone()) LGoto(instr->FirstSuccessor());
902 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
903 HValue* value = instr->value();
906 ToBooleanICStub::Types expected = instr->expected_input_types();
921 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
922 DCHECK(instr->value()->representation().IsTagged());
923 LOperand* value = UseRegisterAtStart(instr->value());
943 HHasInPrototypeChainAndBranch* instr) {
944 LOperand* object = UseRegister(instr->object());
945 LOperand* prototype = UseRegister(instr->prototype());
952 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
953 LOperand* receiver = UseRegisterAtStart(instr->receiver());
954 LOperand* function = UseRegisterAtStart(instr->function());
960 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
961 LOperand* function = UseFixed(instr->function(), a1);
962 LOperand* receiver = UseFixed(instr->receiver(), a0);
963 LOperand* length = UseFixed(instr->length(), a2);
964 LOperand* elements = UseFixed(instr->elements(), a3);
969 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
973 LInstruction* LChunkBuilder::DoPushArguments(HPushArguments* instr) {
974 int argc = instr->OperandCount();
976 LOperand* argument = Use(instr->argument(i));
977 AddInstruction(new(zone()) LPushArgument(argument), instr);
992 HInnerAllocatedObject* instr) {
993 LOperand* base_object = UseRegisterAtStart(instr->base_object());
994 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1000 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1001 return instr->HasNoUses()
1007 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1008 if (instr->HasNoUses()) return NULL;
1018 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1019 LOperand* context = UseFixed(instr->context(), cp);
1020 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1025 HCallWithDescriptor* instr) {
1026 CallInterfaceDescriptor descriptor = instr->descriptor();
1028 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1029 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1033 LOperand* op = UseFixed(instr->OperandAt(1), cp);
1037 i < instr->OperandCount(); i++) {
1039 UseFixed(instr->OperandAt(i),
1047 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1050 return MarkAsCall(DefineFixed(result, v0), instr);
1054 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1055 LOperand* context = UseFixed(instr->context(), cp);
1056 LOperand* function = UseFixed(instr->function(), a1);
1058 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1061 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1065 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1066 switch (instr->op()) {
1068 return DoMathFloor(instr);
1070 return DoMathRound(instr);
1072 return DoMathFround(instr);
1074 return DoMathAbs(instr);
1076 return DoMathLog(instr);
1078 instr);
1080 return DoMathSin(instr);
1082 return DoMathExp(instr);
1084 return DoMathSqrt(instr);
1086 return DoMathPowHalf(instr);
1088 return DoMathClz32(instr);
1096 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1097 DCHECK(instr->representation().IsDouble());
1098 DCHECK(instr->value()->representation().IsDouble());
1099 LOperand* input = UseFixedDouble(instr->value(), f4);
1100 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr);
1104 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
1105 LOperand* input = UseRegisterAtStart(instr->value());
1110 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1111 DCHECK(instr->representation().IsDouble());
1112 DCHECK(instr->value()->representation().IsDouble());
1113 LOperand* input = UseFixedDouble(instr->value(), f4);
1114 return MarkAsCall(DefineFixedDouble(new (zone()) LMathCos(input), f4), instr);
1117 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1118 DCHECK(instr->representation().IsDouble());
1119 DCHECK(instr->value()->representation().IsDouble());
1120 LOperand* input = UseFixedDouble(instr->value(), f4);
1121 return MarkAsCall(DefineFixedDouble(new (zone()) LMathSin(input), f4), instr);
1124 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1125 DCHECK(instr->representation().IsDouble());
1126 DCHECK(instr->value()->representation().IsDouble());
1127 LOperand* input = UseFixedDouble(instr->value(), f4);
1128 return MarkAsCall(DefineFixedDouble(new (zone()) LMathExp(input), f4), instr);
1132 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1134 LOperand* input = UseFixedDouble(instr->value(), f8);
1141 LInstruction* LChunkBuilder::DoMathFround(HUnaryMathOperation* instr) {
1142 LOperand* input = UseRegister(instr->value());
1148 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1149 Representation r = instr->value()->representation();
1152 : UseFixed(instr->context(), cp);
1153 LOperand* input = UseRegister(instr->value());
1162 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1163 LOperand* input = UseRegister(instr->value());
1170 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1171 LOperand* input = UseRegister(instr->value());
1177 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1178 LOperand* input = UseRegister(instr->value());
1185 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1186 LOperand* context = UseFixed(instr->context(), cp);
1187 LOperand* constructor = UseFixed(instr->constructor(), a1);
1189 return MarkAsCall(DefineFixed(result, v0), instr);
1193 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1194 LOperand* context = UseFixed(instr->context(), cp);
1195 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr);
1199 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1200 return DoShift(Token::ROR, instr);
1204 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1205 return DoShift(Token::SHR, instr);
1209 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1210 return DoShift(Token::SAR, instr);
1214 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1215 return DoShift(Token::SHL, instr);
1219 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1220 if (instr->representation().IsSmiOrInteger32()) {
1221 DCHECK(instr->left()->representation().Equals(instr->representation()));
1222 DCHECK(instr->right()->representation().Equals(instr->representation()));
1223 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32));
1225 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1226 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1229 return DoArithmeticT(instr->op(), instr);
1234 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1235 DCHECK(instr->representation().IsSmiOrInteger32());
1236 DCHECK(instr->left()->representation().Equals(instr->representation()));
1237 DCHECK(instr->right()->representation().Equals(instr->representation()));
1238 LOperand* dividend = UseRegister(instr->left());
1239 int32_t divisor = instr->right()->GetInteger32Constant();
1242 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1243 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1244 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1252 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1253 DCHECK(instr->representation().IsInteger32());
1254 DCHECK(instr->left()->representation().Equals(instr->representation()));
1255 DCHECK(instr->right()->representation().Equals(instr->representation()));
1256 LOperand* dividend = UseRegister(instr->left());
1257 int32_t divisor = instr->right()->GetInteger32Constant();
1261 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1262 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1269 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1270 DCHECK(instr->representation().IsSmiOrInteger32());
1271 DCHECK(instr->left()->representation().Equals(instr->representation()));
1272 DCHECK(instr->right()->representation().Equals(instr->representation()));
1273 LOperand* dividend = UseRegister(instr->left());
1274 LOperand* divisor = UseRegister(instr->right());
1278 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1279 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1280 (instr->CheckFlag(HValue::kCanOverflow) &&
1281 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) ||
1282 (!instr->IsMathFloorOfDiv() &&
1283 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1290 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1291 if (instr->representation().IsSmiOrInteger32()) {
1292 if (instr->RightIsPowerOf2()) {
1293 return DoDivByPowerOf2I(instr);
1294 } else if (instr->right()->IsConstant()) {
1295 return DoDivByConstI(instr);
1297 return DoDivI(instr);
1299 } else if (instr->representation().IsDouble()) {
1300 return DoArithmeticD(Token::DIV, instr);
1302 return DoArithmeticT(Token::DIV, instr);
1307 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1308 LOperand* dividend = UseRegisterAtStart(instr->left());
1309 int32_t divisor = instr->right()->GetInteger32Constant();
1312 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1313 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1320 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1321 DCHECK(instr->representation().IsInteger32());
1322 DCHECK(instr->left()->representation().Equals(instr->representation()));
1323 DCHECK(instr->right()->representation().Equals(instr->representation()));
1324 LOperand* dividend = UseRegister(instr->left());
1325 int32_t divisor = instr->right()->GetInteger32Constant();
1327 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) ||
1328 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ?
1333 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1340 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1341 DCHECK(instr->representation().IsSmiOrInteger32());
1342 DCHECK(instr->left()->representation().Equals(instr->representation()));
1343 DCHECK(instr->right()->representation().Equals(instr->representation()));
1344 LOperand* dividend = UseRegister(instr->left());
1345 LOperand* divisor = UseRegister(instr->right());
1348 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1349 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1350 (instr->CheckFlag(HValue::kCanOverflow))) {
1357 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1358 if (instr->RightIsPowerOf2()) {
1359 return DoFlooringDivByPowerOf2I(instr);
1360 } else if (instr->right()->IsConstant()) {
1361 return DoFlooringDivByConstI(instr);
1363 return DoFlooringDivI(instr);
1368 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1369 DCHECK(instr->representation().IsSmiOrInteger32());
1370 DCHECK(instr->left()->representation().Equals(instr->representation()));
1371 DCHECK(instr->right()->representation().Equals(instr->representation()));
1372 LOperand* dividend = UseRegisterAtStart(instr->left());
1373 int32_t divisor = instr->right()->GetInteger32Constant();
1376 if (instr->CheckFlag(HValue::kLeftCanBeNegative) &&
1377 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1384 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1385 DCHECK(instr->representation().IsSmiOrInteger32());
1386 DCHECK(instr->left()->representation().Equals(instr->representation()));
1387 DCHECK(instr->right()->representation().Equals(instr->representation()));
1388 LOperand* dividend = UseRegister(instr->left());
1389 int32_t divisor = instr->right()->GetInteger32Constant();
1392 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1399 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1400 DCHECK(instr->representation().IsSmiOrInteger32());
1401 DCHECK(instr->left()->representation().Equals(instr->representation()));
1402 DCHECK(instr->right()->representation().Equals(instr->representation()));
1403 LOperand* dividend = UseRegister(instr->left());
1404 LOperand* divisor = UseRegister(instr->right());
1407 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1408 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1415 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1416 if (instr->representation().IsSmiOrInteger32()) {
1417 return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr);
1418 } else if (instr->representation().IsDouble()) {
1419 return DoArithmeticD(Token::MOD, instr);
1421 return DoArithmeticT(Token::MOD, instr);
1426 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1427 if (instr->representation().IsSmiOrInteger32()) {
1428 DCHECK(instr->left()->representation().Equals(instr->representation()));
1429 DCHECK(instr->right()->representation().Equals(instr->representation()));
1430 HValue* left = instr->BetterLeftOperand();
1431 HValue* right = instr->BetterRightOperand();
1434 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1435 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1471 } else if (instr->representation().IsDouble()) {
1473 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) {
1474 HAdd* add = HAdd::cast(instr->uses().value());
1475 if (instr == add->left()) {
1480 if (instr == add->right() && !add->left()->IsMul()) {
1487 return DoArithmeticD(Token::MUL, instr);
1489 return DoArithmeticT(Token::MUL, instr);
1494 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1495 if (instr->representation().IsSmiOrInteger32()) {
1496 DCHECK(instr->left()->representation().Equals(instr->representation()));
1497 DCHECK(instr->right()->representation().Equals(instr->representation()));
1498 LOperand* left = UseRegisterAtStart(instr->left());
1499 LOperand* right = UseOrConstantAtStart(instr->right());
1502 if (instr->CheckFlag(HValue::kCanOverflow)) {
1506 } else if (instr->representation().IsDouble()) {
1507 return DoArithmeticD(Token::SUB, instr);
1509 return DoArithmeticT(Token::SUB, instr);
1523 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1524 if (instr->representation().IsSmiOrInteger32()) {
1525 DCHECK(instrinstr->representation()));
1526 DCHECK(instr->right()->representation().Equals(instr->representation()));
1527 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1528 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1531 if (instr->CheckFlag(HValue::kCanOverflow)) {
1535 } else if (instr->representation().IsExternal()) {
1536 DCHECK(instr->IsConsistentExternalRepresentation());
1537 DCHECK(!instr->CheckFlag(HValue::kCanOverflow));
1538 LOperand* left = UseRegisterAtStart(instr->left());
1539 LOperand* right = UseOrConstantAtStart(instr->right());
1543 } else if (instr->representation().IsDouble()) {
1545 if (instr->left()->IsMul())
1546 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1548 if (instr->right()->IsMul()) {
1549 DCHECK(!instr->left()->IsMul());
1550 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1553 return DoArithmeticD(Token::ADD, instr);
1555 return DoArithmeticT(Token::ADD, instr);
1560 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1563 if (instr->representation().IsSmiOrInteger32()) {
1564 DCHECK(instr->left()->representation().Equals(instr->representation()));
1565 DCHECK(instr->right()->representation().Equals(instr->representation()));
1566 left = UseRegisterAtStart(instr->BetterLeftOperand());
1567 right = UseOrConstantAtStart(instr->BetterRightOperand());
1569 DCHECK(instr->representation().IsDouble());
1570 DCHECK(instr->left()->representation().IsDouble());
1571 DCHECK(instr->right()->representation().IsDouble());
1572 left = UseRegisterAtStart(instr->left());
1573 right = UseRegisterAtStart(instr->right());
1579 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1580 DCHECK(instr->representation().IsDouble());
1583 Representation exponent_type = instr->right()->representation();
1584 DCHECK(instr->left()->representation().IsDouble());
1585 LOperand* left = UseFixedDouble(instr->left(), f2);
1588 ? UseFixedDouble(instr->right(), f4)
1589 : UseFixed(instr->right(), MathPowTaggedDescriptor::exponent());
1592 instr,
1597 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1598 DCHECK(instr->left()->representation().IsTagged());
1599 DCHECK(instr->right()->representation().IsTagged());
1600 LOperand* context = UseFixed(instr->context(), cp);
1601 LOperand* left = UseFixed(instr->left(), a1);
1602 LOperand* right = UseFixed(instr->right(), a0);
1604 return MarkAsCall(DefineFixed(result, v0), instr);
1609 HCompareNumericAndBranch* instr) {
1610 Representation r = instr->representation();
1612 DCHECK(instr->left()->representation().Equals(r));
1613 DCHECK(instr->right()->representation().Equals(r));
1614 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1615 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1619 DCHECK(instr->left()->representation().IsDouble());
1620 DCHECK(instr->right()->representation().IsDouble());
1621 LOperand* left = UseRegisterAtStart(instr->left());
1622 LOperand* right = UseRegisterAtStart(instr->right());
1629 HCompareObjectEqAndBranch* instr) {
1630 LOperand* left = UseRegisterAtStart(instr->left());
1631 LOperand* right = UseRegisterAtStart(instr->right());
1637 HCompareHoleAndBranch* instr) {
1638 LOperand* value = UseRegisterAtStart(instr->value());
1643 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1644 DCHECK(instr->value()->representation().IsTagged());
1646 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1651 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1652 DCHECK(instr->value()->representation().IsTagged());
1653 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1658 HIsUndetectableAndBranch* instr) {
1659 DCHECK(instr->value()->representation().IsTagged());
1661 UseRegisterAtStart(instr->value()), TempRegister());
1666 HStringCompareAndBranch* instr) {
1667 DCHECK(instr->left()->representation().IsTagged());
1668 DCHECK(instr->right()->representation().IsTagged());
1669 LOperand* context = UseFixed(instr->context(), cp);
1670 LOperand* left = UseFixed(instr->left(), a1);
1671 LOperand* right = UseFixed(instr->right(), a0);
1674 return MarkAsCall(result, instr);
1679 HHasInstanceTypeAndBranch* instr) {
1680 DCHECK(instr->value()->representation().IsTagged());
1681 LOperand* value = UseRegisterAtStart(instr->value());
1687 HGetCachedArrayIndex* instr) {
1688 DCHECK(instr->value()->representation().IsTagged());
1689 LOperand* value = UseRegisterAtStart(instr->value());
1696 HHasCachedArrayIndexAndBranch* instr) {
1697 DCHECK(instr->value()->representation().IsTagged());
1699 UseRegisterAtStart(instr->value()));
1704 HClassOfTestAndBranch* instr) {
1705 DCHECK(instr->value()->representation().IsTagged());
1706 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1711 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1712 LOperand* string = UseRegisterAtStart(instr->string());
1713 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1718 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1719 LOperand* string = UseRegisterAtStart(instr->string());
1721 ? UseRegisterAtStart(instr->index())
1722 : UseRegisterOrConstantAtStart(instr->index());
1723 LOperand* value = UseRegisterAtStart(instr->value());
1724 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL;
1729 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1730 if (!FLAG_debug_code && instr->skip_check()) return NULL;
1731 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1733 ? UseRegisterOrConstantAtStart(instr->length())
1734 : UseRegisterAtStart(instr->length());
1736 if (!FLAG_debug_code || !instr->skip_check()) {
1743 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1750 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1763 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1764 Representation from = instr->from();
1765 Representation to = instr->to();
1766 HValue* val = instr->value();
1818 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result);
1824 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1843 if (instr->CheckFlag(HValue::kCanOverflow)) {
1861 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1862 LOperand* value = UseRegisterAtStart(instr->value());
1864 if (!instr->value()->type().IsHeapObject()) {
1871 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1872 LOperand* value = UseRegisterAtStart(instr->value());
1878 HCheckArrayBufferNotNeutered* instr) {
1879 LOperand* view = UseRegisterAtStart(instr->value());
1886 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1887 LOperand* value = UseRegisterAtStart(instr->value());
1893 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
1894 LOperand* value = UseRegisterAtStart(instr->value());
1899 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1900 if (instr->IsStabilityCheck()) return new(zone()) LCheckMaps;
1901 LOperand* value = UseRegisterAtStart(instr->value());
1903 if (instr->HasMigrationTarget()) {
1911 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1912 HValue* value = instr->value();
1930 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
1931 HValue* value = instr->value();
1937 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1939 ? UseFixed(instr->context(), cp)
1941 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1942 return new(zone()) LReturn(UseFixed(instr->value(), v0), context,
1947 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1948 Representation r = instr->representation();
1966 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1967 LOperand* context = UseFixed(instr->context(), cp);
1971 return MarkAsCall(DefineFixed(result, v0), instr);
1975 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1976 instr->value());
1979 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
1986 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1989 if (instr->NeedsWriteBarrier()) {
1990 context = UseTempRegister(instr->context());
1991 value = UseTempRegister(instr->value());
1993 context = UseRegister(instr->context());
1994 value = UseRegister(instr->value());
1997 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2004 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2005 LOperand* obj = UseRegisterAtStart(instr->object());
2010 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2011 LOperand* context = UseFixed(instr->context(), cp);
2013 UseFixed(instr->object(), LoadDescriptor::ReceiverRegister());
2018 return MarkAsCall(result, instr);
2023 HLoadFunctionPrototype* instr) {
2025 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2029 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2034 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2035 DCHECK(instr->key()->representation().IsSmiOrInteger32());
2036 ElementsKind elements_kind = instr->elements_kind();
2037 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2040 if (!instr->is_fixed_typed_array()) {
2042 if (instr->representation().IsDouble()) {
2043 obj = UseRegister(instr->elements());
2045 DCHECK(instr->representation().IsSmiOrTagged());
2046 obj = UseRegisterAtStart(instr->elements());
2051 (instr->representation().IsInteger32() &&
2053 (instr->representation().IsDouble() &&
2055 LOperand* backing_store = UseRegister(instr->elements());
2056 LOperand* backing_store_owner = UseAny(instr->backing_store_owner());
2062 if (instr->is_fixed_typed_array()) {
2065 !instr->CheckFlag(HInstruction::kUint32);
2070 instr->RequiresHoleCheck() ||
2071 (instr->hole_mode() == CONVERT_HOLE_TO_UNDEFINED && info()->IsStub());
2081 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2082 LOperand* context = UseFixed(instr->context(), cp);
2084 UseFixed(instr->object(), LoadDescriptor::ReceiverRegister());
2085 LOperand* key = UseFixed(instr->key(), LoadDescriptor::NameRegister());
2091 return MarkAsCall(result, instr);
2095 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2096 if (!instr->is_fixed_typed_array()) {
2097 DCHECK(instr->elements()->representation().IsTagged());
2098 bool needs_write_barrier = instr->NeedsWriteBarrier();
2103 if (instr->value()->representation().IsDouble()) {
2104 object = UseRegisterAtStart(instr->elements());
2105 key = UseRegisterOrConstantAtStart(instr->key());
2106 val = UseRegister(instr->value());
2108 DCHECK(instr->value()->representation().IsSmiOrTagged());
2110 object = UseTempRegister(instr->elements());
2111 val = UseTempRegister(instr->value());
2112 key = UseTempRegister(instr->key());
2114 object = UseRegisterAtStart(instr->elements());
2115 val = UseRegisterAtStart(instr->value());
2116 key = UseRegisterOrConstantAtStart(instr->key());
2124 (instr->value()->representation().IsInteger32() &&
2125 !IsDoubleOrFloatElementsKind(instr->elements_kind())) ||
2126 (instr->value()->representation().IsDouble() &&
2127 IsDoubleOrFloatElementsKind(instr->elements_kind())));
2128 DCHECK(instr->elements()->representation().IsExternal());
2129 LOperand* val = UseRegister(instr->value());
2130 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2131 LOperand* backing_store = UseRegister(instr->elements());
2132 LOperand* backing_store_owner = UseAny(instr->backing_store_owner());
2137 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2138 LOperand* context = UseFixed(instr->context(), cp);
2140 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister());
2141 LOperand* key = UseFixed(instr->key(), StoreDescriptor::NameRegister());
2142 LOperand* val = UseFixed(instr->value(), StoreDescriptor::ValueRegister());
2144 DCHECK(instr->object()->representation().IsTagged());
2145 DCHECK(instr->key()->representation().IsTagged());
2146 DCHECK(instr->value()->representation().IsTagged());
2153 return MarkAsCall(result, instr);
2158 HTransitionElementsKind* instr) {
2159 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2160 LOperand* object = UseRegister(instr->object());
2166 LOperand* object = UseFixed(instr->object(), a0);
2167 LOperand* context = UseFixed(instr->context(), cp);
2170 return MarkAsCall(result, instr);
2176 HTrapAllocationMemento* instr) {
2177 LOperand* object = UseRegister(instr->object());
2185 LInstruction* LChunkBuilder::DoMaybeGrowElements(HMaybeGrowElements* instr) {
2187 LOperand* context = UseFixed(instr->context(), cp);
2188 LOperand* object = Use(instr->object());
2189 LOperand* elements = Use(instr->elements());
2190 LOperand* key = UseRegisterOrConstant(instr->key());
2191 LOperand* current_capacity = UseRegisterOrConstant(instr->current_capacity());
2200 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2201 bool is_in_object = instr->access().IsInobject();
2202 bool needs_write_barrier = instr->NeedsWriteBarrier();
2203 bool needs_write_barrier_for_map = instr->has_transition() &&
2204 instr->NeedsWriteBarrierForMap();
2209 ? UseRegister(instr->object())
2210 : UseTempRegister(instr->object());
2213 ? UseRegister(instr->object())
2214 : UseRegisterAtStart(instr->object());
2219 val = UseTempRegister(instr->value());
2220 } else if (instr->field_representation().IsDouble()) {
2221 val = UseRegisterAtStart(instr->value());
2223 val = UseRegister(instr->value());
2233 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2234 LOperand* context = UseFixed(instr->context(), cp);
2236 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister());
2237 LOperand* val = UseFixed(instr->value(), StoreDescriptor::ValueRegister());
2243 return MarkAsCall(result, instr);
2247 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2248 LOperand* context = UseFixed(instr->context(), cp);
2249 LOperand* left = UseFixed(instr->left(), a1);
2250 LOperand* right = UseFixed(instr->right(), a0);
2253 instr);
2257 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2258 LOperand* string = UseTempRegister(instr->string());
2259 LOperand* index = UseTempRegister(instr->index());
2260 LOperand* context = UseAny(instr->context());
2267 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2268 LOperand* char_code = UseRegister(instr->value());
2269 LOperand* context = UseAny(instr->context());
2276 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2277 LOperand* size = UseRegisterOrConstant(instr->size());
2280 if (instr->IsAllocationFolded()) {
2285 LOperand* context = UseAny(instr->context());
2292 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2295 current_block_->last_environment()->set_ast_id(instr->ast_id());
2300 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2302 if (instr->kind() == HParameter::STACK_PARAMETER) {
2303 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2308 int index = static_cast<int>(instr->index());
2315 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2318 int env_index = instr->index();
2320 if (instr->environment()->is_parameter_index(env_index)) {
2323 spill_index = env_index - instr->environment()->first_local_index();
2334 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2343 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2344 instr->ReplayEnvironment(current_block_->last_environment());
2351 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2353 LOperand* args = UseRegister(instr->arguments());
2354 LOperand* length = UseRegisterOrConstantAtStart(instr->length());
2355 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
2360 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2361 LOperand* context = UseFixed(instr->context(), cp);
2362 LOperand* value = UseFixed(instr->value(), a3);
2364 return MarkAsCall(DefineFixed(result, v0), instr);
2368 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2369 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2373 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2374 instr->ReplayEnvironment(current_block_->last_environment());
2379 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2380 if (instr->is_function_entry()) {
2381 LOperand* context = UseFixed(instr->context(), cp);
2382 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2384 DCHECK(instr->is_backwards_branch());
2385 LOperand* context = UseAny(instr->context());
2392 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2394 outer->set_ast_id(instr->ReturnId());
2397 instr->closure(), instr->arguments_count(), instr->function(), undefined,
2398 instr->inlining_kind(), instr->syntactic_tail_call_mode());
2400 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2401 inner->Bind(instr->arguments_var(), instr->arguments_object());
2403 inner->BindContext(instr->closure_context());
2404 inner->set_entry(instr);
2406 chunk_->AddInlinedFunction(instr->shared());
2411 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2419 DCHECK(instr->argument_delta() == -argument_count);
2430 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2431 LOperand* context = UseFixed(instr->context(), cp);
2432 LOperand* object = UseFixed(instr->enumerable(), a0);
2434 instr, CAN_DEOPTIMIZE_EAGERLY);
2438 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2439 LOperand* map = UseRegister(instr->map());
2444 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2445 LOperand* value = UseRegisterAtStart(instr->value());
2446 LOperand* map = UseRegisterAtStart(instr->map());
2451 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2452 LOperand* object = UseRegister(instr->object());
2453 LOperand* index = UseTempRegister(instr->index());