Lines Matching full:instr
478 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) {
481 if (instr->IsControl()) {
484 instructions_.Add(instr);
487 instructions_.Add(instr);
490 if (instr->HasPointerMap()) {
491 pointer_maps_.Add(instr->pointer_map());
492 instr->pointer_map()->set_lithium_position(index);
671 HInstruction* instr = HInstruction::cast(value);
672 VisitInstruction(instr);
680 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
683 instr->set_result(result);
684 return instr;
690 LTemplateInstruction<1, I, T>* instr) {
691 return Define(instr,
698 LTemplateInstruction<1, I, T>* instr, int index) {
699 return Define(instr,
706 LTemplateInstruction<1, I, T>* instr) {
707 return Define(instr,
714 LTemplateInstruction<1, I, T>* instr, Register reg) {
715 return Define(instr, ToUnallocated(reg));
721 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) {
722 return Define(instr, ToUnallocated(reg));
726 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
729 instr->set_environment(CreateEnvironment(hydrogen_env,
731 return instr;
736 LInstruction* instr, int ast_id) {
739 instruction_pending_deoptimization_environment_ = instr;
741 return instr;
751 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
755 instr->VerifyCall();
757 instr->MarkAsCall();
758 instr = AssignPointerMap(instr);
763 instr = SetInstructionPendingDeoptimizationEnvironment(
764 instr, sim->ast_id());
774 if (needs_environment && !instr->HasEnvironment()) {
775 instr = AssignEnvironment(instr);
778 return instr;
782 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
783 instr->MarkAsSaveDoubles();
784 return instr;
788 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
789 ASSERT(!instr->HasPointerMap());
790 instr->set_pointer_map(new(zone()) LPointerMap(position_));
791 return instr;
818 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
819 return new(zone()) LLabel(instr->block());
823 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) {
828 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
834 HBitwiseBinaryOperation* instr) {
835 if (instr->representation().IsTagged()) {
836 ASSERT(instr->left()->representation().IsTagged());
837 ASSERT(instr->right()->representation().IsTagged());
839 LOperand* left = UseFixed(instr->left(), a1);
840 LOperand* right = UseFixed(instr->right(), a0);
842 return MarkAsCall(DefineFixed(result, v0), 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();
908 return MarkAsCall(DefineFixed(result, v0), instr);
979 LInstruction* instr = current->CompileToLithium(this);
981 if (instr != NULL) {
982 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
983 instr = AssignPointerMap(instr);
985 if (FLAG_stress_environments && !instr->HasEnvironment()) {
986 instr = AssignEnvironment(instr);
988 instr->set_hydrogen_value(current);
989 chunk_->AddInstruction(instr, current_block_);
1038 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1039 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
1043 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1044 HValue* value = instr->value();
1047 ? instr->FirstSuccessor()
1048 : instr->SecondSuccessor();
1064 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1065 ASSERT(instr->value()->representation().IsTagged());
1066 LOperand* value = UseRegisterAtStart(instr->value());
1083 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1085 new(zone()) LInstanceOf(UseFixed(instr->left(), a0),
1086 UseFixed(instr->right(), a1));
1087 return MarkAsCall(DefineFixed(result, v0), instr);
1092 HInstanceOfKnownGlobal* instr) {
1094 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), a0),
1096 return MarkAsCall(DefineFixed(result, v0), instr);
1100 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1101 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1102 instr->function());
1108 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1109 LOperand* function = UseFixed(instr->function(), a1);
1110 LOperand* receiver = UseFixed(instr->receiver(), a0);
1111 LOperand* length = UseFixed(instr->length(), a2);
1112 LOperand* elements = UseFixed(instr->elements(), a3);
1117 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1121 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1123 LOperand* argument = Use(instr->argument());
1128 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1129 return instr->HasNoUses()
1135 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1136 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
1140 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1141 LOperand* context = UseRegisterAtStart(instr->value());
1146 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1147 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1151 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1152 LOperand* context = UseRegisterAtStart(instr->value());
1157 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1158 LOperand* global_object = UseRegisterAtStart(instr->value());
1164 HCallConstantFunction* instr) {
1165 argument_count_ -= instr->argument_count();
1166 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr);
1170 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1171 LOperand* function = UseFixed(instr->function(), a1);
1172 argument_count_ -= instr->argument_count();
1174 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1178 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1179 BuiltinFunctionId op = instr->op();
1181 LOperand* input = UseFixedDouble(instr->value(), f4);
1183 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1187 LOperand* input = UseFixedDouble(instr->value(), f8);
1192 LOperand* input = UseRegisterAtStart(instr->value());
1212 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1213 ASSERT(instr->key()->representation().IsTagged());
1214 argument_count_ -= instr->argument_count();
1215 LOperand* key = UseFixed(instr->key(), a2);
1216 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr);
1220 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1221 argument_count_ -= instr->argument_count();
1222 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, v0), instr);
1226 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1227 argument_count_ -= instr->argument_count();
1228 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, v0), instr);
1232 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1233 argument_count_ -= instr->argument_count();
1234 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr);
1238 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1239 LOperand* constructor = UseFixed(instr->constructor(), a1);
1240 argument_count_ -= instr->argument_count();
1242 return MarkAsCall(DefineFixed(result, v0), instr);
1246 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1247 LOperand* function = UseFixed(instr->function(), a1);
1248 argument_count_ -= instr->argument_count();
1250 instr);
1254 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1255 argument_count_ -= instr->argument_count();
1256 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, v0), instr);
1260 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1261 return DoShift(Token::SHR, instr);
1265 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1266 return DoShift(Token::SAR, instr);
1270 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1271 return DoShift(Token::SHL, instr);
1275 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1276 if (instr->representation().IsInteger32()) {
1277 ASSERT(instr->left()->representation().IsInteger32());
1278 ASSERT(instr->right()->representation().IsInteger32());
1280 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1281 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1284 ASSERT(instr->representation().IsTagged());
1285 ASSERT(instr->left()->representation().IsTagged());
1286 ASSERT(instr->right()->representation().IsTagged());
1288 LOperand* left = UseFixed(instr->left(), a1);
1289 LOperand* right = UseFixed(instr->right(), a0);
1290 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1291 return MarkAsCall(DefineFixed(result, v0), instr);
1296 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1297 ASSERT(instr->value()->representation().IsInteger32());
1298 ASSERT(instr->representation().IsInteger32());
1299 LOperand* value = UseRegisterAtStart(instr->value());
1304 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1305 if (instr->representation().IsDouble()) {
1306 return DoArithmeticD(Token::DIV, instr);
1307 } else if (instr->representation().IsInteger32()) {
1313 LOperand* dividend = UseFixed(instr->left(), a0);
1314 LOperand* divisor = UseFixed(instr->right(), a1);
1318 return DoArithmeticT(Token::DIV, instr);
1323 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1324 if (instr->representation().IsInteger32()) {
1325 ASSERT(instr->left()->representation().IsInteger32());
1326 ASSERT(instr->right()->representation().IsInteger32());
1329 if (instr->HasPowerOf2Divisor()) {
1330 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1331 LOperand* value = UseRegisterAtStart(instr->left());
1332 mod = new(zone()) LModI(value, UseOrConstant(instr->right()));
1334 LOperand* dividend = UseRegister(instr->left());
1335 LOperand* divisor = UseRegister(instr->right());
1343 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1344 instr->CheckFlag(HValue::kCanBeDivByZero)) {
1349 } else if (instr->representation().IsTagged()) {
1350 return DoArithmeticT(Token::MOD, instr);
1352 ASSERT(instr->representation().IsDouble());
1356 LOperand* left = UseFixedDouble(instr->left(), f2);
1357 LOperand* right = UseFixedDouble(instr->right(), f4);
1359 return MarkAsCall(DefineFixedDouble(result, f2), instr);
1364 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1365 if (instr->representation().IsInteger32()) {
1366 ASSERT(instr->left()->representation().IsInteger32());
1367 ASSERT(instr->right()->representation().IsInteger32());
1369 LOperand* right = UseOrConstant(instr->MostConstantOperand());
1371 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
1372 (instr->CheckFlag(HValue::kCanOverflow) ||
1374 left = UseRegister(instr->LeastConstantOperand());
1377 left = UseRegisterAtStart(instr->LeastConstantOperand());
1380 if (instr->CheckFlag(HValue::kCanOverflow) ||
1381 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1386 } else if (instr->representation().IsDouble()) {
1387 return DoArithmeticD(Token::MUL, instr);
1390 return DoArithmeticT(Token::MUL, instr);
1395 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1396 if (instr->representation().IsInteger32()) {
1397 ASSERT(instr->left()->representation().IsInteger32());
1398 ASSERT(instr->right()->representation().IsInteger32());
1399 LOperand* left = UseRegisterAtStart(instr->left());
1400 LOperand* right = UseOrConstantAtStart(instr->right());
1403 if (instr->CheckFlag(HValue::kCanOverflow)) {
1407 } else if (instr->representation().IsDouble()) {
1408 return DoArithmeticD(Token::SUB, instr);
1410 return DoArithmeticT(Token::SUB, instr);
1415 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1416 if (instr->representation().IsInteger32()) {
1417 ASSERT(instr->left()->representation().IsInteger32());
1418 ASSERT(instr->right()->representation().IsInteger32());
1419 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1420 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1423 if (instr->CheckFlag(HValue::kCanOverflow)) {
1427 } else if (instr->representation().IsDouble()) {
1428 return DoArithmeticD(Token::ADD, instr);
1430 ASSERT(instr->representation().IsTagged());
1431 return DoArithmeticT(Token::ADD, instr);
1436 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1437 ASSERT(instr->representation().IsDouble());
1440 Representation exponent_type = instr->right()->representation();
1441 ASSERT(instr->left()->representation().IsDouble());
1442 LOperand* left = UseFixedDouble(instr->left(), f2);
1444 UseFixedDouble(instr->right(), f4) :
1445 UseFixed(instr->right(), a2);
1448 instr,
1453 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1454 ASSERT(instr->representation().IsDouble());
1455 ASSERT(instr->global_object()->representation().IsTagged());
1456 LOperand* global_object = UseFixed(instr->global_object(), a0);
1458 return MarkAsCall(DefineFixedDouble(result, f0), instr);
1462 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1463 ASSERT(instr->left()->representation().IsTagged());
1464 ASSERT(instr->right()->representation().IsTagged());
1465 LOperand* left = UseFixed(instr->left(), a1);
1466 LOperand* right = UseFixed(instr->right(), a0);
1468 return MarkAsCall(DefineFixed(result, v0), instr);
1473 HCompareIDAndBranch* instr) {
1474 Representation r = instr->GetInputRepresentation();
1476 ASSERT(instr->left()->representation().IsInteger32());
1477 ASSERT(instr->right()->representation().IsInteger32());
1478 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1479 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1483 ASSERT(instr->left()->representation().IsDouble());
1484 ASSERT(instr->right()->representation().IsDouble());
1485 LOperand* left = UseRegisterAtStart(instr->left());
1486 LOperand* right = UseRegisterAtStart(instr->right());
1493 HCompareObjectEqAndBranch* instr) {
1494 LOperand* left = UseRegisterAtStart(instr->left());
1495 LOperand* right = UseRegisterAtStart(instr->right());
1501 HCompareConstantEqAndBranch* instr) {
1503 UseRegisterAtStart(instr->value()));
1507 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1508 ASSERT(instr->value()->representation().IsTagged());
1509 return new(zone()) LIsNilAndBranch(UseRegisterAtStart(instr->value()));
1513 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1514 ASSERT(instr->value()->representation().IsTagged());
1516 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1521 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1522 ASSERT(instr->value()->representation().IsTagged());
1524 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1529 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1530 ASSERT(instr->value()->representation().IsTagged());
1531 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1536 HIsUndetectableAndBranch* instr) {
1537 ASSERT(instr->value()->representation().IsTagged());
1539 UseRegisterAtStart(instr->value()), TempRegister());
1544 HStringCompareAndBranch* instr) {
1545 ASSERT(instr->left()->representation().IsTagged());
1546 ASSERT(instr->right()->representation().IsTagged());
1547 LOperand* left = UseFixed(instr->left(), a1);
1548 LOperand* right = UseFixed(instr->right(), a0);
1551 return MarkAsCall(result, instr);
1556 HHasInstanceTypeAndBranch* instr) {
1557 ASSERT(instr
1558 LOperand* value = UseRegisterAtStart(instr->value());
1564 HGetCachedArrayIndex* instr) {
1565 ASSERT(instr->value()->representation().IsTagged());
1566 LOperand* value = UseRegisterAtStart(instr->value());
1573 HHasCachedArrayIndexAndBranch* instr) {
1574 ASSERT(instr->value()->representation().IsTagged());
1576 UseRegisterAtStart(instr->value()));
1581 HClassOfTestAndBranch* instr) {
1582 ASSERT(instr->value()->representation().IsTagged());
1583 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1588 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1589 LOperand* array = UseRegisterAtStart(instr->value());
1595 HFixedArrayBaseLength* instr) {
1596 LOperand* array = UseRegisterAtStart(instr->value());
1601 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1602 LOperand* object = UseRegisterAtStart(instr->value());
1607 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1608 LOperand* object = UseRegister(instr->value());
1614 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1615 LOperand* object = UseFixed(instr->value(), a0);
1616 LDateField* result = new LDateField(object, FixedTemp(a1), instr->index());
1617 return MarkAsCall(DefineFixed(result, v0), instr);
1621 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1622 LOperand* value = UseRegisterAtStart(instr->index());
1623 LOperand* length = UseRegister(instr->length());
1628 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1635 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1636 LOperand* value = UseFixed(instr->value(), a0);
1637 return MarkAsCall(new(zone()) LThrow(value), instr);
1641 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1654 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1655 Representation from = instr->from();
1656 Representation to = instr->to();
1659 LOperand* value = UseRegister(instr->value());
1664 LOperand* value = UseRegisterAtStart(instr->value());
1665 bool needs_check = !instr->value()->type().IsSmi();
1671 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1673 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(f22)
1685 LOperand* value = UseRegister(instr->value());
1697 LOperand* value = UseRegister(instr->value());
1699 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1705 HValue* val = instr->value();
1715 LOperand* value = Use(instr->value());
1724 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1725 LOperand* value = UseRegisterAtStart(instr->value());
1730 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1731 LOperand* value = UseRegisterAtStart(instr->value());
1737 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1745 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1746 LOperand* value = UseRegisterAtStart(instr->value());
1751 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1752 LOperand* value = UseRegisterAtStart(instr->value());
1757 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1758 LOperand* value = UseRegisterAtStart(instr->value());
1764 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1765 HValue* value = instr->value();
1783 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1784 return new(zone()) LReturn(UseFixed(instr->value(), v0));
1788 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1789 Representation r = instr->representation();
1803 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1805 return instr->RequiresHoleCheck()
1811 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1812 LOperand* global_object = UseFixed(instr->global_object(), a0);
1814 return MarkAsCall(DefineFixed(result, v0), instr);
1818 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1819 LOperand* value = UseRegister(instr->value());
1822 return instr->RequiresHoleCheck()
1828 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1829 LOperand* global_object = UseFixed(instr->global_object(), a1);
1830 LOperand* value = UseFixed(instr->value(), a0);
1833 return MarkAsCall(result, instr);
1837 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1838 LOperand* context = UseRegisterAtStart(instr->value());
1841 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1845 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1848 if (instr->NeedsWriteBarrier()) {
1849 context = UseTempRegister(instr->context());
1850 value = UseTempRegister(instr->value());
1852 context = UseRegister(instr->context());
1853 value = UseRegister(instr->value());
1856 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1860 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1862 new(zone()) LLoadNamedField(UseRegisterAtStart(instr->object())));
1867 HLoadNamedFieldPolymorphic* instr) {
1868 ASSERT(instr->representation().IsTagged());
1869 if (instr->need_generic()) {
1870 LOperand* obj = UseFixed(instr->object(), a0);
1873 return MarkAsCall(DefineFixed(result, v0), instr);
1875 LOperand* obj = UseRegisterAtStart(instr->object());
1883 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1884 LOperand* object = UseFixed(instr->object(), a0);
1886 return MarkAsCall(result, instr);
1891 HLoadFunctionPrototype* instr) {
1893 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
1897 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1898 LOperand* input = UseRegisterAtStart(instr->value());
1904 HLoadExternalArrayPointer* instr) {
1905 LOperand* input = UseRegisterAtStart(instr->value());
1911 HLoadKeyedFastElement* instr) {
1912 ASSERT(instr->representation().IsTagged());
1913 ASSERT(instr->key()->representation().IsInteger32());
1914 LOperand* obj = UseRegisterAtStart(instr->object());
1915 LOperand* key = UseRegisterAtStart(instr->key());
1917 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1923 HLoadKeyedFastDoubleElement* instr) {
1924 ASSERT(instr->representation().IsDouble());
1925 ASSERT(instr->key()->representation().IsInteger32());
1926 LOperand* elements = UseTempRegister(instr->elements());
1927 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1935 HLoadKeyedSpecializedArrayElement* instr) {
1936 ElementsKind elements_kind = instr->elements_kind();
1937 Representation representation(instr->representation());
1945 ASSERT(instr->key()->representation().IsInteger32());
1946 LOperand* external_pointer = UseRegister(instr->external_pointer());
1947 LOperand* key = UseRegisterOrConstant(instr->key());
1958 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1959 LOperand* object = UseFixed(instr->object(), a1);
1960 LOperand* key = UseFixed(instr->key(), a0);
1964 return MarkAsCall(result, instr);
1969 HStoreKeyedFastElement* instr) {
1970 bool needs_write_barrier = instr->NeedsWriteBarrier();
1971 ASSERT(instr->value()->representation().IsTagged());
1972 ASSERT(instr->object()->representation().IsTagged());
1973 ASSERT(instr->key()->representation().IsInteger32());
1975 LOperand* obj = UseTempRegister(instr->object());
1977 ? UseTempRegister(instr->value())
1978 : UseRegisterAtStart(instr->value());
1980 ? UseTempRegister(instr->key())
1981 : UseRegisterOrConstantAtStart(instr->key());
1987 HStoreKeyedFastDoubleElement* instr) {
1988 ASSERT(instr->value()->representation().IsDouble());
1989 ASSERT(instr->elements()->representation().IsTagged());
1990 ASSERT(instr->key()->representation().IsInteger32());
1992 LOperand* elements = UseRegisterAtStart(instr->elements());
1993 LOperand* val = UseTempRegister(instr->value());
1994 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2001 HStoreKeyedSpecializedArrayElement* instr) {
2002 Representation representation(instr->value()->representation());
2003 ElementsKind elements_kind = instr->elements_kind();
2011 ASSERT(instr->external_pointer()->representation().IsExternal());
2012 ASSERT(instr->key()->representation().IsInteger32());
2014 LOperand* external_pointer = UseRegister(instr->external_pointer());
2019 ? UseTempRegister(instr->value())
2020 : UseRegister(instr->value());
2021 LOperand* key = UseRegisterOrConstant(instr->key());
2029 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2030 LOperand* obj = UseFixed(instr->object(), a2);
2031 LOperand* key = UseFixed(instr->key(), a1);
2032 LOperand* val = UseFixed(instr->value(), a0);
2034 ASSERT(instr->object()->representation().IsTagged());
2035 ASSERT(instr->key()->representation().IsTagged());
2036 ASSERT(instr->value()->representation().IsTagged());
2038 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
2043 HTransitionElementsKind* instr) {
2044 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS &&
2045 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) {
2046 LOperand* object = UseRegister(instr->object());
2052 LOperand* object = UseFixed(instr->object(), a0);
2059 return MarkAsCall(DefineFixed(result, v0), instr);
2064 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2065 bool needs_write_barrier = instr->NeedsWriteBarrier();
2068 ? UseTempRegister(instr->object())
2069 : UseRegisterAtStart(instr->object());
2072 ? UseTempRegister(instr->value())
2073 : UseRegister(instr->value());
2079 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2080 LOperand* obj = UseFixed(instr->object(), a1);
2081 LOperand* val = UseFixed(instr->value(), a0);
2084 return MarkAsCall(result, instr);
2088 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2089 LOperand* left = UseRegisterAtStart(instr->left());
2090 LOperand* right = UseRegisterAtStart(instr->right());
2092 instr);
2096 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2097 LOperand* string = UseTempRegister(instr->string());
2098 LOperand* index = UseTempRegister(instr->index());
2104 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2105 LOperand* char_code = UseRegister(instr->value());
2111 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2112 LOperand* string = UseRegisterAtStart(instr->value());
2117 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2124 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) {
2125 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, v0), instr);
2129 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2130 return MarkAsCall(DefineFixed(new(zone()) LArrayLiteral, v0), instr);
2134 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2135 return MarkAsCall(DefineFixed(new(zone()) LObjectLiteral, v0), instr);
2139 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2140 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, v0), instr);
2144 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2145 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, v0), instr);
2149 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2150 LOperand* object = UseFixed(instr->object(), a0);
2151 LOperand* key = UseFixed(instr->key(), a1);
2153 return MarkAsCall(DefineFixed(result, v0), instr);
2157 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2159 current_block_->last_environment()->set_ast_id(instr->ast_id());
2164 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2165 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2170 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2180 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2181 argument_count_ -= instr->argument_count();
2182 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr);
2186 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2195 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2196 LOperand* arguments = UseRegister(instr->arguments());
2197 LOperand* length = UseTempRegister(instr->length());
2198 LOperand* index = UseRegister(instr->index());
2205 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2206 LOperand* object = UseFixed(instr->value(), a0);
2208 return MarkAsCall(DefineFixed(result, v0), instr);
2212 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2213 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), a0));
2214 return MarkAsCall(DefineFixed(result, v0), instr);
2218 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2219 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2224 HIsConstructCallAndBranch* instr) {
2229 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2233 env->set_ast_id(instr->ast_id());
2235 env->Drop(instr->pop_count());
2236 for (int i = 0; i < instr->values()->length(); ++i) {
2237 HValue* value = instr->values()->at(i);
2238 if (instr->HasAssignedIndexAt(i)) {
2239 env->Bind(instr->GetAssignedIndexAt(i), value);
2247 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2260 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2261 if (instr->is_function_entry()) {
2262 return MarkAsCall(new(zone()) LStackCheck, instr);
2264 ASSERT(instr->is_backwards_branch());
2270 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2273 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2274 instr->arguments_count(),
2275 instr->function(),
2277 instr->call_kind(),
2278 instr->is_construct());
2279 if (instr->arguments() != NULL) {
2280 inner->Bind(instr->arguments(), graph()->GetArgumentsObject());
2283 chunk_->AddInlinedClosure(instr->closure());
2288 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2296 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2297 LOperand* key = UseRegisterAtStart(instr->key());
2298 LOperand* object = UseRegisterAtStart(instr->object());
2300 return MarkAsCall(DefineFixed(result, v0), instr);
2304 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2305 LOperand* object = UseFixed(instr->enumerable(), a0);
2307 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
2311 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2312 LOperand* map = UseRegister(instr->map());
2318 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2319 LOperand* value = UseRegisterAtStart(instr->value());
2320 LOperand* map = UseRegisterAtStart(instr->map());
2325 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2326 LOperand* object = UseRegister(instr->object());
2327 LOperand* index = UseRegister(instr->index());