Lines Matching refs:instr

164 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
525 HInstruction* instr = HInstruction::cast(value);
526 VisitInstruction(instr);
533 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
536 instr->set_result(result);
537 return instr;
542 LTemplateResultInstruction<1>* instr) {
543 return Define(instr,
549 LTemplateResultInstruction<1>* instr, int index) {
550 return Define(instr,
556 LTemplateResultInstruction<1>* instr) {
557 return Define(instr,
563 LTemplateResultInstruction<1>* instr, Register reg) {
564 return Define(instr, ToUnallocated(reg));
569 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
570 return Define(instr, ToUnallocated(reg));
574 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
578 instr->set_environment(CreateEnvironment(hydrogen_env,
581 return instr;
585 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
590 instr->VerifyCall();
592 instr->MarkAsCall();
593 instr = AssignPointerMap(instr);
602 if (needs_environment && !instr->HasEnvironment()) {
603 instr = AssignEnvironment(instr);
605 instr->environment()->set_has_been_used();
608 return instr;
612 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
613 DCHECK(!instr->HasPointerMap());
614 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
615 return instr;
659 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
660 return new(zone()) LLabel(instr->block());
664 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
665 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
669 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
675 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
681 HBitwiseBinaryOperation* instr) {
682 if (instr->representation().IsSmiOrInteger32()) {
683 DCHECK(instr->left()->representation().Equals(instr->representation()));
684 DCHECK(instr->right()->representation().Equals(instr->representation()));
685 LOperand* left = UseRegisterAtStart(instr->left());
687 HValue* right_value = instr->right();
697 if (instr->representation().IsSmi() && constant_value > 0) {
698 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
708 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
710 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
718 return DoArithmeticT(op, instr);
724 HArithmeticBinaryOperation* instr) {
725 DCHECK(instr->representation().IsDouble());
726 DCHECK(instr->left()->representation().IsDouble());
727 DCHECK(instr->right()->representation().IsDouble());
729 LOperand* left = UseFixedDouble(instr->left(), f2);
730 LOperand* right = UseFixedDouble(instr->right(), f4);
735 return MarkAsCall(DefineFixedDouble(result, f2), instr);
737 LOperand* left = UseRegisterAtStart(instr->left());
738 LOperand* right = UseRegisterAtStart(instr->right());
746 HBinaryOperation* instr) {
747 HValue* left = instr->left();
748 HValue* right = instr->right();
751 LOperand* context = UseFixed(instr->context(), cp);
756 return MarkAsCall(DefineFixed(result, v0), instr);
831 LInstruction* instr = NULL;
834 instr = DefineAsRegister(new(zone()) LDummy());
837 instr = DefineAsRegister(new(zone())
852 instr = new(zone()) LGoto(successor);
854 instr = current->CompileToLithium(this);
861 if (instr != NULL) {
862 AddInstruction(instr, current);
869 void LChunkBuilder::AddInstruction(LInstruction* instr,
873 instr->set_hydrogen_value(hydrogen_val);
886 if (!(instr->ClobbersRegisters() &&
887 instr->ClobbersDoubleRegisters(isolate()))) {
890 for (UseIterator it(instr); !it.Done(); it.Advance()) {
894 if (instr->Output() != NULL) {
895 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
897 for (TempIterator it(instr); !it.Done(); it.Advance()) {
905 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
906 instr = AssignPointerMap(instr);
908 if (FLAG_stress_environments && !instr->HasEnvironment()) {
909 instr = AssignEnvironment(instr);
911 chunk_->AddInstruction(instr, current_block_);
913 if (instr->IsCall()) {
918 instruction_needing_environment = instr;
935 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
936 return new(zone()) LGoto(instr->FirstSuccessor());
940 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
941 HValue* value = instr->value();
944 ToBooleanStub::Types expected = instr->expected_input_types();
959 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
960 DCHECK(instr->value()->representation().IsTagged());
961 LOperand* value = UseRegisterAtStart(instr->value());
980 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
981 LOperand* context = UseFixed(instr->context(), cp);
983 new(zone()) LInstanceOf(context, UseFixed(instr->left(), a0),
984 UseFixed(instr->right(), a1));
985 return MarkAsCall(DefineFixed(result, v0), instr);
990 HInstanceOfKnownGlobal* instr) {
993 UseFixed(instr->context(), cp),
994 UseFixed(instr->left(), a0),
996 return MarkAsCall(DefineFixed(result, v0), instr);
1000 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1001 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1002 LOperand* function = UseRegisterAtStart(instr->function());
1008 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1009 LOperand* function = UseFixed(instr->function(), a1);
1010 LOperand* receiver = UseFixed(instr->receiver(), a0);
1011 LOperand* length = UseFixed(instr->length(), a2);
1012 LOperand* elements = UseFixed(instr->elements(), a3);
1017 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1021 LInstruction* LChunkBuilder::DoPushArguments(HPushArguments* instr) {
1022 int argc = instr->OperandCount();
1024 LOperand* argument = Use(instr->argument(i));
1025 AddInstruction(new(zone()) LPushArgument(argument), instr);
1040 HInnerAllocatedObject* instr) {
1041 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1042 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1048 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1049 return instr->HasNoUses()
1055 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1056 if (instr->HasNoUses()) return NULL;
1066 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1067 LOperand* context = UseFixed(instr->context(), cp);
1068 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1073 HCallJSFunction* instr) {
1074 LOperand* function = UseFixed(instr->function(), a1);
1078 return MarkAsCall(DefineFixed(result, v0), instr);
1083 HCallWithDescriptor* instr) {
1084 CallInterfaceDescriptor descriptor = instr->descriptor();
1086 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1087 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1089 for (int i = 1; i < instr->OperandCount(); i++) {
1091 UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
1097 return MarkAsCall(DefineFixed(result, v0), instr);
1102 HTailCallThroughMegamorphicCache* instr) {
1103 LOperand* context = UseFixed(instr->context(), cp);
1105 UseFixed(instr->receiver(), LoadDescriptor::ReceiverRegister());
1107 UseFixed(instr->name(), LoadDescriptor::NameRegister());
1114 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1115 LOperand* context = UseFixed(instr->context(), cp);
1116 LOperand* function = UseFixed(instr->function(), a1);
1118 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1122 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1123 switch (instr->op()) {
1125 return DoMathFloor(instr);
1127 return DoMathRound(instr);
1129 return DoMathFround(instr);
1131 return DoMathAbs(instr);
1133 return DoMathLog(instr);
1135 return DoMathExp(instr);
1137 return DoMathSqrt(instr);
1139 return DoMathPowHalf(instr);
1141 return DoMathClz32(instr);
1149 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1150 DCHECK(instr->representation().IsDouble());
1151 DCHECK(instr->value()->representation().IsDouble());
1152 LOperand* input = UseFixedDouble(instr->value(), f4);
1153 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr);
1157 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
1158 LOperand* input = UseRegisterAtStart(instr->value());
1164 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1165 DCHECK(instr->representation().IsDouble());
1166 DCHECK(instr->value()->representation().IsDouble());
1167 LOperand* input = UseRegister(instr->value());
1176 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1178 LOperand* input = UseFixedDouble(instr->value(), f8);
1185 LInstruction* LChunkBuilder::DoMathFround(HUnaryMathOperation* instr) {
1186 LOperand* input = UseRegister(instr->value());
1192 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1193 Representation r = instr->value()->representation();
1196 : UseFixed(instr->context(), cp);
1197 LOperand* input = UseRegister(instr->value());
1206 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1207 LOperand* input = UseRegister(instr->value());
1214 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1215 LOperand* input = UseRegister(instr->value());
1221 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1222 LOperand* input = UseRegister(instr->value());
1229 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1230 LOperand* context = UseFixed(instr->context(), cp);
1231 LOperand* constructor = UseFixed(instr->constructor(), a1);
1233 return MarkAsCall(DefineFixed(result, v0), instr);
1237 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1238 LOperand* context = UseFixed(instr->context(), cp);
1239 LOperand* constructor = UseFixed(instr->constructor(), a1);
1241 return MarkAsCall(DefineFixed(result, v0), instr);
1245 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1246 LOperand* context = UseFixed(instr->context(), cp);
1247 LOperand* function = UseFixed(instr->function(), a1);
1249 return MarkAsCall(DefineFixed(call, v0), instr);
1253 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1254 LOperand* context = UseFixed(instr->context(), cp);
1255 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr);
1259 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1260 return DoShift(Token::ROR, instr);
1264 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1265 return DoShift(Token::SHR, instr);
1269 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1270 return DoShift(Token::SAR, instr);
1274 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1275 return DoShift(Token::SHL, instr);
1279 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1280 if (instr->representation().IsSmiOrInteger32()) {
1281 DCHECK(instr->left()->representation().Equals(instr->representation()));
1282 DCHECK(instr->right()->representation().Equals(instr->representation()));
1283 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32));
1285 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1286 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1289 return DoArithmeticT(instr->op(), instr);
1294 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1295 DCHECK(instr->representation().IsSmiOrInteger32());
1296 DCHECK(instr->left()->representation().Equals(instr->representation()));
1297 DCHECK(instr->right()->representation().Equals(instr->representation()));
1298 LOperand* dividend = UseRegister(instr->left());
1299 int32_t divisor = instr->right()->GetInteger32Constant();
1302 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1303 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1304 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1312 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1313 DCHECK(instr->representation().IsInteger32());
1314 DCHECK(instr->left()->representation().Equals(instr->representation()));
1315 DCHECK(instr->right()->representation().Equals(instr->representation()));
1316 LOperand* dividend = UseRegister(instr->left());
1317 int32_t divisor = instr->right()->GetInteger32Constant();
1321 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1322 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1329 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1330 DCHECK(instr->representation().IsSmiOrInteger32());
1331 DCHECK(instr->left()->representation().Equals(instr->representation()));
1332 DCHECK(instr->right()->representation().Equals(instr->representation()));
1333 LOperand* dividend = UseRegister(instr->left());
1334 LOperand* divisor = UseRegister(instr->right());
1338 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1339 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1340 (instr->CheckFlag(HValue::kCanOverflow) &&
1341 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) ||
1342 (!instr->IsMathFloorOfDiv() &&
1343 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1350 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1351 if (instr->representation().IsSmiOrInteger32()) {
1352 if (instr->RightIsPowerOf2()) {
1353 return DoDivByPowerOf2I(instr);
1354 } else if (instr->right()->IsConstant()) {
1355 return DoDivByConstI(instr);
1357 return DoDivI(instr);
1359 } else if (instr->representation().IsDouble()) {
1360 return DoArithmeticD(Token::DIV, instr);
1362 return DoArithmeticT(Token::DIV, instr);
1367 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1368 LOperand* dividend = UseRegisterAtStart(instr->left());
1369 int32_t divisor = instr->right()->GetInteger32Constant();
1372 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1373 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1380 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1381 DCHECK(instr->representation().IsInteger32());
1382 DCHECK(instr->left()->representation().Equals(instr->representation()));
1383 DCHECK(instr->right()->representation().Equals(instr->representation()));
1384 LOperand* dividend = UseRegister(instr->left());
1385 int32_t divisor = instr->right()->GetInteger32Constant();
1387 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) ||
1388 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ?
1393 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1400 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1401 DCHECK(instr->representation().IsSmiOrInteger32());
1402 DCHECK(instr->left()->representation().Equals(instr->representation()));
1403 DCHECK(instr->right()->representation().Equals(instr->representation()));
1404 LOperand* dividend = UseRegister(instr->left());
1405 LOperand* divisor = UseRegister(instr->right());
1411 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1412 if (instr->RightIsPowerOf2()) {
1413 return DoFlooringDivByPowerOf2I(instr);
1414 } else if (instr->right()->IsConstant()) {
1415 return DoFlooringDivByConstI(instr);
1417 return DoFlooringDivI(instr);
1422 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1423 DCHECK(instr->representation().IsSmiOrInteger32());
1424 DCHECK(instr->left()->representation().Equals(instr->representation()));
1425 DCHECK(instr->right()->representation().Equals(instr->representation()));
1426 LOperand* dividend = UseRegisterAtStart(instr->left());
1427 int32_t divisor = instr->right()->GetInteger32Constant();
1430 if (instr->CheckFlag(HValue::kLeftCanBeNegative) &&
1431 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1438 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1439 DCHECK(instr->representation().IsSmiOrInteger32());
1440 DCHECK(instr->left()->representation().Equals(instr->representation()));
1441 DCHECK(instr->right()->representation().Equals(instr->representation()));
1442 LOperand* dividend = UseRegister(instr->left());
1443 int32_t divisor = instr->right()->GetInteger32Constant();
1446 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1453 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1454 DCHECK(instr->representation().IsSmiOrInteger32());
1455 DCHECK(instr->left()->representation().Equals(instr->representation()));
1456 DCHECK(instr->right()->representation().Equals(instr->representation()));
1457 LOperand* dividend = UseRegister(instr->left());
1458 LOperand* divisor = UseRegister(instr->right());
1461 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1462 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1469 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1470 if (instr->representation().IsSmiOrInteger32()) {
1471 return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr);
1472 } else if (instr->representation().IsDouble()) {
1473 return DoArithmeticD(Token::MOD, instr);
1475 return DoArithmeticT(Token::MOD, instr);
1480 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1481 if (instr->representation().IsSmiOrInteger32()) {
1482 DCHECK(instr->left()->representation().Equals(instr->representation()));
1483 DCHECK(instr->right()->representation().Equals(instr->representation()));
1484 HValue* left = instr->BetterLeftOperand();
1485 HValue* right = instr->BetterRightOperand();
1488 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1489 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1521 } else if (instr->representation().IsDouble()) {
1523 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) {
1524 HAdd* add = HAdd::cast(instr->uses().value());
1525 if (instr == add->left()) {
1530 if (instr == add->right() && !add->left()->IsMul()) {
1537 return DoArithmeticD(Token::MUL, instr);
1539 return DoArithmeticT(Token::MUL, instr);
1544 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1545 if (instr->representation().IsSmiOrInteger32()) {
1546 DCHECK(instr->left()->representation().Equals(instr->representation()));
1547 DCHECK(instr->right()->representation().Equals(instr->representation()));
1548 LOperand* left = UseRegisterAtStart(instr->left());
1549 LOperand* right = UseOrConstantAtStart(instr->right());
1552 if (instr->CheckFlag(HValue::kCanOverflow)) {
1556 } else if (instr->representation().IsDouble()) {
1557 return DoArithmeticD(Token::SUB, instr);
1559 return DoArithmeticT(Token::SUB, instr);
1573 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1574 if (instr->representation().IsSmiOrInteger32()) {
1575 DCHECK(instr->left()->representation().Equals(instr->representation()));
1576 DCHECK(instr->right()->representation().Equals(instr->representation()));
1577 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1578 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1581 if (instr->CheckFlag(HValue::kCanOverflow)) {
1585 } else if (instr->representation().IsExternal()) {
1586 DCHECK(instr->left()->representation().IsExternal());
1587 DCHECK(instr->right()->representation().IsInteger32());
1588 DCHECK(!instr->CheckFlag(HValue::kCanOverflow));
1589 LOperand* left = UseRegisterAtStart(instr->left());
1590 LOperand* right = UseOrConstantAtStart(instr->right());
1594 } else if (instr->representation().IsDouble()) {
1596 if (instr->left()->IsMul())
1597 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1599 if (instr->right()->IsMul()) {
1600 DCHECK(!instr->left()->IsMul());
1601 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1604 return DoArithmeticD(Token::ADD, instr);
1606 return DoArithmeticT(Token::ADD, instr);
1611 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1614 if (instr->representation().IsSmiOrInteger32()) {
1615 DCHECK(instr->left()->representation().Equals(instr->representation()));
1616 DCHECK(instr->right()->representation().Equals(instr->representation()));
1617 left = UseRegisterAtStart(instr->BetterLeftOperand());
1618 right = UseOrConstantAtStart(instr->BetterRightOperand());
1620 DCHECK(instr->representation().IsDouble());
1621 DCHECK(instr->left()->representation().IsDouble());
1622 DCHECK(instr->right()->representation().IsDouble());
1623 left = UseRegisterAtStart(instr->left());
1624 right = UseRegisterAtStart(instr->right());
1630 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1631 DCHECK(instr->representation().IsDouble());
1634 Representation exponent_type = instr->right()->representation();
1635 DCHECK(instr->left()->representation().IsDouble());
1636 LOperand* left = UseFixedDouble(instr->left(), f2);
1639 ? UseFixedDouble(instr->right(), f4)
1640 : UseFixed(instr->right(), MathPowTaggedDescriptor::exponent());
1643 instr,
1648 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1649 DCHECK(instr->left()->representation().IsTagged());
1650 DCHECK(instr->right()->representation().IsTagged());
1651 LOperand* context = UseFixed(instr->context(), cp);
1652 LOperand* left = UseFixed(instr->left(), a1);
1653 LOperand* right = UseFixed(instr->right(), a0);
1655 return MarkAsCall(DefineFixed(result, v0), instr);
1660 HCompareNumericAndBranch* instr) {
1661 Representation r = instr->representation();
1663 DCHECK(instr->left()->representation().Equals(r));
1664 DCHECK(instr->right()->representation().Equals(r));
1665 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1666 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1670 DCHECK(instr->left()->representation().IsDouble());
1671 DCHECK(instr->right()->representation().IsDouble());
1672 LOperand* left = UseRegisterAtStart(instr->left());
1673 LOperand* right = UseRegisterAtStart(instr->right());
1680 HCompareObjectEqAndBranch* instr) {
1681 LOperand* left = UseRegisterAtStart(instr->left());
1682 LOperand* right = UseRegisterAtStart(instr->right());
1688 HCompareHoleAndBranch* instr) {
1689 LOperand* value = UseRegisterAtStart(instr->value());
1695 HCompareMinusZeroAndBranch* instr) {
1696 LOperand* value = UseRegister(instr->value());
1702 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1703 DCHECK(instr->value()->representation().IsTagged());
1705 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1710 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1711 DCHECK(instr->value()->representation().IsTagged());
1713 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1718 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1719 DCHECK(instr->value()->representation().IsTagged());
1720 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1725 HIsUndetectableAndBranch* instr) {
1726 DCHECK(instr->value()->representation().IsTagged());
1728 UseRegisterAtStart(instr->value()), TempRegister());
1733 HStringCompareAndBranch* instr) {
1734 DCHECK(instr->left()->representation().IsTagged());
1735 DCHECK(instr->right()->representation().IsTagged());
1736 LOperand* context = UseFixed(instr->context(), cp);
1737 LOperand* left = UseFixed(instr->left(), a1);
1738 LOperand* right = UseFixed(instr->right(), a0);
1741 return MarkAsCall(result, instr);
1746 HHasInstanceTypeAndBranch* instr) {
1747 DCHECK(instr->value()->representation().IsTagged());
1748 LOperand* value = UseRegisterAtStart(instr->value());
1754 HGetCachedArrayIndex* instr) {
1755 DCHECK(instr->value()->representation().IsTagged());
1756 LOperand* value = UseRegisterAtStart(instr->value());
1763 HHasCachedArrayIndexAndBranch* instr) {
1764 DCHECK(instr->value()->representation().IsTagged());
1766 UseRegisterAtStart(instr->value()));
1771 HClassOfTestAndBranch* instr) {
1772 DCHECK(instr->value()->representation().IsTagged());
1773 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1778 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1779 LOperand* map = UseRegisterAtStart(instr->value());
1784 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1785 LOperand* object = UseFixed(instr->value(), a0);
1787 new(zone()) LDateField(object, FixedTemp(a1), instr->index());
1788 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1792 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1793 LOperand* string = UseRegisterAtStart(instr->string());
1794 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1799 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1800 LOperand* string = UseRegisterAtStart(instr->string());
1802 ? UseRegisterAtStart(instr->index())
1803 : UseRegisterOrConstantAtStart(instr->index());
1804 LOperand* value = UseRegisterAtStart(instr->value());
1805 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL;
1810 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1811 if (!FLAG_debug_code && instr->skip_check()) return NULL;
1812 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1814 ? UseRegisterOrConstantAtStart(instr->length())
1815 : UseRegisterAtStart(instr->length());
1817 if (!FLAG_debug_code || !instr->skip_check()) {
1825 HBoundsCheckBaseIndexInformation* instr) {
1831 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1838 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1851 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1852 Representation from = instr->from();
1853 Representation to = instr->to();
1854 HValue* val = instr->value();
1906 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result);
1912 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1931 if (instr->CheckFlag(HValue::kCanOverflow)) {
1949 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1950 LOperand* value = UseRegisterAtStart(instr->value());
1952 if (!instr->value()->type().IsHeapObject()) {
1959 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1960 LOperand* value = UseRegisterAtStart(instr->value());
1965 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1966 LOperand* value = UseRegisterAtStart(instr->value());
1972 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
1973 LOperand* value = UseRegisterAtStart(instr->value());
1978 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1979 if (instr->IsStabilityCheck()) return new(zone()) LCheckMaps;
1980 LOperand* value = UseRegisterAtStart(instr->value());
1982 if (instr->HasMigrationTarget()) {
1990 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1991 HValue* value = instr->value();
2009 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
2010 HValue* value = instr->value();
2016 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
2017 LOperand* lo = UseRegister(instr->lo());
2018 LOperand* hi = UseRegister(instr->hi());
2023 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2025 ? UseFixed(instr->context(), cp)
2027 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
2028 return new(zone()) LReturn(UseFixed(instr->value(), v0), context,
2033 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2034 Representation r = instr->representation();
2052 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2054 return instr->RequiresHoleCheck()
2060 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2061 LOperand* context = UseFixed(instr->context(), cp);
2063 UseFixed(instr->global_object(), LoadDescriptor::ReceiverRegister());
2070 return MarkAsCall(DefineFixed(result, v0), instr);
2074 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2075 LOperand* value = UseRegister(instr->value());
2078 return instr->RequiresHoleCheck()
2084 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2085 LOperand* context = UseRegisterAtStart(instr->value());
2088 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2095 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2098 if (instr->NeedsWriteBarrier()) {
2099 context = UseTempRegister(instr->context());
2100 value = UseTempRegister(instr->value());
2102 context = UseRegister(instr->context());
2103 value = UseRegister(instr->value());
2106 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2113 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2114 LOperand* obj = UseRegisterAtStart(instr->object());
2119 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2120 LOperand* context = UseFixed(instr->context(), cp);
2122 UseFixed(instr->object(), LoadDescriptor::ReceiverRegister());
2130 return MarkAsCall(result, instr);
2135 HLoadFunctionPrototype* instr) {
2137 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2141 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2146 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2147 DCHECK(instr->key()->representation().IsSmiOrInteger32());
2148 ElementsKind elements_kind = instr->elements_kind();
2149 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2152 if (!instr->is_typed_elements()) {
2154 if (instr->representation().IsDouble()) {
2155 obj = UseRegister(instr->elements());
2157 DCHECK(instr->representation().IsSmiOrTagged());
2158 obj = UseRegisterAtStart(instr->elements());
2163 (instr->representation().IsInteger32() &&
2165 (instr->representation().IsDouble() &&
2167 LOperand* backing_store = UseRegister(instr->elements());
2171 if ((instr->is_external() || instr->is_fixed_typed_array()) ?
2175 !instr->CheckFlag(HInstruction::kUint32)) :
2178 instr->RequiresHoleCheck()) {
2185 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2186 LOperand* context = UseFixed(instr->context(), cp);
2188 UseFixed(instr->object(), LoadDescriptor::ReceiverRegister());
2189 LOperand* key = UseFixed(instr->key(), LoadDescriptor::NameRegister());
2198 return MarkAsCall(result, instr);
2202 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2203 if (!instr->is_typed_elements()) {
2204 DCHECK(instr->elements()->representation().IsTagged());
2205 bool needs_write_barrier = instr->NeedsWriteBarrier();
2210 if (instr->value()->representation().IsDouble()) {
2211 object = UseRegisterAtStart(instr->elements());
2212 key = UseRegisterOrConstantAtStart(instr->key());
2213 val = UseRegister(instr->value());
2215 DCHECK(instr->value()->representation().IsSmiOrTagged());
2217 object = UseTempRegister(instr->elements());
2218 val = UseTempRegister(instr->value());
2219 key = UseTempRegister(instr->key());
2221 object = UseRegisterAtStart(instr->elements());
2222 val = UseRegisterAtStart(instr->value());
2223 key = UseRegisterOrConstantAtStart(instr->key());
2231 (instr->value()->representation().IsInteger32() &&
2232 !IsDoubleOrFloatElementsKind(instr->elements_kind())) ||
2233 (instr->value()->representation().IsDouble() &&
2234 IsDoubleOrFloatElementsKind(instr->elements_kind())));
2235 DCHECK((instr->is_fixed_typed_array() &&
2236 instr->elements()->representation().IsTagged()) ||
2237 (instr->is_external() &&
2238 instr->elements()->representation().IsExternal()));
2239 LOperand* val = UseRegister(instr->value());
2240 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2241 LOperand* backing_store = UseRegister(instr->elements());
2246 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2247 LOperand* context = UseFixed(instr->context(), cp);
2249 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister());
2250 LOperand* key = UseFixed(instr->key(), StoreDescriptor::NameRegister());
2251 LOperand* val = UseFixed(instr->value(), StoreDescriptor::ValueRegister());
2253 DCHECK(instr->object()->representation().IsTagged());
2254 DCHECK(instr->key()->representation().IsTagged());
2255 DCHECK(instr->value()->representation().IsTagged());
2258 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr);
2263 HTransitionElementsKind* instr) {
2264 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2265 LOperand* object = UseRegister(instr->object());
2271 LOperand* object = UseFixed(instr->object(), a0);
2272 LOperand* context = UseFixed(instr->context(), cp);
2275 return MarkAsCall(result, instr);
2281 HTrapAllocationMemento* instr) {
2282 LOperand* object = UseRegister(instr->object());
2290 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2291 bool is_in_object = instr->access().IsInobject();
2292 bool needs_write_barrier = instr->NeedsWriteBarrier();
2293 bool needs_write_barrier_for_map = instr->has_transition() &&
2294 instr->NeedsWriteBarrierForMap();
2299 ? UseRegister(instr->object())
2300 : UseTempRegister(instr->object());
2303 ? UseRegister(instr->object())
2304 : UseRegisterAtStart(instr->object());
2309 val = UseTempRegister(instr->value());
2310 } else if (instr->field_representation().IsDouble()) {
2311 val = UseRegisterAtStart(instr->value());
2313 val = UseRegister(instr->value());
2323 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2324 LOperand* context = UseFixed(instr->context(), cp);
2326 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister());
2327 LOperand* val = UseFixed(instr->value(), StoreDescriptor::ValueRegister());
2330 return MarkAsCall(result, instr);
2334 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2335 LOperand* context = UseFixed(instr->context(), cp);
2336 LOperand* left = UseFixed(instr->left(), a1);
2337 LOperand* right = UseFixed(instr->right(), a0);
2340 instr);
2344 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2345 LOperand* string = UseTempRegister(instr->string());
2346 LOperand* index = UseTempRegister(instr->index());
2347 LOperand* context = UseAny(instr->context());
2354 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2355 LOperand* char_code = UseRegister(instr->value());
2356 LOperand* context = UseAny(instr->context());
2363 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2365 LOperand* context = UseAny(instr->context());
2366 LOperand* size = UseRegisterOrConstant(instr->size());
2374 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2375 LOperand* context = UseFixed(instr->context(), cp);
2377 DefineFixed(new(zone()) LRegExpLiteral(context), v0), instr);
2381 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2382 LOperand* context = UseFixed(instr->context(), cp);
2384 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr);
2388 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2391 current_block_->last_environment()->set_ast_id(instr->ast_id());
2396 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2398 if (instr->kind() == HParameter::STACK_PARAMETER) {
2399 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2405 int index = static_cast<int>(instr->index());
2412 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2415 int env_index = instr->index();
2417 if (instr->environment()->is_parameter_index(env_index)) {
2420 spill_index = env_index - instr->environment()->first_local_index();
2430 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2431 LOperand* context = UseFixed(instr->context(), cp);
2432 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr);
2436 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2445 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2446 instr->ReplayEnvironment(current_block_->last_environment());
2453 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2455 LOperand* args = UseRegister(instr->arguments());
2456 LOperand* length = UseRegisterOrConstantAtStart(instr->length());
2457 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
2462 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2463 LOperand* object = UseFixed(instr->value(), a0);
2465 return MarkAsCall(DefineFixed(result, v0), instr);
2469 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2470 LOperand* context = UseFixed(instr->context(), cp);
2471 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0));
2472 return MarkAsCall(DefineFixed(result, v0), instr);
2476 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2477 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2482 HIsConstructCallAndBranch* instr) {
2487 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2488 instr->ReplayEnvironment(current_block_->last_environment());
2493 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2494 if (instr->is_function_entry()) {
2495 LOperand* context = UseFixed(instr->context(), cp);
2496 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2498 DCHECK(instr->is_backwards_branch());
2499 LOperand* context = UseAny(instr->context());
2506 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2508 outer->set_ast_id(instr->ReturnId());
2510 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2511 instr->arguments_count(),
2512 instr->function(),
2514 instr->inlining_kind());
2516 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2517 inner->Bind(instr->arguments_var(), instr->arguments_object());
2519 inner->BindContext(instr->closure_context());
2520 inner->set_entry(instr);
2522 chunk_->AddInlinedClosure(instr->closure());
2527 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2535 DCHECK(instr->argument_delta() == -argument_count);
2546 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2547 LOperand* context = UseFixed(instr->context(), cp);
2548 LOperand* object = UseFixed(instr->enumerable(), a0);
2550 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
2554 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2555 LOperand* map = UseRegister(instr->map());
2560 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2561 LOperand* value = UseRegisterAtStart(instr->value());
2562 LOperand* map = UseRegisterAtStart(instr->map());
2567 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2568 LOperand* object = UseRegister(instr->object());
2569 LOperand* index = UseTempRegister(instr->index());
2577 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2578 LOperand* context = UseRegisterAtStart(instr->context());
2584 HAllocateBlockContext* instr) {
2585 LOperand* context = UseFixed(instr->context(), cp);
2586 LOperand* function = UseRegisterAtStart(instr->function());
2589 return MarkAsCall(DefineFixed(result, cp), instr);