Home | History | Annotate | Download | only in x64

Lines Matching refs:instr

228     LInstruction* instr = instructions_->at(current_instruction_);
229 if (instr->IsLabel()) {
230 LLabel* label = LLabel::cast(instr);
235 Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
236 instr->CompileToNative(this);
445 LInstruction* instr,
448 ASSERT(instr != NULL);
449 LPointerMap* pointers = instr->pointer_map();
452 RegisterLazyDeoptimization(instr, safepoint_mode, argc);
465 LInstruction* instr) {
466 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, 0);
472 LInstruction* instr) {
473 ASSERT(instr != NULL);
474 ASSERT(instr->HasPointerMap());
475 LPointerMap* pointers = instr->pointer_map();
479 RegisterLazyDeoptimization(instr, RECORD_SIMPLE_SAFEPOINT, 0);
485 LInstruction* instr) {
489 instr->pointer_map(), argc, Safepoint::kNoDeoptimizationIndex);
493 void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr,
500 if (instr->HasDeoptimizationEnvironment()) {
501 deoptimization_environment = instr->deoptimization_environment();
503 deoptimization_environment = instr->environment();
509 RecordSafepoint(instr->pointer_map(),
514 instr->pointer_map(),
719 void LCodeGen::DoParameter(LParameter* instr) {
724 void LCodeGen::DoCallStub(LCallStub* instr) {
725 ASSERT(ToRegister(instr->result()).is(rax));
726 switch (instr->hydrogen()->major_key()) {
729 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
734 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
739 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
744 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
749 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
754 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
758 TranscendentalCacheStub stub(instr->transcendental_type(),
760 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
769 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
774 void LCodeGen::DoModI(LModI* instr) {
775 if (instr->hydrogen()->HasPowerOf2Divisor()) {
776 Register dividend = ToRegister(instr->InputAt(0));
779 HConstant::cast(instr->hydrogen()->right())->Integer32Value();
789 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
791 DeoptimizeIf(no_condition, instr->environment());
799 LOperand* right = instr->InputAt(1);
802 ASSERT(ToRegister(instr->result()).is(rdx));
803 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
808 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
810 DeoptimizeIf(zero, instr->environment());
818 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
829 DeoptimizeIf(no_condition, instr->environment());
840 void LCodeGen::DoDivI(LDivI* instr) {
841 LOperand* right = instr->InputAt(1);
842 ASSERT(ToRegister(instr->result()).is(rax));
843 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
844 ASSERT(!ToRegister(instr->InputAt(1)).is(rax));
845 ASSERT(!ToRegister(instr->InputAt(1)).is(rdx));
851 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
853 DeoptimizeIf(zero, instr->environment());
857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
862 DeoptimizeIf(sign, instr->environment());
867 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
872 DeoptimizeIf(zero, instr->environment());
882 DeoptimizeIf(not_zero, instr->environment());
886 void LCodeGen::DoMulI(LMulI* instr) {
887 Register left = ToRegister(instr->InputAt(0));
888 LOperand* right = instr->InputAt(1);
890 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
895 instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
944 DeoptimizeIf(overflow, instr->environment());
947 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
954 DeoptimizeIf(no_condition, instr->environment());
958 DeoptimizeIf(sign, instr->environment());
962 DeoptimizeIf(sign, instr->environment());
969 void LCodeGen::DoBitI(LBitI* instr) {
970 LOperand* left = instr->InputAt(0);
971 LOperand* right = instr->InputAt(1);
972 ASSERT(left->Equals(instr->result()));
977 switch (instr->op()) {
992 switch (instr->op()) {
1008 switch (instr->op()) {
1026 void LCodeGen::DoShiftI(LShiftI* instr) {
1027 LOperand* left = instr->InputAt(0);
1028 LOperand* right = instr->InputAt(1);
1029 ASSERT(left->Equals(instr->result()));
1034 switch (instr->op()) {
1040 if (instr->can_deopt()) {
1042 DeoptimizeIf(negative, instr->environment());
1055 switch (instr->op()) {
1062 if (shift_count == 0 && instr->can_deopt()) {
1064 DeoptimizeIf(negative, instr->environment());
1082 void LCodeGen::DoSubI(LSubI* instr) {
1083 LOperand* left = instr->InputAt(0);
1084 LOperand* right = instr->InputAt(1);
1085 ASSERT(left->Equals(instr->result()));
1096 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1097 DeoptimizeIf(overflow, instr->environment());
1102 void LCodeGen::DoConstantI(LConstantI* instr) {
1103 ASSERT(instr->result()->IsRegister());
1104 __ Set(ToRegister(instr->result()), instr->value());
1108 void LCodeGen::DoConstantD(LConstantD* instr) {
1109 ASSERT(instr->result()->IsDoubleRegister());
1110 XMMRegister res = ToDoubleRegister(instr->result());
1111 double v = instr->value();
1118 Register tmp = ToRegister(instr->TempAt(0));
1125 void LCodeGen::DoConstantT(LConstantT* instr) {
1126 ASSERT(instr->result()->IsRegister());
1127 __ Move(ToRegister(instr->result()), instr->value());
1131 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1132 Register result = ToRegister(instr->result());
1133 Register array = ToRegister(instr->InputAt(0));
1138 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1139 Register result = ToRegister(instr->result());
1140 Register array = ToRegister(instr->InputAt(0));
1145 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1146 Register result = ToRegister(instr->result());
1147 Register array = ToRegister(instr->InputAt(0));
1152 void LCodeGen::DoValueOf(LValueOf* instr) {
1153 Register input = ToRegister(instr->InputAt(0));
1154 Register result = ToRegister(instr->result());
1169 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1170 LOperand* input = instr->InputAt(0);
1171 ASSERT(input->Equals(instr->result()));
1176 void LCodeGen::DoThrow(LThrow* instr) {
1177 __ push(ToRegister(instr->InputAt(0)));
1178 CallRuntime(Runtime::kThrow, 1, instr);
1187 void LCodeGen::DoAddI(LAddI* instr) {
1188 LOperand* left = instr->InputAt(0);
1189 LOperand* right = instr->InputAt(1);
1190 ASSERT(left->Equals(instr->result()));
1201 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1202 DeoptimizeIf(overflow, instr->environment());
1207 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1208 XMMRegister left = ToDoubleRegister(instr->InputAt(0));
1209 XMMRegister right = ToDoubleRegister(instr->InputAt(1));
1210 XMMRegister result = ToDoubleRegister(instr->result());
1212 ASSERT(instr->op() == Token::MOD || left.is(result));
1213 switch (instr->op()) {
1242 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1243 ASSERT(ToRegister(instr->InputAt(0)).is(rdx));
1244 ASSERT(ToRegister(instr->InputAt(1)).is(rax));
1245 ASSERT(ToRegister(instr->result()).is(rax));
1247 TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
1248 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1282 void LCodeGen::DoBranch(LBranch* instr) {
1283 int true_block = chunk_->LookupDestination(instr->true_block_id());
1284 int false_block = chunk_->LookupDestination(instr->false_block_id());
1286 Representation r = instr->hydrogen()->representation();
1288 Register reg = ToRegister(instr->InputAt(0));
1292 XMMRegister reg = ToDoubleRegister(instr->InputAt(0));
1298 Register reg = ToRegister(instr->InputAt(0));
1299 HType type = instr->hydrogen()->type();
1365 void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
1367 CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr);
1371 void LCodeGen::DoGoto(LGoto* instr) {
1374 DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
1375 : LDeferredCode(codegen), instr_(instr) { }
1382 if (instr->include_stack_check()) {
1383 deferred = new DeferredStackCheck(this, instr);
1385 EmitGoto(instr->block_id(), deferred);
1433 void LCodeGen::DoCmpID(LCmpID* instr) {
1434 LOperand* left = instr->InputAt(0);
1435 LOperand* right = instr->InputAt(1);
1436 LOperand* result = instr->result();
1439 if (instr->is_double()) {
1449 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1459 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1460 LOperand* left = instr->InputAt(0);
1461 LOperand* right = instr->InputAt(1);
1462 int false_block = chunk_->LookupDestination(instr->false_block_id());
1463 int true_block = chunk_->LookupDestination(instr->true_block_id());
1465 if (instr->is_double()) {
1474 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1479 void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
1480 Register left = ToRegister(instr->InputAt(0));
1481 Register right = ToRegister(instr->InputAt(1));
1482 Register result = ToRegister(instr->result());
1495 void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
1496 Register left = ToRegister(instr->InputAt(0));
1497 Register right = ToRegister(instr->InputAt(1));
1498 int false_block = chunk_->LookupDestination(instr->false_block_id());
1499 int true_block = chunk_->LookupDestination(instr->true_block_id());
1506 void LCodeGen::DoIsNull(LIsNull* instr) {
1507 Register reg = ToRegister(instr->InputAt(0));
1508 Register result = ToRegister(instr->result());
1513 if (instr->hydrogen()->value()->type().IsSmi()) {
1519 if (instr->is_strict()) {
1550 void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) {
1551 Register reg = ToRegister(instr->InputAt(0));
1553 int false_block = chunk_->LookupDestination(instr->false_block_id());
1555 if (instr->hydrogen()->representation().IsSpecialization() ||
1556 instr->hydrogen()->type().IsSmi()) {
1564 instr->true_block_id());
1567 if (instr->is_strict()) {
1578 Register scratch = ToRegister(instr->TempAt(0));
1612 void LCodeGen::DoIsObject(LIsObject* instr) {
1613 Register reg = ToRegister(instr->InputAt(0));
1614 Register result = ToRegister(instr->result());
1631 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1632 Register reg = ToRegister(instr->InputAt(0));
1634 int true_block = chunk_->LookupDestination(instr->true_block_id());
1635 int false_block = chunk_->LookupDestination(instr->false_block_id());
1645 void LCodeGen::DoIsSmi(LIsSmi* instr) {
1646 LOperand* input_operand = instr->InputAt(0);
1647 Register result = ToRegister(instr->result());
1652 Operand input = ToOperand(instr->InputAt(0));
1661 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1662 int true_block = chunk_->LookupDestination(instr->true_block_id());
1663 int false_block = chunk_->LookupDestination(instr->false_block_id());
1666 if (instr->InputAt(0)->IsRegister()) {
1667 Register input = ToRegister(instr->InputAt(0));
1670 Operand input = ToOperand(instr->InputAt(0));
1677 static InstanceType TestType(HHasInstanceType* instr) {
1678 InstanceType from = instr->from();
1679 InstanceType to = instr->to();
1686 static Condition BranchCondition(HHasInstanceType* instr) {
1687 InstanceType from = instr->from();
1688 InstanceType to = instr->to();
1697 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) {
1698 Register input = ToRegister(instr->InputAt(0));
1699 Register result = ToRegister(instr->result());
1701 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1705 __ CmpObjectType(input, TestType(instr->hydrogen()), result);
1706 __ j(NegateCondition(BranchCondition(instr->hydrogen())), &is_false);
1715 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1716 Register input = ToRegister(instr->InputAt(0));
1718 int true_block = chunk_->LookupDestination(instr->true_block_id());
1719 int false_block = chunk_->LookupDestination(instr->false_block_id());
1725 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister);
1726 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1730 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1731 Register input = ToRegister(instr->InputAt(0));
1732 Register result = ToRegister(instr->result());
1744 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1745 Register input = ToRegister(instr->InputAt(0));
1746 Register result = ToRegister(instr->result());
1748 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1760 LHasCachedArrayIndexAndBranch* instr) {
1761 Register input = ToRegister(instr->InputAt(0));
1763 int true_block = chunk_->LookupDestination(instr->true_block_id());
1764 int false_block = chunk_->LookupDestination(instr->false_block_id());
1826 void LCodeGen::DoClassOfTest(LClassOfTest* instr) {
1827 Register input = ToRegister(instr->InputAt(0));
1828 Register result = ToRegister(instr->result());
1830 Register temp = ToRegister(instr->TempAt(0));
1831 Handle<String> class_name = instr->hydrogen()->class_name();
1849 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1850 Register input = ToRegister(instr->InputAt(0));
1851 Register temp = ToRegister(instr->TempAt(0));
1852 Handle<String> class_name = instr->hydrogen()->class_name();
1854 int true_block = chunk_->LookupDestination(instr->true_block_id());
1855 int false_block = chunk_->LookupDestination(instr->false_block_id());
1866 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1867 Register reg = ToRegister(instr->InputAt(0));
1868 int true_block = instr->true_block_id();
1869 int false_block = instr->false_block_id();
1871 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
1876 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1878 __ push(ToRegister(instr->InputAt(0)));
1879 __ push(ToRegister(instr->InputAt(1)));
1880 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1884 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1887 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
1892 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
1893 int true_block = chunk_->LookupDestination(instr->true_block_id());
1894 int false_block = chunk_->LookupDestination(instr->false_block_id());
1897 __ push(ToRegister(instr->InputAt(0)));
1898 __ push(ToRegister(instr->InputAt(1)));
1899 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1905 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1909 LInstanceOfKnownGlobal* instr)
1910 : LDeferredCode(codegen), instr_(instr) { }
1924 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1927 Register object = ToRegister(instr->InputAt(0));
1937 Register map = ToRegister(instr->TempAt(0));
1945 __ LoadRoot(ToRegister(instr->result()), Heap::kTheHoleValueRootIndex);
1964 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1971 void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
1979 __ push(ToRegister(instr->InputAt(0)));
1980 __ Push(instr->function());
1982 Register temp = ToRegister(instr->TempAt(0));
1995 instr,
2015 void LCodeGen::DoCmpT(LCmpT* instr) {
2016 Token::Value op = instr->op();
2019 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2028 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
2031 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
2036 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
2037 Token::Value op = instr->op();
2038 int true_block = chunk_->LookupDestination(instr->true_block_id());
2039 int false_block = chunk_->LookupDestination(instr->false_block_id());
2042 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2055 void LCodeGen::DoReturn(LReturn* instr) {
2068 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2069 Register result = ToRegister(instr->result());
2071 __ load_rax(instr->hydrogen()->cell().location(),
2074 __ movq(result, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL);
2077 if (instr->hydrogen()->check_hole_value()) {
2079 DeoptimizeIf(equal, instr->environment());
2084 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2085 ASSERT(ToRegister(instr->global_object()).is(rax));
2086 ASSERT(ToRegister(instr->result()).is(rax));
2088 __ Move(rcx, instr->name());
2089 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET :
2092 CallCode(ic, mode, instr);
2096 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2097 Register value = ToRegister(instr->InputAt(0));
2098 Register temp = ToRegister(instr->TempAt(0));
2100 bool check_hole = instr->hydrogen()->check_hole_value();
2102 __ store_rax(instr->hydrogen()->cell().location(),
2110 __ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL);
2113 DeoptimizeIf(equal, instr->environment());
2119 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2120 ASSERT(ToRegister(instr->global_object()).is(rdx));
2121 ASSERT(ToRegister(instr->value()).is(rax));
2123 __ Move(rcx, instr->name());
2124 Handle<Code> ic = instr->strict_mode()
2127 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2131 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2132 Register context = ToRegister(instr->context());
2133 Register result = ToRegister(instr->result());
2134 __ movq(result, ContextOperand(context, instr->slot_index()));
2138 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2139 Register context = ToRegister(instr->context());
2140 Register value = ToRegister(instr->value());
2141 __ movq(ContextOperand(context, instr->slot_index()), value);
2142 if (instr->needs_write_barrier()) {
2143 int offset = Context::SlotOffset(instr->slot_index());
2144 Register scratch = ToRegister(instr->TempAt(0));
2150 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2151 Register object = ToRegister(instr->InputAt(0));
2152 Register result = ToRegister(instr->result());
2153 if (instr->hydrogen()->is_in_object()) {
2154 __ movq(result, FieldOperand(object, instr->hydrogen()->offset()));
2157 __ movq(result, FieldOperand(result, instr->hydrogen()->offset()));
2183 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2184 Register object = ToRegister(instr->object());
2185 Register result = ToRegister(instr->result());
2187 int map_count = instr->hydrogen()->types()->length();
2188 Handle<String> name = instr->hydrogen()->name();
2191 ASSERT(instr->hydrogen()->need_generic());
2192 __ Move(rcx, instr->hydrogen()->name());
2194 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2198 Handle<Map> map = instr->hydrogen()->types()->at(i);
2206 Handle<Map> map = instr->hydrogen()->types()->last();
2208 if (instr->hydrogen()->need_generic()) {
2214 __ Move(rcx, instr->hydrogen()->name());
2216 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2218 DeoptimizeIf(not_equal, instr->environment());
2226 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2227 ASSERT(ToRegister(instr->object()).is(rax));
2228 ASSERT(ToRegister(instr->result()).is(rax));
2230 __ Move(rcx, instr->name());
2232 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2236 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2237 Register function = ToRegister(instr->function());
2238 Register result = ToRegister(instr->result());
2242 DeoptimizeIf(not_equal, instr->environment());
2256 DeoptimizeIf(equal, instr->environment());
2277 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2278 Register result = ToRegister(instr->result());
2279 Register input = ToRegister(instr->InputAt(0));
2303 LLoadExternalArrayPointer* instr) {
2304 Register result = ToRegister(instr->result());
2305 Register input = ToRegister(instr->InputAt(0));
2311 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2312 Register arguments = ToRegister(instr->arguments());
2313 Register length = ToRegister(instr->length());
2314 Register result = ToRegister(instr->result());
2316 if (instr->index()->IsRegister()) {
2317 __ subl(length, ToRegister(instr->index()));
2319 __ subl(length, ToOperand(instr->index()));
2321 DeoptimizeIf(below_equal, instr->environment());
2329 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2330 Register elements = ToRegister(instr->elements());
2331 Register key = ToRegister(instr->key());
2332 Register result = ToRegister(instr->result());
2343 DeoptimizeIf(equal, instr->environment());
2348 LLoadKeyedSpecializedArrayElement* instr) {
2349 Register external_pointer = ToRegister(instr->external_pointer());
2350 Register key = ToRegister(instr->key());
2351 ExternalArrayType array_type = instr->array_type();
2353 XMMRegister result(ToDoubleRegister(instr->result()));
2357 Register result(ToRegister(instr->result()));
2381 DeoptimizeIf(negative, instr->environment());
2391 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2392 ASSERT(ToRegister(instr->object()).is(rdx));
2393 ASSERT(ToRegister(instr->key()).is(rax));
2396 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2400 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2401 Register result = ToRegister(instr->result());
2424 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2425 Register result = ToRegister(instr->result());
2430 if (instr->InputAt(0)->IsRegister()) {
2431 __ cmpq(rbp, ToRegister(instr->InputAt(0)));
2433 __ cmpq(rbp, ToOperand(instr->InputAt(0)));
2449 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2450 Register receiver = ToRegister(instr->receiver());
2451 Register function = ToRegister(instr->function());
2452 Register length = ToRegister(instr->length());
2453 Register elements = ToRegister(instr->elements());
2456 ASSERT(ToRegister(instr->result()).is(rax));
2468 DeoptimizeIf(is_smi, instr->environment());
2470 DeoptimizeIf(below, instr->environment());
2485 DeoptimizeIf(above, instr->environment());
2503 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2504 LPointerMap* pointers = instr->pointer_map();
2505 LEnvironment* env = instr
2516 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2517 LOperand* argument = instr->InputAt(0);
2529 void LCodeGen::DoContext(LContext* instr) {
2530 Register result = ToRegister(instr->result());
2535 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2536 Register context = ToRegister(instr->context());
2537 Register result = ToRegister(instr->result());
2544 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2545 Register result = ToRegister(instr->result());
2550 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2551 Register global = ToRegister(instr->global());
2552 Register result = ToRegister(instr->result());
2559 LInstruction* instr) {
2575 LPointerMap* pointers = instr->pointer_map();
2586 RegisterLazyDeoptimization(instr, RECORD_SIMPLE_SAFEPOINT, 0);
2593 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2594 ASSERT(ToRegister(instr->result()).is(rax));
2595 __ Move(rdi, instr->function());
2596 CallKnownFunction(instr->function(), instr->arity(), instr);
2600 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2601 Register input_reg = ToRegister(instr->InputAt(0));
2604 DeoptimizeIf(not_equal, instr->environment());
2632 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
2652 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2653 Register input_reg = ToRegister(instr->InputAt(0));
2658 DeoptimizeIf(negative, instr->environment());
2663 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2668 LUnaryMathOperation* instr)
2669 : LDeferredCode(codegen), instr_(instr) { }
2677 ASSERT(instr->InputAt(0)->Equals(instr->result()));
2678 Representation r = instr->hydrogen()->value()->representation();
2682 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2687 EmitIntegerMathAbs(instr);
2690 new DeferredMathAbsTaggedHeapNumber(this, instr);
2691 Register input_reg = ToRegister(instr->InputAt(0));
2695 EmitIntegerMathAbs(instr);
2702 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2704 Register output_reg = ToRegister(instr->result());
2705 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2709 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2710 DeoptimizeIf(below_equal, instr->environment());
2712 DeoptimizeIf(below, instr->environment());
2720 DeoptimizeIf(equal, instr->environment());
2724 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2726 Register output_reg = ToRegister(instr->result());
2727 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2738 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2740 DeoptimizeIf(below_equal, instr->environment());
2746 DeoptimizeIf(below, instr->environment());
2755 DeoptimizeIf(equal, instr->environment());
2759 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2760 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2761 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2766 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
2768 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2769 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2776 void LCodeGen::DoPower(LPower* instr) {
2777 LOperand* left = instr->InputAt(0);
2780 LOperand* right = instr->InputAt(1);
2781 XMMRegister result_reg = ToDoubleRegister(instr->result());
2782 Representation exponent_type = instr->hydrogen()->right()->representation();
2814 DeoptimizeIf(not_equal, instr->environment());
2832 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
2833 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2836 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2840 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
2841 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2844 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2848 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
2849 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2852 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2856 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2857 switch (instr->op()) {
2859 DoMathAbs(instr);
2862 DoMathFloor(instr);
2865 DoMathRound(instr);
2868 DoMathSqrt(instr);
2871 DoMathPowHalf(instr);
2874 DoMathCos(instr);
2877 DoMathSin(instr);
2880 DoMathLog(instr);
2889 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
2890 ASSERT(ToRegister(instr->key()).is(rcx));
2891 ASSERT(ToRegister(instr->result()).is(rax));
2893 int arity = instr->arity();
2896 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2901 void LCodeGen::DoCallNamed(LCallNamed* instr) {
2902 ASSERT(ToRegister(instr->result()).is(rax));
2904 int arity = instr->arity();
2907 __ Move(rcx, instr->name());
2908 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2913 void LCodeGen::DoCallFunction(LCallFunction* instr) {
2914 ASSERT(ToRegister(instr->result()).is(rax));
2916 int arity = instr->arity();
2918 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2924 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
2925 ASSERT(ToRegister(instr->result()).is(rax));
2926 int arity = instr->arity();
2929 __ Move(rcx, instr->name());
2930 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2935 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
2936 ASSERT(ToRegister(instr->result()).is(rax));
2937 __ Move(rdi, instr->target());
2938 CallKnownFunction(instr->target(), instr->arity(), instr);
2942 void LCodeGen::DoCallNew(LCallNew* instr) {
2943 ASSERT(ToRegister(instr->InputAt(0)).is(rdi));
2944 ASSERT(ToRegister(instr->result()).is(rax));
2947 __ Set(rax, instr->arity());
2948 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
2952 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
2953 CallRuntime(instr->function(), instr->arity(), instr);
2957 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
2958 Register object = ToRegister(instr->object());
2959 Register value = ToRegister(instr->value());
2960 int offset = instr->offset();
2962 if (!instr->transition().is_null()) {
2963 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition());
2967 if (instr->is_in_object()) {
2969 if (instr->needs_write_barrier()) {
2970 Register temp = ToRegister(instr->TempAt(0));
2975 Register temp = ToRegister(instr->TempAt(0));
2978 if (instr->needs_write_barrier()) {
2987 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
2988 ASSERT(ToRegister(instr->object()).is(rdx));
2989 ASSERT(ToRegister(instr->value()).is(rax));
2991 __ Move(rcx, instr->hydrogen()->name());
2992 Handle<Code> ic = instr->strict_mode()
2995 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3000 LStoreKeyedSpecializedArrayElement* instr) {
3001 Register external_pointer = ToRegister(instr->external_pointer());
3002 Register key = ToRegister(instr->key());
3003 ExternalArrayType array_type = instr->array_type();
3005 XMMRegister value(ToDoubleRegister(instr->value()));
3009 Register value(ToRegister(instr->value()));
3042 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3043 if (instr->length()->IsRegister()) {
3044 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length()));
3046 __ cmpq(ToRegister(instr->index()), ToOperand(instr->length()));
3048 DeoptimizeIf(above_equal, instr->environment());
3052 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3053 Register value = ToRegister(instr->value());
3054 Register elements = ToRegister(instr->object());
3055 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3058 if (instr->key()->IsConstantOperand()) {
3059 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3060 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3072 if (instr->hydrogen()->NeedsWriteBarrier()) {
3083 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3084 ASSERT(ToRegister(instr->object()).is(rdx));
3085 ASSERT(ToRegister(instr->key()).is(rcx));
3086 ASSERT(ToRegister(instr->value()).is(rax));
3088 Handle<Code> ic = instr->strict_mode()
3091 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3095 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3098 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3099 : LDeferredCode(codegen), instr_(instr) { }
3105 Register string = ToRegister(instr->string());
3108 if (instr->index()->IsConstantOperand()) {
3109 const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3122 index = ToRegister(instr->index());
3124 Register result = ToRegister(instr->result());
3127 new DeferredStringCharCodeAt(this, instr);
3170 if (instr->index()->IsConstantOperand()) {
3186 if (instr->index()->IsConstantOperand()) {
3200 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3201 Register string = ToRegister(instr->string());
3202 Register result = ToRegister(instr->result());
3214 if (instr->index()->IsConstantOperand()) {
3215 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3218 Register index = ToRegister(instr->index());
3222 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
3231 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3234 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3235 : LDeferredCode(codegen), instr_(instr) { }
3242 new DeferredStringCharFromCode(this, instr);
3244 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3245 Register char_code = ToRegister(instr->char_code());
3246 Register result = ToRegister(instr->result());
3261 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3262 Register char_code = ToRegister(instr->char_code());
3263 Register result = ToRegister(instr->result());
3273 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
3278 void LCodeGen::DoStringLength(LStringLength* instr) {
3279 Register string = ToRegister(instr->string());
3280 Register result = ToRegister(instr->result());
3285 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3286 LOperand* input = instr->InputAt(0);
3288 LOperand* output = instr->result();
3298 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3299 LOperand* input = instr->InputAt(0);
3300 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3307 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3310 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3311 : LDeferredCode(codegen), instr_(instr) { }
3317 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3318 Register reg = ToRegister(instr->result());
3319 Register tmp = ToRegister(instr->TempAt(0));
3321 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3332 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3336 Register reg = ToRegister(instr->result());
3341 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3349 void LCodeGen::DoSmiTag(LSmiTag* instr) {
3350 ASSERT(instr->InputAt(0)->Equals(instr->result()));
3351 Register input = ToRegister(instr->InputAt(0));
3352 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3357 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3358 ASSERT(instr->InputAt(0)->Equals(instr->result()));
3359 Register input = ToRegister(instr->InputAt(0));
3360 if (instr->needs_check()) {
3362 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
3409 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3410 : LDeferredCode(codegen), instr_(instr) { }
3417 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3419 Register input_reg = ToRegister(instr->InputAt(0));
3425 if (instr->truncating()) {
3430 DeoptimizeIf(not_equal, instr->environment());
3440 DeoptimizeIf(equal, instr->environment());
3443 DeoptimizeIf(not_equal, instr->environment());
3445 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0));
3450 DeoptimizeIf(not_equal, instr->environment());
3451 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3452 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3457 DeoptimizeIf(not_zero, instr->environment());
3464 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3465 LOperand* input = instr->InputAt(0);
3467 ASSERT(input->Equals(instr->result()));
3470 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3477 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3478 LOperand* input = instr->InputAt(0);
3480 LOperand* result = instr->result();
3487 instr->hydrogen()->deoptimize_on_undefined(),
3488 instr->environment());
3492 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3493 LOperand* input = instr->InputAt(0);
3495 LOperand* result = instr->result();
3501 if (instr->truncating()) {
3507 DeoptimizeIf(equal, instr->environment());
3512 DeoptimizeIf(not_equal, instr->environment());
3513 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3514 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3525 DeoptimizeIf(not_zero, instr->environment());
3532 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
3533 LOperand* input = instr->InputAt(0);
3535 DeoptimizeIf(NegateCondition(cc), instr->environment());
3539 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
3540 LOperand* input = instr->InputAt(0);
3542 DeoptimizeIf(cc, instr->environment());
3546 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3547 Register input = ToRegister(instr->InputAt(0));
3548 InstanceType first = instr->hydrogen()->first();
3549 InstanceType last = instr->hydrogen()->last();
3557 DeoptimizeIf(not_equal, instr->environment());
3562 DeoptimizeIf(not_zero, instr->environment());
3566 DeoptimizeIf(below, instr->environment());
3571 DeoptimizeIf(above, instr->environment());
3577 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3578 ASSERT(instr->InputAt(0)->IsRegister());
3579 Register reg = ToRegister(instr->InputAt(0));
3580 __ Cmp(reg, instr->hydrogen()->target());
3581 DeoptimizeIf(not_equal, instr->environment());
3585 void LCodeGen::DoCheckMap(LCheckMap* instr) {
3586 LOperand* input = instr->InputAt(0);
3590 instr->hydrogen()->map());
3591 DeoptimizeIf(not_equal, instr->environment());
3607 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
3608 Register reg = ToRegister(instr->TempAt(0));
3610 Handle<JSObject> holder = instr->holder();
3611 Handle<JSObject> current_prototype = instr->prototype();
3620 DeoptimizeIf(not_equal, instr->environment());
3630 DeoptimizeIf(not_equal, instr->environment());
3634 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
3638 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
3639 __ Push(instr->hydrogen()->constant_elements());
3642 int length = instr->hydrogen()->length();
3643 if (instr->hydrogen()->IsCopyOnWrite()) {
3644 ASSERT(instr->hydrogen()->depth() == 1);
3648 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3649 } else if (instr->hydrogen()->depth() > 1) {
3650 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
3652 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
3657 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3662 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
3666 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
3667 __ Push(instr->hydrogen()->constant_properties());
3668 __ Push(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0));
3671 if (instr->hydrogen()->depth() > 1) {
3672 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
3674 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
3679 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
3680 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
3682 CallRuntime(Runtime::kToFastProperties, 1, instr);
3686 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
3696 instr->hydrogen()->literal_index() * kPointerSize;
3704 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
3705 __ Push(instr->hydrogen()->pattern());
3706 __ Push(instr->hydrogen()->flags());
3707 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
3719 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
3738 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
3741 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
3742 bool pretenure = instr->hydrogen()->pretenure();
3747 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3754 CallRuntime(Runtime::kNewClosure, 3, instr);
3759 void LCodeGen::DoTypeof(LTypeof* instr) {
3760 LOperand* input = instr->InputAt(0);
3769 CallRuntime(Runtime::kTypeof, 1, instr);
3773 void LCodeGen::DoTypeofIs(LTypeofIs* instr) {
3774 Register input = ToRegister(instr->InputAt(0));
3775 Register result = ToRegister(instr->result());
3783 instr->type_literal());
3813 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
3814 Register input = ToRegister(instr->InputAt(0));
3815 int true_block = chunk_->LookupDestination(instr->true_block_id());
3816 int false_block = chunk_->LookupDestination(instr->false_block_id());
3823 instr->type_literal());
3892 void LCodeGen::DoIsConstructCall(LIsConstructCall* instr) {
3893 Register result = ToRegister(instr->result());
3912 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
3913 Register temp = ToRegister(instr->TempAt(0));
3914 int true_block = chunk_->LookupDestination(instr->true_block_id());
3915 int false_block = chunk_->LookupDestination(instr->false_block_id());
3940 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
3946 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
3947 DeoptimizeIf(no_condition, instr->environment());
3951 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
3952 LOperand* obj = instr->object();
3953 LOperand* key = instr->key();
3968 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
3969 LPointerMap* pointers = instr->pointer_map();
3970 LEnvironment* env = instr->deoptimization_environment();
3984 void LCodeGen::DoStackCheck(LStackCheck* instr) {
3991 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3996 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4000 LEnvironment* environment = instr->environment();
4001 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4002 instr->SpilledDoubleRegisterArray());