Home | History | Annotate | Download | only in mips

Lines Matching refs:instr

224     LInstruction* instr = instructions_->at(current_instruction_);
225 if (instr->IsLabel()) {
226 LLabel* label = LLabel::cast(instr);
231 Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
232 instr->CompileToNative(this);
247 code->instr()->Mnemonic());
532 LInstruction* instr) {
533 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT);
539 LInstruction* instr,
541 ASSERT(instr != NULL);
542 LPointerMap* pointers = instr->pointer_map();
545 RecordSafepointWithLazyDeopt(instr, safepoint_mode);
551 LInstruction* instr) {
552 ASSERT(instr != NULL);
553 LPointerMap* pointers = instr->pointer_map();
558 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
564 LInstruction* instr) {
567 instr->pointer_map(), argc, Safepoint::kNoLazyDeopt);
703 LInstruction* instr, SafepointMode safepoint_mode) {
705 RecordSafepoint(instr->pointer_map(), Safepoint::kLazyDeopt);
709 instr->pointer_map(), 0, Safepoint::kLazyDeopt);
802 void LCodeGen::DoInstructionGap(LInstructionGap* instr) {
803 DoGap(instr);
807 void LCodeGen::DoParameter(LParameter* instr) {
812 void LCodeGen::DoCallStub(LCallStub* instr) {
813 ASSERT(ToRegister(instr->result()).is(v0));
814 switch (instr->hydrogen()->major_key()) {
817 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
822 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
827 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
832 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
837 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
842 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
847 TranscendentalCacheStub stub(instr->transcendental_type(),
849 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
858 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
863 void LCodeGen::DoModI(LModI* instr) {
865 const Register left = ToRegister(instr->InputAt(0));
866 const Register result = ToRegister(instr->result());
870 if (instr->hydrogen()->HasPowerOf2Divisor()) {
875 instr->hydrogen()->right())->Integer32Value();
884 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
885 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
893 Register right = EmitLoadRegister(instr->InputAt(1), scratch);
897 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
898 DeoptimizeIf(eq, instr->environment(), right, Operand(zero_reg));
904 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
905 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
912 void LCodeGen::DoDivI(LDivI* instr) {
913 const Register left = ToRegister(instr->InputAt(0));
914 const Register right = ToRegister(instr->InputAt(1));
915 const Register result = ToRegister(instr->result());
922 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
923 DeoptimizeIf(eq, instr->environment(), right, Operand(zero_reg));
927 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
930 DeoptimizeIf(lt, instr->environment(), right, Operand(zero_reg));
935 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
938 DeoptimizeIf(eq, instr->environment(), right, Operand(-1));
943 DeoptimizeIf(ne, instr->environment(), result, Operand(zero_reg));
948 void LCodeGen::DoMulI(LMulI* instr) {
950 Register result = ToRegister(instr->result());
952 Register left = ToRegister(instr->InputAt(0));
953 LOperand* right_op = instr->InputAt(1);
955 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
957 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
966 DeoptimizeIf(eq, instr->environment(), left, Operand(zero_reg));
977 DeoptimizeIf(lt, instr->environment(), left, Operand(zero_reg));
1023 __ Or(ToRegister(instr->TempAt(0)), left, right);
1032 DeoptimizeIf(ne, instr->environment(), scratch, Operand(at));
1042 instr->environment(),
1043 ToRegister(instr->TempAt(0)),
1051 void LCodeGen::DoBitI(LBitI* instr) {
1052 LOperand* left_op = instr->InputAt(0);
1053 LOperand* right_op = instr->InputAt(1);
1056 Register result = ToRegister(instr->result());
1066 switch (instr->op()) {
1083 void LCodeGen::DoShiftI(LShiftI* instr) {
1086 LOperand* right_op = instr->InputAt(1);
1087 Register left = ToRegister(instr->InputAt(0));
1088 Register result = ToRegister(instr->result());
1093 switch (instr->op()) {
1099 if (instr->can_deopt()) {
1100 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg));
1114 switch (instr->op()) {
1126 if (instr->can_deopt()) {
1128 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
1148 void LCodeGen::DoSubI(LSubI* instr) {
1149 LOperand* left = instr->InputAt(0);
1150 LOperand* right = instr->InputAt(1);
1151 LOperand* result = instr->result();
1152 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1182 DeoptimizeIf(lt, instr->environment(), overflow, Operand(zero_reg));
1187 void LCodeGen::DoConstantI(LConstantI* instr) {
1188 ASSERT(instr->result()->IsRegister());
1189 __ li(ToRegister(instr->result()), Operand(instr->value()));
1193 void LCodeGen::DoConstantD(LConstantD* instr) {
1194 ASSERT(instr->result()->IsDoubleRegister());
1195 DoubleRegister result = ToDoubleRegister(instr->result());
1196 double v = instr->value();
1201 void LCodeGen::DoConstantT(LConstantT* instr) {
1202 Handle<Object> value = instr->value();
1204 __ li(ToRegister(instr->result()), Operand(value));
1206 __ LoadHeapObject(ToRegister(instr->result()),
1212 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1213 Register result = ToRegister(instr->result());
1214 Register array = ToRegister(instr->InputAt(0));
1219 void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) {
1220 Register result = ToRegister(instr->result());
1221 Register array = ToRegister(instr->InputAt(0));
1226 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1227 Register result = ToRegister(instr->result());
1228 Register input = ToRegister(instr->InputAt(0));
1240 void LCodeGen::DoValueOf(LValueOf* instr) {
1241 Register input = ToRegister(instr->InputAt(0));
1242 Register result = ToRegister(instr->result());
1243 Register map = ToRegister(instr->TempAt(0));
1259 void LCodeGen::DoDateField(LDateField* instr) {
1260 Register object = ToRegister(instr->InputAt(0));
1261 Register result = ToRegister(instr->result());
1262 Register scratch = ToRegister(instr->TempAt(0));
1263 Smi* index = instr->index();
1299 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1300 Register input = ToRegister(instr->InputAt(0));
1301 Register result = ToRegister(instr->result());
1306 void LCodeGen::DoThrow(LThrow* instr) {
1307 Register input_reg = EmitLoadRegister(instr->InputAt(0), at);
1309 CallRuntime(Runtime::kThrow, 1, instr);
1317 void LCodeGen::DoAddI(LAddI* instr) {
1318 LOperand* left = instr->InputAt(0);
1319 LOperand* right = instr->InputAt(1);
1320 LOperand* result = instr->result();
1321 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1351 DeoptimizeIf(lt, instr->environment(), overflow, Operand(zero_reg));
1356 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1357 DoubleRegister left = ToDoubleRegister(instr->InputAt(0));
1358 DoubleRegister right = ToDoubleRegister(instr->InputAt(1));
1359 DoubleRegister result = ToDoubleRegister(instr->result());
1360 switch (instr->op()) {
1397 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1398 ASSERT(ToRegister(instr->InputAt(0)).is(a1));
1399 ASSERT(ToRegister(instr->InputAt(1)).is(a0));
1400 ASSERT(ToRegister(instr->result()).is(v0));
1402 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1403 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1457 void LCodeGen::DoBranch(LBranch* instr) {
1458 int true_block = chunk_->LookupDestination(instr->true_block_id());
1459 int false_block = chunk_->LookupDestination(instr->false_block_id());
1461 Representation r = instr->hydrogen()->value()->representation();
1463 Register reg = ToRegister(instr->InputAt(0));
1466 DoubleRegister reg = ToDoubleRegister(instr->InputAt(0));
1471 Register reg = ToRegister(instr->InputAt(0));
1472 HType type = instr->hydrogen()->value()->type();
1482 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
1511 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
1556 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg));
1571 void LCodeGen::DoGoto(LGoto* instr) {
1572 EmitGoto(instr->block_id());
1604 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1605 LOperand* left = instr->InputAt(0);
1606 LOperand* right = instr->InputAt(1);
1607 int false_block = chunk_->LookupDestination(instr->false_block_id());
1608 int true_block = chunk_->LookupDestination(instr->true_block_id());
1610 Condition cond = TokenToCondition(instr->op(), false);
1617 EvalComparison(instr->op(), left_val, right_val) ? true_block
1621 if (instr->is_double()) {
1656 void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
1657 Register left = ToRegister(instr->InputAt(0));
1658 Register right = ToRegister(instr->InputAt(1));
1659 int false_block = chunk_->LookupDestination(instr->false_block_id());
1660 int true_block = chunk_->LookupDestination(instr->true_block_id());
1666 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
1667 Register left = ToRegister(instr->InputAt(0));
1668 int true_block = chunk_->LookupDestination(instr->true_block_id());
1669 int false_block = chunk_->LookupDestination(instr->false_block_id());
1672 Operand(instr->hydrogen()->right()));
1677 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
1679 Register reg = ToRegister(instr->InputAt(0));
1680 int false_block = chunk_->LookupDestination(instr->false_block_id());
1684 if (instr->hydrogen()->representation().IsSpecialization() ||
1685 instr->hydrogen()->type().IsSmi()) {
1690 int true_block = chunk_->LookupDestination(instr->true_block_id());
1692 Heap::RootListIndex nil_value = instr->nil() == kNullValue ?
1696 if (instr->kind() == kStrictEquality) {
1699 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ?
1744 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1745 Register reg = ToRegister(instr->InputAt(0));
1746 Register temp1 = ToRegister(instr->TempAt(0));
1749 int true_block = chunk_->LookupDestination(instr->true_block_id());
1750 int false_block = chunk_->LookupDestination(instr->false_block_id());
1772 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
1773 Register reg = ToRegister(instr->InputAt(0));
1774 Register temp1 = ToRegister(instr->TempAt(0));
1776 int true_block = chunk_->LookupDestination(instr->true_block_id());
1777 int false_block = chunk_->LookupDestination(instr->false_block_id());
1788 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1789 int true_block = chunk_->LookupDestination(instr->true_block_id());
1790 int false_block = chunk_->LookupDestination(instr->false_block_id());
1792 Register input_reg = EmitLoadRegister(instr->InputAt(0), at);
1798 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
1799 Register input = ToRegister(instr->InputAt(0));
1800 Register temp = ToRegister(instr->TempAt(0));
1802 int true_block = chunk_->LookupDestination(instr->true_block_id());
1803 int false_block = chunk_->LookupDestination(instr->false_block_id());
1833 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
1834 Token::Value op = instr->op();
1835 int true_block = chunk_->LookupDestination(instr->true_block_id());
1836 int false_block = chunk_->LookupDestination(instr->false_block_id());
1839 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1847 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
1848 InstanceType from = instr->from();
1849 InstanceType to = instr->to();
1856 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
1857 InstanceType from = instr->from();
1858 InstanceType to = instr->to();
1867 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1869 Register input = ToRegister(instr->InputAt(0));
1871 int true_block = chunk_->LookupDestination(instr->true_block_id());
1872 int false_block = chunk_->LookupDestination(instr->false_block_id());
1881 BranchCondition(instr->hydrogen()),
1883 Operand(TestType(instr->hydrogen())));
1887 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1888 Register input = ToRegister(instr->InputAt(0));
1889 Register result = ToRegister(instr->result());
1901 LHasCachedArrayIndexAndBranch* instr) {
1902 Register input = ToRegister(instr->InputAt(0));
1905 int true_block = chunk_->LookupDestination(instr->true_block_id());
1906 int false_block = chunk_->LookupDestination(instr->false_block_id());
1981 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1982 Register input = ToRegister(instr->InputAt(0));
1984 Register temp2 = ToRegister(instr->TempAt(0));
1985 Handle<String> class_name = instr->hydrogen()->class_name();
1987 int true_block = chunk_->LookupDestination(instr->true_block_id());
1988 int false_block = chunk_->LookupDestination(instr->false_block_id());
1999 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
2000 Register reg = ToRegister(instr->InputAt(0));
2001 Register temp = ToRegister(instr->TempAt(0));
2002 int true_block = instr->true_block_id();
2003 int false_block = instr->false_block_id();
2006 EmitBranch(true_block, false_block, eq, temp, Operand(instr->map()));
2010 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
2012 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); // Object is in a0.
2013 ASSERT(ToRegister(instr->InputAt(1)).is(a1)); // Function is in a1.
2014 Register result = ToRegister(instr->result());
2018 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2029 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
2033 LInstanceOfKnownGlobal* instr)
2034 : LDeferredCode(codegen), instr_(instr) { }
2038 virtual LInstruction* instr() { return instr_; }
2047 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
2050 Register object = ToRegister(instr->InputAt(0));
2051 Register temp = ToRegister(instr->TempAt(0));
2052 Register result = ToRegister(instr->result());
2107 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2109 Register result = ToRegister(instr->result());
2126 Register temp = ToRegister(instr->TempAt(0));
2128 __ LoadHeapObject(InstanceofStub::right(), instr->function());
2140 instr,
2142 ASSERT(instr->HasDeoptimizationEnvironment());
2143 LEnvironment* env = instr->deoptimization_environment();
2151 void LCodeGen::DoCmpT(LCmpT* instr) {
2152 Token::Value op = instr->op();
2155 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2164 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
2165 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
2171 void LCodeGen::DoReturn(LReturn* instr) {
2186 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2187 Register result = ToRegister(instr->result());
2188 __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell())));
2190 if (instr->hydrogen()->RequiresHoleCheck()) {
2192 DeoptimizeIf(eq, instr->environment(), result, Operand(at));
2197 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2198 ASSERT(ToRegister(instr->global_object()).is(a0));
2199 ASSERT(ToRegister(instr->result()).is(v0));
2201 __ li(a2, Operand(instr->name()));
2202 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET
2205 CallCode(ic, mode, instr);
2209 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2210 Register value = ToRegister(instr->value());
2214 __ li(cell, Operand(instr->hydrogen()->cell()));
2220 if (instr->hydrogen()->RequiresHoleCheck()) {
2222 Register payload = ToRegister(instr->TempAt(0));
2225 DeoptimizeIf(eq, instr->environment(), payload, Operand(at));
2234 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2235 ASSERT(ToRegister(instr->global_object()).is(a1));
2236 ASSERT(ToRegister(instr->value()).is(a0));
2238 __ li(a2, Operand(instr->name()));
2239 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
2242 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2246 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2247 Register context = ToRegister(instr->context());
2248 Register result = ToRegister(instr->result());
2250 __ lw(result, ContextOperand(context, instr->slot_index()));
2251 if (instr->hydrogen()->RequiresHoleCheck()) {
2254 if (instr->hydrogen()->DeoptimizesOnHole()) {
2255 DeoptimizeIf(eq, instr->environment(), result, Operand(at));
2266 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2267 Register context = ToRegister(instr->context());
2268 Register value = ToRegister(instr->value());
2270 MemOperand target = ContextOperand(context, instr->slot_index());
2274 if (instr->hydrogen()->RequiresHoleCheck()) {
2278 if (instr->hydrogen()->DeoptimizesOnHole()) {
2279 DeoptimizeIf(eq, instr->environment(), scratch, Operand(at));
2286 if (instr->hydrogen()->NeedsWriteBarrier()) {
2287 HType type = instr->hydrogen()->value()->type();
2304 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2305 Register object = ToRegister(instr->InputAt(0));
2306 Register result = ToRegister(instr->result());
2307 if (instr->hydrogen()->is_in_object()) {
2308 __ lw(result, FieldMemOperand(object, instr->hydrogen()->offset()));
2311 __ lw(result, FieldMemOperand(result, instr->hydrogen()->offset()));
2343 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2344 Register object = ToRegister(instr->object());
2345 Register result = ToRegister(instr->result());
2347 int map_count = instr->hydrogen()->types()->length();
2348 Handle<String> name = instr->hydrogen()->name();
2350 ASSERT(instr->hydrogen()->need_generic());
2353 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2358 Handle<Map> map = instr->hydrogen()->types()->at(i);
2365 Handle<Map> map = instr->hydrogen()->types()->last();
2366 if (instr->hydrogen()->need_generic()) {
2374 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2376 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map));
2384 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2385 ASSERT(ToRegister(instr->object()).is(a0));
2386 ASSERT(ToRegister(instr->result()).is(v0));
2389 __ li(a2, Operand(instr->name()));
2391 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2395 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2397 Register function = ToRegister(instr->function());
2398 Register result = ToRegister(instr->result());
2403 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_FUNCTION_TYPE));
2417 DeoptimizeIf(eq, instr->environment(), result, Operand(at));
2438 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2439 Register result = ToRegister(instr->result());
2440 Register input = ToRegister(instr->InputAt(0));
2469 LLoadExternalArrayPointer* instr) {
2470 Register to_reg = ToRegister(instr->result());
2471 Register from_reg = ToRegister(instr->InputAt(0));
2477 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2478 Register arguments = ToRegister(instr->arguments());
2479 Register length = ToRegister(instr->length());
2480 Register index = ToRegister(instr->index());
2481 Register result = ToRegister(instr->result());
2488 DeoptimizeIf(ls, instr->environment(), length, Operand(index));
2500 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2501 Register elements = ToRegister(instr->elements());
2502 Register key = EmitLoadRegister(instr->key(), scratch0());
2503 Register result = ToRegister(instr->result());
2512 if (instr->hydrogen()->RequiresHoleCheck()) {
2514 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
2520 LLoadKeyedFastDoubleElement* instr) {
2521 Register elements = ToRegister(instr->elements());
2522 bool key_is_constant = instr->key()->IsConstantOperand();
2524 DoubleRegister result = ToDoubleRegister(instr->result());
2531 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
2536 key = ToRegister(instr->key());
2550 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32));
2557 LLoadKeyedSpecializedArrayElement* instr) {
2558 Register external_pointer = ToRegister(instr->external_pointer());
2560 ElementsKind elements_kind = instr->elements_kind();
2561 bool key_is_constant = instr->key()->IsConstantOperand();
2564 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
2569 key = ToRegister(instr->key());
2575 FPURegister result = ToDoubleRegister(instr->result());
2590 Register result = ToRegister(instr->result());
2623 DeoptimizeIf(Ugreater_equal, instr->environment(),
2640 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2641 ASSERT(ToRegister(instr->object()).is(a1));
2642 ASSERT(ToRegister(instr->key()).is(a0));
2645 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2649 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2652 Register result = ToRegister(instr->result());
2667 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2668 Register elem = ToRegister(instr->InputAt(0));
2669 Register result = ToRegister(instr->result());
2688 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
2689 Register receiver = ToRegister(instr->receiver());
2690 Register function = ToRegister(instr->function());
2720 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
2723 DeoptimizeIf(lt, instr->environment(),
2734 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2735 Register receiver = ToRegister(instr->receiver());
2736 Register function = ToRegister(instr->function());
2737 Register length = ToRegister(instr->length());
2738 Register elements = ToRegister(instr->elements());
2742 ASSERT(ToRegister(instr->result()).is(v0));
2747 DeoptimizeIf(hi, instr->environment(), length, Operand(kArgumentsLimit));
2771 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2772 LPointerMap* pointers = instr->pointer_map();
2785 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2786 LOperand* argument = instr->InputAt(0);
2796 void LCodeGen::DoThisFunction(LThisFunction* instr) {
2797 Register result = ToRegister(instr->result());
2798 __ LoadHeapObject(result, instr->hydrogen()->closure());
2802 void LCodeGen::DoContext(LContext* instr) {
2803 Register result = ToRegister(instr->result());
2808 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2809 Register context = ToRegister(instr->context());
2810 Register result = ToRegister(instr->result());
2816 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
2817 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs());
2818 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
2821 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
2825 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2826 Register result = ToRegister(instr->result());
2831 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2832 Register global = ToRegister(instr->global());
2833 Register result = ToRegister(instr->result());
2840 LInstruction* instr,
2845 LPointerMap* pointers = instr->pointer_map();
2871 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
2883 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2884 ASSERT(ToRegister(instr->result()).is(v0));
2886 CallKnownFunction(instr->function(), instr->arity(), instr, CALL_AS_METHOD);
2890 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2891 Register input = ToRegister(instr->InputAt(0));
2892 Register result = ToRegister(instr->result());
2898 DeoptimizeIf(ne, instr->environment(), scratch, Operand(at));
2932 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
2955 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2956 Register input = ToRegister(instr->InputAt(0));
2957 Register result = ToRegister(instr->result());
2965 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg));
2970 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2975 LUnaryMathOperation* instr)
2976 : LDeferredCode(codegen), instr_(instr) { }
2980 virtual LInstruction* instr() { return instr_; }
2985 Representation r = instr->hydrogen()->value()->representation();
2987 FPURegister input = ToDoubleRegister(instr->InputAt(0));
2988 FPURegister result = ToDoubleRegister(instr->result());
2991 EmitIntegerMathAbs(instr);
2995 new DeferredMathAbsTaggedHeapNumber(this, instr);
2996 Register input = ToRegister(instr->InputAt(0));
3000 EmitIntegerMathAbs(instr);
3006 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
3007 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
3008 Register result = ToRegister(instr->result());
3011 Register except_flag = ToRegister(instr->TempAt(0));
3020 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg));
3025 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3031 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg));
3037 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
3038 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
3039 Register result = ToRegister(instr->result());
3054 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3063 DeoptimizeIf(ge, instr->environment(), scratch,
3076 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3078 DeoptimizeIf(lt, instr->environment(), result,
3098 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg));
3102 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3108 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
3114 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
3115 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
3116 DoubleRegister result = ToDoubleRegister(instr->result());
3121 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
3122 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
3123 DoubleRegister result = ToDoubleRegister(instr->result());
3124 DoubleRegister temp = ToDoubleRegister(instr->TempAt(0));
3145 void LCodeGen::DoPower(LPower* instr) {
3146 Representation exponent_type = instr->hydrogen()->right()->representation();
3149 ASSERT(!instr->InputAt(1)->IsDoubleRegister() ||
3150 ToDoubleRegister(instr->InputAt(1)).is(f4));
3151 ASSERT(!instr->InputAt(1)->IsRegister() ||
3152 ToRegister(instr->InputAt(1)).is(a2));
3153 ASSERT(ToDoubleRegister(instr->InputAt(0)).is(f2));
3154 ASSERT(ToDoubleRegister(instr->result()).is(f0));
3160 DeoptimizeIf(ne, instr->environment(), t3, Operand(at));
3175 void LCodeGen::DoRandom(LRandom* instr) {
3178 DeferredDoRandom(LCodeGen* codegen, LRandom* instr)
3179 : LDeferredCode(codegen), instr_(instr) { }
3181 virtual LInstruction* instr() { return instr_; }
3186 DeferredDoRandom* deferred = new DeferredDoRandom(this, instr);
3189 ASSERT(ToDoubleRegister(instr->result()).is(f0));
3190 ASSERT(ToRegister(instr->InputAt(0)).is(a0));
3244 void LCodeGen::DoDeferredRandom(LRandom* instr) {
3251 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3252 ASSERT(ToDoubleRegister(instr->result()).is(f4));
3255 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3259 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) {
3260 ASSERT(ToDoubleRegister(instr->result()).is(f4));
3263 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3267 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
3268 ASSERT(ToDoubleRegister(instr->result()).is(f4));
3271 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3275 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
3276 ASSERT(ToDoubleRegister(instr->result()).is(f4));
3279 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3283 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
3284 switch (instr->op()) {
3286 DoMathAbs(instr);
3289 DoMathFloor(instr);
3292 DoMathRound(instr);
3295 DoMathSqrt(instr);
3298 DoMathPowHalf(instr);
3301 DoMathCos(instr);
3304 DoMathSin(instr);
3307 DoMathTan(instr);
3310 DoMathLog(instr);
3319 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3320 ASSERT(ToRegister(instr->function()).is(a1));
3321 ASSERT(instr->HasPointerMap());
3322 ASSERT(instr->HasDeoptimizationEnvironment());
3323 LPointerMap* pointers = instr->pointer_map();
3326 ParameterCount count(instr->arity());
3332 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3333 ASSERT(ToRegister(instr->result()).is(v0));
3335 int arity = instr->arity();
3338 instr);
3343 void LCodeGen::DoCallNamed(LCallNamed* instr) {
3344 ASSERT(ToRegister(instr->result()).is(v0));
3346 int arity = instr->arity();
3350 __ li(a2, Operand(instr->name()));
3351 CallCode(ic, mode, instr);
3357 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3358 ASSERT(ToRegister(instr->function()).is(a1));
3359 ASSERT(ToRegister(instr->result()).is(v0));
3361 int arity = instr->arity();
3363 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3368 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3369 ASSERT(ToRegister(instr->result()).is(v0));
3371 int arity = instr->arity();
3375 __ li(a2, Operand(instr->name()));
3376 CallCode(ic, mode, instr);
3381 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3382 ASSERT(ToRegister(instr->result()).is(v0));
3383 CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
3387 void LCodeGen::DoCallNew(LCallNew* instr) {
3388 ASSERT(ToRegister(instr->InputAt(0)).is(a1));
3389 ASSERT(ToRegister(instr->result()).is(v0));
3392 __ li(a0, Operand(instr->arity()));
3393 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
3397 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3398 CallRuntime(instr->function(), instr->arity(), instr);
3402 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3403 Register object = ToRegister(instr->object());
3404 Register value = ToRegister(instr->value());
3406 int offset = instr->offset();
3410 if (!instr->transition().is_null()) {
3411 __ li(scratch, Operand(instr->transition()));
3416 HType type = instr->hydrogen()->value()->type();
3419 if (instr->is_in_object()) {
3421 if (instr->hydrogen()->NeedsWriteBarrier()) {
3435 if (instr->hydrogen()->NeedsWriteBarrier()) {
3451 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3452 ASSERT(ToRegister(instr->object()).is(a1));
3453 ASSERT(ToRegister(instr->value()).is(a0));
3456 __ li(a2, Operand(instr->name()));
3457 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3460 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3464 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3466 instr->environment(),
3467 ToRegister(instr->index()),
3468 Operand(ToRegister(instr->length())));
3472 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3473 Register value = ToRegister(instr->value());
3474 Register elements = ToRegister(instr->object());
3475 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3479 if (instr->key()->IsConstantOperand()) {
3480 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3481 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3491 if (instr->hydrogen()->NeedsWriteBarrier()) {
3492 HType type = instr->hydrogen()->value()->type();
3509 LStoreKeyedFastDoubleElement* instr) {
3510 DoubleRegister value = ToDoubleRegister(instr->value());
3511 Register elements = ToRegister(instr->elements());
3514 bool key_is_constant = instr->key()->IsConstantOperand();
3521 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3526 key = ToRegister(instr->key());
3554 LStoreKeyedSpecializedArrayElement* instr) {
3556 Register external_pointer = ToRegister(instr->external_pointer());
3558 ElementsKind elements_kind = instr->elements_kind();
3559 bool key_is_constant = instr->key()->IsConstantOperand();
3562 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3567 key = ToRegister(instr->key());
3573 FPURegister value(ToDoubleRegister(instr->value()));
3588 Register value(ToRegister(instr->value()));
3626 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3627 ASSERT(ToRegister(instr->object()).is(a2));
3628 ASSERT(ToRegister(instr->key()).is(a1));
3629 ASSERT(ToRegister(instr->value()).is(a0));
3631 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3634 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3638 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
3639 Register object_reg = ToRegister(instr->object());
3640 Register new_map_reg = ToRegister(instr->new_map_reg());
3643 Handle<Map> from_map = instr->original_map();
3644 Handle<Map> to_map = instr->transitioned_map();
3648 __ mov(ToRegister(instr->result()), object_reg);
3662 Register fixed_object_reg = ToRegister(instr->temp_reg());
3667 RelocInfo::CODE_TARGET, instr);
3669 Register fixed_object_reg = ToRegister(instr->temp_reg());
3674 RelocInfo::CODE_TARGET, instr);
3682 void LCodeGen::DoStringAdd(LStringAdd* instr) {
3683 __ push(ToRegister(instr->left()));
3684 __ push(ToRegister(instr->right()));
3686 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3690 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3693 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3694 : LDeferredCode(codegen), instr_(instr) { }
3696 virtual LInstruction* instr() { return instr_; }
3702 new DeferredStringCharCodeAt(this, instr);
3704 ToRegister(instr->string()),
3705 ToRegister(instr->index()),
3706 ToRegister(instr->result()),
3712 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3713 Register string = ToRegister(instr->string());
3714 Register result = ToRegister(instr->result());
3726 if (instr->index()->IsConstantOperand()) {
3727 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3731 Register index = ToRegister(instr->index());
3735 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
3744 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3747 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3748 : LDeferredCode(codegen), instr_(instr) { }
3750 virtual LInstruction* instr() { return instr_; }
3756 new DeferredStringCharFromCode(this, instr);
3758 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3759 Register char_code = ToRegister(instr->char_code());
3760 Register result = ToRegister(instr->result());
3776 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3777 Register char_code = ToRegister(instr->char_code());
3778 Register result = ToRegister(instr->result());
3788 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
3793 void LCodeGen::DoStringLength(LStringLength* instr) {
3794 Register string = ToRegister(instr->InputAt(0));
3795 Register result = ToRegister(instr->result());
3800 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3801 LOperand* input = instr->InputAt(0);
3803 LOperand* output = instr->result();
3817 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3820 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
3821 : LDeferredCode(codegen), instr_(instr) { }
3823 virtual LInstruction* instr() { return instr_; }
3828 Register src = ToRegister(instr->InputAt(0));
3829 Register dst = ToRegister(instr->result());
3832 DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
3839 void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) {
3841 Register src = ToRegister(instr->InputAt(0));
3842 Register dst = ToRegister(instr->result());
3872 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3883 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3886 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3887 : LDeferredCode(codegen), instr_(instr) { }
3889 virtual LInstruction* instr() { return instr_; }
3894 DoubleRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3896 Register reg = ToRegister(instr->result());
3897 Register temp1 = ToRegister(instr->TempAt(0));
3898 Register temp2 = ToRegister(instr->TempAt(1));
3900 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3912 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3916 Register reg = ToRegister(instr->result());
3920 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3925 void LCodeGen::DoSmiTag(LSmiTag* instr) {
3926 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3927 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->InputAt(0)));
3931 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3933 Register input = ToRegister(instr->InputAt(0));
3934 Register result = ToRegister(instr->result());
3935 if (instr->needs_check()) {
3940 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
3997 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3998 Register input_reg = ToRegister(instr->InputAt(0));
4000 Register scratch2 = ToRegister(instr->TempAt(0));
4016 if (instr->truncating()) {
4017 Register scratch3 = ToRegister(instr->TempAt(1));
4018 DoubleRegister double_scratch2 = ToDoubleRegister(instr->TempAt(2));
4029 DeoptimizeIf(ne, instr->environment(), input_reg, Operand(at));
4030 ASSERT(ToRegister(instr->result()).is(input_reg));
4045 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at));
4060 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg));
4065 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4070 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg));
4077 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
4080 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
4081 : LDeferredCode(codegen), instr_(instr) { }
4083 virtual LInstruction* instr() { return instr_; }
4088 LOperand* input = instr->InputAt(0);
4090 ASSERT(input->Equals(instr->result()));
4094 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
4105 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
4106 LOperand* input = instr->InputAt(0);
4108 LOperand* result = instr->result();
4115 instr->hydrogen()->deoptimize_on_undefined(),
4116 instr->hydrogen()->deoptimize_on_minus_zero(),
4117 instr->environment());
4121 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
4122 Register result_reg = ToRegister(instr->result());
4124 Register scratch2 = ToRegister(instr->TempAt(0));
4125 DoubleRegister double_input = ToDoubleRegister(instr->InputAt(0));
4128 if (instr->truncating()) {
4129 Register scratch3 = ToRegister(instr->TempAt(1));
4147 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg));
4155 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
4156 LOperand* input = instr->InputAt(0);
4158 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
4162 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
4163 LOperand* input = instr->InputAt(0);
4165 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
4169 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
4170 Register input = ToRegister(instr->InputAt(0));
4175 if (instr->hydrogen()->is_interval_check()) {
4178 instr->hydrogen()->GetCheckInterval(&first, &last);
4182 DeoptimizeIf(ne, instr->environment(), scratch, Operand(first));
4184 DeoptimizeIf(lo, instr->environment(), scratch, Operand(first));
4187 DeoptimizeIf(hi, instr->environment(), scratch, Operand(last));
4193 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);
4198 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment(),
4202 DeoptimizeIf(ne, instr->environment(), scratch, Operand(tag));
4208 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
4209 Register reg = ToRegister(instr->value());
4210 Handle<JSFunction> target = instr->hydrogen()->target();
4212 Register reg = ToRegister(instr->value());
4217 DeoptimizeIf(ne, instr->environment(), reg,
4220 DeoptimizeIf(ne, instr->environment(), reg,
4238 void LCodeGen::DoCheckMap(LCheckMap* instr) {
4240 LOperand* input = instr->InputAt(0);
4243 Handle<Map> map = instr->hydrogen()->map();
4244 DoCheckMapCommon(reg, scratch, map, instr->hydrogen()->mode(),
4245 instr->environment());
4249 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
4250 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped());
4251 Register result_reg = ToRegister(instr->result());
4252 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0));
4257 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
4258 Register unclamped_reg = ToRegister(instr->unclamped());
4259 Register result_reg = ToRegister(instr->result());
4264 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
4266 Register input_reg = ToRegister(instr->unclamped());
4267 Register result_reg = ToRegister(instr->result());
4268 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0));
4280 DeoptimizeIf(ne, instr->environment(), input_reg,
4299 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
4300 Register temp1 = ToRegister(instr->TempAt(0));
4301 Register temp2 = ToRegister(instr->TempAt(1));
4303 Handle<JSObject> holder = instr->holder();
4304 Handle<JSObject> current_prototype = instr->prototype();
4313 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4323 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4327 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
4330 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
4331 : LDeferredCode(codegen), instr_(instr) { }
4333 virtual LInstruction* instr() { return instr_; }
4338 DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr);
4340 Register result = ToRegister(instr->result());
4341 Register scratch = ToRegister(instr->TempAt(0));
4342 Register scratch2 = ToRegister(instr->TempAt(1));
4343 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4384 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
4385 Register result = ToRegister(instr->result());
4386 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4396 CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr);
4401 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4404 instr->hydrogen()->boilerplate_elements_kind();
4410 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object());
4418 instr->environment(),
4424 __ li(a2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
4431 int length = instr->hydrogen()->length();
4432 if (instr->hydrogen()->IsCopyOnWrite()) {
4433 ASSERT(instr->hydrogen()->depth() == 1);
4437 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4438 } else if (instr->hydrogen()->depth() > 1) {
4439 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
4441 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
4448 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4556 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4557 int size = instr->hydrogen()->total_size();
4568 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4572 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate());
4573 EmitDeepCopy(instr->hydrogen()->boilerplate(), v0, a1, &offset);
4578 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
4579 ASSERT(ToRegister(instr->result()).is(v0));
4580 Handle<FixedArray> literals(instr->environment()->closure()->literals());
4582 instr->hydrogen()->constant_properties();
4586 __ li(a3, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
4588 int flags = instr->hydrogen()->fast_elements()
4596 if (instr->hydrogen()->depth() > 1) {
4597 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
4600 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
4603 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4608 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
4609 ASSERT(ToRegister(instr->InputAt(0)).is(a0));
4610 ASSERT(ToRegister(instr->result()).is(v0));
4612 CallRuntime(Runtime::kToFastProperties, 1, instr);
4616 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
4627 instr->hydrogen()->literal_index() * kPointerSize;
4634 __ li(t2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
4635 __ li(t1, Operand(instr->hydrogen()->pattern()));
4636 __ li(t0, Operand(instr->hydrogen()->flags()));
4638 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
4651 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4670 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
4673 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
4674 bool pretenure = instr->hydrogen()->pretenure();
4679 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4686 CallRuntime(Runtime::kNewClosure, 3, instr);
4691 void LCodeGen::DoTypeof(LTypeof* instr) {
4692 ASSERT(ToRegister(instr->result()).is(v0));
4693 Register input = ToRegister(instr->InputAt(0));
4695 CallRuntime(Runtime::kTypeof, 1, instr);
4699 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
4700 Register input = ToRegister(instr->InputAt(0));
4701 int true_block = chunk_->LookupDestination(instr->true_block_id());
4702 int false_block = chunk_->LookupDestination(instr->false_block_id());
4712 instr->type_literal(),
4826 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
4827 Register temp1 = ToRegister(instr->TempAt(0));
4828 int true_block = chunk_->LookupDestination(instr->true_block_id());
4829 int false_block = chunk_->LookupDestination(instr->false_block_id());
4873 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
4875 ASSERT(instr->HasEnvironment());
4876 LEnvironment* env = instr->environment();
4882 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
4883 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg));
4887 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
4888 Register object = ToRegister(instr->object());
4889 Register key = ToRegister(instr->key());
4893 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4894 LPointerMap* pointers = instr->pointer_map();
4902 void LCodeGen::DoIn(LIn* instr) {
4903 Register obj = ToRegister(instr->object());
4904 Register key = ToRegister(instr->key());
4906 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4907 LPointerMap* pointers = instr->pointer_map();
4914 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
4918 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
4919 ASSERT(instr->HasEnvironment());
4920 LEnvironment* env = instr->environment();
4925 void LCodeGen::DoStackCheck(LStackCheck* instr) {
4928 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr)
4929 : LDeferredCode(codegen), instr_(instr) { }
4931 virtual LInstruction* instr() { return instr_; }
4936 ASSERT(instr->HasEnvironment());
4937 LEnvironment* env = instr->environment();
4940 if (instr->hydrogen()->is_function_entry()) {
4946 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4952 ASSERT(instr->hydrogen()->is_backwards_branch());
4955 new DeferredStackCheck(this, instr);
4959 __ bind(instr->done_label());
4960 deferred_stack_check->SetExit(instr->done_label());
4969 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4973 LEnvironment* environment = instr->environment();
4974 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4975 instr->SpilledDoubleRegisterArray());
4986 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4987 Register result = ToRegister(instr->result());
4988 Register object = ToRegister(instr->object());
4990 DeoptimizeIf(eq, instr->environment(), object, Operand(at));
4994 DeoptimizeIf(eq, instr->environment(), object, Operand(null_value));
4997 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
5001 DeoptimizeIf(le, instr->environment(), a1, Operand(LAST_JS_PROXY_TYPE));
5013 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
5018 DeoptimizeIf(ne, instr->environment(), a1, Operand(at));
5023 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
5024 Register map = ToRegister(instr->map());
5025 Register result = ToRegister(instr->result());
5030 FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
5031 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
5035 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
5036 Register object = ToRegister(instr->value());
5037 Register map = ToRegister(instr->map());
5039 DeoptimizeIf(ne, instr->environment(), map, Operand(scratch0()));
5043 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
5044 Register object = ToRegister(instr->object());
5045 Register index = ToRegister(instr->index());
5046 Register result = ToRegister(instr->result());