Lines Matching refs:instr

255 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) {
256 if (instr->IsCall()) {
259 if (!instr->IsLazyBailout() && !instr->IsGap()) {
279 code->instr()->hydrogen_value()->id(),
280 code->instr()->Mnemonic());
742 LInstruction* instr,
744 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode);
750 LInstruction* instr,
753 DCHECK(instr != NULL);
758 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
771 LInstruction* instr,
773 DCHECK(instr != NULL);
777 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
798 LInstruction* instr,
803 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
844 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
847 LEnvironment* environment = instr->environment();
898 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
899 instr->Mnemonic(), detail);
921 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
926 DeoptimizeIf(condition, instr, detail, bailout_type);
1001 LInstruction* instr, SafepointMode safepoint_mode) {
1003 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
1007 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
1099 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
1100 DoGap(instr);
1104 void LCodeGen::DoParameter(LParameter* instr) {
1109 void LCodeGen::DoCallStub(LCallStub* instr) {
1110 DCHECK(ToRegister(instr->context()).is(cp));
1111 DCHECK(ToRegister(instr->result()).is(r0));
1112 switch (instr->hydrogen()->major_key()) {
1115 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1120 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1125 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1134 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
1139 void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) {
1140 Register dividend = ToRegister(instr->dividend());
1141 int32_t divisor = instr->divisor();
1142 DCHECK(dividend.is(ToRegister(instr->result())));
1150 HMod* hmod = instr->hydrogen();
1161 DeoptimizeIf(eq, instr);
1172 void LCodeGen::DoModByConstI(LModByConstI* instr) {
1173 Register dividend = ToRegister(instr->dividend());
1174 int32_t divisor = instr->divisor();
1175 Register result = ToRegister(instr->result());
1179 DeoptimizeIf(al, instr);
1189 HMod* hmod = instr->hydrogen();
1194 DeoptimizeIf(lt, instr);
1200 void LCodeGen::DoModI(LModI* instr) {
1201 HMod* hmod = instr->hydrogen();
1205 Register left_reg = ToRegister(instr->left());
1206 Register right_reg = ToRegister(instr->right());
1207 Register result_reg = ToRegister(instr->result());
1214 DeoptimizeIf(eq, instr);
1225 DeoptimizeIf(eq, instr);
1246 DeoptimizeIf(lt, instr);
1252 Register left_reg = ToRegister(instr->left());
1253 Register right_reg = ToRegister(instr->right());
1254 Register result_reg = ToRegister(instr->result());
1259 DwVfpRegister dividend = ToDoubleRegister(instr->temp());
1260 DwVfpRegister divisor = ToDoubleRegister(instr->temp2());
1271 DeoptimizeIf(eq, instr);
1301 DeoptimizeIf(mi, instr);
1308 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) {
1309 Register dividend = ToRegister(instr->dividend());
1310 int32_t divisor = instr->divisor();
1311 Register result = ToRegister(instr->result());
1316 HDiv* hdiv = instr->hydrogen();
1319 DeoptimizeIf(eq, instr);
1324 DeoptimizeIf(eq, instr);
1331 DeoptimizeIf(ne, instr);
1352 void LCodeGen::DoDivByConstI(LDivByConstI* instr) {
1353 Register dividend = ToRegister(instr->dividend());
1354 int32_t divisor = instr->divisor();
1355 Register result = ToRegister(instr->result());
1359 DeoptimizeIf(al, instr);
1364 HDiv* hdiv = instr->hydrogen();
1367 DeoptimizeIf(eq, instr);
1377 DeoptimizeIf(ne, instr);
1383 void LCodeGen::DoDivI(LDivI* instr) {
1384 HBinaryOperation* hdiv = instr->hydrogen();
1385 Register dividend = ToRegister(instr->dividend());
1386 Register divisor = ToRegister(instr->divisor());
1387 Register result = ToRegister(instr->result());
1392 DeoptimizeIf(eq, instr);
1398 if (!instr->hydrogen_value()->CheckFlag(HValue::kCanBeDivByZero)) {
1404 DeoptimizeIf(eq, instr);
1416 DeoptimizeIf(eq, instr);
1423 DoubleRegister vleft = ToDoubleRegister(instr->temp());
1439 DeoptimizeIf(ne, instr);
1444 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) {
1445 DwVfpRegister addend = ToDoubleRegister(instr->addend());
1446 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1447 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1450 DCHECK(addend.is(ToDoubleRegister(instr->result())));
1456 void LCodeGen::DoMultiplySubD(LMultiplySubD* instr) {
1457 DwVfpRegister minuend = ToDoubleRegister(instr->minuend());
1458 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1459 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1462 DCHECK(minuend.is(ToDoubleRegister(instr->result())));
1468 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
1469 Register dividend = ToRegister(instr->dividend());
1470 Register result = ToRegister(instr->result());
1471 int32_t divisor = instr->divisor();
1489 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1490 DeoptimizeIf(eq, instr);
1495 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1496 DeoptimizeIf(vs, instr);
1502 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1512 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
1513 Register dividend = ToRegister(instr->dividend());
1514 int32_t divisor = instr->divisor();
1515 Register result = ToRegister(instr->result());
1519 DeoptimizeIf(al, instr);
1524 HMathFloorOfDiv* hdiv = instr->hydrogen();
1527 DeoptimizeIf(eq, instr);
1541 Register temp = ToRegister(instr->temp());
1559 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
1560 HBinaryOperation* hdiv = instr->hydrogen();
1561 Register left = ToRegister(instr->dividend());
1562 Register right = ToRegister(instr->divisor());
1563 Register result = ToRegister(instr->result());
1568 DeoptimizeIf(eq, instr);
1574 if (!instr->hydrogen_value()->CheckFlag(HValue::kCanBeDivByZero)) {
1580 DeoptimizeIf(eq, instr);
1592 DeoptimizeIf(eq, instr);
1599 DoubleRegister vleft = ToDoubleRegister(instr->temp());
1621 void LCodeGen::DoMulI(LMulI* instr) {
1622 Register result = ToRegister(instr->result());
1624 Register left = ToRegister(instr->left());
1625 LOperand* right_op = instr->right();
1628 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
1629 bool overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1638 DeoptimizeIf(eq, instr);
1645 DeoptimizeIf(vs, instr);
1655 DeoptimizeIf(mi, instr);
1698 if (instr->hydrogen()->representation().IsSmi()) {
1705 DeoptimizeIf(ne, instr);
1707 if (instr->hydrogen()->representation().IsSmi()) {
1721 DeoptimizeIf(eq, instr);
1728 void LCodeGen::DoBitI(LBitI* instr) {
1729 LOperand* left_op = instr->left();
1730 LOperand* right_op = instr->right();
1733 Register result = ToRegister(instr->result());
1743 switch (instr->op()) {
1764 void LCodeGen::DoShiftI(LShiftI* instr) {
1767 LOperand* right_op = instr->right();
1768 Register left = ToRegister(instr->left());
1769 Register result = ToRegister(instr->result());
1774 switch (instr->op()) {
1782 if (instr->can_deopt()) {
1784 DeoptimizeIf(mi, instr);
1800 switch (instr->op()) {
1819 if (instr->can_deopt()) {
1821 DeoptimizeIf(ne, instr);
1828 if (instr->hydrogen_value()->representation().IsSmi() &&
1829 instr->can_deopt()) {
1836 DeoptimizeIf(vs, instr);
1852 void LCodeGen::DoSubI(LSubI* instr) {
1853 LOperand* left = instr->left();
1854 LOperand* right = instr->right();
1855 LOperand* result = instr->result();
1856 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1868 DeoptimizeIf(vs, instr);
1873 void LCodeGen::DoRSubI(LRSubI* instr) {
1874 LOperand* left = instr->left();
1875 LOperand* right = instr->right();
1876 LOperand* result = instr->result();
1877 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1889 DeoptimizeIf(vs, instr);
1894 void LCodeGen::DoConstantI(LConstantI* instr) {
1895 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1899 void LCodeGen::DoConstantS(LConstantS* instr) {
1900 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1904 void LCodeGen::DoConstantD(LConstantD* instr) {
1905 DCHECK(instr->result()->IsDoubleRegister());
1906 DwVfpRegister result = ToDoubleRegister(instr->result());
1907 double v = instr->value();
1912 void LCodeGen::DoConstantE(LConstantE* instr) {
1913 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1917 void LCodeGen::DoConstantT(LConstantT* instr) {
1918 Handle<Object> object = instr->value(isolate());
1920 __ Move(ToRegister(instr->result()), object);
1924 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1925 Register result = ToRegister(instr->result());
1926 Register map = ToRegister(instr->value());
1931 void LCodeGen::DoDateField(LDateField* instr) {
1932 Register object = ToRegister(instr->date());
1933 Register result = ToRegister(instr->result());
1934 Register scratch = ToRegister(instr->temp());
1935 Smi* index = instr->index();
1943 DeoptimizeIf(eq, instr);
1945 DeoptimizeIf(ne, instr);
1994 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
1995 String::Encoding encoding = instr->hydrogen()->encoding();
1996 Register string = ToRegister(instr->string());
1997 Register result = ToRegister(instr->result());
2013 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
2022 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
2023 String::Encoding encoding = instr->hydrogen()->encoding();
2024 Register string = ToRegister(instr->string());
2025 Register value = ToRegister(instr->value());
2028 Register index = ToRegister(instr->index());
2032 instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING
2037 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
2046 void LCodeGen::DoAddI(LAddI* instr) {
2047 LOperand* left = instr->left();
2048 LOperand* right = instr->right();
2049 LOperand* result = instr->result();
2050 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
2062 DeoptimizeIf(vs, instr);
2067 void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
2068 LOperand* left = instr->left();
2069 LOperand* right = instr->right();
2070 HMathMinMax::Operation operation = instr->hydrogen()->operation();
2071 if (instr->hydrogen()->representation().IsSmiOrInteger32()) {
2077 Register result_reg = ToRegister(instr->result());
2082 DCHECK(instr->hydrogen()->representation().IsDouble());
2085 DwVfpRegister result_reg = ToDoubleRegister(instr->result());
2134 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
2135 DwVfpRegister left = ToDoubleRegister(instr->left());
2136 DwVfpRegister right = ToDoubleRegister(instr->right());
2137 DwVfpRegister result = ToDoubleRegister(instr->result());
2138 switch (instr->op()) {
2168 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
2169 DCHECK(ToRegister(instr->context()).is(cp));
2170 DCHECK(ToRegister(instr->left()).is(r1));
2171 DCHECK(ToRegister(instr->right()).is(r0));
2172 DCHECK(ToRegister(instr->result()).is(r0));
2175 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
2179 CallCode(code, RelocInfo::CODE_TARGET, instr);
2184 void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
2185 int left_block = instr->TrueDestination(chunk_);
2186 int right_block = instr->FalseDestination(chunk_);
2204 void LCodeGen::EmitFalseBranch(InstrType instr, Condition condition) {
2205 int false_block = instr->FalseDestination(chunk_);
2210 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2215 void LCodeGen::DoBranch(LBranch* instr) {
2216 Representation r = instr->hydrogen()->value()->representation();
2219 Register reg = ToRegister(instr->value());
2221 EmitBranch(instr, ne);
2224 DwVfpRegister reg = ToDoubleRegister(instr->value());
2228 EmitBranch(instr, ne);
2231 Register reg = ToRegister(instr->value());
2232 HType type = instr->hydrogen()->value()->type();
2236 EmitBranch(instr, eq);
2240 EmitBranch(instr, ne);
2243 EmitBranch(instr, al);
2251 EmitBranch(instr, ne);
2256 EmitBranch(instr, ne);
2258 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2265 __ b(eq, instr->FalseLabel(chunk_));
2270 __ b(eq, instr->TrueLabel(chunk_));
2272 __ b(eq, instr->FalseLabel(chunk_));
2277 __ b(eq, instr->FalseLabel(chunk_));
2283 __ b(eq, instr->FalseLabel(chunk_));
2284 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2288 DeoptimizeIf(eq, instr);
2299 __ b(ne, instr->FalseLabel(chunk_));
2306 __ b(ge, instr->TrueLabel(chunk_));
2316 __ b(ne, instr->TrueLabel(chunk_));
2317 __ b(instr->FalseLabel(chunk_));
2324 __ b(eq, instr->TrueLabel(chunk_));
2336 __ b(eq, instr->FalseLabel(chunk_)); // +0, -0 -> false.
2337 __ b(instr->TrueLabel(chunk_));
2344 DeoptimizeIf(al, instr);
2358 void LCodeGen::DoGoto(LGoto* instr) {
2359 EmitGoto(instr->block_id());
2395 void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
2396 LOperand* left = instr->left();
2397 LOperand* right = instr->right();
2399 instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
2400 instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
2401 Condition cond = TokenToCondition(instr->op(), is_unsigned);
2407 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2408 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
2411 if (instr->is_double()) {
2417 __ b(vs, instr->FalseLabel(chunk_));
2421 if (instr->hydrogen_value()->representation().IsSmi()) {
2428 if (instr->hydrogen_value()->representation().IsSmi()) {
2439 EmitBranch(instr, cond);
2444 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
2445 Register left = ToRegister(instr->left());
2446 Register right = ToRegister(instr->right());
2449 EmitBranch(instr, eq);
2453 void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
2454 if (instr->hydrogen()->representation().IsTagged()) {
2455 Register input_reg = ToRegister(instr->object());
2458 EmitBranch(instr, eq);
2462 DwVfpRegister input_reg = ToDoubleRegister(instr->object());
2464 EmitFalseBranch(instr, vc);
2469 EmitBranch(instr, eq);
2473 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
2474 Representation rep = instr->hydrogen()->value()->representation();
2476 Register scratch = ToRegister(instr->temp());
2479 DwVfpRegister value = ToDoubleRegister(instr->value());
2481 EmitFalseBranch(instr, ne);
2485 Register value = ToRegister(instr->value());
2489 instr->FalseLabel(chunk()),
2496 EmitBranch(instr, eq);
2527 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
2528 Register reg = ToRegister(instr->value());
2529 Register temp1 = ToRegister(instr->temp());
2533 instr->FalseLabel(chunk_), instr->TrueLabel(chunk_));
2535 EmitBranch(instr, true_cond);
2552 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
2553 Register reg = ToRegister(instr->value());
2554 Register temp1 = ToRegister(instr->temp());
2557 instr->hydrogen()->value()->type().IsHeapObject()
2560 EmitIsString(reg, temp1, instr->FalseLabel(chunk_), check_needed);
2562 EmitBranch(instr, true_cond);
2566 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
2567 Register input_reg = EmitLoadRegister(instr->value(), ip);
2569 EmitBranch(instr, eq);
2573 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
2574 Register input = ToRegister(instr->value());
2575 Register temp = ToRegister(instr->temp());
2577 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
2578 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2583 EmitBranch(instr, ne);
2607 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2608 DCHECK(ToRegister(instr->context()).is(cp));
2609 Token::Value op = instr->op();
2612 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2618 EmitBranch(instr, condition);
2622 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
2623 InstanceType from = instr->from();
2624 InstanceType to = instr->to();
2631 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
2632 InstanceType from = instr->from();
2633 InstanceType to = instr->to();
2642 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
2644 Register input = ToRegister(instr->value());
2646 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
2647 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2650 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
2651 EmitBranch(instr, BranchCondition(instr->hydrogen()));
2655 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
2656 Register input = ToRegister(instr->value());
2657 Register result = ToRegister(instr->result());
2667 LHasCachedArrayIndexAndBranch* instr) {
2668 Register input = ToRegister(instr->value());
2674 EmitBranch(instr, eq);
2745 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
2746 Register input = ToRegister(instr->value());
2748 Register temp2 = ToRegister(instr->temp());
2749 Handle<String> class_name = instr->hydrogen()->class_name();
2751 EmitClassOfTest(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_),
2754 EmitBranch(instr, eq);
2758 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
2759 Register reg = ToRegister(instr->value());
2760 Register temp = ToRegister(instr->temp());
2763 __ cmp(temp, Operand(instr->map()));
2764 EmitBranch(instr, eq);
2768 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
2769 DCHECK(ToRegister(instr->context()).is(cp));
2770 DCHECK(ToRegister(instr->left()).is(r0)); // Object is in r0.
2771 DCHECK(ToRegister(instr->right()).is(r1)); // Function is in r1.
2774 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2782 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
2786 LInstanceOfKnownGlobal* instr)
2787 : LDeferredCode(codegen), instr_(instr) { }
2792 virtual LInstruction* instr() OVERRIDE { return instr_; }
2803 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
2806 Register object = ToRegister(instr->value());
2807 Register temp = ToRegister(instr->temp());
2808 Register result = ToRegister(instr->result());
2865 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2878 LoadContextFromDeferred(instr->context());
2880 __ Move(InstanceofStub::right(), instr->function());
2913 instr,
2915 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
2919 __ StoreToSafepointRegisterSlot(r0, ToRegister(instr->result()));
2923 void LCodeGen::DoCmpT(LCmpT* instr) {
2924 DCHECK(ToRegister(instr->context()).is(cp));
2925 Token::Value op = instr->op();
2928 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2933 __ LoadRoot(ToRegister(instr->result()),
2936 __ LoadRoot(ToRegister(instr->result()),
2942 void LCodeGen::DoReturn(LReturn* instr) {
2960 if (instr->has_constant_parameter_count()) {
2961 int parameter_count = ToInteger32(instr->constant_parameter_count());
2967 Register reg = ToRegister(instr->parameter_count());
2982 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2983 Register result = ToRegister(instr->result());
2984 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
2986 if (instr->hydrogen()->RequiresHoleCheck()) {
2989 DeoptimizeIf(eq, instr);
2995 void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
2997 Register vector = ToRegister(instr->temp_vector());
2999 __ Move(vector, instr->hydrogen()->feedback_vector());
3003 Operand(Smi::FromInt(instr->hydrogen()->slot())));
3007 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
3008 DCHECK(ToRegister(instr->context()).is(cp));
3009 DCHECK(ToRegister(instr->global_object())
3011 DCHECK(ToRegister(instr->result()).is(r0));
3013 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
3015 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
3017 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
3019 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3023 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
3024 Register value = ToRegister(instr->value());
3028 __ mov(cell, Operand(instr->hydrogen()->cell().handle()));
3034 if (instr->hydrogen()->RequiresHoleCheck()) {
3036 Register payload = ToRegister(instr->temp());
3039 DeoptimizeIf(eq, instr);
3048 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
3049 Register context = ToRegister(instr->context());
3050 Register result = ToRegister(instr->result());
3051 __ ldr(result, ContextOperand(context, instr->slot_index()));
3052 if (instr->hydrogen()->RequiresHoleCheck()) {
3055 if (instr->hydrogen()->DeoptimizesOnHole()) {
3056 DeoptimizeIf(eq, instr);
3064 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
3065 Register context = ToRegister(instr->context());
3066 Register value = ToRegister(instr->value());
3068 MemOperand target = ContextOperand(context, instr->slot_index());
3072 if (instr->hydrogen()->RequiresHoleCheck()) {
3076 if (instr->hydrogen()->DeoptimizesOnHole()) {
3077 DeoptimizeIf(eq, instr);
3084 if (instr->hydrogen()->NeedsWriteBarrier()) {
3086 instr->hydrogen()->value()->type().IsHeapObject()
3102 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3103 HObjectAccess access = instr->hydrogen()->access();
3105 Register object = ToRegister(instr->object());
3108 Register result = ToRegister(instr->result());
3114 if (instr->hydrogen()->representation().IsDouble()) {
3115 DwVfpRegister result = ToDoubleRegister(instr->result());
3120 Register result = ToRegister(instr->result());
3130 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3131 DCHECK(ToRegister(instr->context()).is(cp));
3132 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister()));
3133 DCHECK(ToRegister(instr->result()).is(r0));
3136 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
3138 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
3141 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3145 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
3147 Register function = ToRegister(instr->function());
3148 Register result = ToRegister(instr->result());
3157 DeoptimizeIf(eq, instr);
3172 void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
3173 Register result = ToRegister(instr->result());
3174 __ LoadRoot(result, instr->index());
3178 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
3179 Register arguments = ToRegister(instr->arguments());
3180 Register result = ToRegister(instr->result());
3183 if (instr->length()->IsConstantOperand()) {
3184 int const_length = ToInteger32(LConstantOperand::cast(instr->length()));
3185 if (instr->index()->IsConstantOperand()) {
3186 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3190 Register index = ToRegister(instr->index());
3194 } else if (instr->index()->IsConstantOperand()) {
3195 Register length = ToRegister(instr->length());
3196 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3205 Register length = ToRegister(instr->length());
3206 Register index = ToRegister(instr->index());
3214 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3215 Register external_pointer = ToRegister(instr->elements());
3217 ElementsKind elements_kind = instr->elements_kind();
3218 bool key_is_constant = instr->key()->IsConstantOperand();
3221 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3226 key = ToRegister(instr->key());
3229 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3231 int base_offset = instr->base_offset();
3237 int base_offset = instr->base_offset();
3238 DwVfpRegister result = ToDoubleRegister(instr->result());
3251 Register result = ToRegister(instr->result());
3281 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3283 DeoptimizeIf(cs, instr);
3305 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
3306 Register elements = ToRegister(instr->elements());
3307 bool key_is_constant = instr->key()->IsConstantOperand();
3309 DwVfpRegister result = ToDoubleRegister(instr->result());
3314 int base_offset = instr->base_offset();
3316 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3325 key = ToRegister(instr->key());
3326 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3333 if (instr->hydrogen()->RequiresHoleCheck()) {
3336 DeoptimizeIf(eq, instr);
3341 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
3342 Register elements = ToRegister(instr->elements());
3343 Register result = ToRegister(instr->result());
3346 int offset = instr->base_offset();
3348 if (instr->key()->IsConstantOperand()) {
3349 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3353 Register key = ToRegister(instr->key());
3358 if (instr->hydrogen()->key()->representation().IsSmi()) {
3367 if (instr->hydrogen()->RequiresHoleCheck()) {
3368 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3370 DeoptimizeIf(ne, instr);
3374 DeoptimizeIf(eq, instr);
3380 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3381 if (instr->is_typed_elements()) {
3382 DoLoadKeyedExternalArray(instr);
3383 } else if (instr->hydrogen()->representation().IsDouble()) {
3384 DoLoadKeyedFixedDoubleArray(instr);
3386 DoLoadKeyedFixedArray(instr);
3422 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
3423 DCHECK(ToRegister(instr->context()).is(cp));
3424 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister()));
3425 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister()));
3428 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
3432 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3436 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3438 Register result = ToRegister(instr->result());
3440 if (instr->hydrogen()->from_inlined()) {
3457 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
3458 Register elem = ToRegister(instr->elements());
3459 Register result = ToRegister(instr->result());
3479 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
3480 Register receiver = ToRegister(instr->receiver());
3481 Register function = ToRegister(instr->function());
3482 Register result = ToRegister(instr->result());
3490 if (!instr->hydrogen()->known_function()) {
3516 DeoptimizeIf(eq, instr);
3518 DeoptimizeIf(lt, instr);
3539 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
3540 Register receiver = ToRegister(instr->receiver());
3541 Register function = ToRegister(instr->function());
3542 Register length = ToRegister(instr->length());
3543 Register elements = ToRegister(instr->elements());
3547 DCHECK(ToRegister(instr->result()).is(r0));
3553 DeoptimizeIf(hi, instr);
3575 DCHECK(instr->HasPointerMap());
3576 LPointerMap* pointers = instr->pointer_map();
3586 void LCodeGen::DoPushArgument(LPushArgument* instr) {
3587 LOperand* argument = instr->value();
3597 void LCodeGen::DoDrop(LDrop* instr) {
3598 __ Drop(instr->count());
3602 void LCodeGen::DoThisFunction(LThisFunction* instr) {
3603 Register result = ToRegister(instr->result());
3608 void LCodeGen::DoContext(LContext* instr) {
3610 Register result = ToRegister(instr->result());
3620 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3621 DCHECK(ToRegister(instr->context()).is(cp));
3623 __ Move(scratch0(), instr->hydrogen()->pairs());
3625 __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3627 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3634 LInstruction* instr,
3641 LPointerMap* pointers = instr->pointer_map();
3662 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3672 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3673 DCHECK(instr->context() != NULL);
3674 DCHECK(ToRegister(instr->context()).is(cp));
3675 Register input = ToRegister(instr->value());
3676 Register result = ToRegister(instr->result());
3683 DeoptimizeIf(ne, instr);
3718 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr,
3719 instr->context());
3741 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) {
3742 Register input = ToRegister(instr->value());
3743 Register result = ToRegister(instr->result());
3751 DeoptimizeIf(vs, instr);
3755 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3759 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr)
3760 : LDeferredCode(codegen), instr_(instr) { }
3764 virtual LInstruction* instr() OVERRIDE { return instr_; }
3769 Representation r = instr->hydrogen()->value()->representation();
3771 DwVfpRegister input = ToDoubleRegister(instr->value());
3772 DwVfpRegister result = ToDoubleRegister(instr->result());
3775 EmitIntegerMathAbs(instr);
3779 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3780 Register input = ToRegister(instr->value());
3784 EmitIntegerMathAbs(instr);
3790 void LCodeGen::DoMathFloor(LMathFloor* instr) {
3791 DwVfpRegister input = ToDoubleRegister(instr->value());
3792 Register result = ToRegister(instr->result());
3797 DeoptimizeIf(al, instr);
3800 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3805 DeoptimizeIf(mi, instr);
3811 void LCodeGen::DoMathRound(LMathRound* instr) {
3812 DwVfpRegister input = ToDoubleRegister(instr->value());
3813 Register result = ToRegister(instr->result());
3814 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->temp());
3827 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3830 DeoptimizeIf(mi, instr); // [-0.5, -0].
3844 DeoptimizeIf(al, instr);
3849 void LCodeGen::DoMathFround(LMathFround* instr) {
3850 DwVfpRegister input_reg = ToDoubleRegister(instr->value());
3851 DwVfpRegister output_reg = ToDoubleRegister(instr->result());
3858 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
3859 DwVfpRegister input = ToDoubleRegister(instr->value());
3860 DwVfpRegister result = ToDoubleRegister(instr->result());
3865 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
3866 DwVfpRegister input = ToDoubleRegister(instr->value());
3867 DwVfpRegister result = ToDoubleRegister(instr->result());
3886 void LCodeGen::DoPower(LPower* instr) {
3887 Representation exponent_type = instr->hydrogen()->right()->representation();
3891 DCHECK(!instr->right()->IsDoubleRegister() ||
3892 ToDoubleRegister(instr->right()).is(d1));
3893 DCHECK(!instr->right()->IsRegister() ||
3894 ToRegister(instr->right()).is(tagged_exponent));
3895 DCHECK(ToDoubleRegister(instr->left()).is(d0));
3896 DCHECK(ToDoubleRegister(instr->result()).is(d2));
3908 DeoptimizeIf(ne, instr);
3923 void LCodeGen::DoMathExp(LMathExp* instr) {
3924 DwVfpRegister input = ToDoubleRegister(instr->value());
3925 DwVfpRegister result = ToDoubleRegister(instr->result());
3926 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->double_temp());
3928 Register temp1 = ToRegister(instr->temp1());
3929 Register temp2 = ToRegister(instr->temp2());
3937 void LCodeGen::DoMathLog(LMathLog* instr) {
3939 __ MovToFloatParameter(ToDoubleRegister(instr->value()));
3942 __ MovFromFloatResult(ToDoubleRegister(instr->result()));
3946 void LCodeGen::DoMathClz32(LMathClz32* instr) {
3947 Register input = ToRegister(instr->value());
3948 Register result = ToRegister(instr->result());
3953 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3954 DCHECK(ToRegister(instr->context()).is(cp));
3955 DCHECK(ToRegister(instr->function()).is(r1));
3956 DCHECK(instr->HasPointerMap());
3958 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3960 LPointerMap* pointers = instr->pointer_map();
3962 ParameterCount count(instr->arity());
3966 instr->hydrogen()->formal_parameter_count(),
3967 instr->arity(),
3968 instr,
3975 LTailCallThroughMegamorphicCache* instr) {
3976 Register receiver = ToRegister(instr->receiver());
3977 Register name = ToRegister(instr->name());
3992 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(),
4002 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
4003 DCHECK(ToRegister(instr->result()).is(r0));
4005 LPointerMap* pointers = instr->pointer_map();
4008 if (instr->target()->IsConstantOperand()) {
4009 LConstantOperand* target = LConstantOperand::cast(instr->target());
4013 instr->descriptor().platform_specific_descriptor();
4017 DCHECK(instr->target()->IsRegister());
4018 Register target = ToRegister(instr->target());
4033 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
4034 DCHECK(ToRegister(instr->function()).is(r1));
4035 DCHECK(ToRegister(instr->result()).is(r0));
4037 if (instr->hydrogen()->pass_argument_count()) {
4038 __ mov(r0, Operand(instr->arity()));
4048 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
4052 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4053 DCHECK(ToRegister(instr->context()).is(cp));
4054 DCHECK(ToRegister(instr->function()).is(r1));
4055 DCHECK(ToRegister(instr->result()).is(r0));
4057 int arity = instr->arity();
4058 CallFunctionStub stub(isolate(), arity, instr->hydrogen()->function_flags());
4059 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4063 void LCodeGen::DoCallNew(LCallNew* instr) {
4064 DCHECK(ToRegister(instr->context()).is(cp));
4065 DCHECK(ToRegister(instr->constructor()).is(r1));
4066 DCHECK(ToRegister(instr->result()).is(r0));
4068 __ mov(r0, Operand(instr->arity()));
4072 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4076 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4077 DCHECK(ToRegister(instr->context()).is(cp));
4078 DCHECK(ToRegister(instr->constructor()).is(r1));
4079 DCHECK(ToRegister(instr->result()).is(r0));
4081 __ mov(r0, Operand(instr->arity()));
4083 ElementsKind kind = instr->hydrogen()->elements_kind();
4089 if (instr->arity() == 0) {
4091 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4092 } else if (instr->arity() == 1) {
4106 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4112 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4116 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
4121 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4122 CallRuntime(instr->function(), instr->arity(), instr);
4126 void LCodeGen::DoStoreCodeEntry(LStoreCodeEntry* instr) {
4127 Register function = ToRegister(instr->function());
4128 Register code_object = ToRegister(instr->code_object());
4135 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4136 Register result = ToRegister(instr->result());
4137 Register base = ToRegister(instr->base_object());
4138 if (instr->offset()->IsConstantOperand()) {
4139 LConstantOperand* offset = LConstantOperand::cast(instr->offset());
4142 Register offset = ToRegister(instr->offset());
4148 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4149 Representation representation = instr->representation();
4151 Register object = ToRegister(instr->object());
4153 HObjectAccess access = instr->hydrogen()->access();
4157 Register value = ToRegister(instr->value());
4166 !instr->value()->IsConstantOperand() ||
4167 IsSmi(LConstantOperand::cast(instr->value())));
4170 DCHECK(!instr->hydrogen()->has_transition());
4171 DCHECK(!instr->hydrogen()->NeedsWriteBarrier());
4172 DwVfpRegister value = ToDoubleRegister(instr->value());
4177 if (instr->hydrogen()->has_transition()) {
4178 Handle<Map> transition = instr->hydrogen()->transition_map();
4182 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
4183 Register temp = ToRegister(instr->temp());
4194 Register value = ToRegister(instr->value());
4198 if (instr->hydrogen()->NeedsWriteBarrier()) {
4207 instr->hydrogen()->SmiCheckForWriteBarrier(),
4208 instr->hydrogen()->PointersToHereCheckForValue());
4214 if (instr->hydrogen()->NeedsWriteBarrier()) {
4224 instr->hydrogen()->SmiCheckForWriteBarrier(),
4225 instr->hydrogen()->PointersToHereCheckForValue());
4231 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4232 DCHECK(ToRegister(instr->context()).is(cp));
4233 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister()));
4234 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
4236 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name()));
4237 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode());
4238 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4242 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4243 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs;
4244 if (instr->index()->IsConstantOperand()) {
4245 Operand index = ToOperand(instr->index());
4246 Register length = ToRegister(instr->length());
4250 Register index = ToRegister(instr->index());
4251 Operand length = ToOperand(instr->length());
4254 if (FLAG_debug_code && instr->hydrogen()->skip_check()) {
4260 DeoptimizeIf(cc, instr);
4265 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4266 Register external_pointer = ToRegister(instr->elements());
4268 ElementsKind elements_kind = instr->elements_kind();
4269 bool key_is_constant = instr->key()->IsConstantOperand();
4272 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4277 key = ToRegister(instr->key());
4280 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4282 int base_offset = instr->base_offset();
4289 DwVfpRegister value(ToDoubleRegister(instr->value()));
4308 Register value(ToRegister(instr->value()));
4353 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4354 DwVfpRegister value = ToDoubleRegister(instr->value());
4355 Register elements = ToRegister(instr->elements());
4358 bool key_is_constant = instr->key()->IsConstantOperand();
4359 int base_offset = instr->base_offset();
4365 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4372 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4376 Operand(ToRegister(instr->key()), LSL, shift_size));
4379 if (instr->NeedsCanonicalization()) {
4394 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4395 Register value = ToRegister(instr->value());
4396 Register elements = ToRegister(instr->elements());
4397 Register key = instr->key()->IsRegister() ? ToRegister(instr->key())
4401 int offset = instr->base_offset();
4404 if (instr->key()->IsConstantOperand()) {
4405 DCHECK(!instr->hydrogen()->NeedsWriteBarrier());
4406 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
4414 if (instr->hydrogen()->key()->representation().IsSmi()) {
4422 if (instr->hydrogen()->NeedsWriteBarrier()) {
4424 instr->hydrogen()->value()->type().IsHeapObject()
4435 instr->hydrogen()->PointersToHereCheckForValue());
4440 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4442 if (instr->is_typed_elements()) {
4443 DoStoreKeyedExternalArray(instr);
4444 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4445 DoStoreKeyedFixedDoubleArray(instr);
4447 DoStoreKeyedFixedArray(instr);
4452 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
4453 DCHECK(ToRegister(instr->context()).is(cp));
4454 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister()));
4455 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
4456 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
4459 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
4460 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4464 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
4465 Register object_reg = ToRegister(instr->object());
4468 Handle<Map> from_map = instr->original_map();
4469 Handle<Map> to_map = instr->transitioned_map();
4470 ElementsKind from_kind = instr->from_kind();
4471 ElementsKind to_kind = instr->to_kind();
4479 Register new_map_reg = ToRegister(instr->new_map_temp());
4489 DCHECK(ToRegister(instr->context()).is(cp));
4497 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
4503 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
4504 Register object = ToRegister(instr->object());
4505 Register temp = ToRegister(instr->temp());
4508 DeoptimizeIf(eq, instr);
4513 void LCodeGen::DoStringAdd(LStringAdd* instr) {
4514 DCHECK(ToRegister(instr->context()).is(cp));
4515 DCHECK(ToRegister(instr->left()).is(r1));
4516 DCHECK(ToRegister(instr->right()).is(r0));
4518 instr->hydrogen()->flags(),
4519 instr->hydrogen()->pretenure_flag());
4520 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4524 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
4527 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
4528 : LDeferredCode(codegen), instr_(instr) { }
4532 virtual LInstruction* instr() OVERRIDE { return instr_; }
4538 new(zone()) DeferredStringCharCodeAt(this, instr);
4541 ToRegister(instr->string()),
4542 ToRegister(instr->index()),
4543 ToRegister(instr->result()),
4549 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
4550 Register string = ToRegister(instr->string());
4551 Register result = ToRegister(instr->result());
4563 if (instr->index()->IsConstantOperand()) {
4564 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
4568 Register index = ToRegister(instr->index());
4572 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, instr,
4573 instr->context());
4580 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
4583 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
4584 : LDeferredCode(codegen), instr_(instr) { }
4588 virtual LInstruction* instr() OVERRIDE { return instr_; }
4594 new(zone()) DeferredStringCharFromCode(this, instr);
4596 DCHECK(instr->hydrogen()->value()->representation().IsInteger32());
4597 Register char_code = ToRegister(instr->char_code());
4598 Register result = ToRegister(instr->result());
4613 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
4614 Register char_code = ToRegister(instr->char_code());
4615 Register result = ToRegister(instr->result());
4625 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context());
4630 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
4631 LOperand* input = instr->value();
4633 LOperand* output = instr->result();
4647 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
4648 LOperand* input = instr->value();
4649 LOperand* output = instr->result();
4657 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
4660 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
4661 : LDeferredCode(codegen), instr_(instr) { }
4669 virtual LInstruction* instr() OVERRIDE { return instr_; }
4674 Register src = ToRegister(instr->value());
4675 Register dst = ToRegister(instr->result());
4677 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr);
4684 void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
4687 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
4688 : LDeferredCode(codegen), instr_(instr) { }
4696 virtual LInstruction* instr() OVERRIDE { return instr_; }
4701 Register input = ToRegister(instr->value());
4702 Register result = ToRegister(instr->result());
4704 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr);
4712 void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
4719 Register dst = ToRegister(instr->result());
4765 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4778 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
4781 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
4782 : LDeferredCode(codegen), instr_(instr) { }
4786 virtual LInstruction* instr() OVERRIDE { return instr_; }
4791 DwVfpRegister input_reg = ToDoubleRegister(instr->value());
4793 Register reg = ToRegister(instr->result());
4794 Register temp1 = ToRegister(instr->temp());
4795 Register temp2 = ToRegister(instr->temp2());
4797 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
4813 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
4817 Register reg = ToRegister(instr->result());
4829 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4835 void LCodeGen::DoSmiTag(LSmiTag* instr) {
4836 HChange* hchange = instr->hydrogen();
4837 Register input = ToRegister(instr->value());
4838 Register output = ToRegister(instr->result());
4842 DeoptimizeIf(ne, instr);
4847 DeoptimizeIf(vs, instr);
4854 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
4855 Register input = ToRegister(instr->value());
4856 Register result = ToRegister(instr->result());
4857 if (instr->needs_check()) {
4861 DeoptimizeIf(cs, instr);
4868 void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg,
4872 instr->hydrogen()->can_convert_undefined_to_nan();
4873 bool deoptimize_on_minus_zero = instr->hydrogen()->deoptimize_on_minus_zero();
4889 DeoptimizeIf(ne, instr);
4899 DeoptimizeIf(eq, instr);
4907 DeoptimizeIf(ne, instr);
4925 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
4926 Register input_reg = ToRegister(instr->value());
4928 Register scratch2 = ToRegister(instr->temp());
4930 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp2());
4948 if (instr->truncating()) {
4975 DeoptimizeIf(ne, instr, "cannot truncate");
4978 DeoptimizeIf(ne, instr, "not a heap number");
4983 DeoptimizeIf(ne, instr, "lost precision or NaN");
4985 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4990 DeoptimizeIf(ne, instr, "minus zero");
4997 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
5000 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
5001 : LDeferredCode(codegen), instr_(instr) { }
5005 virtual LInstruction* instr() OVERRIDE { return instr_; }
5010 LOperand* input = instr->value();
5012 DCHECK(input->Equals(instr->result()));
5016 if (instr->hydrogen()->value()->representation().IsSmi()) {
5019 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr);
5032 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
5033 LOperand* input = instr->value();
5035 LOperand* result = instr->result();
5041 HValue* value = instr->hydrogen()->value();
5045 EmitNumberUntagD(instr, input_reg, result_reg, mode);
5049 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
5050 Register result_reg = ToRegister(instr->result());
5052 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5055 if (instr->truncating()) {
5060 DeoptimizeIf(ne, instr);
5061 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5067 DeoptimizeIf(ne, instr);
5074 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5075 Register result_reg = ToRegister(instr->result());
5077 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5080 if (instr->truncating()) {
5085 DeoptimizeIf(ne, instr);
5086 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5092 DeoptimizeIf(ne, instr);
5097 DeoptimizeIf(vs, instr);
5101 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
5102 LOperand* input = instr->value();
5104 DeoptimizeIf(ne, instr);
5108 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
5109 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
5110 LOperand* input = instr->value();
5112 DeoptimizeIf(eq, instr);
5117 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
5118 Register input = ToRegister(instr->value());
5124 if (instr->hydrogen()->is_interval_check()) {
5127 instr->hydrogen()->GetCheckInterval(&first, &last);
5133 DeoptimizeIf(ne, instr);
5135 DeoptimizeIf(lo, instr);
5139 DeoptimizeIf(hi, instr);
5145 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
5150 DeoptimizeIf(tag == 0 ? ne : eq, instr);
5154 DeoptimizeIf(ne, instr);
5160 void LCodeGen::DoCheckValue(LCheckValue* instr) {
5161 Register reg = ToRegister(instr->value());
5162 Handle<HeapObject> object = instr->hydrogen()->object().handle();
5165 Register reg = ToRegister(instr->value());
5173 DeoptimizeIf(ne, instr);
5177 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
5184 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
5188 DeoptimizeIf(eq, instr);
5192 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5195 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
5196 : LDeferredCode(codegen), instr_(instr), object_(object) {
5203 virtual LInstruction* instr() OVERRIDE { return instr_; }
5210 if (instr->hydrogen()->IsStabilityCheck()) {
5211 const UniqueSet<Map>* maps = instr->hydrogen()->maps();
5220 LOperand* input = instr->value();
5227 if (instr->hydrogen()->HasMigrationTarget()) {
5228 deferred = new(zone()) DeferredCheckMaps(this, instr, reg);
5232 const UniqueSet<Map>* maps = instr->hydrogen()->maps();
5242 if (instr->hydrogen()->HasMigrationTarget()) {
5245 DeoptimizeIf(ne, instr);
5252 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5253 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped());
5254 Register result_reg = ToRegister(instr->result());
5259 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
5260 Register unclamped_reg = ToRegister(instr->unclamped());
5261 Register result_reg = ToRegister(instr->result());
5266 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
5268 Register input_reg = ToRegister(instr->unclamped());
5269 Register result_reg = ToRegister(instr->result());
5270 DwVfpRegister temp_reg = ToDoubleRegister(instr->temp());
5284 DeoptimizeIf(ne, instr);
5302 void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
5303 DwVfpRegister value_reg = ToDoubleRegister(instr->value());
5304 Register result_reg = ToRegister(instr->result());
5305 if (instr->hydrogen()->bits() == HDoubleBits::HIGH) {
5313 void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
5314 Register hi_reg = ToRegister(instr->hi());
5315 Register lo_reg = ToRegister(instr->lo());
5316 DwVfpRegister result_reg = ToDoubleRegister(instr->result());
5322 void LCodeGen::DoAllocate(LAllocate* instr) {
5325 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5326 : LDeferredCode(codegen), instr_(instr) { }
5330 virtual LInstruction* instr() OVERRIDE { return instr_; }
5336 new(zone()) DeferredAllocate(this, instr);
5338 Register result = ToRegister(instr->result());
5339 Register scratch = ToRegister(instr->temp1());
5340 Register scratch2 = ToRegister(instr->temp2());
5344 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5347 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5348 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation());
5349 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5351 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5352 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5356 if (instr->size()->IsConstantOperand()) {
5357 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5364 Register size = ToRegister(instr->size());
5370 if (instr->hydrogen()->MustPrefillWithFiller()) {
5372 if (instr->size()->IsConstantOperand()) {
5373 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5376 __ sub(scratch, ToRegister(instr->size()), Operand(kHeapObjectTag));
5388 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5389 Register result = ToRegister(instr->result());
5397 if (instr->size()->IsRegister()) {
5398 Register size = ToRegister(instr->size());
5403 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5414 instr->hydrogen()->MustAllocateDoubleAligned());
5415 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5416 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation());
5417 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5419 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5420 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5428 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5433 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5434 DCHECK(ToRegister(instr->value()).is(r0));
5436 CallRuntime(Runtime::kToFastProperties, 1, instr);
5440 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5441 DCHECK(ToRegister(instr->context()).is(cp));
5449 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
5450 __ Move(r6, instr->hydrogen()->literals());
5458 __ mov(r5, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5459 __ mov(r4, Operand(instr->hydrogen()->pattern()));
5460 __ mov(r3, Operand(instr->hydrogen()->flags()));
5462 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5475 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5484 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
5485 DCHECK(ToRegister(instr->context()).is(cp));
5488 bool pretenure = instr->hydrogen()->pretenure();
5489 if (!pretenure && instr->hydrogen()->has_no_literals()) {
5490 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(),
5491 instr->hydrogen()->kind());
5492 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5493 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5495 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5499 CallRuntime(Runtime::kNewClosure, 3, instr);
5504 void LCodeGen::DoTypeof(LTypeof* instr) {
5505 Register input = ToRegister(instr->value());
5507 CallRuntime(Runtime::kTypeof, 1, instr);
5511 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5512 Register input = ToRegister(instr->value());
5514 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
5515 instr->FalseLabel(chunk_),
5517 instr->type_literal());
5519 EmitBranch(instr, final_branch_condition);
5598 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
5599 Register temp1 = ToRegister(instr->temp());
5602 EmitBranch(instr, eq);
5642 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
5644 DCHECK(instr->HasEnvironment());
5645 LEnvironment* env = instr->environment();
5651 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
5652 Deoptimizer::BailoutType type = instr->hydrogen()->type();
5661 DeoptimizeIf(al, instr, instr->hydrogen()->reason(), type);
5665 void LCodeGen::DoDummy(LDummy* instr) {
5670 void LCodeGen::DoDummyUse(LDummyUse* instr) {
5675 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
5677 LoadContextFromDeferred(instr->context());
5680 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
5681 DCHECK(instr->HasEnvironment());
5682 LEnvironment* env = instr->environment();
5687 void LCodeGen::DoStackCheck(LStackCheck* instr) {
5690 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
5691 : LDeferredCode(codegen), instr_(instr) { }
5695 virtual LInstruction* instr() OVERRIDE { return instr_; }
5700 DCHECK(instr->HasEnvironment());
5701 LEnvironment* env = instr->environment();
5704 if (instr->hydrogen()->is_function_entry()) {
5713 DCHECK(instr->context()->IsRegister());
5714 DCHECK(ToRegister(instr->context()).is(cp));
5715 CallCode(stack_check, RelocInfo::CODE_TARGET, instr);
5718 DCHECK(instr->hydrogen()->is_backwards_branch());
5721 new(zone()) DeferredStackCheck(this, instr);
5726 __ bind(instr->done_label());
5727 deferred_stack_check->SetExit(instr->done_label());
5736 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
5740 LEnvironment* environment = instr->environment();
5751 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
5754 DeoptimizeIf(eq, instr);
5759 DeoptimizeIf(eq, instr);
5762 DeoptimizeIf(eq, instr);
5766 DeoptimizeIf(le, instr);
5777 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
5782 DeoptimizeIf(ne, instr);
5787 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
5788 Register map = ToRegister(instr->map());
5789 Register result = ToRegister(instr->result());
5802 FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
5804 DeoptimizeIf(eq, instr);
5810 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
5811 Register object = ToRegister(instr->value());
5812 Register map = ToRegister(instr->map());
5815 DeoptimizeIf(ne, instr);
5819 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr,
5829 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt);
5834 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
5838 LLoadFieldByIndex* instr,
5843 instr_(instr),
5851 virtual LInstruction* instr() OVERRIDE { return instr_; }
5859 Register object = ToRegister(instr->object());
5860 Register index = ToRegister(instr->index());
5861 Register result = ToRegister(instr->result());
5866 this, instr, result, object, index);
5894 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
5895 Register context = ToRegister(instr->context());
5900 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
5901 Handle<ScopeInfo> scope_info = instr->scope_info();
5903 __ push(ToRegister(instr->function()));
5904 CallRuntime(Runtime::kPushBlockContext, 2, instr);