Home | History | Annotate | Download | only in x64

Lines Matching refs:instr

235     LInstruction* instr = instructions_->at(current_instruction_);
236 if (instr->IsLabel()) {
237 LLabel* label = LLabel::cast(instr);
242 Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
243 instr->CompileToNative(this);
268 code->instr()->Mnemonic());
453 LInstruction* instr,
457 ASSERT(instr != NULL);
458 LPointerMap* pointers = instr->pointer_map();
461 RecordSafepointWithLazyDeopt(instr, safepoint_mode, argc);
474 LInstruction* instr) {
475 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, 0);
481 LInstruction* instr) {
482 ASSERT(instr != NULL);
483 ASSERT(instr->HasPointerMap());
484 LPointerMap* pointers = instr->pointer_map();
488 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT, 0);
494 LInstruction* instr) {
498 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
622 LInstruction* instr, SafepointMode safepoint_mode, int argc) {
624 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
628 instr->pointer_map(), argc, Safepoint::kLazyDeopt);
712 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
713 DoGap(instr);
717 void LCodeGen::DoParameter(LParameter* instr) {
722 void LCodeGen::DoCallStub(LCallStub* instr) {
723 ASSERT(ToRegister(instr->result()).is(rax));
724 switch (instr->hydrogen()->major_key()) {
727 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
732 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
737 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
747 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
752 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
756 TranscendentalCacheStub stub(instr->transcendental_type(),
758 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
767 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
772 void LCodeGen::DoModI(LModI* instr) {
773 if (instr->hydrogen()->HasPowerOf2Divisor()) {
774 Register dividend = ToRegister(instr->InputAt(0));
777 HConstant::cast(instr->hydrogen()->right())->Integer32Value();
787 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
789 DeoptimizeIf(no_condition, instr->environment());
798 Register left_reg = ToRegister(instr->InputAt(0));
799 Register right_reg = ToRegister(instr->InputAt(1));
800 Register result_reg = ToRegister(instr->result());
808 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
810 DeoptimizeIf(zero, instr->environment());
829 Register scratch = ToRegister(instr->TempAt(0));
857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
868 DeoptimizeIf(no_condition, instr->environment());
885 void LCodeGen::DoDivI(LDivI* instr) {
886 LOperand* right = instr->InputAt(1);
887 ASSERT(ToRegister(instr->result()).is(rax));
888 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
889 ASSERT(!ToRegister(instr->InputAt(1)).is(rax));
890 ASSERT(!ToRegister(instr->InputAt(1)).is(rdx));
896 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
898 DeoptimizeIf(zero, instr->environment());
902 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
907 DeoptimizeIf(sign, instr->environment());
912 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
917 DeoptimizeIf(zero, instr->environment());
927 DeoptimizeIf(not_zero, instr->environment());
931 void LCodeGen::DoMulI(LMulI* instr) {
932 Register left = ToRegister(instr->InputAt(0));
933 LOperand* right = instr->InputAt(1);
935 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
940 instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
989 DeoptimizeIf(overflow, instr->environment());
992 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
999 DeoptimizeIf(no_condition, instr->environment());
1003 DeoptimizeIf(sign, instr->environment());
1007 DeoptimizeIf(sign, instr->environment());
1014 void LCodeGen::DoBitI(LBitI* instr) {
1015 LOperand* left = instr->InputAt(0);
1016 LOperand* right = instr->InputAt(1);
1017 ASSERT(left->Equals(instr->result()));
1022 switch (instr->op()) {
1037 switch (instr->op()) {
1053 switch (instr->op()) {
1071 void LCodeGen::DoShiftI(LShiftI* instr) {
1072 LOperand* left = instr->InputAt(0);
1073 LOperand* right = instr->InputAt(1);
1074 ASSERT(left->Equals(instr->result()));
1079 switch (instr->op()) {
1085 if (instr->can_deopt()) {
1087 DeoptimizeIf(negative, instr->environment());
1100 switch (instr->op()) {
1107 if (shift_count == 0 && instr->can_deopt()) {
1109 DeoptimizeIf(negative, instr->environment());
1127 void LCodeGen::DoSubI(LSubI* instr) {
1128 LOperand* left = instr->InputAt(0);
1129 LOperand* right = instr->InputAt(1);
1130 ASSERT(left->Equals(instr->result()));
1141 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1142 DeoptimizeIf(overflow, instr->environment());
1147 void LCodeGen::DoConstantI(LConstantI* instr) {
1148 ASSERT(instr->result()->IsRegister());
1149 __ Set(ToRegister(instr->result()), instr->value());
1153 void LCodeGen::DoConstantD(LConstantD* instr) {
1154 ASSERT(instr->result()->IsDoubleRegister());
1155 XMMRegister res = ToDoubleRegister(instr->result());
1156 double v = instr->value();
1163 Register tmp = ToRegister(instr->TempAt(0));
1170 void LCodeGen::DoConstantT(LConstantT* instr) {
1171 Handle<Object> value = instr->value();
1173 __ Move(ToRegister(instr->result()), value);
1175 __ LoadHeapObject(ToRegister(instr->result()),
1181 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1182 Register result = ToRegister(instr->result());
1183 Register array = ToRegister(instr->InputAt(0));
1188 void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) {
1189 Register result = ToRegister(instr->result());
1190 Register array = ToRegister(instr->InputAt(0));
1195 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1196 Register result = ToRegister(instr->result());
1197 Register input = ToRegister(instr->InputAt(0));
1209 void LCodeGen::DoValueOf(LValueOf* instr) {
1210 Register input = ToRegister(instr->InputAt(0));
1211 Register result = ToRegister(instr->result());
1226 void LCodeGen::DoDateField(LDateField* instr) {
1227 Register object = ToRegister(instr->InputAt(0));
1228 Register result = ToRegister(instr->result());
1229 Smi* index = instr->index();
1269 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1270 LOperand* input = instr->InputAt(0);
1271 ASSERT(input->Equals(instr->result()));
1276 void LCodeGen::DoThrow(LThrow* instr) {
1277 __ push(ToRegister(instr->InputAt(0)));
1278 CallRuntime(Runtime::kThrow, 1, instr);
1287 void LCodeGen::DoAddI(LAddI* instr) {
1288 LOperand* left = instr->InputAt(0);
1289 LOperand* right = instr->InputAt(1);
1290 ASSERT(left->Equals(instr->result()));
1301 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1302 DeoptimizeIf(overflow, instr->environment());
1307 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1308 XMMRegister left = ToDoubleRegister(instr->InputAt(0));
1309 XMMRegister right = ToDoubleRegister(instr->InputAt(1));
1310 XMMRegister result = ToDoubleRegister(instr->result());
1312 ASSERT(instr->op() == Token::MOD || left.is(result));
1313 switch (instr->op()) {
1342 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1343 ASSERT(ToRegister(instr->InputAt(0)).is(rdx));
1344 ASSERT(ToRegister(instr->InputAt(1)).is(rax));
1345 ASSERT(ToRegister(instr->result()).is(rax));
1347 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1348 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1382 void LCodeGen::DoBranch(LBranch* instr) {
1383 int true_block = chunk_->LookupDestination(instr->true_block_id());
1384 int false_block = chunk_->LookupDestination(instr->false_block_id());
1386 Representation r = instr->hydrogen()->value()->representation();
1388 Register reg = ToRegister(instr->InputAt(0));
1392 XMMRegister reg = ToDoubleRegister(instr->InputAt(0));
1398 Register reg = ToRegister(instr->InputAt(0));
1399 HType type = instr->hydrogen()->value()->type();
1410 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
1441 DeoptimizeIf(zero, instr->environment());
1486 DeoptimizeIf(no_condition, instr->environment());
1501 void LCodeGen::DoGoto(LGoto* instr) {
1502 EmitGoto(instr->block_id());
1534 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1535 LOperand* left = instr->InputAt(0);
1536 LOperand* right = instr->InputAt(1);
1537 int false_block = chunk_->LookupDestination(instr->false_block_id());
1538 int true_block = chunk_->LookupDestination(instr->true_block_id());
1539 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1546 EvalComparison(instr->op(), left_val, right_val) ? true_block
1550 if (instr->is_double()) {
1582 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
1583 Register left = ToRegister(instr->InputAt(0));
1584 Register right = ToRegister(instr->InputAt(1));
1585 int false_block = chunk_->LookupDestination(instr->false_block_id());
1586 int true_block = chunk_->LookupDestination(instr->true_block_id());
1593 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
1594 Register left = ToRegister(instr->InputAt(0));
1595 int true_block = chunk_->LookupDestination(instr->true_block_id());
1596 int false_block = chunk_->LookupDestination(instr->false_block_id());
1598 __ cmpq(left, Immediate(instr->hydrogen()->right()));
1603 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
1604 Register reg = ToRegister(instr->InputAt(0));
1605 int false_block = chunk_->LookupDestination(instr->false_block_id());
1609 if (instr->hydrogen()->representation().IsSpecialization() ||
1610 instr->hydrogen()->type().IsSmi()) {
1615 int true_block = chunk_->LookupDestination(instr->true_block_id());
1616 Heap::RootListIndex nil_value = instr->nil() == kNullValue ?
1620 if (instr->kind() == kStrictEquality) {
1623 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ?
1634 Register scratch = ToRegister(instr->TempAt(0));
1668 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1669 Register reg = ToRegister(instr->InputAt(0));
1671 int true_block = chunk_->LookupDestination(instr->true_block_id());
1672 int false_block = chunk_->LookupDestination(instr->false_block_id());
1692 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
1693 Register reg = ToRegister(instr->InputAt(0));
1694 Register temp = ToRegister(instr->TempAt(0));
1696 int true_block = chunk_->LookupDestination(instr->true_block_id());
1697 int false_block = chunk_->LookupDestination(instr->false_block_id());
1706 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1707 int true_block = chunk_->LookupDestination(instr->true_block_id());
1708 int false_block = chunk_->LookupDestination(instr->false_block_id());
1711 if (instr->InputAt(0)->IsRegister()) {
1712 Register input = ToRegister(instr->InputAt(0));
1715 Operand input = ToOperand(instr->InputAt(0));
1722 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
1723 Register input = ToRegister(instr->InputAt(0));
1724 Register temp = ToRegister(instr->TempAt(0));
1726 int true_block = chunk_->LookupDestination(instr->true_block_id());
1727 int false_block = chunk_->LookupDestination(instr->false_block_id());
1737 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
1738 Token::Value op = instr->op();
1739 int true_block = chunk_->LookupDestination(instr->true_block_id());
1740 int false_block = chunk_->LookupDestination(instr->false_block_id());
1743 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1752 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
1753 InstanceType from = instr->from();
1754 InstanceType to = instr->to();
1761 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
1762 InstanceType from = instr->from();
1763 InstanceType to = instr->to();
1772 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1773 Register input = ToRegister(instr->InputAt(0));
1775 int true_block = chunk_->LookupDestination(instr->true_block_id());
1776 int false_block = chunk_->LookupDestination(instr->false_block_id());
1782 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister);
1783 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1787 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1788 Register input = ToRegister(instr->InputAt(0));
1789 Register result = ToRegister(instr->result());
1802 LHasCachedArrayIndexAndBranch* instr) {
1803 Register input = ToRegister(instr->InputAt(0));
1805 int true_block = chunk_->LookupDestination(instr->true_block_id());
1806 int false_block = chunk_->LookupDestination(instr->false_block_id());
1882 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1883 Register input = ToRegister(instr->InputAt(0));
1884 Register temp = ToRegister(instr->TempAt(0));
1885 Register temp2 = ToRegister(instr->TempAt(1));
1886 Handle<String> class_name = instr->hydrogen()->class_name();
1888 int true_block = chunk_->LookupDestination(instr->true_block_id());
1889 int false_block = chunk_->LookupDestination(instr->false_block_id());
1900 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1901 Register reg = ToRegister(instr->InputAt(0));
1902 int true_block = instr->true_block_id();
1903 int false_block = instr->false_block_id();
1905 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
1910 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1912 __ push(ToRegister(instr->InputAt(0)));
1913 __ push(ToRegister(instr->InputAt(1)));
1914 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1918 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1921 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
1926 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1930 LInstanceOfKnownGlobal* instr)
1931 : LDeferredCode(codegen), instr_(instr) { }
1935 virtual LInstruction* instr() { return instr_; }
1944 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1947 Register object = ToRegister(instr->InputAt(0));
1957 Register map = ToRegister(instr->TempAt(0));
1966 __ LoadRoot(ToRegister(instr->result()), Heap::kTheHoleValueRootIndex);
1985 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1992 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2000 __ push(ToRegister(instr->InputAt(0)));
2001 instr->function());
2015 instr,
2019 ASSERT(instr->HasDeoptimizationEnvironment());
2020 LEnvironment* env = instr->deoptimization_environment();
2038 void LCodeGen::DoCmpT(LCmpT* instr) {
2039 Token::Value op = instr->op();
2042 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2048 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
2051 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
2056 void LCodeGen::DoReturn(LReturn* instr) {
2069 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2070 Register result = ToRegister(instr->result());
2071 __ LoadGlobalCell(result, instr->hydrogen()->cell());
2072 if (instr->hydrogen()->RequiresHoleCheck()) {
2074 DeoptimizeIf(equal, instr->environment());
2079 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2080 ASSERT(ToRegister(instr->global_object()).is(rax));
2081 ASSERT(ToRegister(instr->result()).is(rax));
2083 __ Move(rcx, instr->name());
2084 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET :
2087 CallCode(ic, mode, instr);
2091 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2092 Register value = ToRegister(instr->value());
2093 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell();
2099 if (instr->hydrogen()->RequiresHoleCheck()) {
2101 Register cell = ToRegister(instr->TempAt(0));
2105 DeoptimizeIf(equal, instr->environment());
2117 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2118 ASSERT(ToRegister(instr->global_object()).is(rdx));
2119 ASSERT(ToRegister(instr->value()).is(rax));
2121 __ Move(rcx, instr->name());
2122 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
2125 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2129 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2130 Register context = ToRegister(instr->context());
2131 Register result = ToRegister(instr->result());
2132 __ movq(result, ContextOperand(context, instr->slot_index()));
2133 if (instr->hydrogen()->RequiresHoleCheck()) {
2135 if (instr->hydrogen()->DeoptimizesOnHole()) {
2136 DeoptimizeIf(equal, instr->environment());
2147 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2148 Register context = ToRegister(instr->context());
2149 Register value = ToRegister(instr->value());
2151 Operand target = ContextOperand(context, instr->slot_index());
2154 if (instr->hydrogen()->RequiresHoleCheck()) {
2156 if (instr->hydrogen()->DeoptimizesOnHole()) {
2157 DeoptimizeIf(equal, instr->environment());
2164 if (instr->hydrogen()->NeedsWriteBarrier()) {
2165 HType type = instr->hydrogen()->value()->type();
2168 int offset = Context::SlotOffset(instr->slot_index());
2169 Register scratch = ToRegister(instr->TempAt(0));
2183 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2184 Register object = ToRegister(instr->InputAt(0));
2185 Register result = ToRegister(instr->result());
2186 if (instr->hydrogen()->is_in_object()) {
2187 __ movq(result, FieldOperand(object, instr->hydrogen()->offset()));
2190 __ movq(result, FieldOperand(result, instr->hydrogen()->offset()));
2222 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2223 Register object = ToRegister(instr->object());
2224 Register result = ToRegister(instr->result());
2226 int map_count = instr->hydrogen()->types()->length();
2227 Handle<String> name = instr->hydrogen()->name();
2230 ASSERT(instr->hydrogen()->need_generic());
2231 __ Move(rcx, instr->hydrogen()->name());
2233 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2237 Handle<Map> map = instr->hydrogen()->types()->at(i);
2245 Handle<Map> map = instr->hydrogen()->types()->last();
2247 if (instr->hydrogen()->need_generic()) {
2253 __ Move(rcx, instr->hydrogen()->name());
2255 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2257 DeoptimizeIf(not_equal, instr->environment());
2265 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2266 ASSERT(ToRegister(instr->object()).is(rax));
2267 ASSERT(ToRegister(instr->result()).is(rax));
2269 __ Move(rcx, instr->name());
2271 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2275 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2276 Register function = ToRegister(instr->function());
2277 Register result = ToRegister(instr->result());
2281 DeoptimizeIf(not_equal, instr->environment());
2295 DeoptimizeIf(equal, instr->environment());
2316 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2317 Register result = ToRegister(instr->result());
2318 Register input = ToRegister(instr->InputAt(0));
2350 LLoadExternalArrayPointer* instr) {
2351 Register result = ToRegister(instr->result());
2352 Register input = ToRegister(instr->InputAt(0));
2358 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2359 Register arguments = ToRegister(instr->arguments());
2360 Register length = ToRegister(instr->length());
2361 Register result = ToRegister(instr->result());
2363 if (instr->index()->IsRegister()) {
2364 __ subl(length, ToRegister(instr->index()));
2366 __ subl(length, ToOperand(instr->index()));
2368 DeoptimizeIf(below_equal, instr->environment());
2376 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2377 Register result = ToRegister(instr->result());
2381 BuildFastArrayOperand(instr->elements(), instr->key(),
2386 if (instr->hydrogen()->RequiresHoleCheck()) {
2388 DeoptimizeIf(equal, instr->environment());
2394 LLoadKeyedFastDoubleElement* instr) {
2395 XMMRegister result(ToDoubleRegister(instr->result()));
2400 instr->elements(),
2401 instr->key(),
2405 DeoptimizeIf(equal, instr->environment());
2408 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
2437 LLoadKeyedSpecializedArrayElement* instr) {
2438 ElementsKind elements_kind = instr->elements_kind();
2439 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2440 instr->key(), elements_kind, 0));
2442 XMMRegister result(ToDoubleRegister(instr->result()));
2446 __ movsd(ToDoubleRegister(instr->result()), operand);
2448 Register result(ToRegister(instr->result()));
2472 DeoptimizeIf(negative, instr->environment());
2488 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2489 ASSERT(ToRegister(instr->object()).is(rdx));
2490 ASSERT(ToRegister(instr->key()).is(rax));
2493 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2497 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2498 Register result = ToRegister(instr->result());
2521 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2522 Register result = ToRegister(instr->result());
2527 if (instr->InputAt(0)->IsRegister()) {
2528 __ cmpq(rbp, ToRegister(instr->InputAt(0)));
2530 __ cmpq(rbp, ToOperand(instr->InputAt(0)));
2546 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
2547 Register receiver = ToRegister(instr->receiver());
2548 Register function = ToRegister(instr->function());
2578 DeoptimizeIf(is_smi, instr->environment());
2580 DeoptimizeIf(below, instr->environment());
2594 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2595 Register receiver = ToRegister(instr->receiver());
2596 Register function = ToRegister(instr->function());
2597 Register length = ToRegister(instr->length());
2598 Register elements = ToRegister(instr->elements());
2601 ASSERT(ToRegister(instr->result()).is(rax));
2607 DeoptimizeIf(above, instr->environment());
2625 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2626 LPointerMap* pointers = instr->pointer_map();
2637 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2638 LOperand* argument = instr->InputAt(0);
2643 void LCodeGen::DoThisFunction(LThisFunction* instr) {
2644 Register result = ToRegister(instr->result());
2645 __ LoadHeapObject(result, instr->hydrogen()->closure());
2649 void LCodeGen::DoContext(LContext* instr) {
2650 Register result = ToRegister(instr->result());
2655 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2656 Register context = ToRegister(instr->context());
2657 Register result = ToRegister(instr->result());
2663 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
2665 __ PushHeapObject(instr->hydrogen()->pairs());
2666 __ Push(Smi::FromInt(instr->hydrogen()->flags()));
2667 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
2671 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2672 Register result = ToRegister(instr->result());
2677 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2678 Register global = ToRegister(instr->global());
2679 Register result = ToRegister(instr->result());
2686 LInstruction* instr,
2691 LPointerMap* pointers = instr->pointer_map();
2721 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT, 0);
2735 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2736 ASSERT(ToRegister(instr->result()).is(rax));
2737 CallKnownFunction(instr->function(),
2738 instr->arity(),
2739 instr,
2744 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2745 Register input_reg = ToRegister(instr->InputAt(0));
2748 DeoptimizeIf(not_equal, instr->environment());
2776 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
2796 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2797 Register input_reg = ToRegister(instr->InputAt(0));
2802 DeoptimizeIf(negative, instr->environment());
2807 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2812 LUnaryMathOperation* instr)
2813 : LDeferredCode(codegen), instr_(instr) { }
2817 virtual LInstruction* instr() { return instr_; }
2822 ASSERT(instr->InputAt(0)->Equals(instr->result()));
2823 Representation r = instr->hydrogen()->value()->representation();
2827 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2832 EmitIntegerMathAbs(instr);
2835 new DeferredMathAbsTaggedHeapNumber(this, instr);
2836 Register input_reg = ToRegister(instr->InputAt(0));
2840 EmitIntegerMathAbs(instr);
2847 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2849 Register output_reg = ToRegister(instr->result());
2850 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2855 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2859 DeoptimizeIf(overflow, instr->environment());
2864 DeoptimizeIf(equal, instr->environment());
2869 DeoptimizeIf(below, instr->environment());
2870 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2876 DeoptimizeIf(not_zero, instr->environment());
2887 DeoptimizeIf(equal, instr->environment());
2893 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2895 Register output_reg = ToRegister(instr->result());
2896 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2916 DeoptimizeIf(equal, instr->environment());
2920 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2924 DeoptimizeIf(negative, instr->environment());
2932 DeoptimizeIf(below, instr
2940 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2941 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2942 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2947 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
2949 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2950 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2979 void LCodeGen::DoPower(LPower* instr) {
2980 Representation exponent_type = instr->hydrogen()->right()->representation();
2990 ASSERT(!instr->InputAt(1)->IsRegister() ||
2991 ToRegister(instr->InputAt(1)).is(exponent));
2992 ASSERT(!instr->InputAt(1)->IsDoubleRegister() ||
2993 ToDoubleRegister(instr->InputAt(1)).is(xmm1));
2994 ASSERT(ToDoubleRegister(instr->InputAt(0)).is(xmm2));
2995 ASSERT(ToDoubleRegister(instr->result()).is(xmm3));
3001 DeoptimizeIf(not_equal, instr->environment());
3016 void LCodeGen::DoRandom(LRandom* instr) {
3019 DeferredDoRandom(LCodeGen* codegen, LRandom* instr)
3020 : LDeferredCode(codegen), instr_(instr) { }
3022 virtual LInstruction* instr() { return instr_; }
3027 DeferredDoRandom* deferred = new DeferredDoRandom(this, instr);
3031 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3036 ASSERT(ToRegister(instr->InputAt(0)).is(rcx));
3039 ASSERT(ToRegister(instr->InputAt(0)).is(rdi));
3098 void LCodeGen::DoDeferredRandom(LRandom* instr) {
3106 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3107 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3110 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3114 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) {
3115 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3118 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3122 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
3123 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3126 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3130 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
3131 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3134 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3138 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
3139 switch (instr->op()) {
3141 DoMathAbs(instr);
3144 DoMathFloor(instr);
3147 DoMathRound(instr);
3150 DoMathSqrt(instr);
3153 DoMathPowHalf(instr);
3156 DoMathCos(instr);
3159 DoMathSin(instr);
3162 DoMathTan(instr);
3165 DoMathLog(instr);
3174 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3175 ASSERT(ToRegister(instr->function()).is(rdi));
3176 ASSERT(instr->HasPointerMap());
3177 ASSERT(instr->HasDeoptimizationEnvironment());
3178 LPointerMap* pointers = instr->pointer_map();
3181 ParameterCount count(instr->arity());
3187 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3188 ASSERT(ToRegister(instr->key()).is(rcx));
3189 ASSERT(ToRegister(instr->result()).is(rax));
3191 int arity = instr->arity();
3194 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3199 void LCodeGen::DoCallNamed(LCallNamed* instr) {
3200 ASSERT(ToRegister(instr->result()).is(rax));
3202 int arity = instr->arity();
3206 __ Move(rcx, instr->name());
3207 CallCode(ic, mode, instr);
3212 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3213 ASSERT(ToRegister(instr->function()).is(rdi));
3214 ASSERT(ToRegister(instr->result()).is(rax));
3216 int arity = instr->arity();
3218 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3223 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3224 ASSERT(ToRegister(instr->result()).is(rax));
3225 int arity = instr->arity();
3229 __ Move(rcx, instr->name());
3230 CallCode(ic, mode, instr);
3235 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3236 ASSERT(ToRegister(instr->result()).is(rax));
3237 CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
3241 void LCodeGen::DoCallNew(LCallNew* instr) {
3242 ASSERT(ToRegister(instr->InputAt(0)).is(rdi));
3243 ASSERT(ToRegister(instr->result()).is(rax));
3246 __ Set(rax, instr->arity());
3247 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
3251 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3252 CallRuntime(instr->function(), instr->arity(), instr);
3256 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3257 Register object = ToRegister(instr->object());
3258 Register value = ToRegister(instr->value());
3259 int offset = instr->offset();
3261 if (!instr->transition().is_null()) {
3262 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition());
3266 HType type = instr->hydrogen()->value()->type();
3269 if (instr->is_in_object()) {
3271 if (instr->hydrogen()->NeedsWriteBarrier()) {
3272 Register temp = ToRegister(instr->TempAt(0));
3283 Register temp = ToRegister(instr->TempAt(0));
3286 if (instr->hydrogen()->NeedsWriteBarrier()) {
3301 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3302 ASSERT(ToRegister(instr->object()).is(rdx));
3303 ASSERT(ToRegister(instr->value()).is(rax));
3305 __ Move(rcx, instr->hydrogen()->name());
3306 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3309 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3314 LStoreKeyedSpecializedArrayElement* instr) {
3315 ElementsKind elements_kind = instr->elements_kind();
3316 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
3317 instr->key(), elements_kind, 0));
3319 XMMRegister value(ToDoubleRegister(instr->value()));
3323 __ movsd(operand, ToDoubleRegister(instr->value()));
3325 Register value(ToRegister(instr->value()));
3354 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3355 if (instr->length()->IsRegister()) {
3356 Register reg = ToRegister(instr->length());
3360 if (instr->index()->IsConstantOperand()) {
3362 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3364 Register reg2 = ToRegister(instr->index());
3371 if (instr->index()->IsConstantOperand()) {
3372 __ cmpq(ToOperand(instr->length()),
3373 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3375 __ cmpq(ToOperand(instr->length()), ToRegister(instr->index()));
3378 DeoptimizeIf(below_equal, instr->environment());
3382 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3383 Register value = ToRegister(instr->value());
3384 Register elements = ToRegister(instr->object());
3385 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3388 if (instr->key()->IsConstantOperand()) {
3389 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3390 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3402 if (instr->hydrogen()->NeedsWriteBarrier()) {
3403 HType type = instr->hydrogen()->value()->type();
3422 LStoreKeyedFastDoubleElement* instr) {
3423 XMMRegister value = ToDoubleRegister(instr->value());
3435 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
3440 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3441 ASSERT(ToRegister(instr->object()).is(rdx));
3442 ASSERT(ToRegister(instr->key()).is(rcx));
3443 ASSERT(ToRegister(instr->value()).is(rax));
3445 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3448 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3452 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
3453 Register object_reg = ToRegister(instr->object());
3454 Register new_map_reg = ToRegister(instr->new_map_reg());
3456 Handle<Map> from_map = instr->original_map();
3457 Handle<Map> to_map = instr->transitioned_map();
3468 ASSERT_NE(instr->temp_reg(), NULL);
3470 ToRegister(instr->temp_reg()), kDontSaveFPRegs);
3473 Register fixed_object_reg = ToRegister(instr->temp_reg());
3478 RelocInfo::CODE_TARGET, instr);
3480 Register fixed_object_reg = ToRegister(instr->temp_reg());
3485 RelocInfo::CODE_TARGET, instr);
3493 void LCodeGen::DoStringAdd(LStringAdd* instr) {
3494 EmitPushTaggedOperand(instr->left());
3495 EmitPushTaggedOperand(instr->right());
3497 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3501 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3504 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3505 : LDeferredCode(codegen), instr_(instr) { }
3507 virtual LInstruction* instr() { return instr_; }
3513 new DeferredStringCharCodeAt(this, instr);
3516 ToRegister(instr->string()),
3517 ToRegister(instr->index()),
3518 ToRegister(instr->result()),
3524 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3525 Register string = ToRegister(instr->string());
3526 Register result = ToRegister(instr->result());
3538 if (instr->index()->IsConstantOperand()) {
3539 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3542 Register index = ToRegister(instr->index());
3546 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
3555 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3558 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3559 : LDeferredCode(codegen), instr_(instr) { }
3561 virtual LInstruction* instr() { return instr_; }
3567 new DeferredStringCharFromCode(this, instr);
3569 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3570 Register char_code = ToRegister(instr->char_code());
3571 Register result = ToRegister(instr->result());
3586 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3587 Register char_code = ToRegister(instr->char_code());
3588 Register result = ToRegister(instr->result());
3598 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
3603 void LCodeGen::DoStringLength(LStringLength* instr) {
3604 Register string = ToRegister(instr->string());
3605 Register result = ToRegister(instr->result());
3610 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3611 LOperand* input = instr->InputAt(0);
3613 LOperand* output = instr->result();
3623 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3624 LOperand* input = instr->InputAt(0);
3625 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3632 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3635 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3636 : LDeferredCode(codegen), instr_(instr) { }
3638 virtual LInstruction* instr() { return instr_; }
3643 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3644 Register reg = ToRegister(instr->result());
3645 Register tmp = ToRegister(instr->TempAt(0));
3647 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3658 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3662 Register reg = ToRegister(instr->result());
3667 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3675 void LCodeGen::DoSmiTag(LSmiTag* instr) {
3676 ASSERT(instr->InputAt(0)->Equals(instr->result()));
3677 Register input = ToRegister(instr->InputAt(0));
3678 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3683 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3684 ASSERT(instr->InputAt(0)->Equals(instr->result()));
3685 Register input = ToRegister(instr->InputAt(0));
3686 if (instr->needs_check()) {
3688 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
3744 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3746 Register input_reg = ToRegister(instr->InputAt(0));
3752 if (instr->truncating()) {
3757 DeoptimizeIf(not_equal, instr->environment());
3767 DeoptimizeIf(equal, instr->environment());
3770 DeoptimizeIf(not_equal, instr->environment());
3772 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0));
3777 DeoptimizeIf(not_equal, instr->environment());
3778 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3779 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3784 DeoptimizeIf(not_zero, instr->environment());
3791 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3794 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3795 : LDeferredCode(codegen), instr_(instr) { }
3797 virtual LInstruction* instr() { return instr_; }
3802 LOperand* input = instr->InputAt(0);
3804 ASSERT(input->Equals(instr->result()));
3807 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3814 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3815 LOperand* input = instr->InputAt(0);
3817 LOperand* result = instr->result();
3824 instr->hydrogen()->deoptimize_on_undefined(),
3825 instr->hydrogen()->deoptimize_on_minus_zero(),
3826 instr->environment());
3830 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3831 LOperand* input = instr->InputAt(0);
3833 LOperand* result = instr->result();
3839 if (instr->truncating()) {
3845 DeoptimizeIf(equal, instr->environment());
3850 DeoptimizeIf(not_equal, instr->environment());
3851 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3852 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3863 DeoptimizeIf(not_zero, instr->environment());
3870 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
3871 LOperand* input = instr->InputAt(0);
3873 DeoptimizeIf(NegateCondition(cc), instr->environment());
3877 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
3878 LOperand* input = instr->InputAt(0);
3880 DeoptimizeIf(cc, instr->environment());
3884 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3885 Register input = ToRegister(instr->InputAt(0));
3889 if (instr->hydrogen()->is_interval_check()) {
3892 instr->hydrogen()->GetCheckInterval(&first, &last);
3899 DeoptimizeIf(not_equal, instr->environment());
3901 DeoptimizeIf(below, instr->environment());
3906 DeoptimizeIf(above, instr->environment());
3912 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
3918 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment());
3924 DeoptimizeIf(not_equal, instr->environment());
3930 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3931 Register reg = ToRegister(instr->value());
3932 Handle<JSFunction> target = instr->hydrogen()->target();
3941 DeoptimizeIf(not_equal, instr->environment());
3956 void LCodeGen::DoCheckMap(LCheckMap* instr) {
3957 LOperand* input = instr->InputAt(0);
3960 Handle<Map> map = instr->hydrogen()->map();
3961 DoCheckMapCommon(reg, map, instr->hydrogen()->mode(), instr->environment());
3965 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
3966 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
3967 Register result_reg = ToRegister(instr->result());
3968 Register temp_reg = ToRegister(instr->TempAt(0));
3973 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
3974 ASSERT(instr->unclamped()->Equals(instr->result()));
3975 Register value_reg = ToRegister(instr->result());
3980 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
3981 ASSERT(instr->unclamped()->Equals(instr->result()));
3982 Register input_reg = ToRegister(instr->unclamped());
3983 Register temp_reg = ToRegister(instr->TempAt(0));
3984 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->TempAt(1));
3997 DeoptimizeIf(not_equal, instr->environment());
4016 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
4017 Register reg = ToRegister(instr->TempAt(0));
4019 Handle<JSObject> holder = instr->holder();
4020 Handle<JSObject> current_prototype = instr->prototype();
4028 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4037 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4041 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
4044 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
4045 : LDeferredCode(codegen), instr_(instr) { }
4047 virtual LInstruction* instr() { return instr_; }
4052 DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr);
4054 Register result = ToRegister(instr->result());
4055 Register scratch = ToRegister(instr->TempAt(0));
4056 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4113 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
4114 Register result = ToRegister(instr->result());
4115 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4124 CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr);
4129 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4132 instr->hydrogen()->boilerplate_elements_kind();
4138 __ LoadHeapObject(rax, instr->hydrogen()->boilerplate_object());
4146 DeoptimizeIf(not_equal, instr->environment());
4152 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
4158 int length = instr->hydrogen()->length();
4159 if (instr->hydrogen()->IsCopyOnWrite()) {
4160 ASSERT(instr->hydrogen()->depth() == 1);
4164 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4165 } else if (instr->hydrogen()->depth() > 1) {
4166 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
4168 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
4175 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4277 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4278 int size = instr->hydrogen()->total_size();
4288 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4292 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate());
4293 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset);
4298 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
4299 Handle<FixedArray> literals(instr->environment()->closure()->literals());
4301 instr->hydrogen()->constant_properties();
4305 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
4307 int flags = instr->hydrogen()->fast_elements()
4310 flags |= instr->hydrogen()->has_function()
4317 if (instr->hydrogen()->depth() > 1) {
4318 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
4321 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
4324 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4329 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
4330 instr->InputAt(0)).is(rax));
4332 CallRuntime(Runtime::kToFastProperties, 1, instr);
4336 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
4346 instr->hydrogen()->literal_index() * kPointerSize;
4354 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
4355 __ Push(instr->hydrogen()->pattern());
4356 __ Push(instr->hydrogen()->flags());
4357 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
4369 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4388 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
4391 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
4392 bool pretenure = instr->hydrogen()->pretenure();
4396 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4403 CallRuntime(Runtime::kNewClosure, 3, instr);
4408 void LCodeGen::DoTypeof(LTypeof* instr) {
4409 LOperand* input = instr->InputAt(0);
4411 CallRuntime(Runtime::kTypeof, 1, instr);
4432 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
4433 Register input = ToRegister(instr->InputAt(0));
4434 int true_block = chunk_->LookupDestination(instr->true_block_id());
4435 int false_block = chunk_->LookupDestination(instr->false_block_id());
4440 EmitTypeofIs(true_label, false_label, input, instr->type_literal());
4518 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
4519 Register temp = ToRegister(instr->TempAt(0));
4520 int true_block = chunk_->LookupDestination(instr->true_block_id());
4521 int false_block = chunk_->LookupDestination(instr->false_block_id());
4557 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
4560 ASSERT(instr->HasEnvironment());
4561 LEnvironment* env = instr->environment();
4567 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
4568 DeoptimizeIf(no_condition, instr->environment());
4572 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
4573 LOperand* obj = instr->object();
4574 LOperand* key = instr->key();
4577 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4578 LPointerMap* pointers = instr->pointer_map();
4590 void LCodeGen::DoIn(LIn* instr) {
4591 LOperand* obj = instr->object();
4592 LOperand* key = instr->key();
4595 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4596 LPointerMap* pointers = instr->pointer_map();
4604 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
4608 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0);
4609 ASSERT(instr->HasEnvironment());
4610 LEnvironment* env = instr->environment();
4615 void LCodeGen::DoStackCheck(LStackCheck* instr) {
4618 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
4619 : LDeferredCode(codegen), instr_(instr) { }
4621 virtual LInstruction* instr() { return instr_; }
4626 ASSERT(instr->HasEnvironment());
4627 LEnvironment* env = instr->environment();
4630 if (instr->hydrogen()->is_function_entry()) {
4636 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4643 ASSERT(instr->hydrogen()->is_backwards_branch());
4646 new DeferredStackCheck(this, instr);
4651 __ bind(instr->done_label());
4652 deferred_stack_check->SetExit(instr->done_label());
4661 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4665 LEnvironment* environment = instr->environment();
4666 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4667 instr->SpilledDoubleRegisterArray());
4678 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4680 DeoptimizeIf(equal, instr->environment());
4685 DeoptimizeIf(equal, instr->environment());
4688 DeoptimizeIf(cc, instr->environment());
4692 DeoptimizeIf(below_equal, instr->environment());
4703 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
4707 DeoptimizeIf(not_equal, instr->environment());
4712 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
4713 Register map = ToRegister(instr->map());
4714 Register result = ToRegister(instr->result());
4719 FieldOperand(result, FixedArray::SizeFor(instr->idx())));
4721 DeoptimizeIf(cc, instr->environment());
4725 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
4726 Register object = ToRegister(instr->value());
4727 __ cmpq(ToRegister(instr->map()),
4729 DeoptimizeIf(not_equal, instr->environment());
4733 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
4734 Register object = ToRegister(instr->object());
4735 Register index = ToRegister(instr->index());