Lines Matching refs:instr

473 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) {
476 if (instr->IsControl()) {
479 instructions_.Add(instr);
482 instructions_.Add(instr);
485 if (instr->HasPointerMap()) {
486 pointer_maps_.Add(instr->pointer_map());
487 instr->pointer_map()->set_lithium_position(index);
666 HInstruction* instr = HInstruction::cast(value);
667 VisitInstruction(instr);
675 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
678 instr->set_result(result);
679 return instr;
685 LTemplateInstruction<1, I, T>* instr) {
686 return Define(instr,
693 LTemplateInstruction<1, I, T>* instr,
695 return Define(instr,
702 LTemplateInstruction<1, I, T>* instr) {
703 return Define(instr,
709 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
711 return Define(instr, ToUnallocated(reg));
717 LTemplateInstruction<1, I, T>* instr,
719 return Define(instr, ToUnallocated(reg));
723 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
726 instr->set_environment(CreateEnvironment(hydrogen_env,
728 return instr;
733 LInstruction* instr, int ast_id) {
736 instruction_pending_deoptimization_environment_ = instr;
738 return instr;
748 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
752 instr->VerifyCall();
754 instr->MarkAsCall();
755 instr = AssignPointerMap(instr);
760 instr = SetInstructionPendingDeoptimizationEnvironment(
761 instr, sim->ast_id());
771 if (needs_environment && !instr->HasEnvironment()) {
772 instr = AssignEnvironment(instr);
775 return instr;
779 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
780 instr->MarkAsSaveDoubles();
781 return instr;
785 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
786 ASSERT(!instr->HasPointerMap());
787 instr->set_pointer_map(new(zone()) LPointerMap(position_));
788 return instr;
817 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
818 return new(zone()) LLabel(instr->block());
822 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) {
827 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
833 HBitwiseBinaryOperation* instr) {
834 if (instr->representation().IsTagged()) {
835 ASSERT(instr->left()->representation().IsTagged());
836 ASSERT(instr->right()->representation().IsTagged());
838 LOperand* context = UseFixed(instr->context(), esi);
839 LOperand* left = UseFixed(instr->left(), edx);
840 LOperand* right = UseFixed(instr->right(), eax);
842 return MarkAsCall(DefineFixed(result, eax), instr);
845 ASSERT(instr->representation().IsInteger32());
846 ASSERT(instr->left()->representation().IsInteger32());
847 ASSERT(instr->right()->representation().IsInteger32());
848 LOperand* left = UseRegisterAtStart(instr->left());
850 HValue* right_value = instr->right();
866 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
881 HArithmeticBinaryOperation* instr) {
882 ASSERT(instr->representation().IsDouble());
883 ASSERT(instr->left()->representation().IsDouble());
884 ASSERT(instr->right()->representation().IsDouble());
886 LOperand* left = UseRegisterAtStart(instr->left());
887 LOperand* right = UseRegisterAtStart(instr->right());
894 HArithmeticBinaryOperation* instr) {
900 HValue* left = instr->left();
901 HValue* right = instr->right();
904 LOperand* context = UseFixed(instr->context(), esi);
909 return MarkAsCall(DefineFixed(result, eax), instr);
980 LInstruction* instr = current->CompileToLithium(this);
982 if (instr != NULL) {
983 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
984 instr = AssignPointerMap(instr);
986 if (FLAG_stress_environments && !instr->HasEnvironment()) {
987 instr = AssignEnvironment(instr);
989 instr->set_hydrogen_value(current);
990 chunk_->AddInstruction(instr, current_block_);
1039 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1040 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
1044 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1045 HValue* value = instr->value();
1050 ? instr->FirstSuccessor()
1051 : instr->SecondSuccessor();
1063 ToBooleanStub::Types expected = instr->expected_input_types();
1073 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1074 ASSERT(instr->value()->representation().IsTagged());
1075 LOperand* value = UseRegisterAtStart(instr->value());
1090 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1091 LOperand* left = UseFixed(instr->left(), InstanceofStub::left());
1092 LOperand* right = UseFixed(instr->right(), InstanceofStub::right());
1093 LOperand* context = UseFixed(instr->context(), esi);
1095 return MarkAsCall(DefineFixed(result, eax), instr);
1100 HInstanceOfKnownGlobal* instr) {
1103 UseFixed(instr->context(), esi),
1104 UseFixed(instr->left(), InstanceofStub::left()),
1106 return MarkAsCall(DefineFixed(result, eax), instr);
1110 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1111 LOperand* receiver = UseRegister(instr->receiver());
1112 LOperand* function = UseRegisterAtStart(instr->function());
1120 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1121 LOperand* function = UseFixed(instr->function(), edi);
1122 LOperand* receiver = UseFixed(instr->receiver(), eax);
1123 LOperand* length = UseFixed(instr->length(), ebx);
1124 LOperand* elements = UseFixed(instr->elements(), ecx);
1129 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1133 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1135 LOperand* argument = UseAny(instr->argument());
1140 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1141 return instr->HasNoUses()
1147 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1148 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
1152 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1153 LOperand* context = UseRegisterAtStart(instr->value());
1158 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1159 LOperand* context = UseFixed(instr->context(), esi);
1160 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1164 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1165 LOperand* context = UseRegisterAtStart(instr->value());
1170 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1171 LOperand* global_object = UseRegisterAtStart(instr->value());
1177 HCallConstantFunction* instr) {
1178 argument_count_ -= instr->argument_count();
1179 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr);
1183 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1184 LOperand* context = UseFixed(instr->context(), esi);
1185 LOperand* function = UseFixed(instr->function(), edi);
1186 argument_count_ -= instr->argument_count();
1188 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1192 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1193 BuiltinFunctionId op = instr->op();
1195 ASSERT(instr->representation().IsDouble());
1196 ASSERT(instr->value()->representation().IsDouble());
1197 LOperand* context = UseAny(instr->context()); // Not actually used.
1198 LOperand* input = UseRegisterAtStart(instr->value());
1203 LOperand* context = UseFixed(instr->context(), esi);
1204 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1207 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1209 LOperand* input = UseRegisterAtStart(instr->value());
1210 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs.
1235 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1236 ASSERT(instr->key()->representation().IsTagged());
1237 LOperand* context = UseFixed(instr->context(), esi);
1238 LOperand* key = UseFixed(instr->key(), ecx);
1239 argument_count_ -= instr->argument_count();
1241 return MarkAsCall(DefineFixed(result, eax), instr);
1245 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1246 LOperand* context = UseFixed(instr->context(), esi);
1247 argument_count_ -= instr->argument_count();
1249 return MarkAsCall(DefineFixed(result, eax), instr);
1253 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1254 LOperand* context = UseFixed(instr->context(), esi);
1255 argument_count_ -= instr->argument_count();
1257 return MarkAsCall(DefineFixed(result, eax), instr);
1261 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1262 argument_count_ -= instr->argument_count();
1263 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
1267 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1268 LOperand* context = UseFixed(instr->context(), esi);
1269 LOperand* constructor = UseFixed(instr->constructor(), edi);
1270 argument_count_ -= instr->argument_count();
1272 return MarkAsCall(DefineFixed(result, eax), instr);
1276 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1277 LOperand* context = UseFixed(instr->context(), esi);
1278 LOperand* function = UseFixed(instr->function(), edi);
1279 argument_count_ -= instr->argument_count();
1281 return MarkAsCall(DefineFixed(result, eax), instr);
1285 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1286 argument_count_ -= instr->argument_count();
1287 LOperand* context = UseFixed(instr->context(), esi);
1288 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr);
1292 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1293 return DoShift(Token::SHR, instr);
1297 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1298 return DoShift(Token::SAR, instr);
1302 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1303 return DoShift(Token::SHL, instr);
1307 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1308 if (instr->representation().IsInteger32()) {
1309 ASSERT(instr->left()->representation().IsInteger32());
1310 ASSERT(instr->right()->representation().IsInteger32());
1312 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1313 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1316 ASSERT(instr->representation().IsTagged());
1317 ASSERT(instr->left()->representation().IsTagged());
1318 ASSERT(instr->right()->representation().IsTagged());
1320 LOperand* context = UseFixed(instr->context(), esi);
1321 LOperand* left = UseFixed(instr->left(), edx);
1322 LOperand* right = UseFixed(instr->right(), eax);
1324 new(zone()) LArithmeticT(instr->op(), context, left, right);
1325 return MarkAsCall(DefineFixed(result, eax), instr);
1330 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1331 ASSERT(instr->value()->representation().IsInteger32());
1332 ASSERT(instr->representation().IsInteger32());
1333 LOperand* input = UseRegisterAtStart(instr->value());
1339 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1340 if (instr->representation().IsDouble()) {
1341 return DoArithmeticD(Token::DIV, instr);
1342 } else if (instr->representation().IsInteger32()) {
1346 LOperand* dividend = UseFixed(instr->left(), eax);
1347 LOperand* divisor = UseRegister(instr->right());
1351 ASSERT(instr->representation().IsTagged());
1352 return DoArithmeticT(Token::DIV, instr);
1357 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1358 if (instr->representation().IsInteger32()) {
1359 ASSERT(instr->left()->representation().IsInteger32());
1360 ASSERT(instr->right()->representation().IsInteger32());
1363 if (instr->HasPowerOf2Divisor()) {
1364 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1365 LOperand* value = UseRegisterAtStart(instr->left());
1367 new(zone()) LModI(value, UseOrConstant(instr->right()), NULL);
1373 LOperand* value = UseFixed(instr->left(), eax);
1374 LOperand* divisor = UseRegister(instr->right());
1379 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1380 instr->CheckFlag(HValue::kCanBeDivByZero))
1383 } else if (instr->representation().IsTagged()) {
1384 return DoArithmeticT(Token::MOD, instr);
1386 ASSERT(instr->representation().IsDouble());
1390 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1391 LOperand* right = UseFixedDouble(instr->right(), xmm1);
1393 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1398 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1399 if (instr->representation().IsInteger32()) {
1400 ASSERT(instr->left()->representation().IsInteger32());
1401 ASSERT(instr->right()->representation().IsInteger32());
1402 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1403 LOperand* right = UseOrConstant(instr->MostConstantOperand());
1405 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1409 if (instr->CheckFlag(HValue::kCanOverflow) ||
1410 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1414 } else if (instr->representation().IsDouble()) {
1415 return DoArithmeticD(Token::MUL, instr);
1417 ASSERT(instr->representation().IsTagged());
1418 return DoArithmeticT(Token::MUL, instr);
1423 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1424 if (instr->representation().IsInteger32()) {
1425 ASSERT(instr->left()->representation().IsInteger32());
1426 ASSERT(instr->right()->representation().IsInteger32());
1427 LOperand* left = UseRegisterAtStart(instr->left());
1428 LOperand* right = UseOrConstantAtStart(instr->right());
1431 if (instr->CheckFlag(HValue::kCanOverflow)) {
1435 } else if (instr->representation().IsDouble()) {
1436 return DoArithmeticD(Token::SUB, instr);
1438 ASSERT(instr->representation().IsTagged());
1439 return DoArithmeticT(Token::SUB, instr);
1444 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1445 if (instr->representation().IsInteger32()) {
1446 ASSERT(instr->left()->representation().IsInteger32());
1447 ASSERT(instr->right()->representation().IsInteger32());
1448 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1449 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1452 if (instr->CheckFlag(HValue::kCanOverflow)) {
1456 } else if (instr->representation().IsDouble()) {
1457 return DoArithmeticD(Token::ADD, instr);
1459 ASSERT(instr->representation().IsTagged());
1460 return DoArithmeticT(Token::ADD, instr);
1465 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1466 ASSERT(instr->representation().IsDouble());
1469 Representation exponent_type = instr->right()->representation();
1470 ASSERT(instr->left()->representation().IsDouble());
1471 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1473 UseFixedDouble(instr->right(), xmm1) :
1474 UseFixed(instr->right(), eax);
1476 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1481 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1482 ASSERT(instr->representation().IsDouble());
1483 ASSERT(instr->global_object()->representation().IsTagged());
1484 LOperand* global_object = UseFixed(instr->global_object(), eax);
1486 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1490 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1491 ASSERT(instr->left()->representation().IsTagged());
1492 ASSERT(instr->right()->representation().IsTagged());
1493 LOperand* context = UseFixed(instr->context(), esi);
1494 LOperand* left = UseFixed(instr->left(), edx);
1495 LOperand* right = UseFixed(instr->right(), eax);
1497 return MarkAsCall(DefineFixed(result, eax), instr);
1502 HCompareIDAndBranch* instr) {
1503 Representation r = instr->GetInputRepresentation();
1505 ASSERT(instr->left()->representation().IsInteger32());
1506 ASSERT(instr->right()->representation().IsInteger32());
1507 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1508 LOperand* right = UseOrConstantAtStart(instr->right());
1512 ASSERT(instr->left()->representation().IsDouble());
1513 ASSERT(instr->right()->representation().IsDouble());
1516 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1517 left = UseRegisterOrConstantAtStart(instr->left());
1518 right = UseRegisterOrConstantAtStart(instr->right());
1520 left = UseRegisterAtStart(instr->left());
1521 right = UseRegisterAtStart(instr->right());
1529 HCompareObjectEqAndBranch* instr) {
1530 LOperand* left = UseRegisterAtStart(instr->left());
1531 LOperand* right = UseAtStart(instr->right());
1537 HCompareConstantEqAndBranch* instr) {
1539 UseRegisterAtStart(instr->value()));
1543 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1545 LOperand* temp = instr->kind() == kStrictEquality ? NULL : TempRegister();
1546 return new(zone()) LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp);
1550 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1551 ASSERT(instr->value()->representation().IsTagged());
1553 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1557 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1558 ASSERT(instr->value()->representation().IsTagged());
1560 return new LIsStringAndBranch(UseRegister(instr->value()), temp);
1564 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1565 ASSERT(instr->value()->representation().IsTagged());
1566 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1571 HIsUndetectableAndBranch* instr) {
1572 ASSERT(instr ->value()->representation().IsTagged());
1574 UseRegisterAtStart(instr->value()), TempRegister());
1579 HStringCompareAndBranch* instr) {
1580 ASSERT(instr->left()->representation().IsTagged());
1581 ASSERT(instr->right()->representation().IsTagged());
1582 LOperand* context = UseFixed(instr->context(), esi);
1583 LOperand* left = UseFixed(instr->left(), edx);
1584 LOperand* right = UseFixed(instr->right(), eax);
1589 return MarkAsCall(result, instr);
1594 HHasInstanceTypeAndBranch* instr) {
1595 ASSERT(instr->value()->representation().IsTagged());
1597 UseRegisterAtStart(instr->value()),
1603 HGetCachedArrayIndex* instr) {
1604 ASSERT(instr->value()->representation().IsTagged());
1605 LOperand* value = UseRegisterAtStart(instr->value());
1612 HHasCachedArrayIndexAndBranch* instr) {
1613 ASSERT(instr->value()->representation().IsTagged());
1615 UseRegisterAtStart(instr->value()));
1620 HClassOfTestAndBranch* instr) {
1621 ASSERT(instr->value()->representation().IsTagged());
1622 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1628 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1629 LOperand* array = UseRegisterAtStart(instr->value());
1635 HFixedArrayBaseLength* instr) {
1636 LOperand* array = UseRegisterAtStart(instr->value());
1641 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1642 LOperand* object = UseRegisterAtStart(instr->value());
1647 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1648 LOperand* object = UseRegister(instr->value());
1654 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1655 LOperand* date = UseFixed(instr->value(), eax);
1657 new(zone()) LDateField(date, FixedTemp(ecx), instr->index());
1658 return MarkAsCall(DefineFixed(result, eax), instr);
1662 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1664 UseRegisterOrConstantAtStart(instr->index()),
1665 UseAtStart(instr->length())));
1669 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1676 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1677 LOperand* context = UseFixed(instr->context(), esi);
1678 LOperand* value = UseFixed(instr->value(), eax);
1679 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1683 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1696 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1697 Representation from = instr->from();
1698 Representation to = instr->to();
1701 LOperand* value = UseRegister(instr->value());
1703 LOperand* temp = instr->deoptimize_on_minus_zero()
1710 LOperand* value = UseRegister(instr->value());
1711 bool needs_check = !instr->value()->type().IsSmi();
1713 bool truncating = instr->CanTruncateToInt32();
1726 LOperand* value = UseRegister(instr->value());
1735 bool truncating = instr->CanTruncateToInt32();
1738 UseTempRegister(instr->value()) : UseRegister(instr->value());
1745 HValue* val = instr->value();
1756 new(zone()) LInteger32ToDouble(Use(instr->value())));
1764 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1765 LOperand* value = UseAtStart(instr->value());
1770 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1771 LOperand* value = UseRegisterAtStart(instr->value());
1778 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1785 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1786 LOperand* value = UseAtStart(instr->value());
1791 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1796 LOperand* value = Isolate::Current()->heap()->InNewSpace(*instr->target())
1797 ? UseRegisterAtStart(instr->value())
1798 : UseAtStart(instr->value());
1803 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1804 LOperand* value = UseRegisterAtStart(instr->value());
1810 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1811 HValue* value = instr->value();
1831 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1832 return new(zone()) LReturn(UseFixed(instr->value(), eax));
1836 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1837 Representation r = instr->representation();
1841 double value = instr->DoubleValue();
1855 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1857 return instr->RequiresHoleCheck()
1863 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1864 LOperand* context = UseFixed(instr->context(), esi);
1865 LOperand* global_object = UseFixed(instr->global_object(), eax);
1868 return MarkAsCall(DefineFixed(result, eax), instr);
1872 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1874 new(zone()) LStoreGlobalCell(UseRegister(instr->value()));
1875 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1879 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1880 LOperand* context = UseFixed(instr->context(), esi);
1881 LOperand* global_object = UseFixed(instr->global_object(), edx);
1882 LOperand* value = UseFixed(instr->value(), eax);
1885 return MarkAsCall(result, instr);
1889 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1890 LOperand* context = UseRegisterAtStart(instr->value());
1893 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1897 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1900 LOperand* context = UseRegister(instr->context());
1901 if (instr->NeedsWriteBarrier()) {
1902 value = UseTempRegister(instr->value());
1905 value = UseRegister(instr->value());
1909 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1913 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1914 ASSERT(instr->representation().IsTagged());
1915 LOperand* obj = UseRegisterAtStart(instr->object());
1921 HLoadNamedFieldPolymorphic* instr) {
1922 ASSERT(instr->representation().IsTagged());
1923 if (instr->need_generic()) {
1924 LOperand* context = UseFixed(instr->context(), esi);
1925 LOperand* obj = UseFixed(instr->object(), eax);
1928 return MarkAsCall(DefineFixed(result, eax), instr);
1930 LOperand* context = UseAny(instr->context()); // Not actually used.
1931 LOperand* obj = UseRegisterAtStart(instr->object());
1939 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1940 LOperand* context = UseFixed(instr->context(), esi);
1941 LOperand* object = UseFixed(instr->object(), eax);
1943 return MarkAsCall(DefineFixed(result, eax), instr);
1948 HLoadFunctionPrototype* instr) {
1950 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()),
1955 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1956 LOperand* input = UseRegisterAtStart(instr->value());
1962 HLoadExternalArrayPointer* instr) {
1963 LOperand* input = UseRegisterAtStart(instr->value());
1969 HLoadKeyedFastElement* instr) {
1970 ASSERT(instr->representation().IsTagged());
1971 ASSERT(instr->key()->representation().IsInteger32());
1972 LOperand* obj = UseRegisterAtStart(instr->object());
1973 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1975 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1981 HLoadKeyedFastDoubleElement* instr) {
1982 ASSERT(instr->representation().IsDouble());
1983 ASSERT(instr->key()->representation().IsInteger32());
1984 LOperand* elements = UseRegisterAtStart(instr->elements());
1985 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1993 HLoadKeyedSpecializedArrayElement* instr) {
1994 ElementsKind elements_kind = instr->elements_kind();
1996 (instr->representation().IsInteger32() &&
1999 (instr->representation().IsDouble() &&
2002 ASSERT(instr->key()->representation().IsInteger32());
2003 LOperand* external_pointer = UseRegister(instr->external_pointer());
2004 LOperand* key = UseRegisterOrConstant(instr->key());
2017 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2018 LOperand* context = UseFixed(instr->context(), esi);
2019 LOperand* object = UseFixed(instr->object(), edx);
2020 LOperand* key = UseFixed(instr->key(), eax);
2024 return MarkAsCall(DefineFixed(result, eax), instr);
2029 HStoreKeyedFastElement* instr) {
2030 bool needs_write_barrier = instr->NeedsWriteBarrier();
2031 ASSERT(instr->value()->representation().IsTagged());
2032 ASSERT(instr->object()->representation().IsTagged());
2033 ASSERT(instr->key()->representation().IsInteger32());
2035 LOperand* obj = UseRegister(instr->object());
2037 ? UseTempRegister(instr->value())
2038 : UseRegisterAtStart(instr->value());
2040 ? UseTempRegister(instr->key())
2041 : UseRegisterOrConstantAtStart(instr->key());
2047 HStoreKeyedFastDoubleElement* instr) {
2048 ASSERT(instr->value()->representation().IsDouble());
2049 ASSERT(instr->elements()->representation().IsTagged());
2050 ASSERT(instr->key()->representation().IsInteger32());
2052 LOperand* elements = UseRegisterAtStart(instr->elements());
2053 LOperand* val = UseTempRegister(instr->value());
2054 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2061 HStoreKeyedSpecializedArrayElement* instr) {
2062 ElementsKind elements_kind = instr->elements_kind();
2064 (instr->value()->representation().IsInteger32() &&
2067 (instr->value()->representation().IsDouble() &&
2070 ASSERT(instr->external_pointer()->representation().IsExternal());
2071 ASSERT(instr->key()->representation().IsInteger32());
2073 LOperand* external_pointer = UseRegister(instr->external_pointer());
2074 LOperand* key = UseRegisterOrConstant(instr->key());
2080 val = UseFixed(instr->value(), eax);
2082 val = UseRegister(instr->value());
2091 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2092 LOperand* context = UseFixed(instr->context(), esi);
2093 LOperand* object = UseFixed(instr->object(), edx);
2094 LOperand* key = UseFixed(instr->key(), ecx);
2095 LOperand* value = UseFixed(instr->value(), eax);
2097 ASSERT(instr->object()->representation().IsTagged());
2098 ASSERT(instr->key()->representation().IsTagged());
2099 ASSERT(instr->value()->representation().IsTagged());
2103 return MarkAsCall(result, instr);
2108 HTransitionElementsKind* instr) {
2109 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS &&
2110 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) {
2111 LOperand* object = UseRegister(instr->object());
2118 LOperand* object = UseFixed(instr->object(), eax);
2125 return MarkAsCall(DefineFixed(result, eax), instr);
2130 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2131 bool needs_write_barrier = instr->NeedsWriteBarrier();
2135 obj = instr->is_in_object()
2136 ? UseRegister(instr->object())
2137 : UseTempRegister(instr->object());
2139 obj = UseRegisterAtStart(instr->object());
2143 ? UseTempRegister(instr->value())
2144 : UseRegister(instr->value());
2148 LOperand* temp = (!instr->is_in_object() || needs_write_barrier)
2156 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2157 LOperand* context = UseFixed(instr->context(), esi);
2158 LOperand* object = UseFixed(instr->object(), edx);
2159 LOperand* value = UseFixed(instr->value(), eax);
2163 return MarkAsCall(result, instr);
2167 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2168 LOperand* context = UseFixed(instr->context(), esi);
2169 LOperand* left = UseOrConstantAtStart(instr->left());
2170 LOperand* right = UseOrConstantAtStart(instr->right());
2172 return MarkAsCall(DefineFixed(string_add, eax), instr);
2176 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2177 LOperand* string = UseTempRegister(instr->string());
2178 LOperand* index = UseTempRegister(instr->index());
2179 LOperand* context = UseAny(instr->context());
2186 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2187 LOperand* char_code = UseRegister(instr->value());
2188 LOperand* context = UseAny(instr->context());
2195 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2196 LOperand* string = UseRegisterAtStart(instr->value());
2201 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2202 LOperand* context = UseFixed(instr->context(), esi);
2209 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) {
2210 LOperand* context = UseFixed(instr->context(), esi);
2212 DefineFixed(new(zone()) LFastLiteral(context), eax), instr);
2216 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2217 LOperand* context = UseFixed(instr->context(), esi);
2219 DefineFixed(new(zone()) LArrayLiteral(context), eax), instr);
2223 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2224 LOperand* context = UseFixed(instr->context(), esi);
2226 DefineFixed(new(zone()) LObjectLiteral(context), eax), instr);
2230 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2231 LOperand* context = UseFixed(instr->context(), esi);
2233 DefineFixed(new(zone()) LRegExpLiteral(context), eax), instr);
2237 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2238 LOperand* context = UseFixed(instr->context(), esi);
2240 DefineFixed(new(zone()) LFunctionLiteral(context), eax), instr);
2244 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2245 LOperand* context = UseFixed(instr->context(), esi);
2246 LOperand* object = UseAtStart(instr->object());
2247 LOperand* key = UseOrConstantAtStart(instr->key());
2249 return MarkAsCall(DefineFixed(result, eax), instr);
2253 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2255 current_block_->last_environment()->set_ast_id(instr->ast_id());
2260 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2261 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2266 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2276 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2277 LOperand* context = UseFixed(instr->context(), esi);
2278 argument_count_ -= instr->argument_count();
2280 return MarkAsCall(DefineFixed(result, eax), instr);
2284 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2293 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2294 LOperand* arguments = UseRegister(instr->arguments());
2295 LOperand* length = UseTempRegister(instr->length());
2296 LOperand* index = Use(instr->index());
2303 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2304 LOperand* object = UseFixed(instr->value(), eax);
2306 return MarkAsCall(DefineFixed(result, eax), instr);
2310 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2311 LOperand* context = UseFixed(instr->context(), esi);
2312 LOperand* value = UseAtStart(instr->value());
2314 return MarkAsCall(DefineFixed(result, eax), instr);
2318 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2319 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2324 HIsConstructCallAndBranch* instr) {
2329 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2333 env->set_ast_id(instr->ast_id());
2335 env->Drop(instr->pop_count());
2336 for (int i = 0; i < instr->values()->length(); ++i) {
2337 HValue* value = instr->values()->at(i);
2338 if (instr->HasAssignedIndexAt(i)) {
2339 env->Bind(instr->GetAssignedIndexAt(i), value);
2348 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
2361 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2362 if (instr->is_function_entry()) {
2363 LOperand* context = UseFixed(instr->context(), esi);
2364 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2366 ASSERT(instr->is_backwards_branch());
2367 LOperand* context = UseAny(instr->context());
2374 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2377 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2378 instr->arguments_count(),
2379 instr->function(),
2381 instr->call_kind(),
2382 instr->is_construct());
2383 if (instr->arguments() != NULL) {
2384 inner->Bind(instr->arguments(), graph()->GetArgumentsObject());
2387 chunk_->AddInlinedClosure(instr->closure());
2392 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2400 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2401 LOperand* context = UseFixed(instr->context(), esi);
2402 LOperand* key = UseOrConstantAtStart(instr->key());
2403 LOperand* object = UseOrConstantAtStart(instr->object());
2405 return MarkAsCall(DefineFixed(result, eax), instr);
2409 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2410 LOperand* context = UseFixed(instr->context(), esi);
2411 LOperand* object = UseFixed(instr->enumerable(), eax);
2413 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
2417 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2418 LOperand* map = UseRegister(instr->map());
2424 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2425 LOperand* value = UseRegisterAtStart(instr->value());
2426 LOperand* map = UseRegisterAtStart(instr->map());
2431 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2432 LOperand* object = UseRegister(instr->object());
2433 LOperand* index = UseTempRegister(instr->index());