Home | History | Annotate | Download | only in mips

Lines Matching refs:instr

163 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
529 HInstruction* instr = HInstruction::cast(value);
530 VisitInstruction(instr);
537 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
540 instr->set_result(result);
541 return instr;
546 LTemplateResultInstruction<1>* instr) {
547 return Define(instr,
553 LTemplateResultInstruction<1>* instr, int index) {
554 return Define(instr,
560 LTemplateResultInstruction<1>* instr) {
561 return Define(instr,
567 LTemplateResultInstruction<1>* instr, Register reg) {
568 return Define(instr, ToUnallocated(reg));
573 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
574 return Define(instr, ToUnallocated(reg));
578 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
582 instr->set_environment(CreateEnvironment(hydrogen_env,
585 return instr;
589 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
594 instr->VerifyCall();
596 instr->MarkAsCall();
597 instr = AssignPointerMap(instr);
606 if (needs_environment && !instr->HasEnvironment()) {
607 instr = AssignEnvironment(instr);
609 instr
612 return instr;
616 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
617 ASSERT(!instr->HasPointerMap());
618 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
619 return instr;
663 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
664 return new(zone()) LLabel(instr->block());
668 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
669 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
673 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
679 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
685 HBitwiseBinaryOperation* instr) {
686 if (instr->representation().IsSmiOrInteger32()) {
687 ASSERT(instr->left()->representation().Equals(instr->representation()));
688 ASSERT(instr->right()->representation().Equals(instr->representation()));
689 LOperand* left = UseRegisterAtStart(instr->left());
691 HValue* right_value = instr->right();
701 if (instr->representation().IsSmi() && constant_value > 0) {
702 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
712 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
714 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
722 return DoArithmeticT(op, instr);
728 HArithmeticBinaryOperation* instr) {
729 ASSERT(instr->representation().IsDouble());
730 ASSERT(instr->left()->representation().IsDouble());
731 ASSERT(instr->right()->representation().IsDouble());
733 LOperand* left = UseFixedDouble(instr->left(), f2);
734 LOperand* right = UseFixedDouble(instr->right(), f4);
739 return MarkAsCall(DefineFixedDouble(result, f2), instr);
741 LOperand* left = UseRegisterAtStart(instr->left());
742 LOperand* right = UseRegisterAtStart(instr->right());
750 HBinaryOperation* instr) {
751 HValue* left = instr->left();
752 HValue* right = instr->right();
755 LOperand* context = UseFixed(instr->context(), cp);
760 return MarkAsCall(DefineFixed(result, v0), instr);
835 LInstruction* instr = NULL;
838 instr = DefineAsRegister(new(zone()) LDummy());
841 instr = DefineAsRegister(new(zone())
856 instr = new(zone()) LGoto(successor);
858 instr = current->CompileToLithium(this);
865 if (instr != NULL) {
866 AddInstruction(instr, current);
873 void LChunkBuilder::AddInstruction(LInstruction* instr,
877 instr->set_hydrogen_value(hydrogen_val);
890 if (!(instr->ClobbersRegisters() &&
891 instr->ClobbersDoubleRegisters(isolate()))) {
894 for (UseIterator it(instr); !it.Done(); it.Advance()) {
898 if (instr->Output() != NULL) {
899 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
901 for (TempIterator it(instr); !it.Done(); it.Advance()) {
909 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
910 instr = AssignPointerMap(instr);
912 if (FLAG_stress_environments && !instr->HasEnvironment()) {
913 instr = AssignEnvironment(instr);
915 chunk_->AddInstruction(instr, current_block_);
917 if (instr->IsCall()) {
922 instruction_needing_environment = instr;
939 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
940 return new(zone()) LGoto(instr->FirstSuccessor());
944 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
945 HValue* value = instr->value();
948 ToBooleanStub::Types expected = instr->expected_input_types();
963 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
964 ASSERT(instr->value()->representation().IsTagged());
965 LOperand* value = UseRegisterAtStart(instr->value());
984 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
985 LOperand* context = UseFixed(instr->context(), cp);
987 new(zone()) LInstanceOf(context, UseFixed(instr->left(), a0),
988 UseFixed(instr->right(), a1));
989 return MarkAsCall(DefineFixed(result, v0), instr);
994 HInstanceOfKnownGlobal* instr) {
997 UseFixed(instr->context(), cp),
998 UseFixed(instr->left(), a0),
1000 return MarkAsCall(DefineFixed(result, v0), instr);
1004 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1005 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1006 LOperand* function = UseRegisterAtStart(instr->function());
1012 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1013 LOperand* function = UseFixed(instr->function(), a1);
1014 LOperand* receiver = UseFixed(instr->receiver(), a0);
1015 LOperand* length = UseFixed(instr->length(), a2);
1016 LOperand* elements = UseFixed(instr->elements(), a3);
1021 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1025 LInstruction* LChunkBuilder::DoPushArguments(HPushArguments* instr) {
1026 int argc = instr->OperandCount();
1028 LOperand* argument = Use(instr->argument(i));
1029 AddInstruction(new(zone()) LPushArgument(argument), instr);
1044 HInnerAllocatedObject* instr) {
1045 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1046 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1052 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1053 return instr->HasNoUses()
1059 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1060 if (instr->HasNoUses()) return NULL;
1070 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1071 LOperand* context = UseFixed(instr->context(), cp);
1072 instr);
1077 HCallJSFunction* instr) {
1078 LOperand* function = UseFixed(instr->function(), a1);
1082 return MarkAsCall(DefineFixed(result, v0), instr);
1087 HCallWithDescriptor* instr) {
1088 const CallInterfaceDescriptor* descriptor = instr->descriptor();
1090 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1091 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1093 for (int i = 1; i < instr->OperandCount(); i++) {
1094 LOperand* op = UseFixed(instr->OperandAt(i),
1101 return MarkAsCall(DefineFixed(result, v0), instr);
1105 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1106 LOperand* context = UseFixed(instr->context(), cp);
1107 LOperand* function = UseFixed(instr->function(), a1);
1109 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1113 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1114 switch (instr->op()) {
1115 case kMathFloor: return DoMathFloor(instr);
1116 case kMathRound: return DoMathRound(instr);
1117 case kMathAbs: return DoMathAbs(instr);
1118 case kMathLog: return DoMathLog(instr);
1119 case kMathExp: return DoMathExp(instr);
1120 case kMathSqrt: return DoMathSqrt(instr);
1121 case kMathPowHalf: return DoMathPowHalf(instr);
1122 case kMathClz32: return DoMathClz32(instr);
1130 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1131 ASSERT(instr->representation().IsDouble());
1132 ASSERT(instr->value()->representation().IsDouble());
1133 LOperand* input = UseFixedDouble(instr->value(), f4);
1134 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr);
1138 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
1139 LOperand* input = UseRegisterAtStart(instr->value());
1145 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1146 ASSERT(instr->representation().IsDouble());
1147 ASSERT(instr->value()->representation().IsDouble());
1148 LOperand* input = UseRegister(instr->value());
1157 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1159 LOperand* input = UseFixedDouble(instr->value(), f8);
1166 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1167 Representation r = instr->value()->representation();
1170 : UseFixed(instr->context(), cp);
1171 LOperand* input = UseRegister(instr->value());
1180 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1181 LOperand* input = UseRegister(instr->value());
1188 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1189 LOperand* input = UseRegister(instr->value());
1195 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1196 LOperand* input = UseRegister(instr->value());
1203 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1204 LOperand* context = UseFixed(instr->context(), cp);
1205 LOperand* constructor = UseFixed(instr->constructor(), a1);
1207 return MarkAsCall(DefineFixed(result, v0), instr);
1211 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1212 LOperand* context = UseFixed(instr->context(), cp);
1213 LOperand* constructor = UseFixed(instr->constructor(), a1);
1215 return MarkAsCall(DefineFixed(result, v0), instr);
1219 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1220 LOperand* context = UseFixed(instr->context(), cp);
1221 LOperand* function = UseFixed(instr->function(), a1);
1223 return MarkAsCall(DefineFixed(call, v0), instr);
1227 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1228 LOperand* context = UseFixed(instr->context(), cp);
1229 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr);
1233 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1234 return DoShift(Token::ROR, instr);
1238 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1239 return DoShift(Token::SHR, instr);
1243 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1244 return DoShift(Token::SAR, instr);
1248 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1249 return DoShift(Token::SHL, instr);
1253 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1254 if (instr->representation().IsSmiOrInteger32()) {
1255 ASSERT(instr->left()->representation().Equals(instr->representation()));
1256 ASSERT(instr->right()->representation().Equals(instr->representation()));
1257 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32));
1259 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1260 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1263 return DoArithmeticT(instr->op(), instr);
1268 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1269 ASSERT(instr->representation().IsSmiOrInteger32());
1270 ASSERT(instr->left()->representation().Equals(instr->representation()));
1271 ASSERT(instr->right()->representation().Equals(instr->representation()));
1272 LOperand* dividend = UseRegister(instr->left());
1273 int32_t divisor = instr->right()->GetInteger32Constant();
1276 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1277 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1278 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1286 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1287 ASSERT(instr->representation().IsInteger32());
1288 ASSERT(instr->left()->representation().Equals(instr->representation()));
1289 ASSERT(instr->right()->representation().Equals(instr->representation()));
1290 LOperand* dividend = UseRegister(instr->left());
1291 int32_t divisor = instr->right()->GetInteger32Constant();
1295 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1296 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1303 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1304 ASSERT(instr->representation().IsSmiOrInteger32());
1305 ASSERT(instr->left()->representation().Equals(instr->representation()));
1306 ASSERT(instr->right()->representation().Equals(instr->representation()));
1307 LOperand* dividend = UseRegister(instr->left());
1308 LOperand* divisor = UseRegister(instr->right());
1311 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1312 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1313 (instr->CheckFlag(HValue::kCanOverflow) &&
1314 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) ||
1315 (!instr->IsMathFloorOfDiv() &&
1316 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1323 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1324 if (instr->representation().IsSmiOrInteger32()) {
1325 if (instr->RightIsPowerOf2()) {
1326 return DoDivByPowerOf2I(instr);
1327 } else if (instr->right()->IsConstant()) {
1328 return DoDivByConstI(instr);
1330 return DoDivI(instr);
1332 } else if (instr->representation().IsDouble()) {
1333 return DoArithmeticD(Token::DIV, instr);
1335 return DoArithmeticT(Token::DIV, instr);
1340 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1341 LOperand* dividend = UseRegisterAtStart(instr->left());
1342 int32_t divisor = instr->right()->GetInteger32Constant();
1345 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1346 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1353 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1354 ASSERT(instr->representation().IsInteger32());
1355 ASSERT(instr->left()->representation().Equals(instr->representation()));
1356 ASSERT(instr->right()->representation().Equals(instr->representation()));
1357 LOperand* dividend = UseRegister(instr->left());
1358 int32_t divisor = instr->right()->GetInteger32Constant();
1360 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) ||
1361 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ?
1366 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1373 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1374 ASSERT(instr->representation().IsSmiOrInteger32());
1375 ASSERT(instr->left()->representation().Equals(instr->representation()));
1376 ASSERT(instr->right()->representation().Equals(instr->representation()));
1377 LOperand* dividend = UseRegister(instr->left());
1378 LOperand* divisor = UseRegister(instr->right());
1384 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1385 if (instr->RightIsPowerOf2()) {
1386 return DoFlooringDivByPowerOf2I(instr);
1387 } else if (instr->right()->IsConstant()) {
1388 return DoFlooringDivByConstI(instr);
1390 return DoFlooringDivI(instr);
1395 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1396 ASSERT(instr->representation().IsSmiOrInteger32());
1397 ASSERT(instr->left()->representation().Equals(instr->representation()));
1398 ASSERT(instr->right()->representation().Equals(instr->representation()));
1399 LOperand* dividend = UseRegisterAtStart(instr->left());
1400 int32_t divisor = instr->right()->GetInteger32Constant();
1403 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1410 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1411 ASSERT(instr->representation().IsSmiOrInteger32());
1412 ASSERT(instr->left()->representation().Equals(instr->representation()));
1413 ASSERT(instr->right()->representation().Equals(instr->representation()));
1414 LOperand* dividend = UseRegister(instr->left());
1415 int32_t divisor = instr->right()->GetInteger32Constant();
1418 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1425 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1426 ASSERT(instr->representation().IsSmiOrInteger32());
1427 ASSERT(instr->left()->representation().Equals(instr->representation()));
1428 ASSERT(instr->right()->representation().Equals(instr->representation()));
1429 LOperand* dividend = UseRegister(instr->left());
1430 LOperand* divisor = UseRegister(instr->right());
1433 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1434 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1441 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1442 if (instr->representation().IsSmiOrInteger32()) {
1443 return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr);
1444 } else if (instr->representation().IsDouble()) {
1445 return DoArithmeticD(Token::MOD, instr);
1447 return DoArithmeticT(Token::MOD, instr);
1452 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1453 if (instr->representation().IsSmiOrInteger32()) {
1454 ASSERT(instr->left()->representation().Equals(instr->representation()));
1455 ASSERT(instr->right()->representation().Equals(instr->representation()));
1456 HValue* left = instr->BetterLeftOperand();
1457 HValue* right = instr->BetterRightOperand();
1460 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1461 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1493 } else if (instr->representation().IsDouble()) {
1495 if (instr->UseCount() == 1 && instr->uses().value()->IsAdd()) {
1496 HAdd* add = HAdd::cast(instr->uses().value());
1497 if (instr == add->left()) {
1502 if (instr == add->right() && !add->left()->IsMul()) {
1509 return DoArithmeticD(Token::MUL, instr);
1511 return DoArithmeticT(Token::MUL, instr);
1516 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1517 if (instr->representation().IsSmiOrInteger32()) {
1518 ASSERT(instr->left()->representation().Equals(instr->representation()));
1519 ASSERT(instr->right()->representation().Equals(instr->representation()));
1520 LOperand* left = UseRegisterAtStart(instr->left());
1521 LOperand* right = UseOrConstantAtStart(instr->right());
1524 if (instr->CheckFlag(HValue::kCanOverflow)) {
1528 } else if (instr->representation().IsDouble()) {
1529 return DoArithmeticD(Token::SUB, instr);
1531 return DoArithmeticT(Token::SUB, instr);
1545 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1546 if (instr->representation().IsSmiOrInteger32()) {
1547 ASSERT(instr->left()->representation().Equals(instr->representation()));
1548 ASSERT(instr->right()->representation().Equals(instr->representation()));
1549 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1550 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1553 if (instr->CheckFlag(HValue::kCanOverflow)) {
1557 } else if (instr->representation().IsExternal()) {
1558 ASSERT(instr->left()->representation().IsExternal());
1559 ASSERT(instr->right()->representation().IsInteger32());
1560 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1561 LOperand* left = UseRegisterAtStart(instr->left());
1562 LOperand* right = UseOrConstantAtStart(instr->right());
1566 } else if (instr->representation().IsDouble()) {
1568 if (instr->left()->IsMul())
1569 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1571 if (instr->right()->IsMul()) {
1572 ASSERT(!instr->left()->IsMul());
1573 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1576 return DoArithmeticD(Token::ADD, instr);
1578 return DoArithmeticT(Token::ADD, instr);
1583 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1586 if (instr->representation().IsSmiOrInteger32()) {
1587 ASSERT(instr->left()->representation().Equals(instr->representation()));
1588 ASSERT(instr->right()->representation().Equals(instr->representation()));
1589 left = UseRegisterAtStart(instr->BetterLeftOperand());
1590 right = UseOrConstantAtStart(instr->BetterRightOperand());
1592 ASSERT(instr->representation().IsDouble());
1593 ASSERT(instr->left()->representation().IsDouble());
1594 ASSERT(instr->right()->representation().IsDouble());
1595 left = UseRegisterAtStart(instr->left());
1596 right = UseRegisterAtStart(instr->right());
1602 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1603 ASSERT(instr->representation().IsDouble());
1606 Representation exponent_type = instr->right()->representation();
1607 ASSERT(instr->left()->representation().IsDouble());
1608 LOperand* left = UseFixedDouble(instr->left(), f2);
1610 UseFixedDouble(instr->right(), f4) :
1611 UseFixed(instr->right(), a2);
1614 instr,
1619 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1620 ASSERT(instr->left()->representation().IsTagged());
1621 ASSERT(instr->right()->representation().IsTagged());
1622 LOperand* context = UseFixed(instr->context(), cp);
1623 LOperand* left = UseFixed(instr->left(), a1);
1624 LOperand* right = UseFixed(instr->right(), a0);
1626 return MarkAsCall(DefineFixed(result, v0), instr);
1631 HCompareNumericAndBranch* instr) {
1632 Representation r = instr->representation();
1634 ASSERT(instr->left()->representation().Equals(r));
1635 ASSERT(instr->right()->representation().Equals(r));
1636 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1637 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1641 ASSERT(instr->left()->representation().IsDouble());
1642 ASSERT(instr->right()->representation().IsDouble());
1643 LOperand* left = UseRegisterAtStart(instr->left());
1644 LOperand* right = UseRegisterAtStart(instr->right());
1651 HCompareObjectEqAndBranch* instr) {
1652 LOperand* left = UseRegisterAtStart(instr->left());
1653 LOperand* right = UseRegisterAtStart(instr->right());
1659 HCompareHoleAndBranch* instr) {
1660 LOperand* value = UseRegisterAtStart(instr->value());
1666 HCompareMinusZeroAndBranch* instr) {
1667 LOperand* value = UseRegister(instr->value());
1673 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1674 ASSERT(instr->value()->representation().IsTagged());
1676 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1681 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1682 ASSERT(instr->value()->representation().IsTagged());
1684 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1689 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1690 ASSERT(instr->value()->representation().IsTagged());
1691 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1696 HIsUndetectableAndBranch* instr) {
1697 ASSERT(instr->value()->representation().IsTagged());
1699 UseRegisterAtStart(instr->value()), TempRegister());
1704 HStringCompareAndBranch* instr) {
1705 ASSERT(instr->left()->representation().IsTagged());
1706 ASSERT(instr->right()->representation().IsTagged());
1707 LOperand* context = UseFixed(instr->context(), cp);
1708 LOperand* left = UseFixed(instr->left(), a1);
1709 LOperand* right = UseFixed(instr->right(), a0);
1712 return MarkAsCall(result, instr);
1717 HHasInstanceTypeAndBranch* instr) {
1718 ASSERT(instr->value()->representation().IsTagged());
1719 LOperand* value = UseRegisterAtStart(instr->value());
1725 HGetCachedArrayIndex* instr) {
1726 ASSERT(instr->value()->representation().IsTagged());
1727 LOperand* value = UseRegisterAtStart(instr->value());
1734 HHasCachedArrayIndexAndBranch* instr) {
1735 ASSERT(instr->value()->representation().IsTagged());
1737 UseRegisterAtStart(instr->value()));
1742 HClassOfTestAndBranch* instr) {
1743 ASSERT(instr->value()->representation().IsTagged());
1744 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1749 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1750 LOperand* map = UseRegisterAtStart(instr->value());
1755 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1756 LOperand* object = UseFixed(instr->value(), a0);
1758 new(zone()) LDateField(object, FixedTemp(a1), instr->index());
1759 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1763 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1764 LOperand* string = UseRegisterAtStart(instr->string());
1765 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1770 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1771 LOperand* string = UseRegisterAtStart(instr->string());
1773 ? UseRegisterAtStart(instr->index())
1774 : UseRegisterOrConstantAtStart(instr->index());
1775 LOperand* value = UseRegisterAtStart(instr->value());
1776 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL;
1781 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1782 if (!FLAG_debug_code && instr->skip_check()) return NULL;
1783 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1785 ? UseRegisterOrConstantAtStart(instr->length())
1786 : UseRegisterAtStart(instr->length());
1788 if (!FLAG_debug_code || !instr->skip_check()) {
1796 HBoundsCheckBaseIndexInformation* instr) {
1802 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1809 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1822 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1823 Representation from = instr->from();
1824 Representation to = instr->to();
1825 HValue* val = instr->value();
1877 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result);
1883 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1902 if (instr->CheckFlag(HValue::kCanOverflow)) {
1920 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1921 LOperand* value = UseRegisterAtStart(instr->value());
1923 if (!instr->value()->type().IsHeapObject()) {
1930 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1931 LOperand* value = UseRegisterAtStart(instr->value());
1936 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1937 LOperand* value = UseRegisterAtStart(instr->value());
1943 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
1944 LOperand* value = UseRegisterAtStart(instr->value());
1949 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1950 if (instr->IsStabilityCheck()) return new(zone()) LCheckMaps;
1951 LOperand* value = UseRegisterAtStart(instr->value());
1953 if (instr->HasMigrationTarget()) {
1961 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1962 HValue* value = instr->value();
1980 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
1981 HValue* value = instr->value();
1987 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
1988 LOperand* lo = UseRegister(instr->lo());
1989 LOperand* hi = UseRegister(instr->hi());
1994 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1996 ? UseFixed(instr->context(), cp)
1998 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1999 return new(zone()) LReturn(UseFixed(instr->value(), v0), context,
2004 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2005 Representation r = instr->representation();
2023 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2025 return instr->RequiresHoleCheck()
2031 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2032 LOperand* context = UseFixed(instr->context(), cp);
2033 LOperand* global_object = UseFixed(instr->global_object(), a0);
2036 return MarkAsCall(DefineFixed(result, v0), instr);
2040 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2041 LOperand* value = UseRegister(instr->value());
2044 return instr->RequiresHoleCheck()
2050 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2051 LOperand* context = UseRegisterAtStart(instr->value());
2054 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2061 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2064 if (instr->NeedsWriteBarrier()) {
2065 context = UseTempRegister(instr->context());
2066 value = UseTempRegister(instr->value());
2068 context = UseRegister(instr->context());
2069 value = UseRegister(instr->value());
2072 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2079 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2080 LOperand* obj = UseRegisterAtStart(instr->object());
2085 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2086 LOperand* context = UseFixed(instr->context(), cp);
2087 LOperand* object = UseFixed(instr->object(), a0);
2090 return MarkAsCall(result, instr);
2095 HLoadFunctionPrototype* instr) {
2097 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2101 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2106 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2107 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2108 ElementsKind elements_kind = instr->elements_kind();
2109 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2112 if (!instr->is_typed_elements()) {
2114 if (instr->representation().IsDouble()) {
2115 obj = UseRegister(instr->elements());
2117 ASSERT(instr->representation().IsSmiOrTagged());
2118 obj = UseRegisterAtStart(instr->elements());
2123 (instr->representation().IsInteger32() &&
2125 (instr->representation().IsDouble() &&
2127 LOperand* backing_store = UseRegister(instr->elements());
2131 if ((instr->is_external() || instr->is_fixed_typed_array()) ?
2135 !instr->CheckFlag(HInstruction::kUint32)) :
2138 instr->RequiresHoleCheck()) {
2145 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2146 LOperand* context = UseFixed(instr->context(), cp);
2147 LOperand* object = UseFixed(instr->object(), a1);
2148 LOperand* key = UseFixed(instr->key(), a0);
2152 return MarkAsCall(result, instr);
2156 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2157 if (!instr->is_typed_elements()) {
2158 ASSERT(instr->elements()->representation().IsTagged());
2159 bool needs_write_barrier = instr->NeedsWriteBarrier();
2164 if (instr->value()->representation().IsDouble()) {
2165 object = UseRegisterAtStart(instr->elements());
2166 key = UseRegisterOrConstantAtStart(instr->key());
2167 val = UseRegister(instr->value());
2169 ASSERT(instr->value()->representation().IsSmiOrTagged());
2171 object = UseTempRegister(instr->elements());
2172 val = UseTempRegister(instr->value());
2173 key = UseTempRegister(instr->key());
2175 object = UseRegisterAtStart(instr->elements());
2176 val = UseRegisterAtStart(instr->value());
2177 key = UseRegisterOrConstantAtStart(instr->key());
2185 (instr->value()->representation().IsInteger32() &&
2186 !IsDoubleOrFloatElementsKind(instr->elements_kind())) ||
2187 (instr->value()->representation().IsDouble() &&
2188 IsDoubleOrFloatElementsKind(instr->elements_kind())));
2189 ASSERT((instr->is_fixed_typed_array() &&
2190 instr->elements()->representation().IsTagged()) ||
2191 (instr->is_external() &&
2192 instr->elements()->representation().IsExternal()));
2193 LOperand* val = UseRegister(instr->value());
2194 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2195 LOperand* backing_store = UseRegister(instr->elements());
2200 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2201 LOperand* context = UseFixed(instr->context(), cp);
2202 LOperand* obj = UseFixed(instr->object(), a2);
2203 LOperand* key = UseFixed(instr->key(), a1);
2204 LOperand* val = UseFixed(instr->value(), a0);
2206 ASSERT(instr->object()->representation().IsTagged());
2207 ASSERT(instr->key()->representation().IsTagged());
2208 ASSERT(instr->value()->representation().IsTagged());
2211 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr);
2216 HTransitionElementsKind* instr) {
2217 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2218 LOperand* object = UseRegister(instr->object());
2224 LOperand* object = UseFixed(instr->object(), a0);
2225 LOperand* context = UseFixed(instr->context(), cp);
2228 return MarkAsCall(result, instr);
2234 HTrapAllocationMemento* instr) {
2235 LOperand* object = UseRegister(instr->object());
2243 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2244 bool is_in_object = instr->access().IsInobject();
2245 bool needs_write_barrier = instr->NeedsWriteBarrier();
2246 bool needs_write_barrier_for_map = instr->has_transition() &&
2247 instr->NeedsWriteBarrierForMap();
2252 ? UseRegister(instr->object())
2253 : UseTempRegister(instr->object());
2256 ? UseRegister(instr->object())
2257 : UseRegisterAtStart(instr->object());
2261 if (needs_write_barrier || instr->field_representation().IsSmi()) {
2262 val = UseTempRegister(instr->value());
2263 } else if (instr->field_representation().IsDouble()) {
2264 val = UseRegisterAtStart(instr->value());
2266 val = UseRegister(instr->value());
2276 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2277 LOperand* context = UseFixed(instr->context(), cp);
2278 LOperand* obj = UseFixed(instr->object(), a1);
2279 LOperand* val = UseFixed(instr->value(), a0);
2282 return MarkAsCall(result, instr);
2286 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2287 LOperand* context = UseFixed(instr->context(), cp);
2288 LOperand* left = UseFixed(instr->left(), a1);
2289 LOperand* right = UseFixed(instr->right(), a0);
2292 instr);
2296 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2297 LOperand* string = UseTempRegister(instr->string());
2298 LOperand* index = UseTempRegister(instr->index());
2299 LOperand* context = UseAny(instr->context());
2306 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2307 LOperand* char_code = UseRegister(instr->value());
2308 LOperand* context = UseAny(instr->context());
2315 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2317 LOperand* context = UseAny(instr->context());
2318 LOperand* size = instr->size()->IsConstant()
2319 ? UseConstant(instr->size())
2320 : UseTempRegister(instr->size());
2328 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2329 LOperand* context = UseFixed(instr->context(), cp);
2331 DefineFixed(new(zone()) LRegExpLiteral(context), v0), instr);
2335 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2336 LOperand* context = UseFixed(instr->context(), cp);
2338 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr);
2342 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2345 current_block_->last_environment()->set_ast_id(instr->ast_id());
2350 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2352 if (instr->kind() == HParameter::STACK_PARAMETER) {
2353 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2359 int index = static_cast<int>(instr->index());
2366 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2369 int env_index = instr->index();
2371 if (instr->environment()->is_parameter_index(env_index)) {
2374 spill_index = env_index - instr->environment()->first_local_index();
2384 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2385 LOperand* context = UseFixed(instr->context(), cp);
2386 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr);
2390 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2399 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2400 instr->ReplayEnvironment(current_block_->last_environment());
2407 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2409 LOperand* args = UseRegister(instr->arguments());
2410 LOperand* length = UseRegisterOrConstantAtStart(instr->length());
2411 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
2416 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2417 LOperand* object = UseFixed(instr->value(), a0);
2419 return MarkAsCall(DefineFixed(result, v0), instr);
2423 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2424 LOperand* context = UseFixed(instr->context(), cp);
2425 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0));
2426 return MarkAsCall(DefineFixed(result, v0), instr);
2430 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2431 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2436 HIsConstructCallAndBranch* instr) {
2441 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2442 instr->ReplayEnvironment(current_block_->last_environment());
2447 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2448 if (instr->is_function_entry()) {
2449 LOperand* context = UseFixed(instr
2450 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2452 ASSERT(instr->is_backwards_branch());
2453 LOperand* context = UseAny(instr->context());
2460 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2462 outer->set_ast_id(instr->ReturnId());
2464 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2465 instr->arguments_count(),
2466 instr->function(),
2468 instr->inlining_kind());
2470 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2471 inner->Bind(instr->arguments_var(), instr->arguments_object());
2473 inner->set_entry(instr);
2475 chunk_->AddInlinedClosure(instr->closure());
2480 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2488 ASSERT(instr->argument_delta() == -argument_count);
2499 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2500 LOperand* context = UseFixed(instr->context(), cp);
2501 LOperand* object = UseFixed(instr->enumerable(), a0);
2503 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
2507 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2508 LOperand* map = UseRegister(instr->map());
2513 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2514 LOperand* value = UseRegisterAtStart(instr->value());
2515 LOperand* map = UseRegisterAtStart(instr->map());
2520 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2521 LOperand* object = UseRegister(instr->object());
2522 LOperand* index = UseTempRegister(instr->index());
2530 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2531 LOperand* context = UseRegisterAtStart(instr->context());
2537 HAllocateBlockContext* instr) {
2538 LOperand* context = UseFixed(instr->context(), cp);
2539 LOperand* function = UseRegisterAtStart(instr->function());
2542 return MarkAsCall(DefineFixed(result, cp), instr);