Home | History | Annotate | Download | only in arm

Lines Matching refs:instr

262     LInstruction* instr = instructions_->at(current_instruction_);
265 if (instr->IsLabel()) {
266 emit_instructions = !LLabel::cast(instr)->HasReplacement();
270 if (FLAG_code_comments && instr->HasInterestingComment(this)) {
273 instr->hydrogen_value()->id(),
274 instr->Mnemonic());
277 RecordAndUpdatePosition(instr->position());
279 instr->CompileToNative(this);
299 code->instr()->hydrogen_value()->id(),
300 code->instr()->Mnemonic());
703 LInstruction* instr,
705 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode);
711 LInstruction* instr,
715 ASSERT(instr != NULL);
719 LPointerMap* pointers = instr->pointer_map();
722 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
735 LInstruction* instr) {
736 ASSERT(instr != NULL);
737 LPointerMap* pointers = instr->pointer_map();
742 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
748 LInstruction* instr) {
751 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
935 LInstruction* instr, SafepointMode safepoint_mode) {
937 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
941 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
1049 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
1050 DoGap(instr);
1054 void LCodeGen::DoParameter(LParameter* instr) {
1059 void LCodeGen::DoCallStub(LCallStub* instr) {
1060 ASSERT(ToRegister(instr->result()).is(r0));
1061 switch (instr->hydrogen()->major_key()) {
1064 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1069 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1074 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1079 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1084 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1089 TranscendentalCacheStub stub(instr->transcendental_type(),
1091 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1100 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
1106 void LCodeGen::DoModI(LModI* instr) {
1107 HMod* hmod = instr->hydrogen();
1113 Register left_reg = ToRegister(instr->left());
1114 Register result_reg = ToRegister(instr->result());
1127 DeoptimizeIf(eq, instr->environment());
1137 Register left_reg = ToRegister(instr->left());
1138 Register right_reg = ToRegister(instr->right());
1139 Register result_reg = ToRegister(instr->result());
1146 DeoptimizeIf(ne, instr->environment());
1156 DeoptimizeIf(eq, instr->environment());
1168 Register left_reg = ToRegister(instr->left());
1169 Register right_reg = ToRegister(instr->right());
1170 Register result_reg = ToRegister(instr->result());
1177 DeoptimizeIf(eq, instr->environment());
1188 DeoptimizeIf(eq, instr->environment());
1211 DeoptimizeIf(lt, instr->environment());
1217 Register left_reg = ToRegister(instr->left());
1218 Register right_reg = ToRegister(instr->right());
1219 Register result_reg = ToRegister(instr->result());
1224 DwVfpRegister dividend = ToDoubleRegister(instr->temp());
1225 DwVfpRegister divisor = ToDoubleRegister(instr->temp2());
1236 DeoptimizeIf(eq, instr->environment());
1268 DeoptimizeIf(mi, instr->environment());
1369 void LCodeGen::DoDivI(LDivI* instr) {
1370 if (instr->hydrogen()->HasPowerOf2Divisor()) {
1371 Register dividend = ToRegister(instr->left());
1372 int32_t divisor = instr->hydrogen()->right()->GetInteger32Constant();
1381 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1383 DeoptimizeIf(eq, instr->environment());
1386 if (divisor == -1 && instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1388 DeoptimizeIf(eq, instr->environment());
1395 if (instr->hydrogen()->CheckFlag(
1406 DeoptimizeIf(ne, instr->environment());
1415 const Register left = ToRegister(instr->left());
1416 const Register right = ToRegister(instr->right());
1417 const Register result = ToRegister(instr->result());
1420 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
1422 DeoptimizeIf(eq, instr->environment());
1426 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1431 DeoptimizeIf(mi, instr->environment());
1436 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1441 DeoptimizeIf(eq, instr->environment());
1449 if (!instr->hydrogen()->CheckFlag(
1455 DeoptimizeIf(ne, instr->environment());
1458 const DoubleRegister vleft = ToDoubleRegister(instr->temp());
1468 if (!instr->hydrogen()->CheckFlag(
1474 DeoptimizeIf(ne, instr->environment());
1480 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) {
1481 DwVfpRegister addend = ToDoubleRegister(instr->addend());
1482 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1483 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1486 ASSERT(addend.is(ToDoubleRegister(instr->result())));
1492 void LCodeGen::DoMultiplySubD(LMultiplySubD* instr) {
1493 DwVfpRegister minuend = ToDoubleRegister(instr->minuend());
1494 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1495 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1498 ASSERT(minuend.is(ToDoubleRegister(instr->result())));
1504 void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
1505 const Register result = ToRegister(instr->result());
1506 const Register left = ToRegister(instr->left());
1507 const Register remainder = ToRegister(instr->temp());
1514 ASSERT(instr->right()->IsConstantOperand());
1515 int32_t divisor = ToInteger32(LConstantOperand::cast(instr->right()));
1519 DeoptimizeIf(eq, instr->environment());
1526 instr->environment());
1533 const Register right = ToRegister(instr->right());
1537 DeoptimizeIf(eq, instr->environment());
1540 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1545 DeoptimizeIf(eq, instr->environment());
1550 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1556 DeoptimizeIf(eq, instr->environment());
1575 void LCodeGen::DoMulI(LMulI* instr) {
1577 Register result = ToRegister(instr->result());
1579 Register left = ToRegister(instr->left());
1580 LOperand* right_op = instr->right();
1582 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1584 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
1590 instr->hydrogen()->right()->representation());
1596 DeoptimizeIf(eq, instr->environment());
1608 DeoptimizeIf(mi, instr->environment());
1649 __ orr(ToRegister(instr->temp()), left, right);
1654 if (instr->hydrogen()->representation().IsSmi()) {
1661 DeoptimizeIf(ne, instr->environment());
1663 if (instr->hydrogen()->representation().IsSmi()) {
1676 __ cmp(ToRegister(instr->temp()), Operand::Zero());
1677 DeoptimizeIf(mi, instr->environment());
1684 void LCodeGen::DoBitI(LBitI* instr) {
1685 LOperand* left_op = instr->left();
1686 LOperand* right_op = instr->right();
1689 Register result = ToRegister(instr->result());
1699 switch (instr->op()) {
1720 void LCodeGen::DoShiftI(LShiftI* instr) {
1723 LOperand* right_op = instr->right();
1724 Register left = ToRegister(instr->left());
1725 Register result = ToRegister(instr->result());
1730 switch (instr->op()) {
1738 if (instr->can_deopt()) {
1740 DeoptimizeIf(mi, instr->environment());
1756 switch (instr->op()) {
1775 if (instr->can_deopt()) {
1777 DeoptimizeIf(ne, instr->environment());
1784 if (instr->hydrogen_value()->representation().IsSmi() &&
1785 instr->can_deopt()) {
1792 DeoptimizeIf(vs, instr->environment());
1808 void LCodeGen::DoSubI(LSubI* instr) {
1809 LOperand* left = instr->left();
1810 LOperand* right = instr->right();
1811 LOperand* result = instr->result();
1812 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1824 DeoptimizeIf(vs, instr->environment());
1829 void LCodeGen::DoRSubI(LRSubI* instr) {
1830 LOperand* left = instr->left();
1831 LOperand* right = instr->right();
1832 LOperand* result = instr->result();
1833 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1845 DeoptimizeIf(vs, instr->environment());
1850 void LCodeGen::DoConstantI(LConstantI* instr) {
1851 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1855 void LCodeGen::DoConstantS(LConstantS* instr) {
1856 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1860 void LCodeGen::DoConstantD(LConstantD* instr) {
1861 ASSERT(instr->result()->IsDoubleRegister());
1862 DwVfpRegister result = ToDoubleRegister(instr->result());
1863 double v = instr->value();
1868 void LCodeGen::DoConstantE(LConstantE* instr) {
1869 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1873 void LCodeGen::DoConstantT(LConstantT* instr) {
1874 Handle<Object> value = instr->value();
1876 __ LoadObject(ToRegister(instr->result()), value);
1880 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1881 Register result = ToRegister(instr->result());
1882 Register map = ToRegister(instr->value());
1887 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1888 Register result = ToRegister(instr->result());
1889 Register input = ToRegister(instr->value());
1901 void LCodeGen::DoValueOf(LValueOf* instr) {
1902 Register input = ToRegister(instr->value());
1903 Register result = ToRegister(instr->result());
1904 Register map = ToRegister(instr->temp());
1907 if (!instr->hydrogen()->value()->IsHeapObject()) {
1924 void LCodeGen::DoDateField(LDateField* instr) {
1925 Register object = ToRegister(instr->date());
1926 Register result = ToRegister(instr->result());
1927 Register scratch = ToRegister(instr->temp());
1928 Smi* index = instr->index();
1936 DeoptimizeIf(eq, instr->environment());
1938 DeoptimizeIf(ne, instr->environment());
1963 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
1964 Register string = ToRegister(instr->string());
1965 Register index = ToRegister(instr->index());
1966 Register value = ToRegister(instr->value());
1967 String::Encoding encoding = instr->encoding();
1995 void LCodeGen::DoThrow(LThrow* instr) {
1996 Register input_reg = EmitLoadRegister(instr->value(), ip);
1998 CallRuntime(Runtime::kThrow, 1, instr);
2006 void LCodeGen::DoAddI(LAddI* instr) {
2007 LOperand* left = instr->left();
2008 LOperand* right = instr->right();
2009 LOperand* result = instr->result();
2010 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
2022 DeoptimizeIf(vs, instr->environment());
2027 void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
2028 LOperand* left = instr->left();
2029 LOperand* right = instr->right();
2030 HMathMinMax::Operation operation = instr->hydrogen()->operation();
2031 if (instr->hydrogen()->representation().IsSmiOrInteger32()) {
2037 Register result_reg = ToRegister(instr->result());
2042 ASSERT(instr->hydrogen()->representation().IsDouble());
2045 DwVfpRegister result_reg = ToDoubleRegister(instr->result());
2094 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
2095 DwVfpRegister left = ToDoubleRegister(instr->left());
2096 DwVfpRegister right = ToDoubleRegister(instr->right());
2097 DwVfpRegister result = ToDoubleRegister(instr->result());
2098 switch (instr->op()) {
2134 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
2135 ASSERT(ToRegister(instr->left()).is(r1));
2136 ASSERT(ToRegister(instr->right()).is(r0));
2137 ASSERT(ToRegister(instr->result()).is(r0));
2139 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
2143 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2156 void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
2157 int left_block = instr->TrueDestination(chunk_);
2158 int right_block = instr->FalseDestination(chunk_);
2176 void LCodeGen::EmitFalseBranch(InstrType instr, Condition condition) {
2177 int false_block = instr->FalseDestination(chunk_);
2182 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2187 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
2188 Representation r = instr->hydrogen()->value()->representation();
2190 EmitBranch(instr, al);
2193 Register reg = ToRegister(instr->value());
2194 HType type = instr->hydrogen()->value()->type();
2196 EmitBranch(instr, al);
2198 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2201 EmitBranch(instr, eq);
2206 void LCodeGen::DoBranch(LBranch* instr) {
2207 Representation r = instr->hydrogen()->value()->representation();
2210 Register reg = ToRegister(instr->value());
2212 EmitBranch(instr, ne);
2215 DwVfpRegister reg = ToDoubleRegister(instr->value());
2219 EmitBranch(instr, ne);
2222 Register reg = ToRegister(instr->value());
2223 HType type = instr->hydrogen()->value()->type();
2227 EmitBranch(instr, eq);
2231 EmitBranch(instr, ne);
2234 EmitBranch(instr, al);
2242 EmitBranch(instr, ne);
2247 EmitBranch(instr, ne);
2249 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2256 __ b(eq, instr->FalseLabel(chunk_));
2261 __ b(eq, instr->TrueLabel(chunk_));
2263 __ b(eq, instr->FalseLabel(chunk_));
2268 __ b(eq, instr->FalseLabel(chunk_));
2274 __ b(eq, instr->FalseLabel(chunk_));
2275 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2279 DeoptimizeIf(eq, instr->environment());
2290 __ b(ne, instr->FalseLabel(chunk_));
2297 __ b(ge, instr->TrueLabel(chunk_));
2307 __ b(ne, instr->TrueLabel(chunk_));
2308 __ b(instr->FalseLabel(chunk_));
2315 __ b(eq, instr->TrueLabel(chunk_));
2327 __ b(eq, instr->FalseLabel(chunk_)); // +0, -0 -> false.
2328 __ b(instr->TrueLabel(chunk_));
2335 DeoptimizeIf(al, instr->environment());
2349 void LCodeGen::DoGoto(LGoto* instr) {
2350 EmitGoto(instr->block_id());
2382 void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
2383 LOperand* left = instr->left();
2384 LOperand* right = instr->right();
2385 Condition cond = TokenToCondition(instr->op(), false);
2391 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2392 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
2395 if (instr->is_double()) {
2401 __ b(vs, instr->FalseLabel(chunk_));
2405 if (instr->hydrogen_value()->representation().IsSmi()) {
2412 if (instr->hydrogen_value()->representation().IsSmi()) {
2423 EmitBranch(instr, cond);
2428 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
2429 Register left = ToRegister(instr->left());
2430 Register right = ToRegister(instr->right());
2433 EmitBranch(instr, eq);
2437 void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
2438 if (instr->hydrogen()->representation().IsTagged()) {
2439 Register input_reg = ToRegister(instr->object());
2442 EmitBranch(instr, eq);
2446 DwVfpRegister input_reg = ToDoubleRegister(instr->object());
2448 EmitFalseBranch(instr, vc);
2453 EmitBranch(instr, eq);
2484 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
2485 Register reg = ToRegister(instr->value());
2486 Register temp1 = ToRegister(instr->temp());
2490 instr->FalseLabel(chunk_), instr->TrueLabel(chunk_));
2492 EmitBranch(instr, true_cond);
2509 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
2510 Register reg = ToRegister(instr->value());
2511 Register temp1 = ToRegister(instr->temp());
2514 instr->hydrogen()->value()->IsHeapObject()
2517 EmitIsString(reg, temp1, instr->FalseLabel(chunk_), check_needed);
2519 EmitBranch(instr, true_cond);
2523 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
2524 Register input_reg = EmitLoadRegister(instr->value(), ip);
2526 EmitBranch(instr, eq);
2530 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
2531 Register input = ToRegister(instr->value());
2532 Register temp = ToRegister(instr->temp());
2534 if (!instr->hydrogen()->value()->IsHeapObject()) {
2535 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2540 EmitBranch(instr, ne);
2564 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2565 Token::Value op = instr->op();
2568 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2574 EmitBranch(instr, condition);
2578 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
2579 InstanceType from = instr->from();
2580 InstanceType to = instr->to();
2587 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
2588 InstanceType from = instr->from();
2589 InstanceType to = instr->to();
2598 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
2600 Register input = ToRegister(instr->value());
2602 if (!instr->hydrogen()->value()->IsHeapObject()) {
2603 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2606 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
2607 EmitBranch(instr, BranchCondition(instr->hydrogen()));
2611 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
2612 Register input = ToRegister(instr->value());
2613 Register result = ToRegister(instr->result());
2623 LHasCachedArrayIndexAndBranch* instr) {
2624 Register input = ToRegister(instr->value());
2630 EmitBranch(instr, eq);
2701 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
2702 Register input = ToRegister(instr->value());
2704 Register temp2 = ToRegister(instr->temp());
2705 Handle<String> class_name = instr->hydrogen()->class_name();
2707 EmitClassOfTest(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_),
2710 EmitBranch(instr, eq);
2714 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
2715 Register reg = ToRegister(instr->value());
2716 Register temp = ToRegister(instr->temp());
2719 __ cmp(temp, Operand(instr->map()));
2720 EmitBranch(instr, eq);
2724 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
2725 ASSERT(ToRegister(instr->left()).is(r0)); // Object is in r0.
2726 ASSERT(ToRegister(instr->right()).is(r1)); // Function is in r1.
2729 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2737 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
2741 LInstanceOfKnownGlobal* instr)
2742 : LDeferredCode(codegen), instr_(instr) { }
2746 virtual LInstruction* instr() { return instr_; }
2754 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
2757 Register object = ToRegister(instr->value());
2758 Register temp = ToRegister(instr->temp());
2759 Register result = ToRegister(instr->result());
2819 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2821 Register result = ToRegister(instr->result());
2838 Register temp = ToRegister(instr->temp());
2840 __ LoadHeapObject(InstanceofStub::right(), instr->function());
2859 instr,
2861 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
2869 void LCodeGen::DoInstanceSize(LInstanceSize* instr) {
2870 Register object = ToRegister(instr->object());
2871 Register result = ToRegister(instr->result());
2877 void LCodeGen::DoCmpT(LCmpT* instr) {
2878 Token::Value op = instr->op();
2881 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2886 __ LoadRoot(ToRegister(instr->result()),
2889 __ LoadRoot(ToRegister(instr->result()),
2895 void LCodeGen::DoReturn(LReturn* instr) {
2920 if (instr->has_constant_parameter_count()) {
2921 int parameter_count = ToInteger32(instr->constant_parameter_count());
2927 Register reg = ToRegister(instr->parameter_count());
2941 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2942 Register result = ToRegister(instr->result());
2943 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
2945 if (instr->hydrogen()->RequiresHoleCheck()) {
2948 DeoptimizeIf(eq, instr->environment());
2953 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2954 ASSERT(ToRegister(instr->global_object()).is(r0));
2955 ASSERT(ToRegister(instr->result()).is(r0));
2957 __ mov(r2, Operand(instr->name()));
2958 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET
2961 CallCode(ic, mode, instr);
2965 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2966 Register value = ToRegister(instr->value());
2970 __ mov(cell, Operand(instr->hydrogen()->cell()));
2976 if (instr->hydrogen()->RequiresHoleCheck()) {
2978 Register payload = ToRegister(instr->temp());
2981 DeoptimizeIf(eq, instr->environment());
2990 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2991 ASSERT(ToRegister(instr->global_object()).is(r1));
2992 ASSERT(ToRegister(instr->value()).is(r0));
2994 __ mov(r2, Operand(instr->name()));
2995 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
2998 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
3002 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
3003 Register context = ToRegister(instr->context());
3004 Register result = ToRegister(instr->result());
3005 __ ldr(result, ContextOperand(context, instr->slot_index()));
3006 if (instr->hydrogen()->RequiresHoleCheck()) {
3009 if (instr->hydrogen()->DeoptimizesOnHole()) {
3010 DeoptimizeIf(eq, instr->environment());
3018 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
3019 Register context = ToRegister(instr->context());
3020 Register value = ToRegister(instr->value());
3022 MemOperand target = ContextOperand(context, instr->slot_index());
3026 if (instr->hydrogen()->RequiresHoleCheck()) {
3030 if (instr->hydrogen()->DeoptimizesOnHole()) {
3031 DeoptimizeIf(eq, instr->environment());
3038 if (instr->hydrogen()->NeedsWriteBarrier()) {
3040 instr->hydrogen()->value()->IsHeapObject()
3056 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3057 HObjectAccess access = instr->hydrogen()->access();
3059 Register object = ToRegister(instr->object());
3062 Register result = ToRegister(instr->result());
3067 if (instr->hydrogen()->representation().IsDouble()) {
3068 DwVfpRegister result = ToDoubleRegister(instr->result());
3073 Register result = ToRegister(instr->result());
3083 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3084 ASSERT(ToRegister(instr->object()).is(r0));
3085 ASSERT(ToRegister(instr->result()).is(r0));
3088 __ mov(r2, Operand(instr->name()));
3090 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3094 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
3096 Register function = ToRegister(instr->function());
3097 Register result = ToRegister(instr->result());
3102 DeoptimizeIf(ne, instr->environment());
3117 DeoptimizeIf(eq, instr->environment());
3139 LLoadExternalArrayPointer* instr) {
3140 Register to_reg = ToRegister(instr->result());
3141 Register from_reg = ToRegister(instr->object());
3147 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
3148 Register arguments = ToRegister(instr->arguments());
3149 Register result = ToRegister(instr->result());
3150 if (instr->length()->IsConstantOperand() &&
3151 instr->index()->IsConstantOperand()) {
3152 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3153 int const_length = ToInteger32(LConstantOperand::cast(instr->length()));
3157 Register length = ToRegister(instr->length());
3158 Register index = ToRegister(instr->index());
3168 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3169 Register external_pointer = ToRegister(instr->elements());
3171 ElementsKind elements_kind = instr->elements_kind();
3172 bool key_is_constant = instr->key()->IsConstantOperand();
3175 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3180 key = ToRegister(instr->key());
3183 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3185 int additional_offset = instr->additional_index() << element_size_shift;
3189 DwVfpRegister result = ToDoubleRegister(instr->result());
3201 Register result = ToRegister(instr->result());
3205 instr->additional_index(), additional_offset);
3225 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3227 DeoptimizeIf(cs, instr->environment());
3247 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
3248 Register elements = ToRegister(instr->elements());
3249 bool key_is_constant = instr->key()->IsConstantOperand();
3251 DwVfpRegister result = ToDoubleRegister(instr->result());
3255 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3259 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3264 key = ToRegister(instr->key());
3268 ((constant_key + instr->additional_index()) << element_size_shift);
3274 if (instr->hydrogen()->RequiresHoleCheck()) {
3277 DeoptimizeIf(eq, instr->environment());
3282 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
3283 Register elements = ToRegister(instr->elements());
3284 Register result = ToRegister(instr->result());
3289 if (instr->key()->IsConstantOperand()) {
3290 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3292 instr->additional_index());
3295 Register key = EmitLoadRegister(instr->key(), scratch0());
3300 if (instr->hydrogen()->key()->representation().IsSmi()) {
3305 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3310 if (instr->hydrogen()->RequiresHoleCheck()) {
3311 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3313 DeoptimizeIf(ne, instr->environment());
3317 DeoptimizeIf(eq, instr->environment());
3323 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3324 if (instr->is_external()) {
3325 DoLoadKeyedExternalArray(instr);
3326 } else if (instr->hydrogen()->representation().IsDouble()) {
3327 DoLoadKeyedFixedDoubleArray(instr);
3329 DoLoadKeyedFixedArray(instr);
3370 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
3371 ASSERT(ToRegister(instr->object()).is(r1));
3372 ASSERT(ToRegister(instr->key()).is(r0));
3375 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3379 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3381 Register result = ToRegister(instr->result());
3383 if (instr->hydrogen()->from_inlined()) {
3400 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
3401 Register elem = ToRegister(instr->elements());
3402 Register result = ToRegister(instr->result());
3422 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
3423 Register receiver = ToRegister(instr->receiver());
3424 Register function = ToRegister(instr->function());
3456 DeoptimizeIf(eq, instr->environment());
3458 DeoptimizeIf(lt, instr->environment());
3469 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
3470 Register receiver = ToRegister(instr->receiver());
3471 Register function = ToRegister(instr->function());
3472 Register length = ToRegister(instr->length());
3473 Register elements = ToRegister(instr->elements());
3477 ASSERT(ToRegister(instr->result()).is(r0));
3483 DeoptimizeIf(hi, instr->environment());
3505 ASSERT(instr->HasPointerMap());
3506 LPointerMap* pointers = instr->pointer_map();
3519 void LCodeGen::DoPushArgument(LPushArgument* instr) {
3520 LOperand* argument = instr->value();
3530 void LCodeGen::DoDrop(LDrop* instr) {
3531 __ Drop(instr->count());
3535 void LCodeGen::DoThisFunction(LThisFunction* instr) {
3536 Register result = ToRegister(instr->result());
3541 void LCodeGen::DoContext(LContext* instr) {
3543 Register result = ToRegister(instr->result());
3544 for (HUseIterator it(instr->hydrogen()->uses()); !it.Done(); it.Advance()) {
3553 void LCodeGen::DoOuterContext(LOuterContext* instr) {
3554 Register context = ToRegister(instr->context());
3555 Register result = ToRegister(instr->result());
3561 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3563 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs());
3565 __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3567 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3571 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
3572 Register result = ToRegister(instr->result());
3577 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
3578 Register global = ToRegister(instr->global_object());
3579 Register result = ToRegister(instr->result());
3587 LInstruction* instr,
3595 LPointerMap* pointers = instr->pointer_map();
3618 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3632 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
3633 ASSERT(ToRegister(instr->result()).is(r0));
3634 CallKnownFunction(instr->hydrogen()->function(),
3635 instr->hydrogen()->formal_parameter_count(),
3636 instr->arity(),
3637 instr,
3643 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3644 Register input = ToRegister(instr->value());
3645 Register result = ToRegister(instr->result());
3652 DeoptimizeIf(ne, instr->environment());
3687 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3709 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) {
3710 Register input = ToRegister(instr->value());
3711 Register result = ToRegister(instr->result());
3719 DeoptimizeIf(vs, instr->environment());
3723 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3727 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr)
3728 : LDeferredCode(codegen), instr_(instr) { }
3732 virtual LInstruction* instr() { return instr_; }
3737 Representation r = instr->hydrogen()->value()->representation();
3739 DwVfpRegister input = ToDoubleRegister(instr->value());
3740 DwVfpRegister result = ToDoubleRegister(instr->result());
3743 EmitIntegerMathAbs(instr);
3747 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3748 Register input = ToRegister(instr->value());
3752 EmitIntegerMathAbs(instr);
3758 void LCodeGen::DoMathFloor(LMathFloor* instr) {
3759 DwVfpRegister input = ToDoubleRegister(instr->value());
3760 Register result = ToRegister(instr->result());
3765 DeoptimizeIf(al, instr->environment());
3768 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3773 DeoptimizeIf(mi, instr->environment());
3779 void LCodeGen::DoMathRound(LMathRound* instr) {
3780 DwVfpRegister input = ToDoubleRegister(instr->value());
3781 Register result = ToRegister(instr->result());
3782 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->temp());
3795 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3798 DeoptimizeIf(mi, instr->environment()); // [-0.5, -0].
3812 DeoptimizeIf(al, instr->environment());
3817 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
3818 DwVfpRegister input = ToDoubleRegister(instr->value());
3819 DwVfpRegister result = ToDoubleRegister(instr->result());
3824 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
3825 DwVfpRegister input = ToDoubleRegister(instr->value());
3826 DwVfpRegister result = ToDoubleRegister(instr->result());
3827 DwVfpRegister temp = ToDoubleRegister(instr->temp());
3845 void LCodeGen::DoPower(LPower* instr) {
3846 Representation exponent_type = instr->hydrogen()->right()->representation();
3849 ASSERT(!instr->right()->IsDoubleRegister() ||
3850 ToDoubleRegister(instr->right()).is(d2));
3851 ASSERT(!instr->right()->IsRegister() ||
3852 ToRegister(instr->right()).is(r2));
3853 ASSERT(ToDoubleRegister(instr->left()).is(d1));
3854 ASSERT(ToDoubleRegister(instr->result()).is(d3));
3865 DeoptimizeIf(ne, instr->environment());
3880 void LCodeGen::DoRandom(LRandom* instr) {
3883 DeferredDoRandom(LCodeGen* codegen, LRandom* instr)
3884 : LDeferredCode(codegen), instr_(instr) { }
3886 virtual LInstruction* instr() { return instr_; }
3891 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr);
3895 ASSERT(ToDoubleRegister(instr->result()).is(d7));
3896 ASSERT(ToRegister(instr->global_object()).is(r0));
3951 void LCodeGen::DoDeferredRandom(LRandom* instr) {
3958 void LCodeGen::DoMathExp(LMathExp* instr) {
3959 DwVfpRegister input = ToDoubleRegister(instr->value());
3960 DwVfpRegister result = ToDoubleRegister(instr->result());
3961 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->double_temp());
3963 Register temp1 = ToRegister(instr->temp1());
3964 Register temp2 = ToRegister(instr->temp2());
3972 void LCodeGen::DoMathLog(LMathLog* instr) {
3973 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3976 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3980 void LCodeGen::DoMathTan(LMathTan* instr) {
3981 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3984 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3988 void LCodeGen::DoMathCos(LMathCos* instr) {
3989 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3992 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3996 void LCodeGen::DoMathSin(LMathSin* instr) {
3997 ASSERT(ToDoubleRegister(instr->result()).is(d2));
4000 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4004 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
4005 ASSERT(ToRegister(instr->function()).is(r1));
4006 ASSERT(instr->HasPointerMap());
4008 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
4010 LPointerMap* pointers = instr->pointer_map();
4013 ParameterCount count(instr->arity());
4018 instr->hydrogen()->formal_parameter_count(),
4019 instr->arity(),
4020 instr,
4027 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
4028 ASSERT(ToRegister(instr->result()).is(r0));
4030 int arity = instr->arity();
4033 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4038 void LCodeGen::DoCallNamed(LCallNamed* instr) {
4039 ASSERT(ToRegister(instr->result()).is(r0));
4041 int arity = instr->arity();
4045 __ mov(r2, Operand(instr->name()));
4046 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS);
4052 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4053 ASSERT(ToRegister(instr->function()).is(r1));
4054 ASSERT(ToRegister(instr->result()).is(r0));
4056 int arity = instr->arity();
4058 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4063 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
4064 ASSERT(ToRegister(instr->result()).is(r0));
4066 int arity = instr->arity();
4070 __ mov(r2, Operand(instr->name()));
4071 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS);
4076 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
4077 ASSERT(ToRegister(instr->result()).is(r0));
4078 CallKnownFunction(instr->hydrogen()->target(),
4079 instr->hydrogen()->formal_parameter_count(),
4080 instr->arity(),
4081 instr,
4087 void LCodeGen::DoCallNew(LCallNew* instr) {
4088 ASSERT(ToRegister(instr->constructor()).is(r1));
4089 ASSERT(ToRegister(instr->result()).is(r0));
4091 __ mov(r0, Operand(instr->arity()));
4096 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4100 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4101 ASSERT(ToRegister(instr->constructor()).is(r1));
4102 ASSERT(ToRegister(instr->result()).is(r0));
4104 __ mov(r0, Operand(instr->arity()));
4105 __ mov(r2, Operand(instr->hydrogen()->property_cell()));
4106 ElementsKind kind = instr->hydrogen()->elements_kind();
4113 if (instr->arity() == 0) {
4115 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4116 } else if (instr->arity() == 1) {
4129 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4135 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4139 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4144 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4145 CallRuntime(instr->function(), instr->arity(), instr);
4149 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4150 Register result = ToRegister(instr->result());
4151 Register base = ToRegister(instr->base_object());
4152 __ add(result, base, Operand(instr->offset()));
4156 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4157 Representation representation = instr->representation();
4159 Register object = ToRegister(instr->object());
4161 HObjectAccess access = instr->hydrogen()->access();
4165 Register value = ToRegister(instr->value());
4170 Handle<Map> transition = instr->transition();
4173 Register value = ToRegister(instr->value());
4174 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4176 DeoptimizeIf(eq, instr->environment());
4181 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4182 DwVfpRegister value = ToDoubleRegister(instr->value());
4190 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
4191 Register temp = ToRegister(instr->temp());
4205 Register value = ToRegister(instr->value());
4208 instr->hydrogen()->value()->IsHeapObject()
4212 if (instr->hydrogen()->NeedsWriteBarrier()) {
4226 if (instr->hydrogen()->NeedsWriteBarrier()) {
4242 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4243 ASSERT(ToRegister(instr->object()).is(r1));
4244 ASSERT(ToRegister(instr->value()).is(r0));
4247 __ mov(r2, Operand(instr->name()));
4248 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
4251 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4267 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4268 if (instr->hydrogen()->skip_check()) return;
4270 if (instr->index()->IsConstantOperand()) {
4272 ToInteger32(LConstantOperand::cast(instr->index()));
4273 if (instr->hydrogen()->length()->representation().IsSmi()) {
4278 __ cmp(ip, ToRegister(instr->length()));
4280 __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
4282 Condition condition = instr->hydrogen()->allow_equality() ? hi : hs;
4283 ApplyCheckIf(condition, instr);
4287 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4288 Register external_pointer = ToRegister(instr->elements());
4290 ElementsKind elements_kind = instr->elements_kind();
4291 bool key_is_constant = instr->key()->IsConstantOperand();
4294 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4299 key = ToRegister(instr->key());
4302 int shift_size = (instr
4304 int additional_offset = instr->additional_index() << element_size_shift;
4308 DwVfpRegister value(ToDoubleRegister(instr->value()));
4320 Register value(ToRegister(instr->value()));
4324 instr->additional_index(), additional_offset);
4356 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4357 DwVfpRegister value = ToDoubleRegister(instr->value());
4358 Register elements = ToRegister(instr->elements());
4361 bool key_is_constant = instr->key()->IsConstantOperand();
4367 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4372 key = ToRegister(instr->key());
4375 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4387 if (instr->NeedsCanonicalization()) {
4396 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4400 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4401 Register value = ToRegister(instr->value());
4402 Register elements = ToRegister(instr->elements());
4403 Register key = instr->key()->IsRegister() ? ToRegister(instr->key())
4410 if (instr->key()->IsConstantOperand()) {
4411 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4412 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
4414 instr->additional_index());
4421 if (instr->hydrogen()->key()->representation().IsSmi()) {
4426 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
4430 if (instr->hydrogen()->NeedsWriteBarrier()) {
4432 instr->hydrogen()->value()->IsHeapObject()
4447 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4449 if (instr->is_external()) {
4450 DoStoreKeyedExternalArray(instr);
4451 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4452 DoStoreKeyedFixedDoubleArray(instr);
4454 DoStoreKeyedFixedArray(instr);
4459 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
4460 ASSERT(ToRegister(instr->object()).is(r2));
4461 ASSERT(ToRegister(instr->key()).is(r1));
4462 ASSERT(ToRegister(instr->value()).is(r0));
4464 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
4467 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4471 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
4472 Register object_reg = ToRegister(instr->object());
4475 Handle<Map> from_map = instr->original_map();
4476 Handle<Map> to_map = instr->transitioned_map();
4477 ElementsKind from_kind = instr->from_kind();
4478 ElementsKind to_kind = instr->to_kind();
4486 Register new_map_reg = ToRegister(instr->new_map_temp());
4500 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4506 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
4507 Register object = ToRegister(instr->object());
4508 Register temp = ToRegister(instr->temp());
4510 DeoptimizeIf(eq, instr->environment());
4514 void LCodeGen::DoStringAdd(LStringAdd* instr) {
4515 __ push(ToRegister(instr->left()));
4516 __ push(ToRegister(instr->right()));
4517 StringAddStub stub(instr->hydrogen()->flags());
4518 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4522 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
4525 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
4526 : LDeferredCode(codegen), instr_(instr) { }
4528 virtual LInstruction* instr() { return instr_; }
4534 new(zone()) DeferredStringCharCodeAt(this, instr);
4537 ToRegister(instr->string()),
4538 ToRegister(instr->index()),
4539 ToRegister(instr->result()),
4545 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
4546 Register string = ToRegister(instr->string());
4547 Register result = ToRegister(instr->result());
4559 if (instr->index()->IsConstantOperand()) {
4560 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
4564 Register index = ToRegister(instr->index());
4568 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
4575 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
4578 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
4579 : LDeferredCode(codegen), instr_(instr) { }
4581 virtual LInstruction* instr() { return instr_; }
4587 new(zone()) DeferredStringCharFromCode(this, instr);
4589 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
4590 Register char_code = ToRegister(instr->char_code());
4591 Register result = ToRegister(instr->result());
4606 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
4607 Register char_code = ToRegister(instr->char_code());
4608 Register result = ToRegister(instr->result());
4618 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
4623 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
4624 LOperand* input = instr->value();
4626 LOperand* output = instr->result();
4640 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) {
4641 LOperand* input = instr->value();
4643 LOperand* output = instr->result();
4646 if (!instr->hydrogen()->value()->HasRange() ||
4647 !instr->hydrogen()->value()->range()->IsInSmiRange()) {
4648 DeoptimizeIf(vs, instr->environment());
4653 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
4654 LOperand* input = instr->value();
4655 LOperand* output = instr->result();
4663 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
4666 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
4667 : LDeferredCode(codegen), instr_(instr) { }
4673 virtual LInstruction* instr() { return instr_; }
4678 Register src = ToRegister(instr->value());
4679 Register dst = ToRegister(instr->result());
4681 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr);
4688 void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
4691 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
4692 : LDeferredCode(codegen), instr_(instr) { }
4698 virtual LInstruction* instr() { return instr_; }
4703 LOperand* input = instr->value();
4704 ASSERT(input->IsRegister() && input->Equals(instr->result()));
4707 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr);
4715 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
4720 Register dst = ToRegister(instr->result());
4757 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
4770 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
4773 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
4774 : LDeferredCode(codegen), instr_(instr) { }
4776 virtual LInstruction* instr() { return instr_; }
4781 DwVfpRegister input_reg = ToDoubleRegister(instr->value());
4783 Register reg = ToRegister(instr->result());
4784 Register temp1 = ToRegister(instr->temp());
4785 Register temp2 = ToRegister(instr->temp2());
4787 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
4803 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
4807 Register reg = ToRegister(instr->result());
4811 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
4817 void LCodeGen::DoSmiTag(LSmiTag* instr) {
4818 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
4819 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value()));
4823 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
4824 Register input = ToRegister(instr->value());
4825 Register result = ToRegister(instr->result());
4826 if (instr->needs_check()) {
4830 DeoptimizeIf(cs, instr->environment());
4900 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
4901 Register input_reg = ToRegister(instr->value());
4903 Register scratch2 = ToRegister(instr->temp());
4905 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp3());
4923 if (instr->truncating()) {
4924 Register scratch3 = ToRegister(instr->temp2());
4936 DeoptimizeIf(ne, instr->environment());
4949 DeoptimizeIf(ne, instr->environment());
4954 DeoptimizeIf(ne, instr->environment());
4956 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4961 DeoptimizeIf(ne, instr->environment());
4968 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
4971 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
4972 : LDeferredCode(codegen), instr_(instr) { }
4974 virtual LInstruction* instr() { return instr_; }
4979 LOperand* input = instr->value();
4981 ASSERT(input->Equals(instr->result()));
4985 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr);
4997 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
4998 LOperand* input = instr->value();
5000 LOperand* result = instr->result();
5006 HValue* value = instr->hydrogen()->value();
5011 instr->hydrogen()->can_convert_undefined_to_nan(),
5012 instr->hydrogen()->deoptimize_on_minus_zero(),
5013 instr->environment(),
5018 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
5019 Register result_reg = ToRegister(instr->result());
5021 Register scratch2 = ToRegister(instr->temp());
5022 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5025 if (instr->truncating()) {
5026 Register scratch3 = ToRegister(instr->temp2());
5032 DeoptimizeIf(ne, instr->environment());
5033 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5039 DeoptimizeIf(ne, instr->environment());
5046 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5047 Register result_reg = ToRegister(instr->result());
5049 Register scratch2 = ToRegister(instr->temp());
5050 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5053 if (instr->truncating()) {
5054 Register scratch3 = ToRegister(instr->temp2());
5060 DeoptimizeIf(ne, instr->environment());
5061 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5067 DeoptimizeIf(ne, instr->environment());
5072 DeoptimizeIf(vs, instr->environment());
5076 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
5077 LOperand* input = instr->value();
5079 DeoptimizeIf(ne, instr->environment());
5083 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
5084 if (!instr->hydrogen()->value()->IsHeapObject()) {
5085 LOperand* input = instr->value();
5087 DeoptimizeIf(eq, instr->environment());
5092 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
5093 Register input = ToRegister(instr->value());
5099 if (instr->hydrogen()->is_interval_check()) {
5102 instr->hydrogen()->GetCheckInterval(&first, &last);
5108 DeoptimizeIf(ne, instr->environment());
5110 DeoptimizeIf(lo, instr->environment());
5114 DeoptimizeIf(hi, instr->environment());
5120 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
5125 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment());
5129 DeoptimizeIf(ne, instr->environment());
5135 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
5136 Register reg = ToRegister(instr->value());
5137 Handle<JSFunction> target = instr->hydrogen()->target();
5140 Register reg = ToRegister(instr->value());
5148 DeoptimizeIf(ne, instr->environment());
5152 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
5156 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr);
5160 DeoptimizeIf(eq, instr->environment());
5164 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5167 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
5168 : LDeferredCode(codegen), instr_(instr), object_(object) {
5175 virtual LInstruction* instr() { return instr_; }
5182 if (instr->hydrogen()->CanOmitMapChecks()) return;
5185 LOperand* input = instr->value();
5189 SmallMapList* map_set = instr->hydrogen()->map_set();
5193 if (instr->hydrogen()->has_migration_target()) {
5194 deferred = new(zone()) DeferredCheckMaps(this, instr, reg);
5207 if (instr->hydrogen()->has_migration_target()) {
5210 DeoptimizeIf(ne, instr->environment());
5217 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5218 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped());
5219 Register result_reg = ToRegister(instr->result());
5224 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
5225 Register unclamped_reg = ToRegister(instr->unclamped());
5226 Register result_reg = ToRegister(instr->result());
5231 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
5233 Register input_reg = ToRegister(instr->unclamped());
5234 Register result_reg = ToRegister(instr->result());
5235 DwVfpRegister temp_reg = ToDoubleRegister(instr->temp());
5249 DeoptimizeIf(ne, instr->environment());
5267 void LCodeGen::DoAllocate(LAllocate* instr) {
5270 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5271 : LDeferredCode(codegen), instr_(instr) { }
5273 virtual LInstruction* instr() { return instr_; }
5279 new(zone()) DeferredAllocate(this, instr);
5281 Register result = ToRegister(instr->result());
5282 Register scratch = ToRegister(instr->temp1());
5283 Register scratch2 = ToRegister(instr->temp2());
5287 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5290 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5291 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5292 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5294 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5295 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5299 if (instr->size()->IsConstantOperand()) {
5300 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5303 Register size = ToRegister(instr->size());
5314 if (instr->hydrogen()->MustPrefillWithFiller()) {
5315 if (instr->size()->IsConstantOperand()) {
5316 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5319 scratch = ToRegister(instr->size());
5335 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5336 Register result = ToRegister(instr->result());
5344 if (instr->size()->IsRegister()) {
5345 Register size = ToRegister(instr->size());
5350 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5354 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5355 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5356 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5357 CallRuntimeFromDeferred(Runtime::kAllocateInOldPointerSpace, 1, instr);
5358 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5359 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5360 CallRuntimeFromDeferred(Runtime::kAllocateInOldDataSpace, 1, instr);
5362 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr);
5368 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5369 ASSERT(ToRegister(instr->value()).is(r0));
5371 CallRuntime(Runtime::kToFastProperties, 1, instr);
5375 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5383 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
5384 __ LoadHeapObject(r7, instr->hydrogen()->literals());
5392 __ mov(r6, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5393 __ mov(r5, Operand(instr->hydrogen()->pattern()));
5394 __ mov(r4, Operand(instr->hydrogen()->flags()));
5396 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5409 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5418 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
5421 bool pretenure = instr->hydrogen()->pretenure();
5422 if (!pretenure && instr->hydrogen()->has_no_literals()) {
5423 FastNewClosureStub stub(instr->hydrogen()->language_mode(),
5424 instr->hydrogen()->is_generator());
5425 __ mov(r1, Operand(instr->hydrogen()->shared_info()));
5427 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5429 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5433 CallRuntime(Runtime::kNewClosure, 3, instr);
5438 void LCodeGen::DoTypeof(LTypeof* instr) {
5439 Register input = ToRegister(instr->value());
5441 CallRuntime(Runtime::kTypeof, 1, instr);
5445 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5446 Register input = ToRegister(instr->value());
5448 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
5449 instr->FalseLabel(chunk_),
5451 instr->type_literal());
5453 EmitBranch(instr, final_branch_condition);
5536 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
5537 Register temp1 = ToRegister(instr->temp());
5540 EmitBranch(instr, eq);
5582 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
5585 ASSERT(instr->HasEnvironment());
5586 LEnvironment* env = instr->environment();
5592 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
5593 Deoptimizer::BailoutType type = instr->hydrogen()->type();
5602 Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
5603 DeoptimizeIf(al, instr->environment(), type);
5607 void LCodeGen::DoDummyUse(LDummyUse* instr) {
5612 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
5616 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
5617 ASSERT(instr->HasEnvironment());
5618 LEnvironment* env = instr->environment();
5623 void LCodeGen::DoStackCheck(LStackCheck* instr) {
5626 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
5627 : LDeferredCode(codegen), instr_(instr) { }
5629 virtual LInstruction* instr() { return instr_; }
5634 ASSERT(instr->HasEnvironment());
5635 LEnvironment* env = instr->environment();
5638 if (instr->hydrogen()->is_function_entry()) {
5646 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5653 ASSERT(instr->hydrogen()->is_backwards_branch());
5656 new(zone()) DeferredStackCheck(this, instr);
5662 __ bind(instr->done_label());
5663 deferred_stack_check->SetExit(instr->done_label());
5672 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
5676 LEnvironment* environment = instr->environment();
5689 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
5692 DeoptimizeIf(eq, instr->environment());
5697 DeoptimizeIf(eq, instr->environment());
5700 DeoptimizeIf(eq, instr->environment());
5704 instr->environment());
5715 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
5720 DeoptimizeIf(ne, instr->environment());
5725 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
5726 Register map = ToRegister(instr->map());
5727 Register result = ToRegister(instr->result());
5740 FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
5742 DeoptimizeIf(eq, instr->environment());
5748 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
5749 Register object = ToRegister(instr->value());
5750 Register map = ToRegister(instr->map());
5753 DeoptimizeIf(ne, instr->environment());
5757 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
5758 Register object = ToRegister(instr->object());
5759 Register index = ToRegister(instr->index());
5760 Register result = ToRegister(instr->result());