Lines Matching refs: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(), r1);
840 LOperand* right = UseFixed(instr->right(), r0);
842 return MarkAsCall(DefineFixed(result, r0), 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, r0), 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();
1065 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1066 ASSERT(instr->value()->representation().IsTagged());
1067 LOperand* value = UseRegisterAtStart(instr->value());
1073 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* instr) {
1074 LOperand* value = UseRegister(instr->value());
1084 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1086 new(zone()) LInstanceOf(UseFixed(instr->left(), r0),
1087 UseFixed(instr->right(), r1));
1088 return MarkAsCall(DefineFixed(result, r0), instr);
1093 HInstanceOfKnownGlobal* instr) {
1095 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), r0),
1097 return MarkAsCall(DefineFixed(result, r0), instr);
1101 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1102 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1103 LOperand* function = UseRegisterAtStart(instr->function());
1109 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1110 LOperand* function = UseFixed(instr->function(), r1);
1111 LOperand* receiver = UseFixed(instr->receiver(), r0);
1112 LOperand* length = UseFixed(instr->length(), r2);
1113 LOperand* elements = UseFixed(instr->elements(), r3);
1118 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
1122 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1124 LOperand* argument = Use(instr->argument());
1129 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1130 return instr->HasNoUses()
1136 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1137 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
1141 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1142 LOperand* context = UseRegisterAtStart(instr->value());
1147 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1148 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1152 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1153 LOperand* context = UseRegisterAtStart(instr->value());
1158 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1159 LOperand* global_object = UseRegisterAtStart(instr->value());
1165 HCallConstantFunction* instr) {
1166 argument_count_ -= instr->argument_count();
1167 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr);
1171 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1172 LOperand* function = UseFixed(instr->function(), r1);
1173 argument_count_ -= instr->argument_count();
1175 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1179 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1180 BuiltinFunctionId op = instr->op();
1182 LOperand* input = UseFixedDouble(instr->value(), d2);
1184 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1186 LOperand* input = UseFixedDouble(instr->value(), d2);
1191 LOperand* input = UseRegisterAtStart(instr->value());
1211 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1212 ASSERT(instr->key()->representation().IsTagged());
1213 argument_count_ -= instr->argument_count();
1214 LOperand* key = UseFixed(instr->key(), r2);
1215 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr);
1219 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1220 argument_count_ -= instr->argument_count();
1221 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, r0), instr);
1225 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1226 argument_count_ -= instr->argument_count();
1227 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, r0), instr);
1231 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1232 argument_count_ -= instr->argument_count();
1233 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr);
1237 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1238 LOperand* constructor = UseFixed(instr->constructor(), r1);
1239 argument_count_ -= instr->argument_count();
1241 return MarkAsCall(DefineFixed(result, r0), instr);
1245 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1246 LOperand* function = UseFixed(instr->function(), r1);
1247 argument_count_ -= instr->argument_count();
1249 instr);
1253 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1254 argument_count_ -= instr->argument_count();
1255 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, r0), instr);
1259 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1260 return DoShift(Token::SHR, instr);
1264 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1265 return DoShift(Token::SAR, instr);
1269 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1270 return DoShift(Token::SHL, instr);
1274 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1275 if (instr->representation().IsInteger32()) {
1276 ASSERT(instr->left()->representation().IsInteger32());
1277 ASSERT(instr->right()->representation().IsInteger32());
1279 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1280 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1283 ASSERT(instr->representation().IsTagged());
1284 ASSERT(instr->left()->representation().IsTagged());
1285 ASSERT(instr->right()->representation().IsTagged());
1287 LOperand* left = UseFixed(instr->left(), r1);
1288 LOperand* right = UseFixed(instr->right(), r0);
1289 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1290 return MarkAsCall(DefineFixed(result, r0), instr);
1295 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1296 ASSERT(instr->value()->representation().IsInteger32());
1297 ASSERT(instr->representation().IsInteger32());
1298 LOperand* value = UseRegisterAtStart(instr->value());
1303 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1304 if (instr->representation().IsDouble()) {
1305 return DoArithmeticD(Token::DIV, instr);
1306 } else if (instr->representation().IsInteger32()) {
1312 LOperand* dividend = UseFixed(instr->left(), r0);
1313 LOperand* divisor = UseFixed(instr->right(), r1);
1317 return DoArithmeticT(Token::DIV, instr);
1322 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1323 if (instr->representation().IsInteger32()) {
1324 ASSERT(instr->left()->representation().IsInteger32());
1325 ASSERT(instr->right()->representation().IsInteger32());
1328 if (instr->HasPowerOf2Divisor()) {
1329 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1330 LOperand* value = UseRegisterAtStart(instr->left());
1331 mod = new(zone()) LModI(value, UseOrConstant(instr->right()));
1333 LOperand* dividend = UseRegister(instr->left());
1334 LOperand* divisor = UseRegister(instr->right());
1342 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1343 instr->CheckFlag(HValue::kCanBeDivByZero)) {
1348 } else if (instr->representation().IsTagged()) {
1349 return DoArithmeticT(Token::MOD, instr);
1351 ASSERT(instr->representation().IsDouble());
1355 LOperand* left = UseFixedDouble(instr->left(), d1);
1356 LOperand* right = UseFixedDouble(instr->right(), d2);
1358 return MarkAsCall(DefineFixedDouble(result, d1), instr);
1363 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1364 if (instr->representation().IsInteger32()) {
1365 ASSERT(instr->left()->representation().IsInteger32());
1366 ASSERT(instr->right()->representation().IsInteger32());
1368 LOperand* right = UseOrConstant(instr->MostConstantOperand());
1370 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
1371 (instr->CheckFlag(HValue::kCanOverflow) ||
1373 left = UseRegister(instr->LeastConstantOperand());
1376 left = UseRegisterAtStart(instr->LeastConstantOperand());
1379 if (instr->CheckFlag(HValue::kCanOverflow) ||
1380 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1385 } else if (instr->representation().IsDouble()) {
1386 return DoArithmeticD(Token::MUL, instr);
1389 return DoArithmeticT(Token::MUL, instr);
1394 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1395 if (instr->representation().IsInteger32()) {
1396 ASSERT(instr->left()->representation().IsInteger32());
1397 ASSERT(instr->right()->representation().IsInteger32());
1398 LOperand* left = UseRegisterAtStart(instr->left());
1399 LOperand* right = UseOrConstantAtStart(instr->right());
1402 if (instr->CheckFlag(HValue::kCanOverflow)) {
1406 } else if (instr->representation().IsDouble()) {
1407 return DoArithmeticD(Token::SUB, instr);
1409 return DoArithmeticT(Token::SUB, instr);
1414 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1415 if (instr->representation().IsInteger32()) {
1416 ASSERT(instr->left()->representation().IsInteger32());
1417 ASSERT(instr->right()->representation().IsInteger32());
1418 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1419 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1422 if (instr->CheckFlag(HValue::kCanOverflow)) {
1426 } else if (instr->representation().IsDouble()) {
1427 return DoArithmeticD(Token::ADD, instr);
1429 ASSERT(instr->representation().IsTagged());
1430 return DoArithmeticT(Token::ADD, instr);
1435 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1436 ASSERT(instr->representation().IsDouble());
1439 Representation exponent_type = instr->right()->representation();
1440 ASSERT(instr->left()->representation().IsDouble());
1441 LOperand* left = UseFixedDouble(instr->left(), d1);
1443 UseFixedDouble(instr->right(), d2) :
1444 UseFixed(instr->right(), r2);
1447 instr,
1452 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1453 ASSERT(instr->representation().IsDouble());
1454 ASSERT(instr->global_object()->representation().IsTagged());
1455 LOperand* global_object = UseFixed(instr->global_object(), r0);
1457 return MarkAsCall(DefineFixedDouble(result, d7), instr);
1461 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1462 ASSERT(instr->left()->representation().IsTagged());
1463 ASSERT(instr->right()->representation().IsTagged());
1464 LOperand* left = UseFixed(instr->left(), r1);
1465 LOperand* right = UseFixed(instr->right(), r0);
1467 return MarkAsCall(DefineFixed(result, r0), instr);
1472 HCompareIDAndBranch* instr) {
1473 Representation r = instr->GetInputRepresentation();
1475 ASSERT(instr->left()->representation().IsInteger32());
1476 ASSERT(instr->right()->representation().IsInteger32());
1477 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1478 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1482 ASSERT(instr->left()->representation().IsDouble());
1483 ASSERT(instr->right()->representation().IsDouble());
1484 LOperand* left = UseRegisterAtStart(instr->left());
1485 LOperand* right = UseRegisterAtStart(instr->right());
1492 HCompareObjectEqAndBranch* instr) {
1493 LOperand* left = UseRegisterAtStart(instr->left());
1494 LOperand* right = UseRegisterAtStart(instr->right());
1500 HCompareConstantEqAndBranch* instr) {
1501 LOperand* value = UseRegisterAtStart(instr->value());
1506 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1507 ASSERT(instr->value()->representation().IsTagged());
1508 return new(zone()) LIsNilAndBranch(UseRegisterAtStart(instr->value()));
1512 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1513 ASSERT(instr->value()->representation().IsTagged());
1514 LOperand* value = UseRegisterAtStart(instr->value());
1520 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1521 ASSERT(instr->value()->representation().IsTagged());
1522 LOperand* value = UseRegisterAtStart(instr->value());
1528 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1529 ASSERT(instr->value()->representation().IsTagged());
1530 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1535 HIsUndetectableAndBranch* instr) {
1536 ASSERT(instr->value()->representation().IsTagged());
1537 LOperand* value = UseRegisterAtStart(instr->value());
1543 HStringCompareAndBranch* instr) {
1544 ASSERT(instr->left()->representation().IsTagged());
1545 ASSERT(instr->right()->representation().IsTagged());
1546 LOperand* left = UseFixed(instr->left(), r1);
1547 LOperand* right = UseFixed(instr->right(), r0);
1550 return MarkAsCall(result, instr);
1555 HHasInstanceTypeAndBranch* instr) {
1556 ASSERT(instr->value()->representation().IsTagged());
1557 LOperand* value = UseRegisterAtStart(instr->value());
1563 HGetCachedArrayIndex* instr) {
1564 ASSERT(instr->value()->representation().IsTagged());
1565 LOperand* value = UseRegisterAtStart(instr->value());
1572 HHasCachedArrayIndexAndBranch* instr) {
1573 ASSERT(instr->value()->representation().IsTagged());
1575 UseRegisterAtStart(instr->value()));
1580 HClassOfTestAndBranch* instr) {
1581 ASSERT(instr->value()->representation().IsTagged());
1582 LOperand* value = UseRegister(instr->value());
1587 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1588 LOperand* array = UseRegisterAtStart(instr->value());
1594 HFixedArrayBaseLength* instr) {
1595 LOperand* array = UseRegisterAtStart(instr->value());
1600 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1601 LOperand* object = UseRegisterAtStart(instr->value());
1606 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1607 LOperand* object = UseRegister(instr->value());
1613 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1614 LOperand* object = UseFixed(instr->value(), r0);
1615 LDateField* result = new LDateField(object, FixedTemp(r1), instr->index());
1616 return MarkAsCall(DefineFixed(result, r0), instr);
1620 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1621 LOperand* value = UseRegisterAtStart(instr->index());
1622 LOperand* length = UseRegister(instr->length());
1627 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1634 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1635 LOperand* value = UseFixed(instr->value(), r0);
1636 return MarkAsCall(new(zone()) LThrow(value), instr);
1640 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1653 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1654 Representation from = instr->from();
1655 Representation to = instr->to();
1658 LOperand* value = UseRegister(instr->value());
1663 LOperand* value = UseRegisterAtStart(instr->value());
1664 bool needs_check = !instr->value()->type().IsSmi();
1670 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1672 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d11)
1684 LOperand* value = UseRegister(instr->value());
1696 LOperand* value = UseRegister(instr->value());
1698 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1704 HValue* val = instr->value();
1714 LOperand* value = Use(instr->value());
1723 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1724 LOperand* value = UseRegisterAtStart(instr->value());
1729 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1730 LOperand* value = UseRegisterAtStart(instr->value());
1736 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1744 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1745 LOperand* value = UseRegisterAtStart(instr->value());
1750 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1751 LOperand* value = UseRegisterAtStart(instr->value());
1756 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1757 LOperand* value = UseRegisterAtStart(instr->value());
1763 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1764 HValue* value = instr->value();
1781 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1782 return new(zone()) LReturn(UseFixed(instr->value(), r0));
1786 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1787 Representation r = instr->representation();
1801 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1803 return instr->RequiresHoleCheck()
1809 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1810 LOperand* global_object = UseFixed(instr->global_object(), r0);
1812 return MarkAsCall(DefineFixed(result, r0), instr);
1816 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1817 LOperand* value = UseRegister(instr->value());
1820 return instr->RequiresHoleCheck()
1826 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1827 LOperand* global_object = UseFixed(instr->global_object(), r1);
1828 LOperand* value = UseFixed(instr->value(), r0);
1831 return MarkAsCall(result, instr);
1835 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1836 LOperand* context = UseRegisterAtStart(instr->value());
1839 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1843 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1846 if (instr->NeedsWriteBarrier()) {
1847 context = UseTempRegister(instr->context());
1848 value = UseTempRegister(instr->value());
1850 context = UseRegister(instr->context());
1851 value = UseRegister(instr->value());
1854 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1858 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1860 new(zone()) LLoadNamedField(UseRegisterAtStart(instr->object())));
1865 HLoadNamedFieldPolymorphic* instr) {
1866 ASSERT(instr->representation().IsTagged());
1867 if (instr->need_generic()) {
1868 LOperand* obj = UseFixed(instr->object(), r0);
1871 return MarkAsCall(DefineFixed(result, r0), instr);
1873 LOperand* obj = UseRegisterAtStart(instr->object());
1881 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1882 LOperand* object = UseFixed(instr->object(), r0);
1884 return MarkAsCall(result, instr);
1889 HLoadFunctionPrototype* instr) {
1891 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
1895 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1896 LOperand* input = UseRegisterAtStart(instr->value());
1902 HLoadExternalArrayPointer* instr) {
1903 LOperand* input = UseRegisterAtStart(instr->value());
1909 HLoadKeyedFastElement* instr) {
1910 ASSERT(instr->representation().IsTagged());
1911 ASSERT(instr->key()->representation().IsInteger32());
1912 LOperand* obj = UseRegisterAtStart(instr->object());
1913 LOperand* key = UseRegisterAtStart(instr->key());
1915 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1921 HLoadKeyedFastDoubleElement* instr) {
1922 ASSERT(instr->representation().IsDouble());
1923 ASSERT(instr->key()->representation().IsInteger32());
1924 LOperand* elements = UseTempRegister(instr->elements());
1925 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1933 HLoadKeyedSpecializedArrayElement* instr) {
1934 ElementsKind elements_kind = instr->elements_kind();
1936 (instr->representation().IsInteger32() &&
1939 (instr->representation().IsDouble() &&
1942 ASSERT(instr->key()->representation().IsInteger32());
1943 LOperand* external_pointer = UseRegister(instr->external_pointer());
1944 LOperand* key = UseRegisterOrConstant(instr->key());
1955 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1956 LOperand* object = UseFixed(instr->object(), r1);
1957 LOperand* key = UseFixed(instr->key(), r0);
1961 return MarkAsCall(result, instr);
1966 HStoreKeyedFastElement* instr) {
1967 bool needs_write_barrier = instr->NeedsWriteBarrier();
1968 ASSERT(instr->value()->representation().IsTagged());
1969 ASSERT(instr->object()->representation().IsTagged());
1970 ASSERT(instr->key()->representation().IsInteger32());
1972 LOperand* obj = UseTempRegister(instr->object());
1974 ? UseTempRegister(instr->value())
1975 : UseRegisterAtStart(instr->value());
1977 ? UseTempRegister(instr->key())
1978 : UseRegisterOrConstantAtStart(instr->key());
1984 HStoreKeyedFastDoubleElement* instr) {
1985 ASSERT(instr->value()->representation().IsDouble());
1986 ASSERT(instr->elements()->representation().IsTagged());
1987 ASSERT(instr->key()->representation().IsInteger32());
1989 LOperand* elements = UseRegisterAtStart(instr->elements());
1990 LOperand* val = UseTempRegister(instr->value());
1991 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1998 HStoreKeyedSpecializedArrayElement* instr) {
1999 ElementsKind elements_kind = instr->elements_kind();
2001 (instr->value()->representation().IsInteger32() &&
2004 (instr->value()->representation().IsDouble() &&
2007 ASSERT(instr->external_pointer()->representation().IsExternal());
2008 ASSERT(instr->key()->representation().IsInteger32());
2010 LOperand* external_pointer = UseRegister(instr->external_pointer());
2015 ? UseTempRegister(instr->value())
2016 : UseRegister(instr->value());
2017 LOperand* key = UseRegisterOrConstant(instr->key());
2025 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2026 LOperand* obj = UseFixed(instr->object(), r2);
2027 LOperand* key = UseFixed(instr->key(), r1);
2028 LOperand* val = UseFixed(instr->value(), r0);
2030 ASSERT(instr->object()->representation().IsTagged());
2031 ASSERT(instr->key()->representation().IsTagged());
2032 ASSERT(instr->value()->representation().IsTagged());
2034 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
2039 HTransitionElementsKind* instr) {
2040 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS &&
2041 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) {
2042 LOperand* object = UseRegister(instr->object());
2048 LOperand* object = UseFixed(instr->object(), r0);
2055 return MarkAsCall(DefineFixed(result, r0), instr);
2060 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2061 bool needs_write_barrier = instr->NeedsWriteBarrier();
2064 ? UseTempRegister(instr->object())
2065 : UseRegisterAtStart(instr->object());
2068 ? UseTempRegister(instr->value())
2069 : UseRegister(instr->value());
2075 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2076 LOperand* obj = UseFixed(instr->object(), r1);
2077 LOperand* val = UseFixed(instr->value(), r0);
2080 return MarkAsCall(result, instr);
2084 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2085 LOperand* left = UseRegisterAtStart(instr->left());
2086 LOperand* right = UseRegisterAtStart(instr->right());
2088 instr);
2092 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2093 LOperand* string = UseTempRegister(instr->string());
2094 LOperand* index = UseTempRegister(instr->index());
2100 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2101 LOperand* char_code = UseRegister(instr->value());
2107 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2108 LOperand* string = UseRegisterAtStart(instr->value());
2113 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2119 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) {
2120 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, r0), instr);
2124 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2125 return MarkAsCall(DefineFixed(new(zone()) LArrayLiteral, r0), instr);
2129 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2130 return MarkAsCall(DefineFixed(new(zone()) LObjectLiteral, r0), instr);
2134 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2135 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, r0), instr);
2139 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2140 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, r0), instr);
2144 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2145 LOperand* object = UseFixed(instr->object(), r0);
2146 LOperand* key = UseFixed(instr->key(), r1);
2148 return MarkAsCall(DefineFixed(result, r0), instr);
2152 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2154 current_block_->last_environment()->set_ast_id(instr->ast_id());
2159 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2160 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2165 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2175 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2176 argument_count_ -= instr->argument_count();
2177 return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr);
2181 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2190 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2191 LOperand* arguments = UseRegister(instr->arguments());
2192 LOperand* length = UseTempRegister(instr->length());
2193 LOperand* index = UseRegister(instr->index());
2200 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2201 LOperand* object = UseFixed(instr->value(), r0);
2203 return MarkAsCall(DefineFixed(result, r0), instr);
2207 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2208 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), r0));
2209 return MarkAsCall(DefineFixed(result, r0), instr);
2213 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2214 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2219 HIsConstructCallAndBranch* instr) {
2224 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2228 env->set_ast_id(instr->ast_id());
2230 env->Drop(instr->pop_count());
2231 for (int i = 0; i < instr->values()->length(); ++i) {
2232 HValue* value = instr->values()->at(i);
2233 if (instr->HasAssignedIndexAt(i)) {
2234 env->Bind(instr->GetAssignedIndexAt(i), value);
2242 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2255 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2256 if (instr->is_function_entry()) {
2257 return MarkAsCall(new(zone()) LStackCheck, instr);
2259 ASSERT(instr->is_backwards_branch());
2265 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2268 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2269 instr->arguments_count(),
2270 instr->function(),
2272 instr->call_kind(),
2273 instr->is_construct());
2274 if (instr->arguments() != NULL) {
2275 inner->Bind(instr->arguments(), graph()->GetArgumentsObject());
2278 chunk_->AddInlinedClosure(instr->closure());
2283 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2291 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2292 LOperand* key = UseRegisterAtStart(instr->key());
2293 LOperand* object = UseRegisterAtStart(instr->object());
2295 return MarkAsCall(DefineFixed(result, r0), instr);
2299 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2300 LOperand* object = UseFixed(instr->enumerable(), r0);
2302 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
2306 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2307 LOperand* map = UseRegister(instr->map());
2313 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2314 LOperand* value = UseRegisterAtStart(instr->value());
2315 LOperand* map = UseRegisterAtStart(instr->map());
2320 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2321 LOperand* object = UseRegister(instr->object());
2322 LOperand* index = UseRegister(instr->index());