Home | History | Annotate | Download | only in ia32

Lines Matching refs:instr

243     LInstruction* instr = instructions_->at(current_instruction_);
244 if (instr->IsLabel()) {
245 LLabel* label = LLabel::cast(instr);
250 Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
251 instr->CompileToNative(this);
267 code->instr()->Mnemonic());
453 LInstruction* instr,
455 ASSERT(instr != NULL);
456 LPointerMap* pointers = instr->pointer_map();
459 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
472 LInstruction* instr) {
473 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT);
479 LInstruction* instr) {
480 ASSERT(instr != NULL);
481 ASSERT(instr->HasPointerMap());
482 LPointerMap* pointers = instr->pointer_map();
487 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
493 LInstruction* instr,
511 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
663 LInstruction* instr, SafepointMode safepoint_mode) {
665 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
669 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
747 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
748 DoGap(instr);
752 void LCodeGen::DoParameter(LParameter* instr) {
757 void LCodeGen::DoCallStub(LCallStub* instr) {
758 ASSERT(ToRegister(instr->context()).is(esi));
759 ASSERT(ToRegister(instr->result()).is(eax));
760 switch (instr->hydrogen()->major_key()) {
763 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
768 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
773 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
778 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
783 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
788 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
792 TranscendentalCacheStub stub(instr->transcendental_type(),
794 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
803 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
808 void LCodeGen::DoModI(LModI* instr) {
809 if (instr->hydrogen()->HasPowerOf2Divisor()) {
810 Register dividend = ToRegister(instr->InputAt(0));
813 HConstant::cast(instr->hydrogen()->right())->Integer32Value();
823 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
825 DeoptimizeIf(no_condition, instr->environment());
834 Register left_reg = ToRegister(instr->InputAt(0));
835 Register right_reg = ToRegister(instr->InputAt(1));
836 Register result_reg = ToRegister(instr->result());
844 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
846 DeoptimizeIf(zero, instr->environment());
865 Register scratch = ToRegister(instr->TempAt(0));
892 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
903 DeoptimizeIf(no_condition, instr->environment());
920 void LCodeGen::DoDivI(LDivI* instr) {
921 LOperand* right = instr->InputAt(1);
922 ASSERT(ToRegister(instr->result()).is(eax));
923 ASSERT(ToRegister(instr->InputAt(0)).is(eax));
924 ASSERT(!ToRegister(instr->InputAt(1)).is(eax));
925 ASSERT(!ToRegister(instr->InputAt(1)).is(edx));
931 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
933 DeoptimizeIf(zero, instr->environment());
937 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
942 DeoptimizeIf(sign, instr->environment());
947 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
952 DeoptimizeIf(zero, instr->environment());
962 DeoptimizeIf(not_zero, instr->environment());
966 void LCodeGen::DoMulI(LMulI* instr) {
967 Register left = ToRegister(instr->InputAt(0));
968 LOperand* right = instr->InputAt(1);
970 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
971 __ mov(ToRegister(instr->TempAt(0)), left);
985 } else if (!instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1022 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1023 instr->environment());
1026 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1033 DeoptimizeIf(no_condition, instr->environment());
1037 __ or_(ToRegister(instr->TempAt(0)), ToOperand(right));
1038 DeoptimizeIf(sign, instr->environment());
1045 void LCodeGen::DoBitI(LBitI* instr) {
1046 LOperand* left = instr->InputAt(0);
1047 LOperand* right = instr->InputAt(1);
1048 ASSERT(left->Equals(instr->result()));
1053 switch (instr->op()) {
1068 switch (instr->op()) {
1086 void LCodeGen::DoShiftI(LShiftI* instr) {
1087 LOperand* left = instr->InputAt(0);
1088 LOperand* right = instr->InputAt(1);
1089 ASSERT(left->Equals(instr->result()));
1094 switch (instr->op()) {
1100 if (instr->can_deopt()) {
1102 DeoptimizeIf(not_zero, instr->environment());
1115 switch (instr->op()) {
1122 if (shift_count == 0 && instr->can_deopt()) {
1124 DeoptimizeIf(not_zero, instr->environment());
1142 void LCodeGen::DoSubI(LSubI* instr) {
1143 LOperand* left = instr->InputAt(0);
1144 LOperand* right = instr->InputAt(1);
1145 ASSERT(left->Equals(instr->result()));
1152 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1153 DeoptimizeIf(overflow, instr->environment());
1158 void LCodeGen::DoConstantI(LConstantI* instr) {
1159 ASSERT(instr->result()->IsRegister());
1160 __ Set(ToRegister(instr->result()), Immediate(instr->value()));
1164 void LCodeGen::DoConstantD(LConstantD* instr) {
1165 ASSERT(instr->result()->IsDoubleRegister());
1166 XMMRegister res = ToDoubleRegister(instr->result());
1167 double v = instr->value();
1173 Register temp = ToRegister(instr->TempAt(0));
1203 void LCodeGen::DoConstantT(LConstantT* instr) {
1204 Register reg = ToRegister(instr->result());
1205 Handle<Object> handle = instr->value();
1214 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1215 Register result = ToRegister(instr->result());
1216 Register array = ToRegister(instr->InputAt(0));
1222 LFixedArrayBaseLength* instr) {
1223 Register result = ToRegister(instr->result());
1224 Register array = ToRegister(instr->InputAt(0));
1229 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1230 Register result = ToRegister(instr->result());
1231 Register input = ToRegister(instr->InputAt(0));
1244 void LCodeGen::DoValueOf(LValueOf* instr) {
1245 Register input = ToRegister(instr->InputAt(0));
1246 Register result = ToRegister(instr->result());
1247 Register map = ToRegister(instr->TempAt(0));
1263 void LCodeGen::DoDateField(LDateField* instr) {
1264 Register object = ToRegister(instr->InputAt(0));
1265 Register result = ToRegister(instr->result());
1266 Register scratch = ToRegister(instr->TempAt(0));
1267 Smi* index = instr->index();
1300 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1301 LOperand* input = instr->InputAt(0);
1302 ASSERT(input->Equals(instr->result()));
1307 void LCodeGen::DoThrow(LThrow* instr) {
1308 __ push(ToOperand(instr->value()));
1309 ASSERT(ToRegister(instr->context()).is(esi));
1310 CallRuntime(Runtime::kThrow, 1, instr);
1319 void LCodeGen::DoAddI(LAddI* instr) {
1320 LOperand* left = instr->InputAt(0);
1321 LOperand* right = instr->InputAt(1);
1322 ASSERT(left->Equals(instr->result()));
1330 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1331 DeoptimizeIf(overflow, instr->environment());
1336 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1337 XMMRegister left = ToDoubleRegister(instr->InputAt(0));
1338 XMMRegister right = ToDoubleRegister(instr->InputAt(1));
1339 XMMRegister result = ToDoubleRegister(instr->result());
1341 ASSERT(instr->op() == Token::MOD || left.is(result));
1342 switch (instr->op()) {
1379 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1380 ASSERT(ToRegister(instr->context()).is(esi));
1381 ASSERT(ToRegister(instr->left()).is(edx));
1382 ASSERT(ToRegister(instr->right()).is(eax));
1383 ASSERT(ToRegister(instr->result()).is(eax));
1385 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1386 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1418 void LCodeGen::DoBranch(LBranch* instr) {
1419 int true_block = chunk_->LookupDestination(instr->true_block_id());
1420 int false_block = chunk_->LookupDestination(instr->false_block_id());
1422 Representation r = instr->hydrogen()->value()->representation();
1424 Register reg = ToRegister(instr->InputAt(0));
1428 XMMRegister reg = ToDoubleRegister(instr->InputAt(0));
1434 Register reg = ToRegister(instr->InputAt(0));
1435 HType type = instr->hydrogen()->value()->type();
1446 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
1477 DeoptimizeIf(zero, instr->environment());
1482 map = ToRegister(instr->TempAt(0));
1526 DeoptimizeIf(no_condition, instr->environment());
1541 void LCodeGen::DoGoto(LGoto* instr) {
1542 EmitGoto(instr->block_id());
1574 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1575 LOperand* left = instr->InputAt(0);
1576 LOperand* right = instr->InputAt(1);
1577 int false_block = chunk_->LookupDestination(instr->false_block_id());
1578 int true_block = chunk_->LookupDestination(instr->true_block_id());
1579 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1586 EvalComparison(instr->op(), left_val, right_val) ? true_block
1590 if (instr->is_double()) {
1611 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
1612 Register left = ToRegister(instr->InputAt(0));
1613 Operand right = ToOperand(instr->InputAt(1));
1614 int false_block = chunk_->LookupDestination(instr->false_block_id());
1615 int true_block = chunk_->LookupDestination(instr->true_block_id());
1622 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
1623 Register left = ToRegister(instr->InputAt(0));
1624 int true_block = chunk_->LookupDestination(instr->true_block_id());
1625 int false_block = chunk_->LookupDestination(instr->false_block_id());
1627 __ cmp(left, instr->hydrogen()->right());
1632 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
1633 Register reg = ToRegister(instr->InputAt(0));
1634 int false_block = chunk_->LookupDestination(instr->false_block_id());
1638 if (instr->hydrogen()->representation().IsSpecialization() ||
1639 instr->hydrogen()->type().IsSmi()) {
1644 int true_block = chunk_->LookupDestination(instr->true_block_id());
1645 Handle<Object> nil_value = instr->nil() == kNullValue ?
1649 if (instr->kind() == kStrictEquality) {
1652 Handle<Object> other_nil_value = instr->nil() == kNullValue ?
1663 Register scratch = ToRegister(instr->TempAt(0));
1695 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1696 Register reg = ToRegister(instr->InputAt(0));
1697 Register temp = ToRegister(instr->TempAt(0));
1699 int true_block = chunk_->LookupDestination(instr->true_block_id());
1700 int false_block = chunk_->LookupDestination(instr->false_block_id());
1721 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
1722 Register reg = ToRegister(instr->InputAt(0));
1723 Register temp = ToRegister(instr->TempAt(0));
1725 int true_block = chunk_->LookupDestination(instr->true_block_id());
1726 int false_block = chunk_->LookupDestination(instr->false_block_id());
1735 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1736 Operand input = ToOperand(instr->InputAt(0));
1738 int true_block = chunk_->LookupDestination(instr->true_block_id());
1739 int false_block = chunk_->LookupDestination(instr->false_block_id());
1746 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
1747 Register input = ToRegister(instr->InputAt(0));
1748 Register temp = ToRegister(instr->TempAt(0));
1750 int true_block = chunk_->LookupDestination(instr->true_block_id());
1751 int false_block = chunk_->LookupDestination(instr->false_block_id());
1782 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
1783 Token::Value op = instr->op();
1784 int true_block = chunk_->LookupDestination(instr->true_block_id());
1785 int false_block = chunk_->LookupDestination(instr->false_block_id());
1788 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1797 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
1798 InstanceType from = instr->from();
1799 InstanceType to = instr->to();
1806 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
1807 InstanceType from = instr->from();
1808 InstanceType to = instr->to();
1817 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1818 Register input = ToRegister(instr->InputAt(0));
1819 Register temp = ToRegister(instr->TempAt(0));
1821 int true_block = chunk_->LookupDestination(instr->true_block_id());
1822 int false_block = chunk_->LookupDestination(instr->false_block_id());
1828 __ CmpObjectType(input, TestType(instr->hydrogen()), temp);
1829 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1833 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1834 Register input = ToRegister(instr->InputAt(0));
1835 Register result = ToRegister(instr->result());
1847 LHasCachedArrayIndexAndBranch* instr) {
1848 Register input = ToRegister(instr->InputAt(0));
1850 int true_block = chunk_->LookupDestination(instr->true_block_id());
1851 int false_block = chunk_->LookupDestination(instr->false_block_id());
1924 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1925 Register input = ToRegister(instr->InputAt(0));
1926 Register temp = ToRegister(instr->TempAt(0));
1927 Register temp2 = ToRegister(instr->TempAt(1));
1929 Handle<String> class_name = instr->hydrogen()->class_name();
1931 int true_block = chunk_->LookupDestination(instr->true_block_id());
1932 int false_block = chunk_->LookupDestination(instr->false_block_id());
1943 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1944 Register reg = ToRegister(instr->InputAt(0));
1945 int true_block = instr->true_block_id();
1946 int false_block = instr->false_block_id();
1948 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
1953 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1955 ASSERT(ToRegister(instr->context()).is(esi));
1957 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1962 __ mov(ToRegister(instr->result()), factory()->false_value());
1965 __ mov(ToRegister(instr->result()), factory()->true_value());
1970 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1974 LInstanceOfKnownGlobal* instr)
1975 : LDeferredCode(codegen), instr_(instr) { }
1979 virtual LInstruction* instr() { return instr_; }
1987 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1990 Register object = ToRegister(instr->InputAt(1));
1991 Register temp = ToRegister(instr->TempAt(0));
2000 Register map = ToRegister(instr->TempAt(0));
2025 __ mov(ToRegister(instr->result()), factory()->false_value());
2034 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2051 Register temp = ToRegister(instr->TempAt(0));
2053 __ LoadHeapObject(InstanceofStub::right(), instr->function());
2060 instr,
2062 ASSERT(instr->HasDeoptimizationEnvironment());
2063 LEnvironment* env = instr->deoptimization_environment();
2071 void LCodeGen::DoCmpT(LCmpT* instr) {
2072 Token::Value op = instr->op();
2075 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2081 __ mov(ToRegister(instr->result()), factory()->false_value());
2084 __ mov(ToRegister(instr->result()), factory()->true_value());
2089 void LCodeGen::DoReturn(LReturn* instr) {
2105 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2106 Register result = ToRegister(instr->result());
2107 __ mov(result, Operand::Cell(instr->hydrogen()->cell()));
2108 if (instr->hydrogen()->RequiresHoleCheck()) {
2110 DeoptimizeIf(equal, instr->environment());
2115 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2116 ASSERT(ToRegister(instr->context()).is(esi));
2117 ASSERT(ToRegister(instr->global_object()).is(eax));
2118 ASSERT(ToRegister(instr->result()).is(eax));
2120 __ mov(ecx, instr->name());
2121 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET :
2124 CallCode(ic, mode, instr);
2128 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2129 Register value = ToRegister(instr->value());
2130 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell();
2136 if (instr->hydrogen()->RequiresHoleCheck()) {
2138 DeoptimizeIf(equal, instr->environment());
2147 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2148 ASSERT(ToRegister(instr->context()).is(esi));
2149 ASSERT(ToRegister(instr->global_object()).is(edx));
2150 ASSERT(ToRegister(instr->value()).is(eax));
2152 __ mov(ecx, instr->name());
2153 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
2156 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2160 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2161 Register context = ToRegister(instr->context());
2162 Register result = ToRegister(instr->result());
2163 __ mov(result, ContextOperand(context, instr->slot_index()));
2165 if (instr->hydrogen()->RequiresHoleCheck()) {
2167 if (instr->hydrogen()->DeoptimizesOnHole()) {
2168 DeoptimizeIf(equal, instr->environment());
2179 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2180 Register context = ToRegister(instr->context());
2181 Register value = ToRegister(instr->value());
2185 Operand target = ContextOperand(context, instr->slot_index());
2186 if (instr->hydrogen()->RequiresHoleCheck()) {
2188 if (instr->hydrogen()->DeoptimizesOnHole()) {
2189 DeoptimizeIf(equal, instr->environment());
2196 if (instr->hydrogen()->NeedsWriteBarrier()) {
2197 HType type = instr->hydrogen()->value()->type();
2200 Register temp = ToRegister(instr->TempAt(0));
2201 int offset = Context::SlotOffset(instr->slot_index());
2215 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2216 Register object = ToRegister(instr->object());
2217 Register result = ToRegister(instr->result());
2218 if (instr->hydrogen()->is_in_object()) {
2219 __ mov(result, FieldOperand(object, instr->hydrogen()->offset()));
2222 __ mov(result, FieldOperand(result, instr->hydrogen()->offset()));
2271 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2272 Register object = ToRegister(instr->object());
2273 Register result = ToRegister(instr->result());
2275 int map_count = instr->hydrogen()->types()->length();
2276 Handle<String> name = instr->hydrogen()->name();
2278 ASSERT(instr->hydrogen()->need_generic());
2281 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2285 Handle<Map> map = instr->hydrogen()->types()->at(i);
2293 Handle<Map> map = instr->hydrogen()->types()->last();
2295 if (instr->hydrogen()->need_generic()) {
2303 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2305 DeoptimizeIf(not_equal, instr->environment());
2313 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2314 ASSERT(ToRegister(instr->context()).is(esi));
2315 ASSERT(ToRegister(instr->object()).is(eax));
2316 ASSERT(ToRegister(instr->result()).is(eax));
2318 __ mov(ecx, instr->name());
2320 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2324 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2325 Register function = ToRegister(instr->function());
2326 Register temp = ToRegister(instr->TempAt(0));
2327 Register result = ToRegister(instr->result());
2331 DeoptimizeIf(not_equal, instr->environment());
2345 DeoptimizeIf(equal, instr->environment());
2366 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2367 Register result = ToRegister(instr->result());
2368 Register input = ToRegister(instr->InputAt(0));
2400 LLoadExternalArrayPointer* instr) {
2401 Register result = ToRegister(instr->result());
2402 Register input = ToRegister(instr->InputAt(0));
2408 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2409 Register arguments = ToRegister(instr->arguments());
2410 Register length = ToRegister(instr->length());
2411 Operand index = ToOperand(instr->index());
2412 Register result = ToRegister(instr->result());
2415 DeoptimizeIf(below_equal, instr->environment());
2423 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2424 Register result = ToRegister(instr->result());
2428 BuildFastArrayOperand(instr->elements(), instr->key(),
2433 if (instr->hydrogen()->RequiresHoleCheck()) {
2435 DeoptimizeIf(equal, instr->environment());
2441 LLoadKeyedFastDoubleElement* instr) {
2442 XMMRegister result = ToDoubleRegister(instr->result());
2447 instr->elements(), instr->key(),
2451 DeoptimizeIf(equal, instr->environment());
2454 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
2482 LLoadKeyedSpecializedArrayElement* instr) {
2483 ElementsKind elements_kind = instr->elements_kind();
2484 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2485 instr->key(), elements_kind, 0));
2487 XMMRegister result(ToDoubleRegister(instr->result()));
2491 __ movdbl(ToDoubleRegister(instr->result()), operand);
2493 Register result(ToRegister(instr->result()));
2517 DeoptimizeIf(negative, instr->environment());
2533 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2534 ASSERT(ToRegister(instr->context()).is(esi));
2535 ASSERT(ToRegister(instr->object()).is(edx));
2536 ASSERT(ToRegister(instr->key()).is(eax));
2539 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2543 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2544 Register result = ToRegister(instr->result());
2568 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2569 Operand elem = ToOperand(instr->InputAt(0));
2570 Register result = ToRegister(instr->result());
2590 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
2591 Register receiver = ToRegister(instr->receiver());
2592 Register function = ToRegister(instr->function());
2593 Register scratch = ToRegister(instr->TempAt(0));
2621 DeoptimizeIf(equal, instr->environment());
2623 DeoptimizeIf(below, instr->environment());
2638 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2639 Register receiver = ToRegister(instr->receiver());
2640 Register function = ToRegister(instr->function());
2641 Register length = ToRegister(instr->length());
2642 Register elements = ToRegister(instr->elements());
2645 ASSERT(ToRegister(instr->result()).is(eax));
2651 DeoptimizeIf(above, instr->environment());
2669 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2670 LPointerMap* pointers = instr->pointer_map();
2680 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2681 LOperand* argument = instr->InputAt(0);
2686 void LCodeGen::DoThisFunction(LThisFunction* instr) {
2687 Register result = ToRegister(instr->result());
2688 __ LoadHeapObject(result, instr->hydrogen()->closure());
2692 void LCodeGen::DoContext(LContext* instr) {
2693 Register result = ToRegister(instr->result());
2698 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2699 Register context = ToRegister(instr->context());
2700 Register result = ToRegister(instr->result());
2706 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
2707 ASSERT(ToRegister(instr->InputAt(0)).is(esi));
2709 __ push(Immediate(instr->hydrogen()->pairs()));
2710 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags())));
2711 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
2715 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2716 Register context = ToRegister(instr->context());
2717 Register result = ToRegister(instr->result());
2722 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2723 Register global = ToRegister(instr->global());
2724 Register result = ToRegister(instr->result());
2731 LInstruction* instr,
2736 LPointerMap* pointers = instr->pointer_map();
2767 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
2778 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2779 ASSERT(ToRegister(instr->result()).is(eax));
2780 CallKnownFunction(instr->function(),
2781 instr->arity(),
2782 instr,
2787 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2788 Register input_reg = ToRegister(instr->value());
2791 DeoptimizeIf(not_equal, instr->environment());
2820 instr, instr->context());
2840 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2841 Register input_reg = ToRegister(instr->value());
2847 DeoptimizeIf(negative, instr->environment());
2852 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2857 LUnaryMathOperation* instr)
2858 : LDeferredCode(codegen), instr_(instr) { }
2862 virtual LInstruction* instr() { return instr_; }
2867 ASSERT(instr->value()->Equals(instr->result()));
2868 Representation r = instr->hydrogen()->value()->representation();
2872 XMMRegister input_reg = ToDoubleRegister(instr->value());
2877 EmitIntegerMathAbs(instr);
2880 new DeferredMathAbsTaggedHeapNumber(this, instr);
2881 Register input_reg = ToRegister(instr->value());
2884 EmitIntegerMathAbs(instr);
2890 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2892 Register output_reg = ToRegister(instr->result());
2893 XMMRegister input_reg = ToDoubleRegister(instr->value());
2897 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2905 DeoptimizeIf(not_zero, instr->environment());
2912 DeoptimizeIf(equal, instr->environment());
2918 DeoptimizeIf(below, instr->environment());
2920 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2926 DeoptimizeIf(not_zero, instr->environment());
2937 DeoptimizeIf(equal, instr->environment());
2942 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2944 Register output_reg = ToRegister(instr->result());
2945 instr->value());
2962 DeoptimizeIf(equal, instr->environment());
2969 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2973 DeoptimizeIf(not_zero, instr->environment());
2980 DeoptimizeIf(below, instr->environment());
2987 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2988 XMMRegister input_reg = ToDoubleRegister(instr->value());
2989 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2994 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
2996 XMMRegister input_reg = ToDoubleRegister(instr->value());
2997 Register scratch = ToRegister(instr->temp());
2998 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
3028 void LCodeGen::DoPower(LPower* instr) {
3029 Representation exponent_type = instr->hydrogen()->right()->representation();
3032 ASSERT(!instr->InputAt(1)->IsDoubleRegister() ||
3033 ToDoubleRegister(instr->InputAt(1)).is(xmm1));
3034 ASSERT(!instr->InputAt(1)->IsRegister() ||
3035 ToRegister(instr->InputAt(1)).is(eax));
3036 ASSERT(ToDoubleRegister(instr->InputAt(0)).is(xmm2));
3037 ASSERT(ToDoubleRegister(instr->result()).is(xmm3));
3043 DeoptimizeIf(not_equal, instr->environment());
3058 void LCodeGen::DoRandom(LRandom* instr) {
3061 DeferredDoRandom(LCodeGen* codegen, LRandom* instr)
3062 : LDeferredCode(codegen), instr_(instr) { }
3064 virtual LInstruction* instr() { return instr_; }
3069 DeferredDoRandom* deferred = new DeferredDoRandom(this, instr);
3073 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3074 ASSERT(ToRegister(instr->InputAt(0)).is(eax));
3129 void LCodeGen::DoDeferredRandom(LRandom* instr) {
3137 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3138 ASSERT(instr->value()->Equals(instr->result()));
3139 XMMRegister input_reg = ToDoubleRegister(instr->value());
3168 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) {
3169 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3172 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3176 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
3177 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3180 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3184 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
3185 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3188 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3192 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
3193 switch (instr->op()) {
3195 DoMathAbs(instr);
3198 DoMathFloor(instr);
3201 DoMathRound(instr);
3204 DoMathSqrt(instr);
3207 DoMathCos(instr);
3210 DoMathSin(instr);
3213 DoMathTan(instr);
3216 DoMathLog(instr);
3225 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3226 ASSERT(ToRegister(instr->context()).is(esi));
3227 ASSERT(ToRegister(instr->function()).is(edi));
3228 ASSERT(instr->HasPointerMap());
3229 ASSERT(instr->HasDeoptimizationEnvironment());
3230 LPointerMap* pointers = instr->pointer_map();
3234 ParameterCount count(instr->arity());
3239 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3240 ASSERT(ToRegister(instr->context()).is(esi));
3241 ASSERT(ToRegister(instr->key()).is(ecx));
3242 ASSERT(ToRegister(instr->result()).is(eax));
3244 int arity = instr->arity();
3247 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3251 void LCodeGen::DoCallNamed(LCallNamed* instr) {
3252 ASSERT(ToRegister(instr->context()).is(esi));
3253 ASSERT(ToRegister(instr->result()).is(eax));
3255 int arity = instr->arity();
3259 __ mov(ecx, instr->name());
3260 CallCode(ic, mode, instr);
3264 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3265 ASSERT(ToRegister(instr->context()).is(esi));
3266 ASSERT(ToRegister(instr->function()).is(edi));
3267 ASSERT(ToRegister(instr->result()).is(eax));
3269 int arity = instr->arity();
3271 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3275 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3276 ASSERT(ToRegister(instr->context()).is(esi));
3277 ASSERT(ToRegister(instr->result()).is(eax));
3279 int arity = instr->arity();
3283 __ mov(ecx, instr->name());
3284 CallCode(ic, mode, instr);
3288 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3289 ASSERT(ToRegister(instr->result()).is(eax));
3290 CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
3294 void LCodeGen::DoCallNew(LCallNew* instr) {
3295 ASSERT(ToRegister(instr->context()).is(esi));
3296 ASSERT(ToRegister(instr->constructor()).is(edi));
3297 ASSERT(ToRegister(instr->result()).is(eax));
3300 __ Set(eax, Immediate(instr->arity()));
3301 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
3305 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3306 CallRuntime(instr->function(), instr->arity(), instr);
3310 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3311 Register object = ToRegister(instr->object());
3312 Register value = ToRegister(instr->value());
3313 int offset = instr->offset();
3315 if (!instr->transition().is_null()) {
3316 __ mov(FieldOperand(object, HeapObject::kMapOffset), instr->transition());
3320 HType type = instr->hydrogen()->value()->type();
3323 if (instr->is_in_object()) {
3325 if (instr->hydrogen()->NeedsWriteBarrier()) {
3326 Register temp = ToRegister(instr->TempAt(0));
3337 Register temp = ToRegister(instr->TempAt(0));
3340 if (instr->hydrogen()->NeedsWriteBarrier()) {
3355 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3356 ASSERT(ToRegister(instr->context()).is(esi));
3357 ASSERT(ToRegister(instr->object()).is(edx));
3358 ASSERT(ToRegister(instr->value()).is(eax));
3360 __ mov(ecx, instr->name());
3361 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3364 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3368 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3369 if (instr->index()->IsConstantOperand()) {
3370 __ cmp(ToOperand(instr->length()),
3371 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3372 DeoptimizeIf(below_equal, instr->environment());
3374 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
3375 DeoptimizeIf(above_equal, instr->environment());
3381 LStoreKeyedSpecializedArrayElement* instr) {
3382 ElementsKind elements_kind = instr->elements_kind();
3383 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
3384 instr->key(), elements_kind, 0));
3386 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value()));
3389 __ movdbl(operand, ToDoubleRegister(instr->value()));
3391 Register value = ToRegister(instr->value());
3420 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3421 Register value = ToRegister(instr->value());
3422 Register elements = ToRegister(instr->object());
3423 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3426 if (instr->key()->IsConstantOperand()) {
3427 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3428 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3440 if (instr->hydrogen()->NeedsWriteBarrier()) {
3441 HType type = instr->hydrogen()->value()->type();
3461 LStoreKeyedFastDoubleElement* instr) {
3462 XMMRegister value = ToDoubleRegister(instr->value());
3474 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
3480 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3481 ASSERT(ToRegister(instr->context()).is(esi));
3482 ASSERT(ToRegister(instr->object()).is(edx));
3483 ASSERT(ToRegister(instr->key()).is(ecx));
3484 ASSERT(ToRegister(instr->value()).is(eax));
3486 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3489 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3493 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
3494 Register object_reg = ToRegister(instr->object());
3495 Register new_map_reg = ToRegister(instr->new_map_reg());
3497 Handle<Map> from_map = instr->original_map();
3498 Handle<Map> to_map = instr->transitioned_map();
3507 Register object_reg = ToRegister(instr->object());
3510 ASSERT_NE(instr->temp_reg(), NULL);
3512 ToRegister(instr->temp_reg()), kDontSaveFPRegs);
3515 Register fixed_object_reg = ToRegister(instr->temp_reg());
3520 RelocInfo::CODE_TARGET, instr);
3522 Register fixed_object_reg = ToRegister(instr->temp_reg());
3527 RelocInfo::CODE_TARGET, instr);
3535 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3538 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3539 : LDeferredCode(codegen), instr_(instr) { }
3541 virtual LInstruction* instr() { return instr_; }
3547 new DeferredStringCharCodeAt(this, instr);
3551 ToRegister(instr->string()),
3552 ToRegister(instr->index()),
3553 ToRegister(instr->result()),
3559 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3560 Register string = ToRegister(instr->string());
3561 Register result = ToRegister(instr->result());
3573 if (instr->index()->IsConstantOperand()) {
3574 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3577 Register index = ToRegister(instr->index());
3582 instr, instr->context());
3591 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3594 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3595 : LDeferredCode(codegen), instr_(instr) { }
3597 virtual LInstruction* instr() { return instr_; }
3603 new DeferredStringCharFromCode(this, instr);
3605 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3606 Register char_code = ToRegister(instr->char_code());
3607 Register result = ToRegister(instr->result());
3622 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3623 Register char_code = ToRegister(instr->char_code());
3624 Register result = ToRegister(instr->result());
3634 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context());
3639 void LCodeGen::DoStringLength(LStringLength* instr) {
3640 Register string = ToRegister(instr->string());
3641 Register result = ToRegister(instr->result());
3646 void LCodeGen::DoStringAdd(LStringAdd* instr) {
3647 EmitPushTaggedOperand(instr->left());
3648 EmitPushTaggedOperand(instr->right());
3650 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3654 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3655 LOperand* input = instr->InputAt(0);
3657 LOperand* output = instr->result();
3663 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3666 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
3667 : LDeferredCode(codegen), instr_(instr) { }
3669 virtual LInstruction* instr() { return instr_; }
3674 LOperand* input = instr->InputAt(0);
3675 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3678 DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
3685 void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) {
3687 Register reg = ToRegister(instr->InputAt(0));
3720 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
3731 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3734 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3735 : LDeferredCode(codegen), instr_(instr) { }
3737 virtual LInstruction* instr() { return instr_; }
3742 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3743 Register reg = ToRegister(instr->result());
3744 Register tmp = ToRegister(instr->TempAt(0));
3746 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3757 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3761 Register reg = ToRegister(instr->result());
3773 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
3778 void LCodeGen::DoSmiTag(LSmiTag* instr) {
3779 LOperand* input = instr->InputAt(0);
3780 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3781 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3786 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3787 LOperand* input = instr->InputAt(0);
3788 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3789 if (instr->needs_check()) {
3791 DeoptimizeIf(not_zero, instr->environment());
3850 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3852 Register input_reg = ToRegister(instr->InputAt(0));
3858 if (instr->truncating()) {
3863 DeoptimizeIf(not_equal, instr->environment());
3883 DeoptimizeIf(no_condition, instr->environment());
3893 instr->TempAt(0));
3903 DeoptimizeIf(not_equal, instr->environment());
3904 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3908 DeoptimizeIf(not_equal, instr->environment());
3910 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0));
3915 DeoptimizeIf(not_equal, instr->environment());
3916 DeoptimizeIf(parity_even, instr->environment()); // NaN.
3917 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3922 DeoptimizeIf(not_zero, instr->environment());
3929 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3932 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3933 : LDeferredCode(codegen), instr_(instr) { }
3935 virtual LInstruction* instr() { return instr_; }
3940 LOperand* input = instr->InputAt(0);
3942 ASSERT(input->Equals(instr->result()));
3946 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3958 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3959 LOperand* input = instr->InputAt(0);
3961 LOperand* temp = instr->TempAt(0);
3963 LOperand* result = instr->result();
3970 instr->hydrogen()->deoptimize_on_minus_zero();
3976 instr->hydrogen()->deoptimize_on_undefined(),
3978 instr->environment());
3982 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3983 LOperand* input = instr->InputAt(0);
3985 LOperand* result = instr->result();
3991 if (instr->truncating()) {
4011 DeoptimizeIf(no_condition, instr->environment());
4021 Register temp_reg = ToRegister(instr->TempAt(0));
4049 DeoptimizeIf(greater, instr->environment());
4080 DeoptimizeIf(not_equal, instr->environment());
4081 DeoptimizeIf(parity_even, instr->environment()); // NaN.
4082 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4092 DeoptimizeIf(not_zero, instr->environment());
4099 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
4100 LOperand* input = instr->InputAt(0);
4102 DeoptimizeIf(not_zero, instr->environment());
4106 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
4107 LOperand* input = instr->InputAt(0);
4109 DeoptimizeIf(zero, instr->environment());
4113 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
4114 Register input = ToRegister(instr->InputAt(0));
4115 Register temp = ToRegister(instr->TempAt(0));
4119 if (instr->hydrogen()->is_interval_check()) {
4122 instr->hydrogen()->GetCheckInterval(&first, &last);
4129 DeoptimizeIf(not_equal, instr->environment());
4131 DeoptimizeIf(below, instr->environment());
4136 DeoptimizeIf(above, instr->environment());
4142 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
4147 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment());
4152 DeoptimizeIf(not_equal, instr->environment());
4158 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
4159 Handle<JSFunction> target = instr->hydrogen()->target();
4161 Register reg = ToRegister(instr->value());
4166 Operand operand = ToOperand(instr->value());
4169 DeoptimizeIf(not_equal, instr->environment());
4184 void LCodeGen::DoCheckMap(LCheckMap* instr) {
4185 LOperand* input = instr->InputAt(0);
4188 Handle<Map> map = instr->hydrogen()->map();
4189 DoCheckMapCommon(reg, map, instr->hydrogen()->mode(), instr->environment());
4193 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
4194 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
4195 Register result_reg = ToRegister(instr->result());
4200 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
4201 ASSERT(instr->unclamped()->Equals(instr->result()));
4202 Register value_reg = ToRegister(instr->result());
4207 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
4208 ASSERT(instr->unclamped()->Equals(instr->result()));
4209 Register input_reg = ToRegister(instr->unclamped());
4222 DeoptimizeIf(not_equal, instr->environment());
4241 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
4242 Register reg = ToRegister(instr->TempAt(0));
4244 Handle<JSObject> holder = instr->holder();
4245 Handle<JSObject> current_prototype = instr->prototype();
4253 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4263 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4267 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
4270 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
4271 : LDeferredCode(codegen), instr_(instr) { }
4273 virtual LInstruction* instr() { return instr_; }
4278 DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr);
4280 Register result = ToRegister(instr->result());
4281 Register scratch = ToRegister(instr->TempAt(0));
4282 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4339 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
4340 Register result = ToRegister(instr->result());
4341 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4350 CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr, instr->context());
4355 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4356 ASSERT(ToRegister(instr->context()).is(esi));
4359 instr->hydrogen()->boilerplate_elements_kind();
4365 __ LoadHeapObject(eax, instr->hydrogen()->boilerplate_object());
4373 DeoptimizeIf(not_equal, instr->environment());
4379 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
4385 int length = instr->hydrogen()->length();
4386 if (instr->hydrogen()->IsCopyOnWrite()) {
4387 ASSERT(instr->hydrogen()->depth() == 1);
4391 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4392 } else if (instr->hydrogen()->depth() > 1) {
4393 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
4395 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
4402 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4510 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4511 ASSERT(ToRegister(instr->context()).is(esi));
4512 int size = instr->hydrogen()->total_size();
4522 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4526 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate());
4527 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset);
4532 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
4533 ASSERT(ToRegister(instr->context()).is(esi));
4534 Handle<FixedArray> literals(instr->environment()->closure()->literals());
4536 instr->hydrogen()->constant_properties();
4540 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
4542 int flags = instr->hydrogen()->fast_elements()
4545 flags |= instr->hydrogen()->has_function()
4552 if (instr->hydrogen()->depth() > 1) {
4553 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
4556 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
4559 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4564 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
4565 ASSERT(ToRegister(instr->InputAt(0)).is(eax));
4567 CallRuntime(Runtime::kToFastProperties, 1, instr);
4571 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
4572 ASSERT(ToRegister(instr->context()).is(esi));
4583 instr->hydrogen()->literal_index() * kPointerSize;
4591 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
4592 __ push(Immediate(instr->hydrogen()->pattern()));
4593 __ push(Immediate(instr->hydrogen()->flags()));
4594 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
4606 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4625 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
4626 ASSERT(ToRegister(instr->context()).is(esi));
4629 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
4630 bool pretenure = instr->hydrogen()->pretenure();
4634 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4641 CallRuntime(Runtime::kNewClosure, 3, instr);
4646 void LCodeGen::DoTypeof(LTypeof* instr) {
4647 LOperand* input = instr->InputAt(1);
4649 CallRuntime(Runtime::kTypeof, 1, instr);
4653 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
4654 Register input = ToRegister(instr->InputAt(0));
4655 int true_block = chunk_->LookupDestination(instr->true_block_id());
4656 int false_block = chunk_->LookupDestination(instr->false_block_id());
4661 EmitTypeofIs(true_label, false_label, input, instr->type_literal());
4737 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
4738 Register temp = ToRegister(instr->TempAt(0));
4739 int true_block = chunk_->LookupDestination(instr->true_block_id());
4740 int false_block = chunk_->LookupDestination(instr->false_block_id());
4778 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
4780 ASSERT(instr->HasEnvironment());
4781 LEnvironment* env = instr->environment();
4787 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
4788 DeoptimizeIf(no_condition, instr->environment());
4792 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
4793 LOperand* obj = instr->object();
4794 LOperand* key = instr->key();
4797 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4798 LPointerMap* pointers = instr->pointer_map();
4810 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
4815 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
4816 ASSERT(instr->HasEnvironment());
4817 LEnvironment* env = instr->environment();
4822 void LCodeGen::DoStackCheck(LStackCheck* instr) {
4825 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
4826 : LDeferredCode(codegen), instr_(instr) { }
4828 virtual LInstruction* instr() { return instr_; }
4833 ASSERT(instr->HasEnvironment());
4834 LEnvironment* env = instr->environment();
4837 if (instr->hydrogen()->is_function_entry()) {
4845 ASSERT(instr->context()->IsRegister());
4846 ASSERT(ToRegister(instr->context()).is(esi));
4848 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4854 ASSERT(instr->hydrogen()->is_backwards_branch());
4857 new DeferredStackCheck(this, instr);
4863 __ bind(instr->done_label());
4864 deferred_stack_check->SetExit(instr->done_label());
4873 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4877 LEnvironment* environment = instr->environment();
4878 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4879 instr->SpilledDoubleRegisterArray());
4890 void LCodeGen::DoIn(LIn* instr) {
4891 LOperand* obj = instr->object();
4892 LOperand* key = instr->key();
4895 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4896 LPointerMap* pointers = instr->pointer_map();
4904 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4906 DeoptimizeIf(equal, instr->environment());
4909 DeoptimizeIf(equal, instr->environment());
4912 DeoptimizeIf(zero, instr->environment());
4916 DeoptimizeIf(below_equal, instr->environment());
4927 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
4931 DeoptimizeIf(not_equal, instr->environment());
4936 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
4937 Register map = ToRegister(instr->map());
4938 Register result = ToRegister(instr->result());
4943 FieldOperand(result, FixedArray::SizeFor(instr->idx())));
4945 DeoptimizeIf(equal, instr->environment());
4949 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
4950 Register object = ToRegister(instr->value());
4951 __ cmp(ToRegister(instr->map()),
4953 DeoptimizeIf(not_equal, instr->environment());
4957 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
4958 Register object = ToRegister(instr->object());
4959 Register index = ToRegister(instr->index());