Home | History | Annotate | Download | only in x64

Lines Matching refs:instr

547     HInstruction* instr = HInstruction::cast(value);
548 VisitInstruction(instr);
555 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
558 instr->set_result(result);
559 return instr;
564 LTemplateResultInstruction<1>* instr) {
565 return Define(instr,
571 LTemplateResultInstruction<1>* instr,
573 return Define(instr,
579 LTemplateResultInstruction<1>* instr) {
580 return Define(instr,
585 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr,
587 return Define(instr, ToUnallocated(reg));
592 LTemplateResultInstruction<1>* instr,
594 return Define(instr, ToUnallocated(reg));
598 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
602 instr->set_environment(CreateEnvironment(hydrogen_env,
605 return instr;
609 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
615 instr->VerifyCall();
617 instr->MarkAsCall();
618 instr = AssignPointerMap(instr);
627 if (needs_environment && !instr->HasEnvironment()) {
628 instr = AssignEnvironment(instr);
630 instr->environment()->set_has_been_used();
633 return instr;
637 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
638 ASSERT(!instr->HasPointerMap());
639 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
640 return instr;
671 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
672 return new(zone()) LLabel(instr->block());
676 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
677 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
681 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
687 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
693 HBitwiseBinaryOperation* instr) {
694 if (instr->representation().IsSmiOrInteger32()) {
695 ASSERT(instr->left()->representation().Equals(instr->representation()));
696 ASSERT(instr->right()->representation().Equals(instr->representation()));
697 LOperand* left = UseRegisterAtStart(instr->left());
699 HValue* right_value = instr->right();
707 if (SmiValuesAre31Bits() && instr->representation().IsSmi() &&
711 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
721 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
723 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
731 return DoArithmeticT(op, instr);
737 HArithmeticBinaryOperation* instr) {
738 ASSERT(instr->representation().IsDouble());
739 ASSERT(instr->left()->representation().IsDouble());
740 ASSERT(instr->right()->representation().IsDouble());
742 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
743 LOperand* right = UseFixedDouble(instr->BetterRightOperand(), xmm1);
745 return MarkAsCall(DefineSameAsFirst(result), instr);
747 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
748 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
756 HBinaryOperation* instr) {
757 HValue* left = instr->left();
758 HValue* right = instr->right();
761 LOperand* context = UseFixed(instr->context(), rsi);
766 return MarkAsCall(DefineFixed(result, rax), instr);
841 LInstruction* instr = NULL;
844 instr = DefineAsRegister(new(zone()) LDummy());
847 instr = DefineAsRegister(new(zone())
862 instr = new(zone()) LGoto(successor);
864 instr = current->CompileToLithium(this);
871 if (instr != NULL) {
872 AddInstruction(instr, current);
879 void LChunkBuilder::AddInstruction(LInstruction* instr,
883 instr->set_hydrogen_value(hydrogen_val);
896 if (!(instr->ClobbersRegisters() &&
897 instr->ClobbersDoubleRegisters(isolate()))) {
900 for (UseIterator it(instr); !it.Done(); it.Advance()) {
904 if (instr->Output() != NULL) {
905 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
907 for (TempIterator it(instr); !it.Done(); it.Advance()) {
915 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
916 instr = AssignPointerMap(instr);
918 if (FLAG_stress_environments && !instr->HasEnvironment()) {
919 instr = AssignEnvironment(instr);
921 chunk_->AddInstruction(instr, current_block_);
923 if (instr->IsCall()) {
928 instruction_needing_environment = instr;
945 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
946 return new(zone()) LGoto(instr->FirstSuccessor());
950 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
955 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
956 HValue* value = instr->value();
959 ToBooleanStub::Types expected = instr->expected_input_types();
974 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
975 ASSERT(instr->value()->representation().IsTagged());
976 LOperand* value = UseRegisterAtStart(instr->value());
993 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
994 LOperand* left = UseFixed(instr->left(), rax);
995 LOperand* right = UseFixed(instr->right(), rdx);
996 LOperand* context = UseFixed(instr->context(), rsi);
998 return MarkAsCall(DefineFixed(result, rax), instr);
1003 HInstanceOfKnownGlobal* instr) {
1005 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->context(), rsi),
1006 UseFixed(instr->left(), rax),
1008 return MarkAsCall(DefineFixed(result, rax), instr);
1012 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1013 LOperand* receiver = UseRegister(instr->receiver());
1014 LOperand* function = UseRegisterAtStart(instr->function());
1020 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1021 LOperand* function = UseFixed(instr->function(), rdi);
1022 LOperand* receiver = UseFixed(instr->receiver(), rax);
1023 LOperand* length = UseFixed(instr->length(), rbx);
1024 LOperand* elements = UseFixed(instr->elements(), rcx);
1029 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1033 LInstruction* LChunkBuilder::DoPushArguments(HPushArguments* instr) {
1034 int argc = instr->OperandCount();
1036 LOperand* argument = UseOrConstant(instr->argument(i));
1037 AddInstruction(new(zone()) LPushArgument(argument), instr);
1052 HInnerAllocatedObject* instr) {
1053 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1054 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1060 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1061 return instr->HasNoUses()
1067 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1068 if (instr->HasNoUses()) return NULL;
1078 instr) {
1079 LOperand* context = UseFixed(instr->context(), rsi);
1080 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1085 HCallJSFunction* instr) {
1086 LOperand* function = UseFixed(instr->function(), rdi);
1090 return MarkAsCall(DefineFixed(result, rax), instr);
1095 HCallWithDescriptor* instr) {
1096 const CallInterfaceDescriptor* descriptor = instr->descriptor();
1098 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1099 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1101 for (int i = 1; i < instr->OperandCount(); i++) {
1102 LOperand* op = UseFixed(instr->OperandAt(i),
1109 return MarkAsCall(DefineFixed(result, rax), instr);
1113 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1114 LOperand* context = UseFixed(instr->context(), rsi);
1115 LOperand* function = UseFixed(instr->function(), rdi);
1117 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1121 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1122 switch (instr->op()) {
1123 case kMathFloor: return DoMathFloor(instr);
1124 case kMathRound: return DoMathRound(instr);
1125 case kMathAbs: return DoMathAbs(instr);
1126 case kMathLog: return DoMathLog(instr);
1127 case kMathExp: return DoMathExp(instr);
1128 case kMathSqrt: return DoMathSqrt(instr);
1129 case kMathPowHalf: return DoMathPowHalf(instr);
1130 case kMathClz32: return DoMathClz32(instr);
1138 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1139 LOperand* input = UseRegisterAtStart(instr->value());
1145 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1146 LOperand* input = UseRegister(instr->value());
1153 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1154 LOperand* context = UseAny(instr->context());
1155 LOperand* input = UseRegisterAtStart(instr->value());
1158 Representation r = instr->value()->representation();
1165 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1166 ASSERT(instr->representation().IsDouble());
1167 ASSERT(instr->value()->representation().IsDouble());
1168 LOperand* input = UseRegisterAtStart(instr->value());
1169 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr);
1173 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
1174 LOperand* input = UseRegisterAtStart(instr->value());
1180 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1181 ASSERT(instr->representation().IsDouble());
1182 ASSERT(instr->value()->representation().IsDouble());
1183 LOperand* value = UseTempRegister(instr->value());
1191 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1192 LOperand* input = UseAtStart(instr->value());
1197 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1198 LOperand* input = UseRegisterAtStart(instr->value());
1204 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1205 LOperand* context = UseFixed(instr->context(), rsi);
1206 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1208 return MarkAsCall(DefineFixed(result, rax), instr);
1212 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1213 LOperand* context = UseFixed(instr->context(), rsi);
1214 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1216 return MarkAsCall(DefineFixed(result, rax), instr);
1220 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1221 LOperand* context = UseFixed(instr->context(), rsi);
1222 LOperand* function = UseFixed(instr->function(), rdi);
1224 return MarkAsCall(DefineFixed(call, rax), instr);
1228 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1229 LOperand* context = UseFixed(instr->context(), rsi);
1231 return MarkAsCall(DefineFixed(result, rax), instr);
1235 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1236 return DoShift(Token::ROR, instr);
1240 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1241 return DoShift(Token::SHR, instr);
1245 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1246 return DoShift(Token::SAR, instr);
1250 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1251 return DoShift(Token::SHL, instr);
1255 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1256 if (instr->representation().IsSmiOrInteger32()) {
1257 ASSERT(instr->left()->representation().Equals(instr->representation()));
1258 ASSERT(instr->right()->representation().Equals(instr->representation()));
1259 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32));
1261 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1262 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1265 return DoArithmeticT(instr->op(), instr);
1270 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1271 ASSERT(instr->representation().IsSmiOrInteger32());
1272 ASSERT(instr->left()->representation().Equals(instr->representation()));
1273 ASSERT(instr->right()->representation().Equals(instr->representation()));
1274 LOperand* dividend = UseRegister(instr->left());
1275 int32_t divisor = instr->right()->GetInteger32Constant();
1278 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1279 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1280 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1288 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1289 ASSERT(instr->representation().IsInteger32());
1290 ASSERT(instr->left()->representation().Equals(instr->representation()));
1291 ASSERT(instr->right()->representation().Equals(instr->representation()));
1292 LOperand* dividend = UseRegister(instr->left());
1293 int32_t divisor = instr->right()->GetInteger32Constant();
1299 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1300 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1307 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1308 ASSERT(instr->representation().IsSmiOrInteger32());
1309 ASSERT(instr->left()->representation().Equals(instr->representation()));
1310 ASSERT(instr->right()->representation().Equals(instr->representation()));
1311 LOperand* dividend = UseFixed(instr->left(), rax);
1312 LOperand* divisor = UseRegister(instr->right());
1316 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1317 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1318 instr->CheckFlag(HValue::kCanOverflow) ||
1319 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) {
1326 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1327 if (instr->representation().IsSmiOrInteger32()) {
1328 if (instr->RightIsPowerOf2()) {
1329 return DoDivByPowerOf2I(instr);
1330 } else if (instr->right()->IsConstant()) {
1331 return DoDivByConstI(instr);
1333 return DoDivI(instr);
1335 } else if (instr->representation().IsDouble()) {
1336 return DoArithmeticD(Token::DIV, instr);
1338 return DoArithmeticT(Token::DIV, instr);
1343 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1344 LOperand* dividend = UseRegisterAtStart(instr->left());
1345 int32_t divisor = instr->right()->GetInteger32Constant();
1348 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1349 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1356 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1357 ASSERT(instr->representation().IsInteger32());
1358 ASSERT(instr->left()->representation().Equals(instr->representation()));
1359 ASSERT(instr->right()->representation().Equals(instr->representation()));
1360 LOperand* dividend = UseRegister(instr->left());
1361 int32_t divisor = instr->right()->GetInteger32Constant();
1365 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) ||
1366 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ?
1376 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1383 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1384 ASSERT(instr->representation().IsSmiOrInteger32());
1385 ASSERT(instr->left()->representation().Equals(instr->representation()));
1386 ASSERT(instr->right()->representation().Equals(instr->representation()));
1387 LOperand* dividend = UseFixed(instr->left(), rax);
1388 LOperand* divisor = UseRegister(instr->right());
1392 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1393 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1394 instr->CheckFlag(HValue::kCanOverflow)) {
1401 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1402 if (instr->RightIsPowerOf2()) {
1403 return DoFlooringDivByPowerOf2I(instr);
1404 } else if (instr->right()->IsConstant()) {
1405 return DoFlooringDivByConstI(instr);
1407 return DoFlooringDivI(instr);
1412 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1413 ASSERT(instr->representation().IsSmiOrInteger32());
1414 ASSERT(instr->left()->representation().Equals(instr->representation()));
1415 ASSERT(instr->right()->representation().Equals(instr->representation()));
1416 LOperand* dividend = UseRegisterAtStart(instr->left());
1417 int32_t divisor = instr->right()->GetInteger32Constant();
1420 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1427 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1428 ASSERT(instr->representation().IsSmiOrInteger32());
1429 ASSERT(instr->left()->representation().Equals(instr->representation()));
1430 ASSERT(instr->right()->representation().Equals(instr->representation()));
1431 LOperand* dividend = UseRegister(instr->left());
1432 int32_t divisor = instr->right()->GetInteger32Constant();
1437 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1444 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1445 ASSERT(instr->representation().IsSmiOrInteger32());
1446 ASSERT(instr->left()->representation().Equals(instr->representation()));
1447 ASSERT(instr->right()->representation().Equals(instr->representation()));
1448 LOperand* dividend = UseFixed(instr->left(), rax);
1449 LOperand* divisor = UseRegister(instr->right());
1453 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1454 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1461 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1462 if (instr->representation().IsSmiOrInteger32()) {
1463 if (instr->RightIsPowerOf2()) {
1464 return DoModByPowerOf2I(instr);
1465 } else if (instr->right()->IsConstant()) {
1466 return DoModByConstI(instr);
1468 return DoModI(instr);
1470 } else if (instr->representation().IsDouble()) {
1471 return DoArithmeticD(Token::MOD, instr);
1473 return DoArithmeticT(Token::MOD, instr);
1478 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1479 if (instr->representation().IsSmiOrInteger32()) {
1480 ASSERT(instr->left()->representation().Equals(instr->representation()));
1481 ASSERT(instr->right()->representation().Equals(instr->representation()));
1482 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1483 LOperand* right = UseOrConstant(instr->BetterRightOperand());
1485 if (instr->CheckFlag(HValue::kCanOverflow) ||
1486 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1490 } else if (instr->representation().IsDouble()) {
1491 return DoArithmeticD(Token::MUL, instr);
1493 return DoArithmeticT(Token::MUL, instr);
1498 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1499 if (instr->representation().IsSmiOrInteger32()) {
1500 ASSERT(instr->left()->representation().Equals(instr->representation()));
1501 ASSERT(instr->right()->representation().Equals(instr->representation()));
1502 LOperand* left = UseRegisterAtStart(instr->left());
1503 LOperand* right = UseOrConstantAtStart(instr->right());
1506 if (instr->CheckFlag(HValue::kCanOverflow)) {
1510 } else if (instr->representation().IsDouble()) {
1511 return DoArithmeticD(Token::SUB, instr);
1513 return DoArithmeticT(Token::SUB, instr);
1518 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1519 if (instr->representation().IsSmiOrInteger32()) {
1524 bool use_lea = LAddI::UseLea(instr);
1525 ASSERT(instr->left()->representation().Equals(instr->representation()));
1526 ASSERT(instrinstr->representation()));
1527 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1528 HValue* right_candidate = instr->BetterRightOperand();
1530 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) {
1539 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1546 } else if (instr->representation().IsExternal()) {
1547 ASSERT(instr->left()->representation().IsExternal());
1548 ASSERT(instr->right()->representation().IsInteger32());
1549 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1550 bool use_lea = LAddI::UseLea(instr);
1551 LOperand* left = UseRegisterAtStart(instr->left());
1552 HValue* right_candidate = instr->right();
1561 } else if (instr->representation().IsDouble()) {
1562 return DoArithmeticD(Token::ADD, instr);
1564 return DoArithmeticT(Token::ADD, instr);
1570 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1573 ASSERT(instr->left()->representation().Equals(instr->representation()));
1574 ASSERT(instr->right()->representation().Equals(instr->representation()));
1575 if (instr->representation().IsSmi()) {
1576 left = UseRegisterAtStart(instr->BetterLeftOperand());
1577 right = UseAtStart(instr->BetterRightOperand());
1578 } else if (instr->representation().IsInteger32()) {
1579 left = UseRegisterAtStart(instr->BetterLeftOperand());
1580 right = UseOrConstantAtStart(instr->BetterRightOperand());
1582 ASSERT(instr->representation().IsDouble());
1583 left = UseRegisterAtStart(instr->left());
1584 right = UseRegisterAtStart(instr->right());
1591 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1592 ASSERT(instr->representation().IsDouble());
1595 Representation exponent_type = instr->right()->representation();
1596 ASSERT(instr->left()->representation().IsDouble());
1597 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1599 UseFixedDouble(instr->right(), xmm1) : UseFixed(instr->right(), rdx);
1601 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1606 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1607 ASSERT(instr->left()->representation().IsTagged());
1608 ASSERT(instr->right()->representation().IsTagged());
1609 LOperand* context = UseFixed(instr->context(), rsi);
1610 LOperand* left = UseFixed(instr->left(), rdx);
1611 LOperand* right = UseFixed(instr->right(), rax);
1613 return MarkAsCall(DefineFixed(result, rax), instr);
1618 HCompareNumericAndBranch* instr) {
1619 Representation r = instr->representation();
1621 ASSERT(instr->left()->representation().Equals(r));
1622 ASSERT(instr->right()->representation().Equals(r));
1623 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1624 LOperand* right = UseOrConstantAtStart(instr->right());
1628 ASSERT(instr->left()->representation().IsDouble());
1629 ASSERT(instr->right()->representation().IsDouble());
1632 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1633 left = UseRegisterOrConstantAtStart(instr->left());
1634 right = UseRegisterOrConstantAtStart(instr->right());
1636 left = UseRegisterAtStart(instr->left());
1637 right = UseRegisterAtStart(instr->right());
1645 HCompareObjectEqAndBranch* instr) {
1646 LOperand* left = UseRegisterAtStart(instr->left());
1647 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1653 HCompareHoleAndBranch* instr) {
1654 LOperand* value = UseRegisterAtStart(instr->value());
1660 HCompareMinusZeroAndBranch* instr) {
1661 LOperand* value = UseRegister(instr->value());
1666 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1667 ASSERT(instr->value()->representation().IsTagged());
1668 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()));
1672 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1673 ASSERT(instr->value()->representation().IsTagged());
1674 LOperand* value = UseRegisterAtStart(instr->value());
1680 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1681 ASSERT(instr->value()->representation().IsTagged());
1682 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1687 HIsUndetectableAndBranch* instr) {
1688 ASSERT(instr->value()->representation().IsTagged());
1689 LOperand* value = UseRegisterAtStart(instr->value());
1696 HStringCompareAndBranch* instr) {
1698 ASSERT(instr->left()->representation().IsTagged());
1699 ASSERT(instr->right()->representation().IsTagged());
1700 LOperand* context = UseFixed(instr->context(), rsi);
1701 LOperand* left = UseFixed(instr->left(), rdx);
1702 LOperand* right = UseFixed(instr->right(), rax);
1706 return MarkAsCall(result, instr);
1711 HHasInstanceTypeAndBranch* instr) {
1712 ASSERT(instr->value()->representation().IsTagged());
1713 LOperand* value = UseRegisterAtStart(instr->value());
1719 HGetCachedArrayIndex* instr) {
1720 ASSERT(instr->value()->representation().IsTagged());
1721 LOperand* value = UseRegisterAtStart(instr->value());
1728 HHasCachedArrayIndexAndBranch* instr) {
1729 ASSERT(instr->value()->representation().IsTagged());
1730 LOperand* value = UseRegisterAtStart(instr->value());
1736 HClassOfTestAndBranch* instr) {
1737 LOperand* value = UseRegister(instr->value());
1744 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1745 LOperand* map = UseRegisterAtStart(instr->value());
1750 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1751 LOperand* object = UseFixed(instr->value(), rax);
1752 LDateField* result = new(zone()) LDateField(object, instr->index());
1753 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1757 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1758 LOperand* string = UseRegisterAtStart(instr->string());
1759 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1764 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1765 LOperand* string = UseRegisterAtStart(instr->string());
1767 ? UseRegisterAtStart(instr->index())
1768 : UseRegisterOrConstantAtStart(instr->index());
1770 ? UseRegisterAtStart(instr->value())
1771 : UseRegisterOrConstantAtStart(instr->value());
1772 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), rsi) : NULL;
1776 result = MarkAsCall(result, instr);
1782 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1783 if (!FLAG_debug_code && instr->skip_check()) return NULL;
1784 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1786 ? UseOrConstantAtStart(instr->length())
1787 : UseAtStart(instr->length());
1789 if (!FLAG_debug_code || !instr->skip_check()) {
1797 HBoundsCheckBaseIndexInformation* instr) {
1803 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1810 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1823 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1824 Representation from = instr->from();
1825 Representation to = instr->to();
1826 HValue* val = instr->value();
1853 bool truncating = instr->CanTruncateToInt32();
1877 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result);
1883 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1902 if (instr->CheckFlag(HValue::kCanOverflow)) {
1921 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1922 LOperand* value = UseRegisterAtStart(instr->value());
1924 if (!instr->value()->type().IsHeapObject()) {
1931 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1932 LOperand* value = UseRegisterAtStart(instr->value());
1937 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1938 LOperand* value = UseRegisterAtStart(instr->value());
1944 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) {
1945 LOperand* value = UseRegisterAtStart(instr->value());
1950 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1951 if (instr->IsStabilityCheck()) return new(zone()) LCheckMaps;
1952 LOperand* value = UseRegisterAtStart(instr->value());
1954 if (instr->HasMigrationTarget()) {
1962 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1963 HValue* value = instr->value();
1981 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
1982 HValue* value = instr->value();
1988 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
1989 LOperand* lo = UseRegister(instr->lo());
1990 LOperand* hi = UseRegister(instr->hi());
1995 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1996 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), rsi) : NULL;
1997 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1999 UseFixed(instr->value(), rax), context, parameter_count);
2003 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2004 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(), rsi);
2033 LOperand* global_object = UseFixed(instr->global_object(), rax);
2036 return MarkAsCall(DefineFixed(result, rax), 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) {
2065 context = UseRegister(instr->context());
2066 if (instr->NeedsWriteBarrier()) {
2067 value = UseTempRegister(instr->value());
2070 value = UseRegister(instr->value());
2074 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2081 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2084 if (instr->access().IsExternalMemory() &&
2085 instr->access().offset() == 0 &&
2086 (instr->access().representation().IsSmi() ||
2087 instr->access().representation().IsTagged() ||
2088 instr->access().representation().IsHeapObject() ||
2089 instr->access().representation().IsExternal())) {
2090 LOperand* obj = UseRegisterOrConstantAtStart(instr->object());
2093 LOperand* obj = UseRegisterAtStart(instr->object());
2098 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2099 LOperand* context = UseFixed(instr->context(), rsi);
2100 LOperand* object = UseFixed(instr->object(), rax);
2102 return MarkAsCall(DefineFixed(result, rax), instr);
2107 HLoadFunctionPrototype* instr) {
2109 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2113 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
2134 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2136 instr->key()->representation().IsInteger32()) ||
2138 instr->key()->representation().IsSmiOrInteger32()));
2139 ElementsKind elements_kind = instr->elements_kind();
2144 key = UseRegisterOrConstantAtStart(instr->key());
2147 instr->key()->representation(), elements_kind);
2149 ? UseTempRegister(instr->key())
2150 : UseRegisterOrConstantAtStart(instr->key());
2153 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) {
2154 FindDehoistedKeyDefinitions(instr->key());
2157 if (!instr->is_typed_elements()) {
2158 LOperand* obj = UseRegisterAtStart(instr->elements());
2162 (instr->representation().IsInteger32() &&
2164 (instr->representation().IsDouble() &&
2166 LOperand* backing_store = UseRegister(instr->elements());
2170 if ((instr->is_external() || instr->is_fixed_typed_array()) ?
2174 !instr->CheckFlag(HInstruction::kUint32)) :
2177 instr->RequiresHoleCheck()) {
2184 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2185 LOperand* context = UseFixed(instr->context(), rsi);
2186 LOperand* object = UseFixed(instr->object(), rdx);
2187 LOperand* key = UseFixed(instr->key(), rax);
2191 return MarkAsCall(DefineFixed(result, rax), instr);
2195 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2196 ElementsKind elements_kind = instr->elements_kind();
2198 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) {
2199 FindDehoistedKeyDefinitions(instr->key());
2202 if (!instr->is_typed_elements()) {
2203 ASSERT(instr->elements()->representation().IsTagged());
2204 bool needs_write_barrier = instr->NeedsWriteBarrier();
2209 Representation value_representation = instr->value()->representation();
2211 object = UseRegisterAtStart(instr->elements());
2212 val = UseRegisterAtStart(instr->value());
2213 key = UseRegisterOrConstantAtStart(instr->key());
2218 object = UseTempRegister(instr->elements());
2219 val = UseTempRegister(instr->value());
2220 key = UseTempRegister(instr->key());
2222 object = UseRegisterAtStart(instr->elements());
2223 val = UseRegisterOrConstantAtStart(instr->value());
2224 key = UseRegisterOrConstantAtStart(instr->key());
2232 (instr->value()->representation().IsInteger32() &&
2234 (instr->value()->representation().IsDouble() &&
2236 ASSERT((instr->is_fixed_typed_array() &&
2237 instr->elements()->representation().IsTagged()) ||
2238 (instr->is_external() &&
2239 instr->elements()->representation().IsExternal()));
2244 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
2245 : UseRegister(instr->value());
2248 key = UseRegisterOrConstantAtStart(instr->key());
2251 instr->key()->representation(), elements_kind);
2253 ? UseTempRegister(instr->key())
2254 : UseRegisterOrConstantAtStart(instr->key());
2256 LOperand* backing_store = UseRegister(instr->elements());
2261 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2262 LOperand* context = UseFixed(instr->context(), rsi);
2263 LOperand* object = UseFixed(instr->object(), rdx);
2264 LOperand* key = UseFixed(instr->key(), rcx);
2265 LOperand* value = UseFixed(instr->value(), rax);
2267 ASSERT(instr->object()->representation().IsTagged());
2268 ASSERT(instr->key()->representation().IsTagged());
2269 ASSERT(instr->value()->representation().IsTagged());
2273 return MarkAsCall(result, instr);
2278 HTransitionElementsKind* instr) {
2279 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2280 LOperand* object = UseRegister(instr->object());
2287 LOperand* object = UseFixed(instr->object(), rax);
2288 LOperand* context = UseFixed(instr->context(), rsi);
2291 return MarkAsCall(result, instr);
2297 HTrapAllocationMemento* instr) {
2298 LOperand* object = UseRegister(instr->object());
2306 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2307 bool is_in_object = instr->access().IsInobject();
2308 bool is_external_location = instr->access().IsExternalMemory() &&
2309 instr->access().offset() == 0;
2310 bool needs_write_barrier = instr->NeedsWriteBarrier();
2311 bool needs_write_barrier_for_map = instr->has_transition() &&
2312 instr->NeedsWriteBarrierForMap();
2317 ? UseRegister(instr->object())
2318 : UseTempRegister(instr->object());
2323 obj = UseRegisterOrConstant(instr->object());
2326 ? UseRegister(instr->object())
2327 : UseRegisterAtStart(instr->object());
2330 bool can_be_constant = instr->value()->IsConstant() &&
2331 HConstant::cast(instr->value())->NotInNewSpace() &&
2332 !instr->field_representation().IsDouble();
2336 val = UseTempRegister(instr->value());
2338 val = UseFixed(instr->value(), rax);
2340 val = UseRegisterOrConstant(instr->value());
2341 } else if (instr->field_representation().IsSmi()) {
2342 val = UseRegister(instr->value());
2343 } else if (instr->field_representation().IsDouble()) {
2344 val = UseRegisterAtStart(instr->value());
2346 val = UseRegister(instr->value());
2358 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2359 LOperand* context = UseFixed(instr->context(), rsi);
2360 LOperand* object = UseFixed(instr->object(), rdx);
2361 LOperand* value = UseFixed(instr->value(), rax);
2365 return MarkAsCall(result, instr);
2369 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2370 LOperand* context = UseFixed(instr->context(), rsi);
2371 LOperand* left = UseFixed(instr->left(), rdx);
2372 LOperand* right = UseFixed(instr->right(), rax);
2374 DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr);
2378 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2379 LOperand* string = UseTempRegister(instr->string());
2380 LOperand* index = UseTempRegister(instr->index());
2381 LOperand* context = UseAny(instr->context());
2388 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2389 LOperand* char_code = UseRegister(instr->value());
2390 LOperand* context = UseAny(instr->context());
2397 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2399 LOperand* context = UseAny(instr->context());
2400 LOperand* size = instr->size()->IsConstant()
2401 ? UseConstant(instr->size())
2402 : UseTempRegister(instr->size());
2409 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2410 LOperand* context = UseFixed(instr->context(), rsi);
2412 return MarkAsCall(DefineFixed(result, rax), instr);
2416 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2417 LOperand* context = UseFixed(instr->context(), rsi);
2419 return MarkAsCall(DefineFixed(result, rax), instr);
2423 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2426 current_block_->last_environment()->set_ast_id(instr->ast_id());
2431 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2433 if (instr->kind() == HParameter::STACK_PARAMETER) {
2434 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2440 int index = static_cast<int>(instr->index());
2447 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2450 int env_index = instr->index();
2452 if (instr->environment()->is_parameter_index(env_index)) {
2455 spill_index = env_index - instr->environment()->first_local_index();
2465 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2466 LOperand* context = UseFixed(instr->context(), rsi);
2468 return MarkAsCall(DefineFixed(result, rax), instr);
2472 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2481 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2482 instr->ReplayEnvironment(current_block_->last_environment());
2489 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2491 LOperand* args = UseRegister(instr->arguments());
2494 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2495 length = UseRegisterOrConstant(instr->length());
2496 index = UseOrConstant(instr->index());
2498 length = UseTempRegister(instr->length());
2499 index = Use(instr->index());
2505 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2506 LOperand* object = UseFixed(instr->value(), rax);
2508 return MarkAsCall(DefineFixed(result, rax), instr);
2512 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2513 LOperand* context = UseFixed(instr->context(), rsi);
2514 LOperand* value = UseAtStart(instr->value());
2516 return MarkAsCall(DefineFixed(result, rax), instr);
2520 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2521 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2526 HIsConstructCallAndBranch* instr) {
2531 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2532 instr->ReplayEnvironment(current_block_->last_environment());
2537 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2539 if (instr->is_function_entry()) {
2540 LOperand* context = UseFixed(instr->context(), rsi);
2541 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2543 ASSERT(instr->is_backwards_branch());
2544 LOperand* context = UseAny(instr->context());
2551 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2553 outer->set_ast_id(instr->ReturnId());
2555 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2556 instr->arguments_count(),
2557 instr->function(),
2559 instr->inlining_kind());
2561 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2562 inner->Bind(instr->arguments_var(), instr->arguments_object());
2564 inner->set_entry(instr);
2566 chunk_->AddInlinedClosure(instr->closure());
2571 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2579 ASSERT(instr->argument_delta() == -argument_count);
2590 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2591 LOperand* context = UseFixed(instr->context(), rsi);
2592 LOperand* object = UseFixed(instr->enumerable(), rax);
2594 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
2598 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2599 LOperand* map = UseRegister(instr->map());
2605 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2606 LOperand* value = UseRegisterAtStart(instr->value());
2607 LOperand* map = UseRegisterAtStart(instr->map());
2612 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2613 LOperand* object = UseRegister(instr->object());
2614 LOperand* index = UseTempRegister(instr->index());
2621 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2622 LOperand* context = UseRegisterAtStart(instr->context());
2628 HAllocateBlockContext* instr) {
2629 LOperand* context = UseFixed(instr->context(), rsi);
2630 LOperand* function = UseRegisterAtStart(instr->function());
2633 return MarkAsCall(DefineFixed(result, rsi), instr);