Home | History | Annotate | Download | only in arm

Lines Matching refs:instr

273               code->instr()->hydrogen_value()->id(),
274 code->instr()->Mnemonic());
701 LInstruction* instr,
703 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode);
709 LInstruction* instr,
713 ASSERT(instr != NULL);
718 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
731 LInstruction* instr,
733 ASSERT(instr != NULL);
737 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
758 LInstruction* instr,
763 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
951 LInstruction* instr, SafepointMode safepoint_mode) {
953 RecordSafepoint(instr
957 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
1054 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
1055 DoGap(instr);
1059 void LCodeGen::DoParameter(LParameter* instr) {
1064 void LCodeGen::DoCallStub(LCallStub* instr) {
1065 ASSERT(ToRegister(instr->context()).is(cp));
1066 ASSERT(ToRegister(instr->result()).is(r0));
1067 switch (instr->hydrogen()->major_key()) {
1070 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1075 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1080 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1085 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1090 TranscendentalCacheStub stub(instr->transcendental_type(),
1092 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1101 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());
1138 Register left_reg = ToRegister(instr->left());
1139 Register right_reg = ToRegister(instr->right());
1140 Register result_reg = ToRegister(instr->result());
1147 DeoptimizeIf(eq, instr->environment());
1158 DeoptimizeIf(eq, instr->environment());
1181 DeoptimizeIf(lt, instr->environment());
1187 Register left_reg = ToRegister(instr->left());
1188 Register right_reg = ToRegister(instr->right());
1189 Register result_reg = ToRegister(instr->result());
1194 DwVfpRegister dividend = ToDoubleRegister(instr->temp());
1195 DwVfpRegister divisor = ToDoubleRegister(instr->temp2());
1206 DeoptimizeIf(eq, instr->environment());
1238 DeoptimizeIf(mi, instr->environment());
1339 void LCodeGen::DoDivI(LDivI* instr) {
1340 if (instr->hydrogen()->HasPowerOf2Divisor()) {
1341 const Register dividend = ToRegister(instr->left());
1342 const Register result = ToRegister(instr->result());
1343 int32_t divisor = instr->hydrogen()->right()->GetInteger32Constant();
1352 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1354 DeoptimizeIf(eq, instr->environment());
1357 if (divisor == -1 && instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1359 DeoptimizeIf(eq, instr->environment());
1366 if (instr->hydrogen()->CheckFlag(
1377 DeoptimizeIf(ne, instr->environment());
1392 const Register left = ToRegister(instr->left());
1393 const Register right = ToRegister(instr->right());
1394 const Register result = ToRegister(instr->result());
1397 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
1399 DeoptimizeIf(eq, instr->environment());
1403 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1405 if (!instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
1411 DeoptimizeIf(eq, instr->environment());
1416 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1421 DeoptimizeIf(eq, instr->environment());
1429 if (!instr->hydrogen()->CheckFlag(
1435 DeoptimizeIf(ne, instr->environment());
1438 const DoubleRegister vleft = ToDoubleRegister(instr->temp());
1448 if (!instr->hydrogen()->CheckFlag(
1454 DeoptimizeIf(ne, instr->environment());
1460 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) {
1461 DwVfpRegister addend = ToDoubleRegister(instr->addend());
1462 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1463 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1466 ASSERT(addend.is(ToDoubleRegister(instr->result())));
1472 void LCodeGen::DoMultiplySubD(LMultiplySubD* instr) {
1473 DwVfpRegister minuend = ToDoubleRegister(instr->minuend());
1474 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier());
1475 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand());
1478 ASSERT(minuend.is(ToDoubleRegister(instr->result())));
1484 void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
1485 const Register result = ToRegister(instr->result());
1486 const Register left = ToRegister(instr->left());
1487 const Register remainder = ToRegister(instr->temp());
1494 ASSERT(instr->right()->IsConstantOperand());
1495 int32_t divisor = ToInteger32(LConstantOperand::cast(instr->right()));
1499 DeoptimizeIf(eq, instr->environment());
1506 instr->environment());
1513 const Register right = ToRegister(instr->right());
1517 DeoptimizeIf(eq, instr->environment());
1520 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1525 DeoptimizeIf(eq, instr->environment());
1530 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1536 DeoptimizeIf(eq, instr->environment());
1555 void LCodeGen::DoMulI(LMulI* instr) {
1556 Register result = ToRegister(instr->result());
1558 Register left = ToRegister(instr->left());
1559 LOperand* right_op = instr->right();
1562 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
1563 bool overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1572 DeoptimizeIf(eq, instr->environment());
1579 DeoptimizeIf(vs, instr->environment());
1589 DeoptimizeIf(mi, instr->environment());
1632 if (instr->hydrogen()->representation().IsSmi()) {
1639 DeoptimizeIf(ne, instr->environment());
1641 if (instr->hydrogen()->representation().IsSmi()) {
1655 DeoptimizeIf(eq, instr->environment());
1662 void LCodeGen::DoBitI(LBitI* instr) {
1663 LOperand* left_op = instr->left();
1664 LOperand* right_op = instr->right();
1667 Register result = ToRegister(instr->result());
1677 switch (instr->op()) {
1698 void LCodeGen::DoShiftI(LShiftI* instr) {
1701 LOperand* right_op = instr->right();
1702 Register left = ToRegister(instr->left());
1703 Register result = ToRegister(instr->result());
1708 switch (instr->op()) {
1716 if (instr->can_deopt()) {
1718 DeoptimizeIf(mi, instr->environment());
1734 switch (instr->op()) {
1753 if (instr->can_deopt()) {
1755 DeoptimizeIf(ne, instr->environment());
1762 if (instr->hydrogen_value()->representation().IsSmi() &&
1763 instr->can_deopt()) {
1770 DeoptimizeIf(vs, instr->environment());
1786 void LCodeGen::DoSubI(LSubI* instr) {
1787 LOperand* left = instr->left();
1788 LOperand* right = instr->right();
1789 LOperand* result = instr->result();
1790 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1802 DeoptimizeIf(vs, instr->environment());
1807 void LCodeGen::DoRSubI(LRSubI* instr) {
1808 LOperand* left = instr->left();
1809 LOperand* right = instr->right();
1810 LOperand* result = instr->result();
1811 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1823 DeoptimizeIf(vs, instr->environment());
1828 void LCodeGen::DoConstantI(LConstantI* instr) {
1829 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1833 void LCodeGen::DoConstantS(LConstantS* instr) {
1834 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1838 void LCodeGen::DoConstantD(LConstantD* instr) {
1839 ASSERT(instr->result()->IsDoubleRegister());
1840 DwVfpRegister result = ToDoubleRegister(instr->result());
1841 double v = instr->value();
1846 void LCodeGen::DoConstantE(LConstantE* instr) {
1847 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1851 void LCodeGen::DoConstantT(LConstantT* instr) {
1852 Handle<Object> value = instr->value(isolate());
1854 __ Move(ToRegister(instr->result()), value);
1858 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1859 Register result = ToRegister(instr->result());
1860 Register map = ToRegister(instr->value());
1865 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1866 Register result = ToRegister(instr->result());
1867 Register input = ToRegister(instr->value());
1879 void LCodeGen::DoValueOf(LValueOf* instr) {
1880 Register input = ToRegister(instr->value());
1881 Register result = ToRegister(instr->result());
1882 Register map = ToRegister(instr->temp());
1885 if (!instr->hydrogen()->value()->IsHeapObject()) {
1902 void LCodeGen::DoDateField(LDateField* instr) {
1903 Register object = ToRegister(instr->date());
1904 Register result = ToRegister(instr->result());
1905 Register scratch = ToRegister(instr->temp());
1906 Smi* index = instr->index();
1914 DeoptimizeIf(eq, instr->environment());
1916 DeoptimizeIf(ne, instr->environment());
1965 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
1966 String::Encoding encoding = instr->hydrogen()->encoding();
1967 Register string = ToRegister(instr->string());
1968 Register result = ToRegister(instr->result());
1984 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
1993 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
1994 String::Encoding encoding = instr->hydrogen()->encoding();
1995 Register string = ToRegister(instr->string());
1996 Register value = ToRegister(instr->value());
1999 Register index = ToRegister(instr->index());
2003 instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING
2008 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
2017 void LCodeGen::DoThrow(LThrow* instr) {
2018 __ push(ToRegister(instr->value()));
2019 ASSERT(ToRegister(instr->context()).is(cp));
2020 CallRuntime(Runtime::kThrow, 1, instr);
2028 void LCodeGen::DoAddI(LAddI* instr) {
2029 LOperand* left = instr->left();
2030 LOperand* right = instr->right();
2031 LOperand* result = instr->result();
2032 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
2044 DeoptimizeIf(vs, instr->environment());
2049 void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
2050 LOperand* left = instr->left();
2051 LOperand* right = instr->right();
2052 HMathMinMax::Operation operation = instr->hydrogen()->operation();
2053 if (instr->hydrogen()->representation().IsSmiOrInteger32()) {
2059 Register result_reg = ToRegister(instr->result());
2064 ASSERT(instr->hydrogen()->representation().IsDouble());
2067 DwVfpRegister result_reg = ToDoubleRegister(instr->result());
2116 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
2117 DwVfpRegister left = ToDoubleRegister(instr->left());
2118 DwVfpRegister right = ToDoubleRegister(instr->right());
2119 DwVfpRegister result = ToDoubleRegister(instr->result());
2120 switch (instr->op()) {
2150 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
2151 ASSERT(ToRegister(instr->context()).is(cp));
2152 ASSERT(ToRegister(instr->left()).is(r1));
2153 ASSERT(ToRegister(instr->right()).is(r0));
2154 ASSERT(ToRegister(instr->result()).is(r0));
2156 BinaryOpICStub stub(instr->op(), NO_OVERWRITE);
2160 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2166 void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
2167 int left_block = instr->TrueDestination(chunk_);
2168 int right_block = instr->FalseDestination(chunk_);
2186 void LCodeGen::EmitFalseBranch(InstrType instr, Condition condition) {
2187 int false_block = instr->FalseDestination(chunk_);
2192 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2197 void LCodeGen::DoBranch(LBranch* instr) {
2198 Representation r = instr->hydrogen()->value()->representation();
2201 Register reg = ToRegister(instr->value());
2203 EmitBranch(instr, ne);
2206 DwVfpRegister reg = ToDoubleRegister(instr->value());
2210 EmitBranch(instr, ne);
2213 Register reg = ToRegister(instr->value());
2214 HType type = instr->hydrogen()->value()->type();
2218 EmitBranch(instr, eq);
2222 EmitBranch(instr, ne);
2225 EmitBranch(instr, al);
2233 EmitBranch(instr, ne);
2238 EmitBranch(instr, ne);
2240 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2247 __ b(eq, instr->FalseLabel(chunk_));
2252 __ b(eq, instr->TrueLabel(chunk_));
2254 __ b(eq, instr->FalseLabel(chunk_));
2259 __ b(eq, instr->FalseLabel(chunk_));
2265 __ b(eq, instr->FalseLabel(chunk_));
2266 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2270 DeoptimizeIf(eq, instr->environment());
2281 __ b(ne, instr->FalseLabel(chunk_));
2288 __ b(ge, instr->TrueLabel(chunk_));
2298 __ b(ne, instr->TrueLabel(chunk_));
2299 __ b(instr->FalseLabel(chunk_));
2306 __ b(eq, instr->TrueLabel(chunk_));
2318 __ b(eq, instr->FalseLabel(chunk_)); // +0, -0 -> false.
2319 __ b(instr->TrueLabel(chunk_));
2326 DeoptimizeIf(al, instr->environment());
2340 void LCodeGen::DoGoto(LGoto* instr) {
2341 EmitGoto(instr->block_id());
2377 void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
2378 LOperand* left = instr->left();
2379 LOperand* right = instr->right();
2380 Condition cond = TokenToCondition(instr->op(), false);
2386 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2387 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
2390 if (instr->is_double()) {
2396 __ b(vs, instr->FalseLabel(chunk_));
2400 if (instr->hydrogen_value()->representation().IsSmi()) {
2407 if (instr->hydrogen_value()->representation().IsSmi()) {
2418 EmitBranch(instr, cond);
2423 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
2424 Register left = ToRegister(instr->left());
2425 Register right = ToRegister(instr->right());
2428 EmitBranch(instr, eq);
2432 void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
2433 if (instr->hydrogen()->representation().IsTagged()) {
2434 Register input_reg = ToRegister(instr->object());
2437 EmitBranch(instr, eq);
2441 DwVfpRegister input_reg = ToDoubleRegister(instr->object());
2443 EmitFalseBranch(instr, vc);
2448 EmitBranch(instr, eq);
2452 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
2453 Representation rep = instr->hydrogen()->value()->representation();
2455 Register scratch = ToRegister(instr->temp());
2458 DwVfpRegister value = ToDoubleRegister(instr->value());
2460 EmitFalseBranch(instr, ne);
2464 Register value = ToRegister(instr->value());
2468 instr->FalseLabel(chunk()),
2475 EmitBranch(instr, eq);
2506 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
2507 Register reg = ToRegister(instr->value());
2508 Register temp1 = ToRegister(instr->temp());
2512 instr->FalseLabel(chunk_), instr->TrueLabel(chunk_));
2514 EmitBranch(instr, true_cond);
2531 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
2532 Register reg = ToRegister(instr->value());
2533 Register temp1 = ToRegister(instr->temp());
2536 instr->hydrogen()->value()->IsHeapObject()
2539 EmitIsString(reg, temp1, instr->FalseLabel(chunk_), check_needed);
2541 EmitBranch(instr, true_cond);
2545 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
2546 Register input_reg = EmitLoadRegister(instr->value(), ip);
2548 EmitBranch(instr, eq);
2552 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
2553 Register input = ToRegister(instr->value());
2554 Register temp = ToRegister(instr->temp());
2556 if (!instr->hydrogen()->value()->IsHeapObject()) {
2557 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2562 EmitBranch(instr, ne);
2586 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2587 ASSERT(ToRegister(instr->context()).is(cp));
2588 Token::Value op = instr->op();
2591 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2597 EmitBranch(instr, condition);
2601 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
2602 InstanceType from = instr->from();
2603 InstanceType to = instr->to();
2610 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
2611 InstanceType from = instr->from();
2612 InstanceType to = instr->to();
2621 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
2623 Register input = ToRegister(instr->value());
2625 if (!instr->hydrogen()->value()->IsHeapObject()) {
2626 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2629 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
2630 EmitBranch(instr, BranchCondition(instr->hydrogen()));
2634 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
2635 Register input = ToRegister(instr->value());
2636 Register result = ToRegister(instr->result());
2646 LHasCachedArrayIndexAndBranch* instr) {
2647 Register input = ToRegister(instr->value());
2653 EmitBranch(instr, eq);
2724 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
2725 Register input = ToRegister(instr->value());
2727 Register temp2 = ToRegister(instr->temp());
2728 Handle<String> class_name = instr->hydrogen()->class_name();
2730 EmitClassOfTest(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_),
2733 EmitBranch(instr, eq);
2737 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
2738 Register reg = ToRegister(instr->value());
2739 Register temp = ToRegister(instr->temp());
2742 __ cmp(temp, Operand(instr->map()));
2743 EmitBranch(instr, eq);
2747 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
2748 ASSERT(ToRegister(instr->context()).is(cp));
2749 ASSERT(ToRegister(instr->left()).is(r0)); // Object is in r0.
2750 ASSERT(ToRegister(instr->right()).is(r1)); // Function is in r1.
2753 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2761 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
2765 LInstanceOfKnownGlobal* instr)
2766 : LDeferredCode(codegen), instr_(instr) { }
2770 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
2778 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
2781 Register object = ToRegister(instr->value());
2782 Register temp = ToRegister(instr->temp());
2783 Register result = ToRegister(instr->result());
2843 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2845 Register result = ToRegister(instr->result());
2858 LoadContextFromDeferred(instr->context());
2863 Register temp = ToRegister(instr->temp());
2865 __ Move(InstanceofStub::right(), instr->function());
2884 instr,
2886 LEnvironment* env = instr
2894 void LCodeGen::DoCmpT(LCmpT* instr) {
2895 ASSERT(ToRegister(instr->context()).is(cp));
2896 Token::Value op = instr->op();
2899 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2904 __ LoadRoot(ToRegister(instr->result()),
2907 __ LoadRoot(ToRegister(instr->result()),
2913 void LCodeGen::DoReturn(LReturn* instr) {
2932 if (instr->has_constant_parameter_count()) {
2933 int parameter_count = ToInteger32(instr->constant_parameter_count());
2939 Register reg = ToRegister(instr->parameter_count());
2953 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2954 Register result = ToRegister(instr->result());
2955 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
2957 if (instr->hydrogen()->RequiresHoleCheck()) {
2960 DeoptimizeIf(eq, instr->environment());
2965 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2966 ASSERT(ToRegister(instr->context()).is(cp));
2967 ASSERT(ToRegister(instr->global_object()).is(r0));
2968 ASSERT(ToRegister(instr->result()).is(r0));
2970 __ mov(r2, Operand(instr->name()));
2971 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET
2974 CallCode(ic, mode, instr);
2978 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2979 Register value = ToRegister(instr->value());
2983 __ mov(cell, Operand(instr->hydrogen()->cell().handle()));
2989 if (instr->hydrogen()->RequiresHoleCheck()) {
2991 Register payload = ToRegister(instr->temp());
2994 DeoptimizeIf(eq, instr->environment());
3003 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
3004 ASSERT(ToRegister(instr->context()).is(cp));
3005 ASSERT(ToRegister(instr->global_object()).is(r1));
3006 ASSERT(ToRegister(instr->value()).is(r0));
3008 __ mov(r2, Operand(instr->name()));
3009 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3012 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
3016 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
3017 Register context = ToRegister(instr->context());
3018 Register result = ToRegister(instr->result());
3019 __ ldr(result, ContextOperand(context, instr->slot_index()));
3020 if (instr->hydrogen()->RequiresHoleCheck()) {
3023 if (instr->hydrogen()->DeoptimizesOnHole()) {
3024 DeoptimizeIf(eq, instr->environment());
3032 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
3033 Register context = ToRegister(instr->context());
3034 Register value = ToRegister(instr->value());
3036 MemOperand target = ContextOperand(context, instr->slot_index());
3040 if (instr->hydrogen()->RequiresHoleCheck()) {
3044 if (instr->hydrogen()->DeoptimizesOnHole()) {
3045 DeoptimizeIf(eq, instr->environment());
3052 if (instr->hydrogen()->NeedsWriteBarrier()) {
3054 instr->hydrogen()->value()->IsHeapObject()
3070 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3071 HObjectAccess access = instr->hydrogen()->access();
3073 Register object = ToRegister(instr->object());
3076 Register result = ToRegister(instr->result());
3082 if (instr->hydrogen()->representation().IsDouble()) {
3083 DwVfpRegister result = ToDoubleRegister(instr->result());
3088 Register result = ToRegister(instr->result());
3098 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3099 ASSERT(ToRegister(instr->context()).is(cp));
3100 ASSERT(ToRegister(instr->object()).is(r0));
3101 ASSERT(ToRegister(instr->result()).is(r0));
3104 __ mov(r2, Operand(instr->name()));
3106 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3110 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
3112 Register function = ToRegister(instr->function());
3113 Register result = ToRegister(instr->result());
3118 DeoptimizeIf(ne, instr->environment());
3133 DeoptimizeIf(eq, instr->environment());
3154 void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
3155 Register result = ToRegister(instr->result());
3156 __ LoadRoot(result, instr->index());
3161 LLoadExternalArrayPointer* instr) {
3162 Register to_reg = ToRegister(instr->result());
3163 Register from_reg = ToRegister(instr->object());
3169 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
3170 Register arguments = ToRegister(instr->arguments());
3171 Register result = ToRegister(instr->result());
3174 if (instr->length()->IsConstantOperand()) {
3175 int const_length = ToInteger32(LConstantOperand::cast(instr->length()));
3176 if (instr->index()->IsConstantOperand()) {
3177 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3181 Register index = ToRegister(instr->index());
3185 } else if (instr->index()->IsConstantOperand()) {
3186 Register length = ToRegister(instr->length());
3187 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3196 Register length = ToRegister(instr->length());
3197 Register index = ToRegister(instr->index());
3205 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3206 Register external_pointer = ToRegister(instr->elements());
3208 ElementsKind elements_kind = instr->elements_kind();
3209 bool key_is_constant = instr->key()->IsConstantOperand();
3212 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3217 key = ToRegister(instr->key());
3220 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3222 int additional_offset = instr->additional_index() << element_size_shift;
3226 DwVfpRegister result = ToDoubleRegister(instr->result());
3238 Register result = ToRegister(instr->result());
3242 instr->additional_index(), additional_offset);
3262 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3264 DeoptimizeIf(cs, instr->environment());
3284 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
3285 Register elements = ToRegister(instr->elements());
3286 bool key_is_constant = instr->key()->IsConstantOperand();
3288 DwVfpRegister result = ToDoubleRegister(instr->result());
3295 (instr->additional_index() << element_size_shift);
3297 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3306 key = ToRegister(instr->key());
3307 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3314 if (instr->hydrogen()->RequiresHoleCheck()) {
3317 DeoptimizeIf(eq, instr->environment());
3322 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
3323 Register elements = ToRegister(instr->elements());
3324 Register result = ToRegister(instr->result());
3329 if (instr->key()->IsConstantOperand()) {
3330 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3332 instr->additional_index());
3335 Register key = ToRegister(instr->key());
3340 if (instr->hydrogen()->key()->representation().IsSmi()) {
3345 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3350 if (instr->hydrogen()->RequiresHoleCheck()) {
3351 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3353 DeoptimizeIf(ne, instr->environment());
3357 DeoptimizeIf(eq, instr->environment());
3363 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3364 if (instr->is_external()) {
3365 DoLoadKeyedExternalArray(instr);
3366 } else if (instr->hydrogen()->representation().IsDouble()) {
3367 DoLoadKeyedFixedDoubleArray(instr);
3369 DoLoadKeyedFixedArray(instr);
3410 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
3411 ASSERT(ToRegister(instr->context()).is(cp));
3412 ASSERT(ToRegister(instr->object()).is(r1));
3413 ASSERT(ToRegister(instr->key()).is(r0));
3416 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
3420 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3422 Register result = ToRegister(instr->result());
3424 if (instr->hydrogen()->from_inlined()) {
3441 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
3442 Register elem = ToRegister(instr->elements());
3443 Register result = ToRegister(instr->result());
3463 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
3464 Register receiver = ToRegister(instr->receiver());
3465 Register function = ToRegister(instr->function());
3466 Register result = ToRegister(instr->result());
3498 DeoptimizeIf(eq, instr->environment());
3500 DeoptimizeIf(lt, instr->environment());
3521 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
3522 Register receiver = ToRegister(instr->receiver());
3523 Register function = ToRegister(instr->function());
3524 Register length = ToRegister(instr->length());
3525 Register elements = ToRegister(instr->elements());
3529 ASSERT(ToRegister(instr->result()).is(r0));
3535 DeoptimizeIf(hi, instr->environment());
3557 ASSERT(instr->HasPointerMap());
3558 LPointerMap* pointers = instr->pointer_map();
3569 void LCodeGen::DoPushArgument(LPushArgument* instr) {
3570 LOperand* argument = instr->value();
3580 void LCodeGen::DoDrop(LDrop* instr) {
3581 __ Drop(instr->count());
3585 void LCodeGen::DoThisFunction(LThisFunction* instr) {
3586 Register result = ToRegister(instr->result());
3591 void LCodeGen::DoContext(LContext* instr) {
3593 Register result = ToRegister(instr->result());
3603 void LCodeGen::DoOuterContext(LOuterContext* instr) {
3604 Register context = ToRegister(instr->context());
3605 Register result = ToRegister(instr->result());
3611 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3612 ASSERT(ToRegister(instr->context()).is(cp));
3614 __ Move(scratch0(), instr->hydrogen()->pairs());
3616 __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3618 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3622 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
3623 Register context = ToRegister(instr->context());
3624 Register result = ToRegister(instr->result());
3629 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
3630 Register global = ToRegister(instr->global_object());
3631 Register result = ToRegister(instr->result());
3639 LInstruction* instr,
3647 LPointerMap* pointers = instr->pointer_map();
3669 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3680 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
3681 ASSERT(ToRegister(instr->result()).is(r0));
3682 CallKnownFunction(instr->hydrogen()->function(),
3683 instr->hydrogen()->formal_parameter_count(),
3684 instr->arity(),
3685 instr,
3691 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3692 ASSERT(instr->context() != NULL);
3693 ASSERT(ToRegister(instr->context()).is(cp));
3694 Register input = ToRegister(instr->value());
3695 Register result = ToRegister(instr->result());
3702 DeoptimizeIf(ne, instr->environment());
3737 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr,
3738 instr->context());
3760 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) {
3761 Register input = ToRegister(instr->value());
3762 Register result = ToRegister(instr->result());
3770 DeoptimizeIf(vs, instr->environment());
3774 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3778 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr)
3779 : LDeferredCode(codegen), instr_(instr) { }
3783 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
3788 Representation r = instr->hydrogen()->value()->representation();
3790 DwVfpRegister input = ToDoubleRegister(instr->value());
3791 DwVfpRegister result = ToDoubleRegister(instr->result());
3794 EmitIntegerMathAbs(instr);
3798 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3799 Register input = ToRegister(instr->value());
3803 EmitIntegerMathAbs(instr);
3809 void LCodeGen::DoMathFloor(LMathFloor* instr) {
3810 DwVfpRegister input = ToDoubleRegister(instr->value());
3811 Register result = ToRegister(instr->result());
3816 DeoptimizeIf(al, instr->environment());
3819 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3824 DeoptimizeIf(mi, instr->environment());
3830 instr) {
3831 DwVfpRegister input = ToDoubleRegister(instr->value());
3832 Register result = ToRegister(instr->result());
3833 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->temp());
3846 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3849 DeoptimizeIf(mi, instr->environment()); // [-0.5, -0].
3863 DeoptimizeIf(al, instr->environment());
3868 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
3869 DwVfpRegister input = ToDoubleRegister(instr->value());
3870 DwVfpRegister result = ToDoubleRegister(instr->result());
3875 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
3876 DwVfpRegister input = ToDoubleRegister(instr->value());
3877 DwVfpRegister result = ToDoubleRegister(instr->result());
3896 void LCodeGen::DoPower(LPower* instr) {
3897 Representation exponent_type = instr->hydrogen()->right()->representation();
3900 ASSERT(!instr->right()->IsDoubleRegister() ||
3901 ToDoubleRegister(instr->right()).is(d1));
3902 ASSERT(!instr->right()->IsRegister() ||
3903 ToRegister(instr->right()).is(r2));
3904 ASSERT(ToDoubleRegister(instr->left()).is(d0));
3905 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3916 DeoptimizeIf(ne, instr->environment());
3931 void LCodeGen::DoMathExp(LMathExp* instr) {
3932 DwVfpRegister input = ToDoubleRegister(instr->value());
3933 DwVfpRegister result = ToDoubleRegister(instr->result());
3934 DwVfpRegister double_scratch1 = ToDoubleRegister(instr->double_temp());
3936 Register temp1 = ToRegister(instr->temp1());
3937 Register temp2 = ToRegister(instr->temp2());
3945 void LCodeGen::DoMathLog(LMathLog* instr) {
3946 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3952 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3956 void LCodeGen::DoMathTan(LMathTan* instr) {
3957 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3963 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3967 void LCodeGen::DoMathCos(LMathCos* instr) {
3968 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3974 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3978 void LCodeGen::DoMathSin(LMathSin* instr) {
3979 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3985 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3989 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3990 ASSERT(ToRegister(instr->context()).is(cp));
3991 ASSERT(ToRegister(instr->function()).is(r1));
3992 ASSERT(instr->HasPointerMap());
3994 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3996 LPointerMap* pointers = instr->pointer_map();
3998 ParameterCount count(instr->arity());
4002 instr->hydrogen()->formal_parameter_count(),
4003 instr->arity(),
4004 instr,
4011 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
4012 ASSERT(ToRegister(instr->context()).is(cp));
4013 ASSERT(ToRegister(instr->result()).is(r0));
4015 int arity = instr->arity();
4018 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4022 void LCodeGen::DoCallNamed(LCallNamed* instr) {
4023 ASSERT(ToRegister(instr->context()).is(cp));
4024 ASSERT(ToRegister(instr->result()).is(r0));
4026 int arity = instr->arity();
4030 __ mov(r2, Operand(instr->name()));
4031 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS);
4035 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4036 ASSERT(ToRegister(instr->context()).is(cp));
4037 ASSERT(ToRegister(instr->function()).is(r1));
4038 ASSERT(ToRegister(instr->result()).is(r0));
4040 int arity = instr->arity();
4042 if (instr->hydrogen()->IsTailCall()) {
4046 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4051 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
4052 ASSERT(ToRegister(instr->context()).is(cp));
4053 ASSERT(ToRegister(instr->result()).is(r0));
4055 int arity = instr->arity();
4059 __ mov(r2, Operand(instr->name()));
4060 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS);
4064 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
4065 ASSERT(ToRegister(instr->result()).is(r0));
4066 CallKnownFunction(instr->hydrogen()->target(),
4067 instr->hydrogen()->formal_parameter_count(),
4068 instr->arity(),
4069 instr,
4075 void LCodeGen::DoCallNew(LCallNew* instr) {
4076 ASSERT(ToRegister(instr->context()).is(cp));
4077 ASSERT(ToRegister(instr->constructor()).is(r1));
4078 ASSERT(ToRegister(instr->result()).is(r0));
4080 __ mov(r0, Operand(instr->arity()));
4085 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4089 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
4090 ASSERT(ToRegister(instr->context()).is(cp));
4091 ASSERT(ToRegister(instr->constructor()).is(r1));
4092 ASSERT(ToRegister(instr->result()).is(r0));
4094 __ mov(r0, Operand(instr->arity()));
4095 __ mov(r2, Operand(instr->hydrogen()->property_cell()));
4096 ElementsKind kind = instr->hydrogen()->elements_kind();
4103 if (instr->arity() == 0) {
4105 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4106 } else if (instr->arity() == 1) {
4119 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4125 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4129 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
4134 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
4135 CallRuntime(instr->function(), instr->arity(), instr);
4139 void LCodeGen::DoStoreCodeEntry(LStoreCodeEntry* instr) {
4140 Register function = ToRegister(instr->function());
4141 Register code_object = ToRegister(instr->code_object());
4148 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4149 Register result = ToRegister(instr->result());
4150 Register base = ToRegister(instr->base_object());
4151 if (instr->offset()->IsConstantOperand()) {
4152 LConstantOperand* offset = LConstantOperand::cast(instr->offset());
4155 Register offset = ToRegister(instr->offset());
4161 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4162 Representation representation = instr->representation();
4164 Register object = ToRegister(instr->object());
4166 HObjectAccess access = instr->hydrogen()->access();
4170 Register value = ToRegister(instr->value());
4176 Handle<Map> transition = instr->transition();
4179 Register value = ToRegister(instr->value());
4180 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4182 DeoptimizeIf(eq, instr->environment());
4187 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4188 DwVfpRegister value = ToDoubleRegister(instr->value());
4196 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
4197 Register temp = ToRegister(instr->temp());
4211 Register value = ToRegister(instr->value());
4214 instr->hydrogen()->value()->IsHeapObject()
4219 if (instr->hydrogen()->NeedsWriteBarrier()) {
4234 if (instr->hydrogen()->NeedsWriteBarrier()) {
4250 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4251 ASSERT(ToRegister(instr->context()).is(cp));
4252 ASSERT(ToRegister(instr->object()).is(r1));
4253 ASSERT(ToRegister(instr->value()).is(r0));
4256 __ mov(r2, Operand(instr->name()));
4257 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
4260 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4276 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4277 if (instr->hydrogen()->skip_check()) return;
4279 if (instr->index()->IsConstantOperand()) {
4281 ToInteger32(LConstantOperand::cast(instr->index()));
4282 if (instr->hydrogen()->length()->representation().IsSmi()) {
4287 __ cmp(ip, ToRegister(instr
4289 __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
4291 Condition condition = instr->hydrogen()->allow_equality() ? hi : hs;
4292 ApplyCheckIf(condition, instr);
4296 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4297 Register external_pointer = ToRegister(instr->elements());
4299 ElementsKind elements_kind = instr->elements_kind();
4300 bool key_is_constant = instr->key()->IsConstantOperand();
4303 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4308 key = ToRegister(instr->key());
4311 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4313 int additional_offset = instr->additional_index() << element_size_shift;
4318 DwVfpRegister value(ToDoubleRegister(instr->value()));
4336 Register value(ToRegister(instr->value()));
4340 instr->additional_index(), additional_offset);
4372 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4373 DwVfpRegister value = ToDoubleRegister(instr->value());
4374 Register elements = ToRegister(instr->elements());
4377 bool key_is_constant = instr->key()->IsConstantOperand();
4383 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4391 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4396 Operand(ToRegister(instr->key()), LSL, shift_size));
4399 if (instr->NeedsCanonicalization()) {
4408 instr->additional_index() << element_size_shift);
4410 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4415 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4416 Register value = ToRegister(instr->value());
4417 Register elements = ToRegister(instr->elements());
4418 Register key = instr->key()->IsRegister() ? ToRegister(instr->key())
4425 if (instr->key()->IsConstantOperand()) {
4426 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4427 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
4429 instr->additional_index());
4436 if (instr->hydrogen()->key()->representation().IsSmi()) {
4441 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
4445 if (instr->hydrogen()->NeedsWriteBarrier()) {
4447 instr->hydrogen()->value()->IsHeapObject()
4462 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4464 if (instr->is_external()) {
4465 DoStoreKeyedExternalArray(instr);
4466 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4467 DoStoreKeyedFixedDoubleArray(instr);
4469 DoStoreKeyedFixedArray(instr);
4474 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
4475 ASSERT(ToRegister(instr->context()).is(cp));
4476 ASSERT(ToRegister(instr->object()).is(r2));
4477 ASSERT(ToRegister(instr->key()).is(r1));
4478 ASSERT(ToRegister(instr->value()).is(r0));
4480 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
4483 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4487 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
4488 Register object_reg = ToRegister(instr->object());
4491 Handle<Map> from_map = instr->original_map();
4492 Handle<Map> to_map = instr->transitioned_map();
4493 ElementsKind from_kind = instr->from_kind();
4494 ElementsKind to_kind = instr->to_kind();
4502 Register new_map_reg = ToRegister(instr->new_map_temp());
4509 ASSERT(ToRegister(instr->context()).is(cp));
4517 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4523 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
4524 Register object = ToRegister(instr->object());
4525 Register temp = ToRegister(instr->temp());
4528 DeoptimizeIf(eq, instr->environment());
4533 void LCodeGen::DoStringAdd(LStringAdd* instr) {
4534 ASSERT(ToRegister(instr->context()).is(cp));
4536 ASSERT(ToRegister(instr->left()).is(r1));
4537 ASSERT(ToRegister(instr->right()).is(r0));
4538 NewStringAddStub stub(instr->hydrogen()->flags(),
4540 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4542 __ push(ToRegister(instr->left()));
4543 __ push(ToRegister(instr->right()));
4544 StringAddStub stub(instr->hydrogen()->flags());
4545 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4550 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
4553 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
4554 : LDeferredCode(codegen), instr_(instr) { }
4558 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
4564 new(zone()) DeferredStringCharCodeAt(this, instr);
4567 ToRegister(instr->string()),
4568 ToRegister(instr->index()),
4569 ToRegister(instr->result()),
4575 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
4576 Register string = ToRegister(instr->string());
4577 Register result = ToRegister(instr->result());
4589 if (instr->index()->IsConstantOperand()) {
4590 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
4594 Register index = ToRegister(instr->index());
4598 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr,
4599 instr->context());
4606 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
4609 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
4610 : LDeferredCode(codegen), instr_(instr) { }
4614 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
4620 new(zone()) DeferredStringCharFromCode(this, instr);
4622 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
4623 Register char_code = ToRegister(instr->char_code());
4624 Register result = ToRegister(instr->result());
4639 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
4640 Register char_code = ToRegister(instr->char_code());
4641 Register result = ToRegister(instr->result());
4651 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context());
4656 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
4657 LOperand* input = instr->value();
4659 LOperand* output = instr->result();
4673 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) {
4674 LOperand* input = instr->value();
4675 LOperand* output = instr->result();
4677 if (!instr->hydrogen()->value()->HasRange() ||
4678 !instr->hydrogen()->value()->range()->IsInSmiRange()) {
4680 DeoptimizeIf(vs, instr->environment());
4687 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
4688 LOperand* input = instr->value();
4689 LOperand* output = instr->result();
4697 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) {
4698 LOperand* input = instr->value();
4699 LOperand* output = instr->result();
4700 if (!instr->hydrogen()->value()->HasRange() ||
4701 !instr->hydrogen()->value()->range()->IsInSmiRange()) {
4703 DeoptimizeIf(ne, instr->environment());
4709 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
4712 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
4713 : LDeferredCode(codegen), instr_(instr) { }
4719 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
4724 Register src = ToRegister(instr->value());
4725 Register dst = ToRegister(instr->result());
4727 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr);
4734 void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
4737 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
4738 : LDeferredCode(codegen), instr_(instr) { }
4744 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
4749 Register input = ToRegister(instr->value());
4750 Register result = ToRegister(instr->result());
4752 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr);
4760 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
4765 Register dst = ToRegister(instr->result());
4810 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4823 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
4826 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
4827 : LDeferredCode(codegen), instr_(instr) { }
4831 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
4836 DwVfpRegister input_reg = ToDoubleRegister(instr->value());
4838 Register reg = ToRegister(instr->result());
4839 Register temp1 = ToRegister(instr->temp());
4840 Register temp2 = ToRegister(instr->temp2());
4842 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
4858 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
4862 Register reg = ToRegister(instr->result());
4874 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4880 void LCodeGen::DoSmiTag(LSmiTag* instr) {
4881 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
4882 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value()));
4886 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
4887 Register input = ToRegister(instr->value());
4888 Register result = ToRegister(instr->result());
4889 if (instr->needs_check()) {
4893 DeoptimizeIf(cs, instr->environment());
4956 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
4957 Register input_reg = ToRegister(instr->value());
4959 Register scratch2 = ToRegister(instr->temp());
4961 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp2());
4979 if (instr->truncating()) {
5006 DeoptimizeIf(ne, instr->environment());
5011 DeoptimizeIf(ne, instr->environment());
5016 DeoptimizeIf(ne, instr->environment());
5018 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5023 DeoptimizeIf(ne, instr->environment());
5030 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
5033 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
5034 : LDeferredCode(codegen), instr_(instr) { }
5038 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
5043 LOperand* input = instr->value();
5045 ASSERT(input->Equals(instr->result()));
5049 if (instr->hydrogen()->value()->representation().IsSmi()) {
5052 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr);
5065 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
5066 LOperand* input = instr->value();
5068 LOperand* result = instr->result();
5074 HValue* value = instr->hydrogen()->value();
5079 instr->hydrogen()->can_convert_undefined_to_nan(),
5080 instr->hydrogen()->deoptimize_on_minus_zero(),
5081 instr->environment(),
5086 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
5087 Register result_reg = ToRegister(instr->result());
5089 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5092 if (instr->truncating()) {
5097 DeoptimizeIf(ne, instr->environment());
5098 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5104 DeoptimizeIf(ne, instr->environment());
5111 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5112 Register result_reg = ToRegister(instr->result());
5114 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5117 if (instr->truncating()) {
5122 DeoptimizeIf(ne, instr->environment());
5123 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5129 DeoptimizeIf(ne, instr->environment());
5134 DeoptimizeIf(vs, instr->environment());
5138 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
5139 LOperand* input = instr->value();
5141 DeoptimizeIf(ne, instr->environment());
5145 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
5146 if (!instr->hydrogen()->value()->IsHeapObject()) {
5147 LOperand* input = instr->value();
5149 DeoptimizeIf(eq, instr->environment());
5154 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
5155 Register input = ToRegister(instr->value());
5161 if (instr->hydrogen()->is_interval_check()) {
5164 instr->hydrogen()->GetCheckInterval(&first, &last);
5170 DeoptimizeIf(ne, instr->environment());
5172 DeoptimizeIf(lo, instr->environment());
5176 DeoptimizeIf(hi, instr->environment());
5182 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
5187 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment());
5191 DeoptimizeIf(ne, instr->environment());
5197 void LCodeGen::DoCheckValue(LCheckValue* instr) {
5198 Register reg = ToRegister(instr->value());
5199 Handle<HeapObject> object = instr->hydrogen()->object().handle();
5202 Register reg = ToRegister(instr->value());
5210 DeoptimizeIf(ne, instr->environment());
5214 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
5221 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
5225 DeoptimizeIf(eq, instr->environment());
5229 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5232 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
5233 : LDeferredCode(codegen), instr_(instr), object_(object) {
5240 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
5247 if (instr->hydrogen()->CanOmitMapChecks()) return;
5250 LOperand* input = instr->value();
5257 if (instr->hydrogen()->has_migration_target()) {
5258 deferred = new(zone()) DeferredCheckMaps(this, instr, reg);
5262 UniqueSet<Map> map_set = instr->hydrogen()->map_set();
5272 if (instr->hydrogen()->has_migration_target()) {
5275 DeoptimizeIf(ne, instr->environment());
5282 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5283 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped());
5284 Register result_reg = ToRegister(instr->result());
5289 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
5290 Register unclamped_reg = ToRegister(instr->unclamped());
5291 Register result_reg = ToRegister(instr->result());
5296 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
5298 Register input_reg = ToRegister(instr->unclamped());
5299 Register result_reg = ToRegister(instr->result());
5300 DwVfpRegister temp_reg = ToDoubleRegister(instr->temp());
5314 DeoptimizeIf(ne, instr->environment());
5332 void LCodeGen::DoAllocate(LAllocate* instr) {
5335 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5336 : LDeferredCode(codegen), instr_(instr) { }
5340 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
5346 new(zone()) DeferredAllocate(this, instr);
5348 Register result = ToRegister(instr->result());
5349 Register scratch = ToRegister(instr->temp1());
5350 Register scratch2 = ToRegister(instr->temp2());
5354 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5357 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5358 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5359 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5361 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5362 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5366 if (instr->size()->IsConstantOperand()) {
5367 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5374 Register size = ToRegister(instr->size());
5385 if (instr->hydrogen()->MustPrefillWithFiller()) {
5386 if (instr->size()->IsConstantOperand()) {
5387 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5390 scratch = ToRegister(instr->size());
5406 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5407 Register result = ToRegister(instr->result());
5415 if (instr->size()->IsRegister()) {
5416 Register size = ToRegister(instr->size());
5421 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5426 instr->hydrogen()->MustAllocateDoubleAligned());
5427 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5428 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5429 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5431 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5432 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5440 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5445 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5446 ASSERT(ToRegister(instr->value()).is(r0));
5448 CallRuntime(Runtime::kToFastProperties, 1, instr);
5452 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5453 ASSERT(ToRegister(instr->context()).is(cp));
5461 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
5462 __ Move(r6, instr->hydrogen()->literals());
5470 __ mov(r5, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5471 __ mov(r4, Operand(instr->hydrogen()->pattern()));
5472 __ mov(r3, Operand(instr->hydrogen()->flags()));
5474 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5487 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5496 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
5497 ASSERT(ToRegister(instr->context()).is(cp));
5500 bool pretenure = instr->hydrogen()->pretenure();
5501 if (!pretenure && instr->hydrogen()->has_no_literals()) {
5502 FastNewClosureStub stub(instr->hydrogen()->language_mode(),
5503 instr->hydrogen()->is_generator());
5504 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5505 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5507 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5511 CallRuntime(Runtime::kNewClosure, 3, instr);
5516 void LCodeGen::DoTypeof(LTypeof* instr) {
5517 Register input = ToRegister(instr->value());
5519 CallRuntime(Runtime::kTypeof, 1, instr);
5523 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5524 Register input = ToRegister(instr->value());
5526 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
5527 instr->FalseLabel(chunk_),
5529 instr->type_literal());
5531 EmitBranch(instr, final_branch_condition);
5615 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
5616 Register temp1 = ToRegister(instr->temp());
5619 EmitBranch(instr, eq);
5660 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
5663 ASSERT(instr->HasEnvironment());
5664 LEnvironment* env = instr->environment();
5670 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
5671 Deoptimizer::BailoutType type = instr->hydrogen()->type();
5680 Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
5681 DeoptimizeIf(al, instr->environment(), type);
5685 instr) {
5690 void LCodeGen::DoDummyUse(LDummyUse* instr) {
5695 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
5697 LoadContextFromDeferred(instr->context());
5700 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
5701 ASSERT(instr->HasEnvironment());
5702 LEnvironment* env = instr->environment();
5707 void LCodeGen::DoStackCheck(LStackCheck* instr) {
5710 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
5711 : LDeferredCode(codegen), instr_(instr) { }
5715 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
5720 ASSERT(instr->HasEnvironment());
5721 LEnvironment* env = instr->environment();
5724 if (instr->hydrogen()->is_function_entry()) {
5731 ASSERT(instr->context()->IsRegister());
5732 ASSERT(ToRegister(instr->context()).is(cp));
5735 instr);
5742 ASSERT(instr->hydrogen()->is_backwards_branch());
5745 new(zone()) DeferredStackCheck(this, instr);
5751 __ bind(instr->done_label());
5752 deferred_stack_check->SetExit(instr->done_label());
5761 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
5765 LEnvironment* environment = instr->environment();
5776 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
5779 DeoptimizeIf(eq, instr->environment());
5784 DeoptimizeIf(eq, instr->environment());
5787 DeoptimizeIf(eq, instr->environment());
5791 DeoptimizeIf(le, instr->environment());
5802 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
5807 DeoptimizeIf(ne, instr->environment());
5812 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
5813 Register map = ToRegister(instr->map());
5814 Register result = ToRegister(instr->result());
5827 FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
5829 DeoptimizeIf(eq, instr->environment());
5835 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
5836 Register object = ToRegister(instr->value());
5837 Register map = ToRegister(instr->map());
5840 DeoptimizeIf(ne, instr->environment());
5844 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
5845 Register object = ToRegister(instr->object());
5846 Register index = ToRegister(instr->index());
5847 Register result = ToRegister(instr->result());