Home | History | Annotate | Download | only in x64

Lines Matching refs:instr

544     HInstruction* instr = HInstruction::cast(value);
545 VisitInstruction(instr);
553 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
556 instr->set_result(result);
557 return instr;
563 LTemplateInstruction<1, I, T>* instr) {
564 return Define(instr,
571 LTemplateInstruction<1, I, T>* instr,
573 return Define(instr,
580 LTemplateInstruction<1, I, T>* instr) {
581 return Define(instr,
587 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
589 return Define(instr, ToUnallocated(reg));
595 LTemplateInstruction<1, I, T>* instr,
597 return Define(instr, ToUnallocated(reg));
601 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
605 instr->set_environment(CreateEnvironment(hydrogen_env,
608 return instr;
612 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
618 instr->VerifyCall();
620 instr->MarkAsCall();
621 instr = AssignPointerMap(instr);
628 instruction_pending_deoptimization_environment_ = instr;
639 if (needs_environment && !instr->HasEnvironment()) {
640 instr = AssignEnvironment(instr);
643 return instr;
647 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
648 ASSERT(!instr->HasPointerMap());
649 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone()));
650 return instr;
681 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
682 return new(zone()) LLabel(instr->block());
686 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) {
687 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value())));
691 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) {
697 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
703 HBitwiseBinaryOperation* instr) {
704 if (instr->representation().IsTagged()) {
705 ASSERT(instr->left()->representation().IsTagged());
706 ASSERT(instr->right()->representation().IsTagged());
708 LOperand* left = UseFixed(instr->left(), rdx);
709 LOperand* right = UseFixed(instr->right(), rax);
711 return MarkAsCall(DefineFixed(result, rax), instr);
714 ASSERT(instr->representation().IsSmiOrInteger32());
715 ASSERT(instr->left()->representation().Equals(instr->representation()));
716 ASSERT(instr->right()->representation().Equals(instr->representation()));
717 LOperand* left = UseRegisterAtStart(instr->left());
719 HValue* right_value = instr->right();
735 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
737 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
753 HArithmeticBinaryOperation* instr) {
754 ASSERT(instr->representation().IsDouble());
755 ASSERT(instr->left()->representation().IsDouble());
756 ASSERT(instr->right()->representation().IsDouble());
758 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
759 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
766 HArithmeticBinaryOperation* instr) {
772 HValue* left = instr->left();
773 HValue* right = instr->right();
780 return MarkAsCall(DefineFixed(result, rax), instr);
855 LInstruction* instr = current->CompileToLithium(this);
857 if (instr != NULL) {
869 if (!(instr->ClobbersRegisters() && instr->ClobbersDoubleRegisters())) {
872 for (UseIterator it(instr); !it.Done(); it.Advance()) {
876 if (instr->Output() != NULL) {
877 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
879 for (TempIterator it(instr); !it.Done(); it.Advance()) {
887 instr->set_position(position_);
888 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
889 instr = AssignPointerMap(instr);
891 if (FLAG_stress_environments && !instr->HasEnvironment()) {
892 instr = AssignEnvironment(instr);
894 instr->set_hydrogen_value(current);
895 chunk_->AddInstruction(instr, current_block_);
985 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
986 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
990 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
995 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
996 HValue* value = instr->value();
1001 ? instr->FirstSuccessor()
1002 : instr->SecondSuccessor();
1010 ToBooleanStub::Types expected = instr->expected_input_types();
1021 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1022 ASSERT(instr->value()->representation().IsTagged());
1023 LOperand* value = UseRegisterAtStart(instr->value());
1040 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1041 LOperand* left = UseFixed(instr->left(), rax);
1042 LOperand* right = UseFixed(instr->right(), rdx);
1044 return MarkAsCall(DefineFixed(result, rax), instr);
1049 HInstanceOfKnownGlobal* instr) {
1051 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), rax),
1053 return MarkAsCall(DefineFixed(result, rax), instr);
1057 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) {
1058 LOperand* object = UseRegisterAtStart(instr->object());
1063 instr) {
1064 LOperand* receiver = UseRegister(instr->receiver());
1065 LOperand* function = UseRegisterAtStart(instr->function());
1071 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1072 LOperand* function = UseFixed(instr->function(), rdi);
1073 LOperand* receiver = UseFixed(instr->receiver(), rax);
1074 LOperand* length = UseFixed(instr->length(), rbx);
1075 LOperand* elements = UseFixed(instr->elements(), rcx);
1080 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1084 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1086 LOperand* argument = UseOrConstant(instr->argument());
1100 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1101 return instr->HasNoUses()
1107 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1109 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
1119 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1120 LOperand* context = UseRegisterAtStart(instr->value());
1125 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1126 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1130 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1135 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1136 LOperand* global_object = UseRegisterAtStart(instr->value());
1142 HCallConstantFunction* instr) {
1143 argument_count_ -= instr->argument_count();
1144 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr);
1148 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1149 LOperand* function = UseFixed(instr->function(), rdi);
1150 argument_count_ -= instr->argument_count();
1152 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1156 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1157 switch (instr->op()) {
1158 case kMathFloor: return DoMathFloor(instr);
1159 case kMathRound: return DoMathRound(instr);
1160 case kMathAbs: return DoMathAbs(instr);
1161 case kMathLog: return DoMathLog(instr);
1162 case kMathSin: return DoMathSin(instr);
1163 case kMathCos: return DoMathCos(instr);
1164 case kMathTan: return DoMathTan(instr);
1165 case kMathExp: return DoMathExp(instr);
1166 case kMathSqrt: return DoMathSqrt(instr);
1167 case kMathPowHalf: return DoMathPowHalf(instr);
1175 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1176 LOperand* input = UseRegisterAtStart(instr->value());
1182 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1183 LOperand* input = UseRegisterAtStart(instr->value());
1189 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1190 LOperand* input = UseRegisterAtStart(instr->value());
1196 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1197 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1199 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1203 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1204 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1206 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1210 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1211 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1213 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1217 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1218 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1220 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1224 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1225 ASSERT(instr->representation().IsDouble());
1226 ASSERT(instr->value()->representation().IsDouble());
1227 LOperand* value = UseTempRegister(instr->value());
1235 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1236 LOperand* input = UseRegisterAtStart(instr->value());
1242 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1243 LOperand* input = UseRegisterAtStart(instr->value());
1249 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1250 ASSERT(instr->key()->representation().IsTagged());
1251 LOperand* key = UseFixed(instr->key(), rcx);
1252 argument_count_ -= instr->argument_count();
1254 return MarkAsCall(DefineFixed(result, rax), instr);
1258 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1259 argument_count_ -= instr->argument_count();
1260 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, rax), instr);
1264 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1265 argument_count_ -= instr->argument_count();
1266 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, rax), instr);
1270 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1271 argument_count_ -= instr->argument_count();
1272 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr);
1276 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1277 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1278 argument_count_ -= instr->argument_count();
1280 return MarkAsCall(DefineFixed(result, rax), instr);
1284 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1285 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1286 argument_count_ -= instr->argument_count();
1288 return MarkAsCall(DefineFixed(result, rax), instr);
1292 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1293 LOperand* function = UseFixed(instr->function(), rdi);
1294 argument_count_ -= instr->argument_count();
1296 return MarkAsCall(DefineFixed(result, rax), instr);
1300 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1301 argument_count_ -= instr->argument_count();
1302 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, rax), instr);
1306 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1307 return DoShift(Token::ROR, instr);
1311 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1312 return DoShift(Token::SHR, instr);
1316 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1317 return DoShift(Token::SAR, instr);
1321 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1322 return DoShift(Token::SHL, instr);
1326 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1327 if (instr->representation().IsSmiOrInteger32()) {
1328 ASSERT(instr->left()->representation().Equals(instr->representation()));
1329 ASSERT(instr->right()->representation().Equals(instr->representation()));
1331 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1332 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1335 ASSERT(instr->representation().IsTagged());
1336 ASSERT(instr->left()->representation().IsTagged());
1337 ASSERT(instr->right()->representation().IsTagged());
1339 LOperand* left = UseFixed(instr->left(), rdx);
1340 LOperand* right = UseFixed(instr->right(), rax);
1341 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1342 return MarkAsCall(DefineFixed(result, rax), instr);
1347 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1348 if (instr->representation().IsDouble()) {
1349 return DoArithmeticD(Token::DIV, instr);
1350 } else if (instr->representation().IsSmiOrInteger32()) {
1351 ASSERT(instr->left()->representation().Equals(instr->representation()));
1352 ASSERT(instr->right()->representation().Equals(instr->representation()));
1353 if (instr->HasPowerOf2Divisor()) {
1354 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1355 LOperand* value = UseRegisterAtStart(instr->left());
1357 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1363 LOperand* dividend = UseFixed(instr->left(), rax);
1364 LOperand* divisor = UseRegister(instr->right());
1368 ASSERT(instr->representation().IsTagged());
1369 return DoArithmeticT(Token::DIV, instr);
1393 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1394 HValue* right = instr->right();
1400 LOperand* dividend = UseFixed(instr->left(), rax);
1401 LOperand* divisor = UseRegister(instr->right());
1410 LOperand* dividend = UseRegister(instr->left());
1414 LOperand* dividend = UseRegisterAtStart(instr->left());
1420 LOperand* dividend = UseRegisterAtStart(instr->left());
1429 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1430 HValue* left = instr->left();
1431 HValue* right = instr->right();
1432 if (instr->representation().IsSmiOrInteger32()) {
1433 ASSERT(left->representation().Equals(instr->representation()));
1434 ASSERT(right->representation().Equals(instr->representation()));
1435 if (instr->HasPowerOf2Divisor()) {
1442 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1445 } else if (instr->fixed_right_arg().has_value) {
1460 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1462 instr->CanBeZero() &&
1463 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1467 } else if (instr->representation().IsTagged()) {
1468 return DoArithmeticT(Token::MOD, instr);
1470 ASSERT(instr->representation().IsDouble());
1477 return MarkAsCall(DefineFixedDouble(mod, xmm1), instr);
1482 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1483 if (instr->representation().IsSmiOrInteger32()) {
1484 ASSERT(instr->left()->representation().Equals(instr->representation()));
1485 ASSERT(instr->right()->representation().Equals(instr->representation()));
1486 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1487 LOperand* right = UseOrConstant(instr->BetterRightOperand());
1489 if (instr->CheckFlag(HValue::kCanOverflow) ||
1490 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1494 } else if (instr->representation().IsDouble()) {
1495 return DoArithmeticD(Token::MUL, instr);
1497 ASSERT(instr->representation().IsTagged());
1498 return DoArithmeticT(Token::MUL, instr);
1503 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1504 if (instr->representation().IsSmiOrInteger32()) {
1505 ASSERT(instr->left()->representation().Equals(instr->representation()));
1506 ASSERT(instr->right()->representation().Equals(instr
1507 LOperand* left = UseRegisterAtStart(instr->left());
1508 LOperand* right = UseOrConstantAtStart(instr->right());
1511 if (instr->CheckFlag(HValue::kCanOverflow)) {
1515 } else if (instr->representation().IsDouble()) {
1516 return DoArithmeticD(Token::SUB, instr);
1518 ASSERT(instr->representation().IsTagged());
1519 return DoArithmeticT(Token::SUB, instr);
1524 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1525 if (instr->representation().IsSmiOrInteger32()) {
1530 bool use_lea = LAddI::UseLea(instr);
1531 ASSERT(instr->left()->representation().Equals(instr->representation()));
1532 ASSERT(instr->right()->representation().Equals(instr->representation()));
1533 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1534 HValue* right_candidate = instr->BetterRightOperand();
1539 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1547 } else if (instr->representation().IsDouble()) {
1548 return DoArithmeticD(Token::ADD, instr);
1550 ASSERT(instr->representation().IsTagged());
1551 return DoArithmeticT(Token::ADD, instr);
1557 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1560 if (instr->representation().IsSmiOrInteger32()) {
1561 ASSERT(instr->left()->representation().Equals(instr->representation()));
1562 ASSERT(instr->right()->representation().Equals(instr->representation()));
1563 left = UseRegisterAtStart(instr->BetterLeftOperand());
1564 right = UseOrConstantAtStart(instr->BetterRightOperand());
1566 ASSERT(instr->representation().IsDouble());
1567 ASSERT(instr->left()->representation().IsDouble());
1568 ASSERT(instr->right()->representation().IsDouble());
1569 left = UseRegisterAtStart(instr->left());
1570 right = UseRegisterAtStart(instr->right());
1577 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1578 ASSERT(instr->representation().IsDouble());
1581 Representation exponent_type = instr->right()->representation();
1582 ASSERT(instr->left()->representation().IsDouble());
1583 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1585 UseFixedDouble(instr->right(), xmm1) : UseFixed(instr->right(), rdx);
1587 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1592 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1593 ASSERT(instr->representation().IsDouble());
1594 ASSERT(instr->global_object()->representation().IsTagged());
1595 LOperand* global_object = UseFixed(instr->global_object(), arg_reg_1);
1597 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1601 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1602 ASSERT(instr->left()->representation().IsTagged());
1603 ASSERT(instr->right()->representation().IsTagged());
1604 LOperand* left = UseFixed(instr->left(), rdx);
1605 LOperand* right = UseFixed(instr->right(), rax);
1607 return MarkAsCall(DefineFixed(result, rax), instr);
1612 HCompareNumericAndBranch* instr) {
1613 Representation r = instr->representation();
1615 ASSERT(instr->left()->representation().Equals(r));
1616 ASSERT(instr->right()->representation().Equals(r));
1617 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1618 LOperand* right = UseOrConstantAtStart(instr->right());
1622 ASSERT(instr->left()->representation().IsDouble());
1623 ASSERT(instr->right()->representation().IsDouble());
1626 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1627 left = UseRegisterOrConstantAtStart(instr->left());
1628 right = UseRegisterOrConstantAtStart(instr->right());
1630 left = UseRegisterAtStart(instr->left());
1631 right = UseRegisterAtStart(instr->right());
1639 HCompareObjectEqAndBranch* instr) {
1640 LOperand* left = UseRegisterAtStart(instr->left());
1641 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1647 HCompareHoleAndBranch* instr) {
1648 LOperand* object = UseRegisterAtStart(instr->object());
1653 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1654 ASSERT(instr->value()->representation().IsTagged());
1655 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()));
1659 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1660 ASSERT(instr->value()->representation().IsTagged());
1661 LOperand* value = UseRegisterAtStart(instr->value());
1667 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1668 ASSERT(instr->value()->representation().IsTagged());
1669 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1674 HIsUndetectableAndBranch* instr) {
1675 ASSERT(instr->value()->representation().IsTagged());
1676 LOperand* value = UseRegisterAtStart(instr->value());
1683 HStringCompareAndBranch* instr) {
1685 ASSERT(instr->left()->representation().IsTagged());
1686 ASSERT(instr->right()->representation().IsTagged());
1687 LOperand* left = UseFixed(instr->left(), rdx);
1688 LOperand* right = UseFixed(instr->right(), rax);
1692 return MarkAsCall(result, instr);
1697 HHasInstanceTypeAndBranch* instr) {
1698 ASSERT(instr->value()->representation().IsTagged());
1699 LOperand* value = UseRegisterAtStart(instr->value());
1705 HGetCachedArrayIndex* instr) {
1706 ASSERT(instr->value()->representation().IsTagged());
1707 LOperand* value = UseRegisterAtStart(instr->value());
1714 HHasCachedArrayIndexAndBranch* instr) {
1715 ASSERT(instr->value()->representation().IsTagged());
1716 LOperand* value = UseRegisterAtStart(instr->value());
1722 HClassOfTestAndBranch* instr) {
1723 LOperand* value = UseRegister(instr->value());
1730 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
1731 LOperand* map = UseRegisterAtStart(instr->value());
1736 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1737 LOperand* object = UseRegisterAtStart(instr->value());
1742 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1743 LOperand* object = UseRegister(instr->value());
1749 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1750 LOperand* object = UseFixed(instr->value(), rax);
1751 LDateField* result = new(zone()) LDateField(object, instr->index());
1752 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1756 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1757 LOperand* string = UseRegister(instr->string());
1758 LOperand* index = UseRegister(instr->index());
1760 LOperand* value = UseFixed(instr->value(), rcx);
1762 new(zone()) LSeqStringSetChar(instr->encoding(), string, index, value);
1767 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1768 LOperand* value = UseRegisterOrConstantAtStart(instr->index());
1769 LOperand* length = Use(instr->length());
1775 HBoundsCheckBaseIndexInformation* instr) {
1781 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1782 LOperand* value = UseFixed(instr->value(), rax);
1783 return MarkAsCall(new(zone()) LThrow(value), instr);
1787 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1800 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1801 Representation from = instr->from();
1802 Representation to = instr->to();
1805 LOperand* value = UseRegister(instr->value());
1816 LOperand* value = UseRegister(instr->value());
1820 HValue* val = instr->value();
1828 LOperand* value = UseRegister(instr->value());
1829 if (instr->value()->type().IsSmi()) {
1832 bool truncating = instr->CanTruncateToInt32();
1841 LOperand* value = UseRegister(instr->value());
1849 LOperand* value = UseRegister(instr->value());
1854 LOperand* value = UseRegister(instr->value());
1861 HValue* val = instr->value();
1874 HValue* val = instr->value();
1891 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1894 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
1897 LOperand* value = Use(instr->value());
1907 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1908 LOperand* value = UseRegisterAtStart(instr->value());
1913 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1914 LOperand* value = UseRegisterAtStart(instr->value());
1919 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) {
1921 UseRegisterOrConstantAtStart(instr->value()));
1925 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1926 LOperand* value = UseRegisterAtStart(instr->value());
1932 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1933 LOperand* value = UseRegisterAtStart(instr->value());
1938 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
1940 if (!instr->CanOmitMapChecks()) {
1941 value = UseRegisterAtStart(instr->value());
1942 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
1945 if (!instr->CanOmitMapChecks()) {
1947 if (instr->has_migration_target()) return AssignPointerMap(result);
1953 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1954 HValue* value = instr->value();
1972 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1973 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1974 return new(zone()) LReturn(UseFixed(instr->value(), rax),
1979 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1980 Representation r = instr->representation();
1999 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2001 return instr->RequiresHoleCheck()
2007 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2008 LOperand* global_object = UseFixed(instr->global_object(), rax);
2010 return MarkAsCall(DefineFixed(result, rax), instr);
2014 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2015 LOperand* value = UseRegister(instr->value());
2018 return instr->RequiresHoleCheck()
2024 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2025 LOperand* global_object = UseFixed(instr->global_object(), rdx);
2026 LOperand* value = UseFixed(instr->value(), rax);
2029 return MarkAsCall(result, instr);
2033 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2034 LOperand* context = UseRegisterAtStart(instr->value());
2037 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2041 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2045 if (instr->NeedsWriteBarrier()) {
2046 context = UseTempRegister(instr->context());
2047 value = UseTempRegister(instr->value());
2050 context = UseRegister(instr->context());
2051 value = UseRegister(instr->value());
2055 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2059 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2060 if (instr->access().IsExternalMemory() && instr->access().offset() == 0) {
2061 LOperand* obj = UseRegisterOrConstantAtStart(instr->object());
2064 LOperand* obj = UseRegisterAtStart(instr->object());
2069 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2070 LOperand* object = UseFixed(instr->object(), rax);
2072 return MarkAsCall(DefineFixed(result, rax), instr);
2077 HLoadFunctionPrototype* instr) {
2079 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2084 HLoadExternalArrayPointer* instr) {
2085 LOperand* input = UseRegisterAtStart(instr->value());
2090 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2091 ASSERT(instr->key()->representation().IsInteger32());
2092 ElementsKind elements_kind = instr->elements_kind();
2093 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2096 if (!instr->is_external()) {
2097 LOperand* obj = UseRegisterAtStart(instr->elements());
2101 (instr->representation().IsInteger32() &&
2104 (instr->representation().IsDouble() &&
2107 LOperand* external_pointer = UseRegister(instr->elements());
2112 bool can_deoptimize = instr->RequiresHoleCheck() ||
2120 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2121 LOperand* object = UseFixed(instr->object(), rdx);
2122 LOperand* key = UseFixed(instr->key(), rax);
2125 return MarkAsCall(DefineFixed(result, rax), instr);
2129 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2130 ElementsKind elements_kind = instr->elements_kind();
2132 if (!instr->is_external()) {
2133 ASSERT(instr->elements()->representation().IsTagged());
2134 bool needs_write_barrier = instr->NeedsWriteBarrier();
2139 if (instr->value()->representation().IsDouble()) {
2140 object = UseRegisterAtStart(instr->elements());
2141 val = UseTempRegister(instr->value());
2142 key = UseRegisterOrConstantAtStart(instr->key());
2144 ASSERT(instr->value()->representation().IsSmiOrTagged());
2145 object = UseTempRegister(instr->elements());
2147 val = UseTempRegister(instr->value());
2148 key = UseTempRegister(instr->key());
2150 val = UseRegisterOrConstantAtStart(instr->value());
2151 key = UseRegisterOrConstantAtStart(instr->key());
2159 (instr->value()->representation().IsInteger32() &&
2162 (instr->value()->representation().IsDouble() &&
2165 ASSERT(instr->elements()->representation().IsExternal());
2169 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
2170 : UseRegister(instr->value());
2171 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2172 LOperand* external_pointer = UseRegister(instr->elements());
2177 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2178 LOperand* object = UseFixed(instr->object(), rdx);
2179 LOperand* key = UseFixed(instr->key(), rcx);
2180 LOperand* value = UseFixed(instr->value(), rax);
2182 ASSERT(instr->object()->representation().IsTagged());
2183 ASSERT(instr->key()->representation().IsTagged());
2184 ASSERT(instr->value()->representation().IsTagged());
2188 return MarkAsCall(result, instr);
2193 HTransitionElementsKind* instr) {
2194 LOperand* object = UseRegister(instr->object());
2195 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2196 LOperand* object = UseRegister(instr->object());
2211 HTrapAllocationMemento* instr) {
2212 LOperand* object = UseRegister(instr->object());
2220 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2221 bool is_in_object = instr->access().IsInobject();
2222 bool is_external_location = instr->access().IsExternalMemory() &&
2223 instr->access().offset() == 0;
2224 bool needs_write_barrier = instr->NeedsWriteBarrier();
2225 bool needs_write_barrier_for_map = instr->has_transition() &&
2226 instr->NeedsWriteBarrierForMap();
2231 ? UseRegister(instr->object())
2232 : UseTempRegister(instr->object());
2237 obj = UseRegisterOrConstant(instr->object());
2240 ? UseRegister(instr->object())
2241 : UseRegisterAtStart(instr->object());
2244 bool can_be_constant = instr->value()->IsConstant() &&
2245 HConstant::cast(instr->value())->NotInNewSpace() &&
2246 !(FLAG_track_double_fields && instr->field_representation().IsDouble());
2250 val = UseTempRegister(instr->value());
2252 val = UseFixed(instr->value(), rax);
2254 val = UseRegisterOrConstant(instr->value());
2255 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) {
2256 val = UseTempRegister(instr->value());
2258 instr->field_representation().IsDouble()) {
2259 val = UseRegisterAtStart(instr->value());
2261 val = UseRegister(instr->value());
2271 instr->field_representation().IsHeapObject()) {
2272 if (!instr->value()->type().IsHeapObject()) {
2280 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2281 LOperand* object = UseFixed(instr->object(), rdx);
2282 LOperand* value = UseFixed(instr->value(), rax);
2285 return MarkAsCall(result, instr);
2289 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2290 LOperand* left = UseOrConstantAtStart(instr->left());
2291 LOperand* right = UseOrConstantAtStart(instr->right());
2293 instr);
2297 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2298 LOperand* string = UseTempRegister(instr->string());
2299 LOperand* index = UseTempRegister(instr->index());
2305 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2306 LOperand* char_code = UseRegister(instr->value());
2312 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2314 LOperand* size = instr->size()->IsConstant()
2315 ? UseConstant(instr->size())
2316 : UseTempRegister(instr->size());
2323 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2324 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, rax), instr);
2328 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2329 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, rax), instr);
2333 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2336 current_block_->last_environment()->set_ast_id(instr->ast_id());
2341 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2343 if (instr->kind() == HParameter::STACK_PARAMETER) {
2344 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2350 int index = static_cast<int>(instr->index());
2357 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2367 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2368 argument_count_ -= instr->argument_count();
2369 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr);
2373 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2382 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
2388 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2390 LOperand* args = UseRegister(instr->arguments());
2393 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2394 length = UseRegisterOrConstant(instr->length());
2395 index = UseOrConstant(instr->index());
2397 length = UseTempRegister(instr->length());
2398 index = Use(instr->index());
2404 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2405 LOperand* object = UseFixed(instr->value(), rax);
2407 return MarkAsCall(DefineFixed(result, rax), instr);
2411 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2412 LTypeof* result = new(zone()) LTypeof(UseAtStart(instr->value()));
2413 return MarkAsCall(DefineFixed(result, rax), instr);
2417 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2418 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2423 HIsConstructCallAndBranch* instr) {
2428 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2432 env->set_ast_id(instr->ast_id());
2434 env->Drop(instr->pop_count());
2435 for (int i = instr->values()->length() - 1; i >= 0; --i) {
2436 HValue* value = instr->values()->at(i);
2437 if (instr->HasAssignedIndexAt(i)) {
2438 env->Bind(instr->GetAssignedIndexAt(i), value);
2446 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2462 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2464 if (instr->is_function_entry()) {
2465 return MarkAsCall(new(zone()) LStackCheck, instr);
2467 ASSERT(instr->is_backwards_branch());
2473 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2476 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2477 instr->arguments_count(),
2478 instr->function(),
2480 instr->inlining_kind(),
2481 instr->undefined_receiver());
2483 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) {
2484 inner->Bind(instr->arguments_var(), instr->arguments_object());
2486 inner->set_entry(instr);
2488 chunk_->AddInlinedClosure(instr->closure());
2493 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2512 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2513 LOperand* object = UseFixed(instr->enumerable(), rax);
2515 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
2519 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2520 LOperand* map = UseRegister(instr->map());
2526 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2527 LOperand* value = UseRegisterAtStart(instr->value());
2528 LOperand* map = UseRegisterAtStart(instr->map());
2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2534 LOperand* object = UseRegister(instr->object());
2535 LOperand* index = UseTempRegister(instr->index());