Lines Matching refs:instr
380 LInstruction* instr) {
381 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT);
387 LInstruction* instr,
389 ASSERT(instr != NULL);
393 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
404 void LCodeGen::DoCallFunction(LCallFunction* instr) {
405 ASSERT(ToRegister(instr->context()).is(cp));
406 ASSERT(ToRegister(instr->function()).Is(x1));
407 ASSERT(ToRegister(instr->result()).Is(x0));
409 int arity = instr->arity();
410 CallFunctionStub stub(isolate(), arity, instr->hydrogen()->function_flags());
411 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
416 void LCodeGen::DoCallNew(LCallNew* instr) {
417 ASSERT(ToRegister(instr->context()).is(cp));
418 ASSERT(instr->IsMarkedAsCall());
419 ASSERT(ToRegister(instr->constructor()).is(x1));
421 __ Mov(x0, instr->arity());
426 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
429 ASSERT(ToRegister(instr->result()).is(x0));
433 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
434 ASSERT(instr->IsMarkedAsCall());
435 ASSERT(ToRegister(instr->context()).is(cp));
436 ASSERT(ToRegister(instr->constructor()).is(x1));
438 __ Mov(x0, Operand(instr->arity()));
441 ElementsKind kind = instr->hydrogen()->elements_kind();
447 if (instr->arity() == 0) {
449 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
450 } else if (instr->arity() == 1) {
463 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
469 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
473 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
477 ASSERT(ToRegister(instr->result()).is(x0));
483 LInstruction* instr,
485 ASSERT(instr != NULL);
489 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
511 LInstruction* instr,
516 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
527 void LCodeGen::RecordSafepointWithLazyDeopt(LInstruction* instr,
530 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
534 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
769 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) {
770 if (instr->IsCall()) {
773 if (!instr->IsLazyBailout() && !instr->IsGap()) {
793 code->instr()->hydrogen_value()->id(),
794 code->instr()->Mnemonic());
1395 void LCodeGen::EmitBranchGeneric(InstrType instr,
1397 int left_block = instr->TrueDestination(chunk_);
1398 int right_block = instr->FalseDestination(chunk_);
1416 void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
1419 EmitBranchGeneric(instr, branch);
1424 void LCodeGen::EmitCompareAndBranch(InstrType instr,
1430 EmitBranchGeneric(instr, branch);
1435 void LCodeGen::EmitTestAndBranch(InstrType instr,
1441 EmitBranchGeneric(instr, branch);
1446 void LCodeGen::EmitBranchIfNonZeroNumber(InstrType instr,
1450 EmitBranchGeneric(instr, branch);
1455 void LCodeGen::EmitBranchIfHeapNumber(InstrType instr,
1458 EmitBranchGeneric(instr, branch);
1463 void LCodeGen::EmitBranchIfRoot(InstrType instr,
1467 EmitBranchGeneric(instr, branch);
1484 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
1485 Register arguments = ToRegister(instr->arguments());
1486 Register result = ToRegister(instr->result());
1493 if (instr->length()->IsConstantOperand() &&
1494 instr->index()->IsConstantOperand()) {
1495 int index = ToInteger32(LConstantOperand::cast(instr->index()));
1496 int length = ToInteger32(LConstantOperand::cast(instr->length()));
1499 } else if (instr->index()->IsConstantOperand()) {
1500 Register length = ToRegister32(instr->length());
1501 int index = ToInteger32(LConstantOperand::cast(instr->index()));
1510 Register length = ToRegister32(instr->length());
1511 Operand index = ToOperand32I(instr->index());
1519 void LCodeGen::DoAddE(LAddE* instr) {
1520 Register result = ToRegister(instr->result());
1521 Register left = ToRegister(instr->left());
1522 Operand right = (instr->right()->IsConstantOperand())
1523 ? ToInteger32(LConstantOperand::cast(instr->right()))
1524 : Operand(ToRegister32(instr->right()), SXTW);
1526 ASSERT(!instr->hydrogen()->CheckFlag(HValue::kCanOverflow));
1531 void LCodeGen::DoAddI(LAddI* instr) {
1532 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1533 Register result = ToRegister32(instr->result());
1534 Register left = ToRegister32(instr->left());
1535 Operand right = ToShiftedRightOperand32I(instr->right(), instr);
1539 DeoptimizeIf(vs, instr->environment());
1546 void LCodeGen::DoAddS(LAddS* instr) {
1547 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1548 Register result = ToRegister(instr->result());
1549 Register left = ToRegister(instr->left());
1550 Operand right = ToOperand(instr->right());
1553 DeoptimizeIf(vs, instr->environment());
1560 void LCodeGen::DoAllocate(LAllocate* instr) {
1563 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
1564 : LDeferredCode(codegen), instr_(instr) { }
1566 virtual LInstruction* instr() { return instr_; }
1571 DeferredAllocate* deferred = new(zone()) DeferredAllocate(this, instr);
1573 Register result = ToRegister(instr->result());
1574 Register temp1 = ToRegister(instr->temp1());
1575 Register temp2 = ToRegister(instr->temp2());
1579 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
1583 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
1584 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
1585 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
1587 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
1588 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
1592 if (instr->size()->IsConstantOperand()) {
1593 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
1600 Register size = ToRegister32(instr->size());
1607 if (instr->hydrogen()->MustPrefillWithFiller()) {
1610 Register untagged_result = ToRegister(instr->temp3());
1612 if (instr->size()->IsConstantOperand()) {
1613 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
1616 __ Lsr(filler_count.W(), ToRegister32(instr->size()), kPointerSizeLog2);
1623 ASSERT(instr->temp3() == NULL);
1628 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
1632 __ Mov(ToRegister(instr->result()), Smi::FromInt(0));
1637 if (instr->size()->IsConstantOperand()) {
1638 __ Mov(size, ToSmi(LConstantOperand::cast(instr->size())));
1640 __ SmiTag(size, ToRegister32(instr->size()).X());
1643 instr->hydrogen()->MustAllocateDoubleAligned());
1644 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
1645 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
1646 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
1648 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
1649 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
1658 Runtime::kHiddenAllocateInTargetSpace, 2, instr, instr->context());
1659 __ StoreToSafepointRegisterSlot(x0, ToRegister(instr->result()));
1663 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
1664 Register receiver = ToRegister(instr->receiver());
1665 Register function = ToRegister(instr->function());
1666 Register length = ToRegister32(instr->length());
1668 Register elements = ToRegister(instr->elements());
1672 ASSERT(ToRegister(instr->result()).Is(x0));
1673 ASSERT(instr->IsMarkedAsCall());
1679 DeoptimizeIf(hi, instr->environment());
1702 ASSERT(instr->HasPointerMap());
1703 LPointerMap* pointers = instr->pointer_map();
1712 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
1717 Register result = ToRegister(instr->result());
1719 if (instr->hydrogen()->from_inlined()) {
1731 ASSERT(instr->temp() != NULL);
1732 Register previous_fp = ToRegister(instr->temp());
1744 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
1745 Register elements = ToRegister(instr->elements());
1746 Register result = ToRegister32(instr->result());
1765 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1766 DoubleRegister left = ToDoubleRegister(instr->left());
1767 DoubleRegister right = ToDoubleRegister(instr->right());
1768 DoubleRegister result = ToDoubleRegister(instr->result());
1770 switch (instr->op()) {
1800 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1801 ASSERT(ToRegister(instr->context()).is(cp));
1802 ASSERT(ToRegister(instr->left()).is(x1));
1803 ASSERT(ToRegister(instr->right()).is(x0));
1804 ASSERT(ToRegister(instr->result()).is(x0));
1806 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE);
1807 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1811 void LCodeGen::DoBitI(LBitI* instr) {
1812 Register result = ToRegister32(instr->result());
1813 Register left = ToRegister32(instr->left());
1814 Operand right = ToShiftedRightOperand32U(instr->right(), instr);
1816 switch (instr->op()) {
1827 void LCodeGen::DoBitS(LBitS* instr) {
1828 Register result = ToRegister(instr->result());
1829 Register left = ToRegister(instr->left());
1830 Operand right = ToOperand(instr->right());
1832 switch (instr->op()) {
1843 void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) {
1844 Condition cond = instr->hydrogen()->allow_equality() ? hi : hs;
1845 ASSERT(instr->hydrogen()->index()->representation().IsInteger32());
1846 ASSERT(instr->hydrogen()->length()->representation().IsInteger32());
1847 if (instr->index()->IsConstantOperand()) {
1848 Operand index = ToOperand32I(instr->index());
1849 Register length = ToRegister32(instr->length());
1853 Register index = ToRegister32(instr->index());
1854 Operand length = ToOperand32I(instr->length());
1857 if (FLAG_debug_code && instr->hydrogen()->skip_check()) {
1860 DeoptimizeIf(cond, instr->environment());
1865 void LCodeGen::DoBranch(LBranch* instr) {
1866 Representation r = instr->hydrogen()->value()->representation();
1867 Label* true_label = instr->TrueLabel(chunk_);
1868 Label* false_label = instr->FalseLabel(chunk_);
1872 EmitCompareAndBranch(instr, ne, ToRegister32(instr->value()), 0);
1876 EmitCompareAndBranch(instr, ne, ToRegister(instr->value()), 0);
1878 DoubleRegister value = ToDoubleRegister(instr->value());
1880 EmitBranchIfNonZeroNumber(instr, value, double_scratch());
1883 Register value = ToRegister(instr->value());
1884 HType type = instr->hydrogen()->value()->type();
1889 EmitBranch(instr, eq);
1892 EmitCompareAndBranch(instr, ne, value, Smi::FromInt(0));
1895 EmitGoto(instr->TrueDestination(chunk()));
1901 EmitBranchIfNonZeroNumber(instr, double_scratch(), double_scratch());
1904 Register temp = ToRegister(instr->temp1());
1906 EmitCompareAndBranch(instr, ne, temp, 0);
1908 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
1939 DeoptimizeIfSmi(value, instr->environment());
1946 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
1947 map = ToRegister(instr->temp1());
1948 scratch = ToRegister(instr->temp2());
2000 Deoptimize(instr->environment());
2010 LInstruction* instr,
2021 LPointerMap* pointers = instr->pointer_map();
2052 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
2062 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
2063 ASSERT(instr->IsMarkedAsCall());
2064 ASSERT(ToRegister(instr->result()).Is(x0));
2066 LPointerMap* pointers = instr->pointer_map();
2069 if (instr->target()->IsConstantOperand()) {
2070 LConstantOperand* target = LConstantOperand::cast(instr->target());
2078 ASSERT(instr->target()->IsRegister());
2079 Register target = ToRegister(instr->target());
2089 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
2090 ASSERT(instr->IsMarkedAsCall());
2091 ASSERT(ToRegister(instr->function()).is(x1));
2093 if (instr->hydrogen()->pass_argument_count()) {
2094 __ Mov(x0, Operand(instr->arity()));
2104 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
2109 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
2110 CallRuntime(instr->function(), instr->arity(), instr);
2115 void LCodeGen::DoCallStub(LCallStub* instr) {
2116 ASSERT(ToRegister(instr->context()).is(cp));
2117 ASSERT(ToRegister(instr->result()).is(x0));
2118 switch (instr->hydrogen()->major_key()) {
2121 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2126 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2131 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2141 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
2146 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
2147 Register temp = ToRegister(instr->temp());
2154 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
2157 DeoptimizeIfSmi(temp, instr->environment());
2161 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
2164 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
2165 : LDeferredCode(codegen), instr_(instr), object_(object) {
2172 virtual LInstruction* instr() { return instr_; }
2179 if (instr->hydrogen()->IsStabilityCheck()) {
2180 const UniqueSet<Map>* maps = instr->hydrogen()->maps();
2187 Register object = ToRegister(instr->value());
2188 Register map_reg = ToRegister(instr->temp());
2193 if (instr->hydrogen()->HasMigrationTarget()) {
2194 deferred = new(zone()) DeferredCheckMaps(this, instr, object);
2198 const UniqueSet<Map>* maps = instr->hydrogen()->maps();
2209 if (instr->hydrogen()->HasMigrationTarget()) {
2212 DeoptimizeIf(ne, instr->environment());
2219 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
2220 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
2221 DeoptimizeIfSmi(ToRegister(instr->value()), instr->environment());
2226 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
2227 Register value = ToRegister(instr->value());
2228 ASSERT(!instr->result() || ToRegister(instr->result()).Is(value));
2229 DeoptimizeIfNotSmi(value, instr->environment());
2233 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
2234 Register input = ToRegister(instr->value());
2235 Register scratch = ToRegister(instr->temp());
2240 if (instr->hydrogen()->is_interval_check()) {
2242 instr->hydrogen()->GetCheckInterval(&first, &last);
2247 DeoptimizeIf(ne, instr->environment());
2250 DeoptimizeIf(lo, instr->environment());
2255 DeoptimizeIf(hi, instr->environment());
2260 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
2265 DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr->environment());
2267 DeoptimizeIfBitClear(scratch, MaskToBit(mask), instr->environment());
2276 DeoptimizeIf(ne, instr->environment());
2282 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
2283 DoubleRegister input = ToDoubleRegister(instr->unclamped());
2284 Register result = ToRegister32(instr->result());
2289 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
2290 Register input = ToRegister32(instr->unclamped());
2291 Register result = ToRegister32(instr->result());
2296 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
2297 Register input = ToRegister(instr->unclamped());
2298 Register result = ToRegister32(instr->result());
2299 Register scratch = ToRegister(instr->temp1());
2318 instr->environment());
2325 DoubleRegister dbl_scratch2 = ToDoubleRegister(instr->temp2());
2333 void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
2334 DoubleRegister value_reg = ToDoubleRegister(instr->value());
2335 Register result_reg = ToRegister(instr->result());
2336 if (instr->hydrogen()->bits() == HDoubleBits::HIGH) {
2345 void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
2346 Register hi_reg = ToRegister(instr->hi());
2347 Register lo_reg = ToRegister(instr->lo());
2348 DoubleRegister result_reg = ToDoubleRegister(instr->result());
2357 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
2358 Handle<String> class_name = instr->hydrogen()->class_name();
2359 Label* true_label = instr->TrueLabel(chunk_);
2360 Label* false_label = instr->FalseLabel(chunk_);
2361 Register input = ToRegister(instr->value());
2362 Register scratch1 = ToRegister(instr->temp1());
2363 Register scratch2 = ToRegister(instr->temp2());
2414 EmitCompareAndBranch(instr, eq, scratch1, Operand(class_name));
2418 void LCodeGen::DoCmpHoleAndBranchD(LCmpHoleAndBranchD* instr) {
2419 ASSERT(instr->hydrogen()->representation().IsDouble());
2420 FPRegister object = ToDoubleRegister(instr->object());
2421 Register temp = ToRegister(instr->temp());
2426 __ B(vc, instr->FalseLabel(chunk_));
2430 EmitCompareAndBranch(instr, eq, temp, kHoleNanInt64);
2434 void LCodeGen::DoCmpHoleAndBranchT(LCmpHoleAndBranchT* instr) {
2435 ASSERT(instr->hydrogen()->representation().IsTagged());
2436 Register object = ToRegister(instr->object());
2438 EmitBranchIfRoot(instr, object, Heap::kTheHoleValueRootIndex);
2442 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
2443 Register value = ToRegister(instr->value());
2444 Register map = ToRegister(instr->temp());
2447 EmitCompareAndBranch(instr, eq, map, Operand(instr->map()));
2451 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
2452 Representation rep = instr->hydrogen()->value()->representation();
2454 Register scratch = ToRegister(instr->temp());
2457 __ JumpIfMinusZero(ToDoubleRegister(instr->value()),
2458 instr->TrueLabel(chunk()));
2460 Register value = ToRegister(instr->value());
2462 instr->FalseLabel(chunk()), DO_SMI_CHECK);
2464 __ JumpIfMinusZero(scratch, instr->TrueLabel(chunk()));
2466 EmitGoto(instr->FalseDestination(chunk()));
2470 void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
2471 LOperand* left = instr->left();
2472 LOperand* right = instr->right();
2474 instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
2475 instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
2476 Condition cond = TokenToCondition(instr->op(), is_unsigned);
2482 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2483 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
2486 if (instr->is_double()) {
2501 __ B(vs, instr->FalseLabel(chunk_));
2502 EmitBranch(instr, cond);
2504 if (instr->hydrogen_value()->representation().IsInteger32()) {
2506 EmitCompareAndBranch(instr,
2512 EmitCompareAndBranch(instr,
2518 ASSERT(instr->hydrogen_value()->representation().IsSmi());
2521 EmitCompareAndBranch(instr,
2528 EmitCompareAndBranch(instr,
2533 EmitCompareAndBranch(instr,
2544 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
2545 Register left = ToRegister(instr->left());
2546 Register right = ToRegister(instr->right());
2547 EmitCompareAndBranch(instr, eq, left, right);
2551 void LCodeGen::DoCmpT(LCmpT* instr) {
2552 ASSERT(ToRegister(instr->context()).is(cp));
2553 Token::Value op = instr->op();
2556 ASSERT(ToRegister(instr->left()).Is(x1));
2557 ASSERT(ToRegister(instr->right()).Is(x0));
2559 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2565 ASSERT(instr->IsMarkedAsCall());
2568 __ Csel(ToRegister(instr->result()), x1, x2, cond);
2572 void LCodeGen::DoConstantD(LConstantD* instr) {
2573 ASSERT(instr->result()->IsDoubleRegister());
2574 DoubleRegister result = ToDoubleRegister(instr->result());
2575 if (instr->value() == 0) {
2576 if (copysign(1.0, instr->value()) == 1.0) {
2582 __ Fmov(result, instr->value());
2587 void LCodeGen::DoConstantE(LConstantE* instr) {
2588 __ Mov(ToRegister(instr->result()), Operand(instr->value()));
2592 void LCodeGen::DoConstantI(LConstantI* instr) {
2593 ASSERT(is_int32(instr->value()));
2596 __ Mov(ToRegister32(instr->result()), static_cast<uint32_t>(instr->value()));
2600 void LCodeGen::DoConstantS(LConstantS* instr) {
2601 __ Mov(ToRegister(instr->result()), Operand(instr->value()));
2605 void LCodeGen::DoConstantT(LConstantT* instr) {
2606 Handle<Object> object = instr->value(isolate());
2608 __ LoadObject(ToRegister(instr->result()), object);
2612 void LCodeGen::DoContext(LContext* instr) {
2614 Register result = ToRegister(instr->result());
2624 void LCodeGen::DoCheckValue(LCheckValue* instr) {
2625 Register reg = ToRegister(instr->value());
2626 Handle<HeapObject> object = instr->hydrogen()->object().handle();
2638 DeoptimizeIf(ne, instr->environment());
2642 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
2644 ASSERT(instr->HasEnvironment());
2645 LEnvironment* env = instr->environment();
2651 void LCodeGen::DoDateField(LDateField* instr) {
2652 Register object = ToRegister(instr->date());
2653 Register result = ToRegister(instr->result());
2656 Smi* index = instr->index();
2660 ASSERT(instr->IsMarkedAsCall());
2662 DeoptimizeIfSmi(object, instr->environment());
2664 DeoptimizeIf(ne, instr->environment());
2690 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
2691 Deoptimizer::BailoutType type = instr->hydrogen()->type();
2700 Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
2701 Deoptimize(instr->environment(), &type);
2705 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) {
2706 Register dividend = ToRegister32(instr->dividend());
2707 int32_t divisor = instr->divisor();
2708 Register result = ToRegister32(instr->result());
2713 HDiv* hdiv = instr->hydrogen();
2715 DeoptimizeIfZero(dividend, instr->environment());
2722 DeoptimizeIf(vs, instr->environment());
2729 DeoptimizeIf(ne, instr->environment());
2750 void LCodeGen::DoDivByConstI(LDivByConstI* instr) {
2751 Register dividend = ToRegister32(instr->dividend());
2752 int32_t divisor = instr->divisor();
2753 Register result = ToRegister32(instr->result());
2757 Deoptimize(instr->environment());
2762 HDiv* hdiv = instr->hydrogen();
2764 DeoptimizeIfZero(dividend, instr->environment());
2771 Register temp = ToRegister32(instr->temp());
2776 DeoptimizeIfNotZero(temp, instr->environment());
2782 void LCodeGen::DoDivI(LDivI* instr) {
2783 HBinaryOperation* hdiv = instr->hydrogen();
2784 Register dividend = ToRegister32(instr->dividend());
2785 Register divisor = ToRegister32(instr->divisor());
2786 Register result = ToRegister32(instr->result());
2793 ASSERT_EQ(NULL, instr->temp());
2799 DeoptimizeIfZero(divisor, instr->environment());
2811 DeoptimizeIf(eq, instr->environment());
2823 DeoptimizeIf(eq, instr->environment());
2827 Register remainder = ToRegister32(instr->temp());
2829 DeoptimizeIfNotZero(remainder, instr->environment());
2833 void LCodeGen::DoDoubleToIntOrSmi(LDoubleToIntOrSmi* instr) {
2834 DoubleRegister input = ToDoubleRegister(instr->value());
2835 Register result = ToRegister32(instr->result());
2837 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2838 DeoptimizeIfMinusZero(input, instr->environment());
2842 DeoptimizeIf(ne, instr->environment());
2844 if (instr->tag_result()) {
2850 void LCodeGen::DoDrop(LDrop* instr) {
2851 __ Drop(instr->count());
2855 void LCodeGen::DoDummy(LDummy* instr) {
2860 void LCodeGen::DoDummyUse(LDummyUse* instr) {
2865 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
2866 ASSERT(ToRegister(instr->context()).is(cp));
2868 ASSERT(instr->IsMarkedAsCall());
2872 bool pretenure = instr->hydrogen()->pretenure();
2873 if (!pretenure && instr->hydrogen()->has_no_literals()) {
2875 instr->hydrogen()->strict_mode(),
2876 instr->hydrogen()->is_generator());
2877 __ Mov(x2, Operand(instr->hydrogen()->shared_info()));
2878 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2880 __ Mov(x2, Operand(instr->hydrogen()->shared_info()));
2884 CallRuntime(Runtime::kHiddenNewClosure, 3, instr);
2889 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
2890 Register map = ToRegister(instr->map());
2891 Register result = ToRegister(instr->result());
2903 __ Ldr(result, FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
2904 DeoptimizeIfZero(result, instr->environment());
2910 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
2911 Register object = ToRegister(instr->object());
2914 ASSERT(instr->IsMarkedAsCall());
2918 instr->environment());
2922 DeoptimizeIf(eq, instr->environment());
2924 DeoptimizeIfSmi(object, instr->environment());
2928 DeoptimizeIf(le, instr->environment());
2939 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
2942 DeoptimizeIfNotRoot(x1, Heap::kMetaMapRootIndex, instr->environment());
2948 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
2949 Register input = ToRegister(instr->value());
2950 Register result = ToRegister(instr->result());
2969 void LCodeGen::DoGoto(LGoto* instr) {
2970 EmitGoto(instr->block_id());
2975 LHasCachedArrayIndexAndBranch* instr) {
2976 Register input = ToRegister(instr->value());
2977 Register temp = ToRegister32(instr->temp());
2983 EmitBranch(instr, eq);
2990 // - [ FIRST_TYPE, instr->to() ]
2991 // - [ instr->form(), LAST_TYPE ]
2992 // - instr->from() == instr->to()
3000 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
3001 InstanceType from = instr->from();
3002 InstanceType to = instr->to();
3010 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
3011 InstanceType from = instr->from();
3012 InstanceType to = instr->to();
3021 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
3022 Register input = ToRegister(instr->value());
3023 Register scratch = ToRegister(instr->temp());
3025 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
3026 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
3028 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
3029 EmitBranch(instr, BranchCondition(instr->hydrogen()));
3033 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
3034 Register result = ToRegister(instr->result());
3035 Register base = ToRegister(instr->base_object());
3036 if (instr->offset()->IsConstantOperand()) {
3037 __ Add(result, base, ToOperand32I(instr->offset()));
3039 __ Add(result, base, Operand(ToRegister32(instr->offset()), SXTW));
3044 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
3045 ASSERT(ToRegister(instr->context()).is(cp));
3047 ASSERT(ToRegister(instr->left()).Is(InstanceofStub::left()));
3048 ASSERT(ToRegister(instr->right()).Is(InstanceofStub::right()));
3051 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3062 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
3066 LInstanceOfKnownGlobal* instr)
3067 : LDeferredCode(codegen), instr_(instr) { }
3071 virtual LInstruction* instr() { return instr_; }
3077 new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
3080 Register object = ToRegister(instr->value());
3081 Register result = ToRegister(instr->result());
3087 ASSERT(instr->IsMarkedAsCall());
3147 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
3148 Register result = ToRegister(instr->result());
3159 LoadContextFromDeferred(instr->context());
3162 ASSERT(ToRegister(instr->value()).Is(InstanceofStub::left()));
3163 __ LoadObject(InstanceofStub::right(), instr->function());
3168 instr,
3170 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
3178 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
3179 DoGap(instr);
3183 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3184 Register value = ToRegister32(instr->value());
3185 DoubleRegister result = ToDoubleRegister(instr->result());
3190 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3191 ASSERT(ToRegister(instr->context()).is(cp));
3193 ASSERT(ToRegister(instr->function()).is(x1));
3194 ASSERT(instr->HasPointerMap());
3196 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3198 LPointerMap* pointers = instr->pointer_map();
3200 ParameterCount count(instr->arity());
3204 instr->hydrogen()->formal_parameter_count(),
3205 instr->arity(),
3206 instr,
3213 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
3214 Register temp1 = ToRegister(instr->temp1());
3215 Register temp2 = ToRegister(instr->temp2());
3232 instr, eq, temp1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
3236 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
3237 Label* is_object = instr->TrueLabel(chunk_);
3238 Label* is_not_object = instr->FalseLabel(chunk_);
3239 Register value = ToRegister(instr->value());
3240 Register map = ToRegister(instr->temp1());
3241 Register scratch = ToRegister(instr->temp2());
3257 EmitBranch(instr, le);
3274 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
3275 Register val = ToRegister(instr->value());
3276 Register scratch = ToRegister(instr->temp());
3279 instr->hydrogen()->value()->type().IsHeapObject()
3282 EmitIsString(val, scratch, instr->FalseLabel(chunk_), check_needed);
3284 EmitBranch(instr, true_cond);
3288 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
3289 Register value = ToRegister(instr->value());
3291 EmitTestAndBranch(instr, eq, value, kSmiTagMask);
3295 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
3296 Register input = ToRegister(instr->value());
3297 Register temp = ToRegister(instr->temp());
3299 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
3300 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
3305 EmitTestAndBranch(instr, ne, temp, 1 << Map::kIsUndetectable);
3329 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
3330 Register context = ToRegister(instr->context());
3331 Register result = ToRegister(instr->result());
3332 __ Ldr(result, ContextMemOperand(context, instr->slot_index()));
3333 if (instr->hydrogen()->RequiresHoleCheck()) {
3334 if (instr->hydrogen()->DeoptimizesOnHole()) {
3336 instr->environment());
3347 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
3348 Register function = ToRegister(instr->function());
3349 Register result = ToRegister(instr->result());
3350 Register temp = ToRegister(instr->temp());
3355 DeoptimizeIf(ne, instr->environment());
3368 instr->environment());
3389 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
3390 Register result = ToRegister(instr->result());
3391 __ Mov(result, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
3393 if (instr->hydrogen()->RequiresHoleCheck()) {
3395 result, Heap::kTheHoleValueRootIndex, instr->environment());
3400 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
3401 ASSERT(ToRegister(instr->context()).is(cp));
3402 ASSERT(ToRegister(instr->global_object()).Is(x0));
3403 ASSERT(ToRegister(instr->result()).Is(x0));
3404 instr->name()));
3405 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
3407 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3442 void LCodeGen::DoLoadKeyedExternal(LLoadKeyedExternal* instr) {
3443 Register ext_ptr = ToRegister(instr->elements());
3445 ElementsKind elements_kind = instr->elements_kind();
3447 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
3448 bool key_is_constant = instr->key()->IsConstantOperand();
3452 ASSERT(instr->temp() == NULL);
3453 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3458 scratch = ToRegister(instr->temp());
3459 key = ToRegister(instr->key());
3466 instr->base_offset());
3470 DoubleRegister result = ToDoubleRegister(instr->result());
3475 DoubleRegister result = ToDoubleRegister(instr->result());
3478 Register result = ToRegister(instr->result());
3506 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3509 DeoptimizeIf(ne, instr->environment());
3573 void LCodeGen::DoLoadKeyedFixedDouble(LLoadKeyedFixedDouble* instr) {
3574 Register elements = ToRegister(instr->elements());
3575 DoubleRegister result = ToDoubleRegister(instr->result());
3578 if (instr->key()->IsConstantOperand()) {
3579 ASSERT(instr->hydrogen()->RequiresHoleCheck() ||
3580 (instr->temp() == NULL));
3582 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3586 int offset = instr->base_offset() + constant_key * kDoubleSize;
3589 Register load_base = ToRegister(instr->temp());
3590 Register key = ToRegister(instr->key());
3591 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
3593 instr->hydrogen()->elements_kind(),
3594 instr->hydrogen()->representation(),
3595 instr->base_offset());
3600 if (instr->hydrogen()->RequiresHoleCheck()) {
3601 Register scratch = ToRegister(instr->temp());
3607 DeoptimizeIf(vs, instr->environment());
3612 void LCodeGen::DoLoadKeyedFixed(LLoadKeyedFixed* instr) {
3613 Register elements = ToRegister(instr->elements());
3614 Register result = ToRegister(instr->result());
3617 Representation representation = instr->hydrogen()->representation();
3618 if (instr->key()->IsConstantOperand()) {
3619 ASSERT(instr->temp() == NULL);
3620 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3621 int offset = instr->base_offset() +
3624 ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS);
3632 Register load_base = ToRegister(instr->temp());
3633 Register key = ToRegister(instr->key());
3634 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
3637 instr->hydrogen()->elements_kind(),
3638 representation, instr->base_offset());
3643 if (instr->hydrogen()->RequiresHoleCheck()) {
3644 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3645 DeoptimizeIfNotSmi(result, instr->environment());
3648 instr->environment());
3654 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
3655 ASSERT(ToRegister(instr->context()).is(cp));
3656 ASSERT(ToRegister(instr->object()).Is(x1));
3657 ASSERT(ToRegister(instr->key()).Is(x0));
3660 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3662 ASSERT(ToRegister(instr->result()).Is(x0));
3666 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3667 HObjectAccess access = instr->hydrogen()->access();
3669 Register object = ToRegister(instr->object());
3672 Register result = ToRegister(instr->result());
3677 if (instr->hydrogen()->representation().IsDouble()) {
3678 FPRegister result = ToDoubleRegister(instr->result());
3683 Register result = ToRegister(instr->result());
3694 instr->hydrogen()->representation().IsInteger32()) {
3705 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3706 ASSERT(ToRegister(instr->context()).is(cp));
3708 ASSERT(ToRegister(instr->object()).is(x0));
3709 __ Mov(x2, Operand(instr->name()));
3712 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3714 ASSERT(ToRegister(instr->result()).is(x0));
3718 void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
3719 Register result = ToRegister(instr->result());
3720 __ LoadRoot(result, instr->index());
3724 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
3725 Register result = ToRegister(instr->result());
3726 Register map = ToRegister(instr->value());
3731 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3732 Representation r = instr->hydrogen()->value()->representation();
3734 DoubleRegister input = ToDoubleRegister(instr->value());
3735 DoubleRegister result = ToDoubleRegister(instr->result());
3738 Register input = r.IsSmi() ? ToRegister(instr->value())
3739 : ToRegister32(instr->value());
3740 Register result = r.IsSmi() ? ToRegister(instr->result())
3741 : ToRegister32(instr->result());
3743 DeoptimizeIf(vs, instr->environment());
3748 void LCodeGen::DoDeferredMathAbsTagged(LMathAbsTagged* instr,
3760 ASSERT(instr->context() != NULL);
3761 ASSERT(ToRegister(instr->context()).is(cp));
3762 Register input = ToRegister(instr->value());
3763 Register temp1 = ToRegister(instr->temp1());
3764 Register temp2 = ToRegister(instr->temp2());
3765 Register result_bits = ToRegister(instr->temp3());
3766 Register result = ToRegister(instr->result());
3773 instr->environment());
3800 Register input = ToRegister(instr->value());
3808 CallRuntimeFromDeferred(Runtime::kHiddenAllocateHeapNumber, 0, instr,
3809 instr->context());
3816 void LCodeGen::DoMathAbsTagged(LMathAbsTagged* instr) {
3820 DeferredMathAbsTagged(LCodeGen* codegen, LMathAbsTagged* instr)
3821 : LDeferredCode(codegen), instr_(instr) { }
3826 virtual LInstruction* instr() { return instr_; }
3838 new(zone()) DeferredMathAbsTagged(this, instr);
3840 ASSERT(instr->hydrogen()->value()->representation().IsTagged() ||
3841 instr->hydrogen()->value()->representation().IsSmi());
3842 Register input = ToRegister(instr->value());
3843 Register result_bits = ToRegister(instr->temp3());
3844 Register result = ToRegister(instr->result());
3869 void LCodeGen::DoMathExp(LMathExp* instr) {
3870 DoubleRegister input = ToDoubleRegister(instr->value());
3871 DoubleRegister result = ToDoubleRegister(instr->result());
3872 DoubleRegister double_temp1 = ToDoubleRegister(instr->double_temp1());
3874 Register temp1 = ToRegister(instr->temp1());
3875 Register temp2 = ToRegister(instr->temp2());
3876 Register temp3 = ToRegister(instr->temp3());
3884 void LCodeGen::DoMathFloorD(LMathFloorD* instr) {
3885 DoubleRegister input = ToDoubleRegister(instr->value());
3886 DoubleRegister result = ToDoubleRegister(instr->result());
3892 void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
3893 DoubleRegister input = ToDoubleRegister(instr->value());
3894 Register result = ToRegister(instr->result());
3896 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3897 DeoptimizeIfMinusZero(input, instr->environment());
3907 DeoptimizeIf(ne, instr->environment());
3911 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
3912 Register dividend = ToRegister32(instr->dividend());
3913 Register result = ToRegister32(instr->result());
3914 int32_t divisor = instr->divisor();
3932 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3933 DeoptimizeIf(eq, instr->environment());
3938 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
3939 DeoptimizeIf(vs, instr->environment());
3945 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
3955 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
3956 Register dividend = ToRegister32(instr->dividend());
3957 int32_t divisor = instr->divisor();
3958 Register result = ToRegister32(instr->result());
3962 Deoptimize(instr->environment());
3967 HMathFloorOfDiv* hdiv = instr->hydrogen();
3969 DeoptimizeIfZero(dividend, instr->environment());
3983 Register temp = ToRegister32(instr->temp());
4001 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) {
4002 Register dividend = ToRegister32(instr->dividend());
4003 Register divisor = ToRegister32(instr->divisor());
4004 Register remainder = ToRegister32(instr->temp());
4005 Register result = ToRegister32(instr->result());
4012 DeoptimizeIfZero(divisor, instr->environment());
4015 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
4019 DeoptimizeIf(eq, instr->environment());
4023 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4029 DeoptimizeIf(eq, instr->environment());
4046 void LCodeGen::DoMathLog(LMathLog* instr) {
4047 ASSERT(instr->IsMarkedAsCall());
4048 ASSERT(ToDoubleRegister(instr->value()).is(d0));
4051 ASSERT(ToDoubleRegister(instr->result()).Is(d0));
4055 void LCodeGen::DoMathClz32(LMathClz32* instr) {
4056 Register input = ToRegister32(instr->value());
4057 Register result = ToRegister32(instr->result());
4062 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
4063 DoubleRegister input = ToDoubleRegister(instr->value());
4064 DoubleRegister result = ToDoubleRegister(instr->result());
4086 void LCodeGen::DoPower(LPower* instr) {
4087 Representation exponent_type = instr->hydrogen()->right()->representation();
4090 ASSERT(!instr->right()->IsDoubleRegister() ||
4091 ToDoubleRegister(instr->right()).is(d1));
4092 ASSERT(exponent_type.IsInteger32() || !instr->right()->IsRegister() ||
4093 ToRegister(instr->right()).is(x11));
4094 ASSERT(!exponent_type.IsInteger32() || ToRegister(instr->right()).is(x12));
4095 ASSERT(ToDoubleRegister(instr->left()).is(d0));
4096 ASSERT(ToDoubleRegister(instr->result()).is(d0));
4106 instr->environment());
4113 Register exponent = ToRegister(instr->right());
4125 void LCodeGen::DoMathRoundD(LMathRoundD* instr) {
4126 DoubleRegister input = ToDoubleRegister(instr->value());
4127 DoubleRegister result = ToDoubleRegister(instr->result());
4155 void LCodeGen::DoMathRoundI(LMathRoundI* instr) {
4156 DoubleRegister input = ToDoubleRegister(instr->value());
4157 DoubleRegister temp = ToDoubleRegister(instr->temp1());
4159 Register result = ToRegister(instr->result());
4188 DeoptimizeIf(hi, instr->environment());
4192 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4194 DeoptimizeIfNegative(result, instr->environment());
4199 DeoptimizeIf(vs, instr->environment());
4209 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
4210 DoubleRegister input = ToDoubleRegister(instr->value());
4211 DoubleRegister result = ToDoubleRegister(instr->result());
4216 void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
4217 HMathMinMax::Operation op = instr->hydrogen()->operation();
4218 if (instr->hydrogen()->representation().IsInteger32()) {
4219 Register result = ToRegister32(instr->result());
4220 Register left = ToRegister32(instr->left());
4221 Operand right = ToOperand32I(instr->right());
4225 } else if (instr->hydrogen()->representation().IsSmi()) {
4226 Register result = ToRegister(instr->result());
4227 Register left = ToRegister(instr->left());
4228 Operand right = ToOperand(instr->right());
4233 ASSERT(instr->hydrogen()->representation().IsDouble());
4234 DoubleRegister result = ToDoubleRegister(instr->result());
4235 DoubleRegister left = ToDoubleRegister(instr->left());
4236 DoubleRegister right = ToDoubleRegister(instr->right());
4248 void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) {
4249 Register dividend = ToRegister32(instr->dividend());
4250 int32_t divisor = instr->divisor();
4251 ASSERT(dividend.is(ToRegister32(instr->result())));
4259 HMod* hmod = instr->hydrogen();
4269 DeoptimizeIf(eq, instr->environment());
4280 void LCodeGen::DoModByConstI(LModByConstI* instr) {
4281 Register dividend = ToRegister32(instr->dividend());
4282 int32_t divisor = instr->divisor();
4283 Register result = ToRegister32(instr->result());
4284 Register temp = ToRegister32(instr->temp());
4288 Deoptimize(instr->environment());
4298 HMod* hmod = instr->hydrogen();
4302 DeoptimizeIfNegative(dividend, instr->environment());
4308 void LCodeGen::DoModI(LModI* instr) {
4309 Register dividend = ToRegister32(instr->left());
4310 Register divisor = ToRegister32(instr->right());
4311 Register result = ToRegister32(instr->result());
4316 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
4317 DeoptimizeIfZero(divisor, instr->environment());
4320 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4322 DeoptimizeIfNegative(dividend, instr->environment());
4328 void LCodeGen::DoMulConstIS(LMulConstIS* instr) {
4329 ASSERT(instr->hydrogen()->representation().IsSmiOrInteger32());
4330 instr->hydrogen()->representation().IsSmi();
4332 is_smi ? ToRegister(instr->result()) : ToRegister32(instr->result());
4334 is_smi ? ToRegister(instr->left()) : ToRegister32(instr->left()) ;
4335 int32_t right = ToInteger32(instr->right());
4338 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
4340 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
4345 DeoptimizeIfZero(left, instr->environment());
4348 DeoptimizeIfNegative(left, instr->environment());
4358 DeoptimizeIf(vs, instr->environment());
4374 DeoptimizeIf(vs, instr->environment());
4393 DeoptimizeIf(lt, instr->environment());
4403 DeoptimizeIf(vs, instr->environment());
4444 void LCodeGen::DoMulI(LMulI* instr) {
4445 Register result = ToRegister32(instr->result());
4446 Register left = ToRegister32(instr->left());
4447 Register right = ToRegister32(instr->right());
4449 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
4451 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
4461 DeoptimizeIf(mi, instr->environment());
4467 DeoptimizeIf(ne, instr->environment());
4474 void LCodeGen::DoMulS(LMulS* instr) {
4475 Register result = ToRegister(instr->result());
4476 Register left = ToRegister(instr->left());
4477 Register right = ToRegister(instr->right());
4479 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
4481 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
4491 DeoptimizeIf(mi, instr->environment());
4499 DeoptimizeIf(ne, instr->environment());
4524 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
4528 Register result = ToRegister(instr->result());
4540 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4545 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
4548 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
4549 : LDeferredCode(codegen), instr_(instr) { }
4551 virtual LInstruction* instr() { return instr_; }
4556 DoubleRegister input = ToDoubleRegister(instr->value());
4557 Register result = ToRegister(instr->result());
4558 Register temp1 = ToRegister(instr->temp1());
4559 Register temp2 = ToRegister(instr->temp2());
4561 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
4573 void LCodeGen::DoDeferredNumberTagU(LInstruction* instr,
4579 Register dst = ToRegister(instr->result());
4606 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4619 void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
4622 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
4623 : LDeferredCode(codegen), instr_(instr) { }
4630 virtual LInstruction* instr() { return instr_; }
4635 Register value = ToRegister32(instr->value());
4636 Register result = ToRegister(instr->result());
4638 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr);
4646 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
4647 Register input = ToRegister(instr->value());
4648 Register scratch = ToRegister(instr->temp());
4649 DoubleRegister result = ToDoubleRegister(instr->result());
4651 instr->hydrogen()->can_convert_undefined_to_nan();
4656 HValue* value = instr->hydrogen()->value();
4672 instr->environment());
4677 if (instr->hydrogen()->deoptimize_on_minus_zero()) {
4678 DeoptimizeIfMinusZero(result, instr->environment());
4685 instr->environment());
4705 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4709 LEnvironment* environment = instr->environment();
4720 void LCodeGen::DoParameter(LParameter* instr) {
4725 void LCodeGen::DoPreparePushArguments(LPreparePushArguments* instr) {
4726 __ PushPreamble(instr->argc(), kPointerSize);
4730 void LCodeGen::DoPushArguments(LPushArguments* instr) {
4733 for (int i = 0; i < instr->ArgumentCount(); ++i) {
4734 LOperand* arg = instr->argument(i);
4749 void LCodeGen::DoReturn(LReturn* instr) {
4772 if (instr->has_constant_parameter_count()) {
4773 int parameter_count = ToInteger32(instr->constant_parameter_count());
4776 Register parameter_count = ToRegister(instr->parameter_count());
4810 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
4811 String::Encoding encoding = instr->hydrogen()->encoding();
4812 Register string = ToRegister(instr->string());
4813 Register result = ToRegister(instr
4814 Register temp = ToRegister(instr->temp());
4836 BuildSeqStringOperand(string, temp, instr->index(), encoding);
4845 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
4846 String::Encoding encoding = instr->hydrogen()->encoding();
4847 Register string = ToRegister(instr->string());
4848 Register value = ToRegister(instr->value());
4849 Register temp = ToRegister(instr->temp());
4852 ASSERT(ToRegister(instr->context()).is(cp));
4853 Register index = ToRegister(instr->index());
4857 instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING
4863 BuildSeqStringOperand(string, temp, instr->index(), encoding);
4872 void LCodeGen::DoSmiTag(LSmiTag* instr) {
4873 HChange* hchange = instr->hydrogen();
4874 Register input = ToRegister(instr->value());
4875 Register output = ToRegister(instr->result());
4878 DeoptimizeIfNegative(input.W(), instr->environment());
4884 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
4885 Register input = ToRegister(instr->value());
4886 Register result = ToRegister(instr->result());
4889 if (instr->needs_check()) {
4890 DeoptimizeIfNotSmi(input, instr->environment());
4899 void LCodeGen::DoShiftI(LShiftI* instr) {
4900 LOperand* right_op = instr->right();
4901 Register left = ToRegister32(instr->left());
4902 Register result = ToRegister32(instr->result());
4905 Register right = ToRegister32(instr->right());
4906 switch (instr->op()) {
4911 if (instr->can_deopt()) {
4914 DeoptimizeIfNegative(left, instr->environment());
4925 if ((instr->op() == Token::SHR) && instr->can_deopt()) {
4926 DeoptimizeIfNegative(left, instr->environment());
4930 switch (instr->op()) {
4942 void LCodeGen::DoShiftS(LShiftS* instr) {
4943 LOperand* right_op = instr->right();
4944 Register left = ToRegister(instr->left());
4945 Register result = ToRegister(instr->result());
4948 ASSERT(((instr->op() == Token::ROR) && right_op->IsRegister()) ||
4949 (instr->temp() == NULL));
4952 Register right = ToRegister(instr->right());
4953 switch (instr->op()) {
4955 Register temp = ToRegister(instr->temp());
4972 if (instr->can_deopt()) {
4975 DeoptimizeIfNegative(left, instr->environment());
4988 if ((instr->op() == Token::SHR) && instr->can_deopt()) {
4989 DeoptimizeIfNegative(left, instr->environment());
4993 switch (instr->op()) {
5017 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
5022 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
5023 ASSERT(ToRegister(instr->context()).is(cp));
5026 ASSERT(instr->IsMarkedAsCall());
5031 __ LoadHeapObject(scratch1, instr->hydrogen()->pairs());
5032 __ Mov(scratch2, Smi::FromInt(instr->hydrogen()->flags()));
5034 CallRuntime(Runtime::kHiddenDeclareGlobals, 3, instr);
5038 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
5040 LoadContextFromDeferred(instr->context());
5043 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
5044 ASSERT(instr->HasEnvironment());
5045 LEnvironment* env = instr->environment();
5050 void LCodeGen::DoStackCheck(LStackCheck* instr) {
5053 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
5054 : LDeferredCode(codegen), instr_(instr) { }
5056 virtual LInstruction* instr() { return instr_; }
5061 ASSERT(instr->HasEnvironment());
5062 LEnvironment* env = instr->environment();
5065 if (instr->hydrogen()->is_function_entry()) {
5073 ASSERT(instr->context()->IsRegister());
5074 ASSERT(ToRegister(instr->context()).is(cp));
5077 instr);
5080 ASSERT(instr->hydrogen()->is_backwards_branch());
5083 new(zone()) DeferredStackCheck(this, instr);
5088 __ Bind(instr->done_label());
5089 deferred_stack_check->SetExit(instr->done_label());
5098 void LCodeGen::DoStoreCodeEntry(LStoreCodeEntry* instr) {
5099 Register function = ToRegister(instr->function());
5100 Register code_object = ToRegister(instr->code_object());
5101 Register temp = ToRegister(instr->temp());
5107 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
5108 Register context = ToRegister(instr->context());
5109 Register value = ToRegister(instr->value());
5110 Register scratch = ToRegister(instr->temp());
5111 MemOperand target = ContextMemOperand(context, instr->slot_index());
5115 if (instr->hydrogen()->RequiresHoleCheck()) {
5117 if (instr->hydrogen()->DeoptimizesOnHole()) {
5119 instr->environment());
5126 if (instr->hydrogen()->NeedsWriteBarrier()) {
5128 instr->hydrogen()->value()->type().IsHeapObject()
5143 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
5144 Register value = ToRegister(instr->value());
5145 Register cell = ToRegister(instr->temp1());
5148 __ Mov(cell, Operand(instr->hydrogen()->cell().handle()));
5154 if (instr->hydrogen()->RequiresHoleCheck()) {
5155 Register payload = ToRegister(instr->temp2());
5158 payload, Heap::kTheHoleValueRootIndex, instr->environment());
5167 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) {
5168 Register ext_ptr = ToRegister(instr->elements());
5171 ElementsKind elements_kind = instr->elements_kind();
5173 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
5174 bool key_is_constant = instr->key()->IsConstantOperand();
5177 ASSERT(instr->temp() == NULL);
5178 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
5183 key = ToRegister(instr->key());
5184 scratch = ToRegister(instr->temp());
5191 instr->base_offset());
5195 DoubleRegister value = ToDoubleRegister(instr->value());
5201 DoubleRegister value = ToDoubleRegister(instr->value());
5204 Register value = ToRegister(instr->value());
5246 void LCodeGen::DoStoreKeyedFixedDouble(LStoreKeyedFixedDouble* instr) {
5247 Register elements = ToRegister(instr->elements());
5248 DoubleRegister value = ToDoubleRegister(instr->value());
5251 if (instr->key()->IsConstantOperand()) {
5252 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
5256 int offset = instr->base_offset() + constant_key * kDoubleSize;
5259 Register store_base = ToRegister(instr->temp());
5260 Register key = ToRegister(instr->key());
5261 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
5263 instr->hydrogen()->elements_kind(),
5264 instr->hydrogen()->representation(),
5265 instr->base_offset());
5268 if (instr->NeedsCanonicalization()) {
5277 void LCodeGen::DoStoreKeyedFixed(LStoreKeyedFixed* instr) {
5278 Register value = ToRegister(instr->value());
5279 Register elements = ToRegister(instr->elements());
5285 if (!instr->key()->IsConstantOperand() ||
5286 instr
5287 scratch = ToRegister(instr->temp());
5290 Representation representation = instr->hydrogen()->value()->representation();
5291 if (instr->key()->IsConstantOperand()) {
5292 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
5293 int offset = instr->base_offset() +
5297 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
5298 ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS);
5307 key = ToRegister(instr->key());
5308 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
5311 instr->hydrogen()->elements_kind(),
5312 representation, instr->base_offset());
5317 if (instr->hydrogen()->NeedsWriteBarrier()) {
5322 instr->hydrogen()->value()->type().IsHeapObject()
5328 instr->hydrogen()->PointersToHereCheckForValue());
5333 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
5334 ASSERT(ToRegister(instr->context()).is(cp));
5335 ASSERT(ToRegister(instr->object()).Is(x2));
5336 ASSERT(ToRegister(instr->key()).Is(x1));
5337 ASSERT(ToRegister(instr->value()).Is(x0));
5339 Handle<Code> ic = instr->strict_mode() == STRICT
5342 CallCode(ic, RelocInfo::CODE_TARGET, instr);
5346 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
5347 Representation representation = instr->representation();
5349 Register object = ToRegister(instr->object());
5350 HObjectAccess access = instr->hydrogen()->access();
5354 ASSERT(!instr->hydrogen()->has_transition());
5355 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
5356 Register value = ToRegister(instr->value());
5365 ASSERT(!instr->hydrogen()->has_transition());
5366 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
5367 FPRegister value = ToDoubleRegister(instr->value());
5372 Register value = ToRegister(instr->value());
5375 !instr->value()->IsConstantOperand() ||
5376 IsInteger32Constant(LConstantOperand::cast(instr->value())));
5378 if (instr->hydrogen()->has_transition()) {
5379 Handle<Map> transition = instr->hydrogen()->transition_map();
5382 Register new_map_value = ToRegister(instr->temp0());
5385 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
5389 ToRegister(instr->temp1()),
5400 Register temp0 = ToRegister(instr->temp0());
5406 instr->hydrogen()->value()->representation().IsInteger32()) {
5407 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
5409 Register temp0 = ToRegister(instr->temp0());
5425 if (instr->hydrogen()->NeedsWriteBarrier()) {
5429 ToRegister(instr->temp1()), // Clobbered.
5433 instr->hydrogen()->SmiCheckForWriteBarrier(),
5434 instr->hydrogen()->PointersToHereCheckForValue());
5439 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
5440 ASSERT(ToRegister(instr->context()).is(cp));
5441 ASSERT(ToRegister(instr->value()).is(x0));
5442 ASSERT(ToRegister(instr->object()).is(x1));
5445 __ Mov(x2, Operand(instr->name()));
5446 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode());
5447 CallCode(ic, RelocInfo::CODE_TARGET, instr);
5451 void LCodeGen::DoStringAdd(LStringAdd* instr) {
5452 ASSERT(ToRegister(instr->context()).is(cp));
5453 ASSERT(ToRegister(instr->left()).Is(x1));
5454 ASSERT(ToRegister(instr->right()).Is(x0));
5456 instr->hydrogen()->flags(),
5457 instr->hydrogen()->pretenure_flag());
5458 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5462 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
5465 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
5466 : LDeferredCode(codegen), instr_(instr) { }
5468 virtual LInstruction* instr() { return instr_; }
5474 new(zone()) DeferredStringCharCodeAt(this, instr);
5477 ToRegister(instr->string()),
5478 ToRegister32(instr->index()),
5479 ToRegister(instr->result()),
5485 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
5486 Register string = ToRegister(instr->string());
5487 Register result = ToRegister(instr->result());
5498 Register index = ToRegister(instr->index());
5501 CallRuntimeFromDeferred(Runtime::kHiddenStringCharCodeAt, 2, instr,
5502 instr->context());
5509 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
5512 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
5513 : LDeferredCode(codegen), instr_(instr) { }
5515 virtual LInstruction* instr() { return instr_; }
5521 new(zone()) DeferredStringCharFromCode(this, instr);
5523 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
5524 Register char_code = ToRegister32(instr->char_code());
5525 Register result = ToRegister(instr->result());
5538 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
5539 Register char_code = ToRegister(instr->char_code());
5540 Register result = ToRegister(instr->result());
5549 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context());
5554 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
5555 ASSERT(ToRegister(instr->context()).is(cp));
5556 Token::Value op = instr->op();
5559 CallCode(ic, RelocInfo::CODE_TARGET, instr);
5564 EmitCompareAndBranch(instr, condition, x0, 0);
5568 void LCodeGen::DoSubI(LSubI* instr) {
5569 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
5570 Register result = ToRegister32(instr->result());
5571 Register left = ToRegister32(instr->left());
5572 Operand right = ToShiftedRightOperand32I(instr->right(), instr);
5576 DeoptimizeIf(vs, instr->environment());
5583 void LCodeGen::DoSubS(LSubS* instr) {
5584 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
5585 Register result = ToRegister(instr->result());
5586 Register left = ToRegister(instr->left());
5587 Operand right = ToOperand(instr->right());
5590 DeoptimizeIf(vs, instr->environment());
5597 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
5610 if (instr->truncating()) {
5611 Register output = ToRegister(instr->result());
5634 instr->environment());
5636 Register output = ToRegister32(instr->result());
5642 instr->environment());
5648 DeoptimizeIf(ne, instr->environment());
5650 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5654 DeoptimizeIfNegative(scratch1, instr->environment());
5661 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
5664 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
5665 : LDeferredCode(codegen), instr_(instr) { }
5671 virtual LInstruction* instr() { return instr_; }
5676 Register input = ToRegister(instr->value());
5677 Register output = ToRegister(instr->result());
5679 if (instr->hydrogen()->value()->representation().IsSmi()) {
5682 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr);
5691 void LCodeGen::DoThisFunction(LThisFunction* instr) {
5692 Register result = ToRegister(instr->result());
5697 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5698 ASSERT(ToRegister(instr->value()).Is(x0));
5699 ASSERT(ToRegister(instr->result()).Is(x0));
5701 CallRuntime(Runtime::kToFastProperties, 1, instr);
5705 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5706 ASSERT(ToRegister(instr->context()).is(cp));
5714 FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
5715 __ LoadObject(x7, instr->hydrogen()->literals());
5721 __ Mov(x12, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5722 __ Mov(x11, Operand(instr->hydrogen()->pattern()));
5723 __ Mov(x10, Operand(instr->hydrogen()->flags()));
5725 CallRuntime(Runtime::kHiddenMaterializeRegExpLiteral, 4, instr);
5738 CallRuntime(Runtime::kHiddenAllocateInNewSpace, 1, instr);
5747 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
5748 Register object = ToRegister(instr->object());
5750 Handle<Map> from_map = instr->original_map();
5751 instr->transitioned_map();
5752 ElementsKind from_kind = instr->from_kind();
5753 ElementsKind to_kind = instr->to_kind();
5758 Register temp1 = ToRegister(instr->temp1());
5759 Register new_map = ToRegister(instr->temp2());
5775 ASSERT(ToRegister(instr->context()).is(cp));
5783 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
5789 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
5790 Register object = ToRegister(instr->object());
5791 Register temp1 = ToRegister(instr->temp1());
5792 Register temp2 = ToRegister(instr->temp2());
5796 DeoptimizeIf(eq, instr->environment());
5801 void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) {
5802 DoubleRegister input = ToDoubleRegister(instr->value());
5803 Register result = ToRegister(instr->result());
5805 if (instr->tag_result()) {
5811 void LCodeGen::DoTypeof(LTypeof* instr) {
5812 Register input = ToRegister(instr->value());
5814 CallRuntime(Runtime::kTypeof, 1, instr);
5818 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5819 Handle<String> type_name = instr->type_literal();
5820 Label* true_label = instr->TrueLabel(chunk_);
5821 Label* false_label = instr->FalseLabel(chunk_);
5822 Register value = ToRegister(instr->value());
5826 ASSERT(instr->temp1() != NULL);
5827 Register map = ToRegister(instr->temp1());
5832 EmitBranch(instr, eq);
5835 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5836 Register map = ToRegister(instr->temp1());
5837 Register scratch = ToRegister(instr->temp2());
5843 EmitTestAndBranch(instr, eq, scratch, 1 << Map::kIsUndetectable);
5846 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5847 Register map = ToRegister(instr->temp1());
5848 Register scratch = ToRegister(instr->temp2());
5852 EmitBranch(instr, eq);
5857 EmitBranch(instr, eq);
5862 EmitBranch(instr, eq);
5865 ASSERT(instr->temp1() != NULL);
5866 Register scratch = ToRegister(instr->temp1());
5873 EmitTestAndBranch(instr, ne, scratch, 1 << Map::kIsUndetectable);
5877 ASSERT(instr->temp1() != NULL);
5878 Register type = ToRegister(instr->temp1());
5883 EmitCompareAndBranch(instr, eq, type, JS_FUNCTION_PROXY_TYPE);
5886 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5887 Register map = ToRegister(instr->temp1());
5888 Register scratch = ToRegister(instr->temp2());
5900 EmitTestAndBranch(instr, eq, scratch, 1 << Map::kIsUndetectable);
5908 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
5909 __ Ucvtf(ToDoubleRegister(instr->result()), ToRegister32(instr->value()));
5913 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
5914 Register object = ToRegister(instr->value());
5915 Register map = ToRegister(instr->map());
5916 Register temp = ToRegister(instr->temp());
5919 DeoptimizeIf(ne, instr->environment());
5923 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
5924 Register receiver = ToRegister(instr->receiver());
5925 Register function = ToRegister(instr->function());
5926 Register result = ToRegister(instr->result());
5933 if (!instr->hydrogen()->known_function()) {
5953 DeoptimizeIfSmi(receiver, instr->environment());
5956 Deoptimize(instr->environment());
5970 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr,
5980 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt);
5985 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
5989 LLoadFieldByIndex* instr,
5994 instr_(instr),
6002 virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
6009 Register object = ToRegister(instr->object());
6010 Register index = ToRegister(instr->index());
6011 Register result = ToRegister(instr->result());
6017 this, instr, result, object, index);
6045 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
6046 Register context = ToRegister(instr->context());
6051 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
6052 Handle<ScopeInfo> scope_info = instr->scope_info();
6054 __ Push(ToRegister(instr->function()));
6055 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr);