Lines Matching refs:instr
219 LInstruction* instr = instructions_->at(current_instruction_);
220 if (instr->IsLabel()) {
221 LLabel* label = LLabel::cast(instr);
226 Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic());
227 instr->CompileToNative(this);
486 LInstruction* instr) {
487 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT);
493 LInstruction* instr,
495 ASSERT(instr != NULL);
496 LPointerMap* pointers = instr->pointer_map();
499 RegisterLazyDeoptimization(instr, safepoint_mode);
512 LInstruction* instr) {
513 ASSERT(instr != NULL);
514 LPointerMap* pointers = instr->pointer_map();
519 RegisterLazyDeoptimization(instr, RECORD_SIMPLE_SAFEPOINT);
525 LInstruction* instr) {
528 instr->pointer_map(), argc, Safepoint::kNoDeoptimizationIndex);
532 void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr,
538 if (instr->HasDeoptimizationEnvironment()) {
539 deoptimization_environment = instr->deoptimization_environment();
541 deoptimization_environment = instr->environment();
546 RecordSafepoint(instr->pointer_map(),
551 instr->pointer_map(),
775 void LCodeGen::DoParameter(LParameter* instr) {
780 void LCodeGen::DoCallStub(LCallStub* instr) {
781 ASSERT(ToRegister(instr->result()).is(r0));
782 switch (instr->hydrogen()->major_key()) {
785 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
790 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
795 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
800 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
805 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
810 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
815 TranscendentalCacheStub stub(instr->transcendental_type(),
817 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
826 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
831 void LCodeGen::DoModI(LModI* instr) {
832 if (instr->hydrogen()->HasPowerOf2Divisor()) {
833 Register dividend = ToRegister(instr->InputAt(0));
836 HConstant::cast(instr->hydrogen()->right())->Integer32Value();
846 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
848 DeoptimizeIf(al, instr->environment());
859 Register left = ToRegister(instr->InputAt(0));
860 Register right = ToRegister(instr->InputAt(1));
861 Register result = ToRegister(instr->result());
864 Register scratch2 = ToRegister(instr->TempAt(0));
865 DwVfpRegister dividend = ToDoubleRegister(instr->TempAt(1));
866 DwVfpRegister divisor = ToDoubleRegister(instr->TempAt(2));
881 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
883 DeoptimizeIf(eq, instr->environment());
951 if (!instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
959 DeoptimizeIf(mi, instr->environment());
969 void LCodeGen::DoDivI(LDivI* instr) {
972 DeferredDivI(LCodeGen* codegen, LDivI* instr)
973 : LDeferredCode(codegen), instr_(instr) { }
981 const Register left = ToRegister(instr->InputAt(0));
982 const Register right = ToRegister(instr->InputAt(1));
984 const Register result = ToRegister(instr->result());
987 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
989 DeoptimizeIf(eq, instr->environment());
993 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
998 DeoptimizeIf(mi, instr->environment());
1003 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1008 DeoptimizeIf(eq, instr->environment());
1030 DeferredDivI* deferred = new DeferredDivI(this, instr);
1044 DeoptimizeIf(al, instr->environment());
1050 void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
1052 Register left = ToRegister(instr->InputAt(0));
1053 Register right = ToRegister(instr->InputAt(1));
1072 RecordSafepointWithRegistersAndDoubles(instr->pointer_map(),
1080 void LCodeGen::DoMulI(LMulI* instr) {
1082 Register left = ToRegister(instr->InputAt(0));
1083 Register right = EmitLoadRegister(instr->InputAt(1), scratch);
1085 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero) &&
1086 !instr->InputAt(1)->IsConstantOperand()) {
1087 __ orr(ToRegister(instr->TempAt(0)), left, right);
1090 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1095 DeoptimizeIf(ne, instr->environment());
1100 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1105 if (instr->InputAt(1)->IsConstantOperand()) {
1106 if (ToInteger32(LConstantOperand::cast(instr->InputAt(1))) <= 0) {
1107 DeoptimizeIf(al, instr->environment());
1111 __ cmp(ToRegister(instr->TempAt(0)), Operand(0));
1112 DeoptimizeIf(mi, instr->environment());
1119 void LCodeGen::DoBitI(LBitI* instr) {
1120 LOperand* left = instr->InputAt(0);
1121 LOperand* right = instr->InputAt(1);
1122 ASSERT(left->Equals(instr->result()));
1135 switch (instr->op()) {
1152 void LCodeGen::DoShiftI(LShiftI* instr) {
1154 LOperand* left = instr->InputAt(0);
1155 LOperand* right = instr->InputAt(1);
1156 ASSERT(left->Equals(instr->result()));
1162 switch (instr->op()) {
1167 if (instr->can_deopt()) {
1169 DeoptimizeIf(mi, instr->environment());
1184 switch (instr->op()) {
1191 if (shift_count == 0 && instr->can_deopt()) {
1193 DeoptimizeIf(ne, instr->environment());
1211 void LCodeGen::DoSubI(LSubI* instr) {
1212 LOperand* left = instr->InputAt(0);
1213 LOperand* right = instr->InputAt(1);
1214 ASSERT(left->Equals(instr->result()));
1215 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1227 DeoptimizeIf(vs, instr->environment());
1232 void LCodeGen::DoConstantI(LConstantI* instr) {
1233 ASSERT(instr->result()->IsRegister());
1234 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1238 void LCodeGen::DoConstantD(LConstantD* instr) {
1239 ASSERT(instr->result()->IsDoubleRegister());
1240 DwVfpRegister result = ToDoubleRegister(instr->result());
1241 double v = instr->value();
1246 void LCodeGen::DoConstantT(LConstantT* instr) {
1247 ASSERT(instr->result()->IsRegister());
1248 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1252 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1253 Register result = ToRegister(instr->result());
1254 Register array = ToRegister(instr->InputAt(0));
1259 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1260 Register result = ToRegister(instr->result());
1261 Register array = ToRegister(instr->InputAt(0));
1266 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1267 Register result = ToRegister(instr->result());
1268 Register array = ToRegister(instr->InputAt(0));
1273 void LCodeGen::DoValueOf(LValueOf* instr) {
1274 Register input = ToRegister(instr->InputAt(0));
1275 Register result = ToRegister(instr->result());
1276 Register map = ToRegister(instr->TempAt(0));
1293 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1294 LOperand* input = instr->InputAt(0);
1295 ASSERT(input->Equals(instr->result()));
1300 void LCodeGen::DoThrow(LThrow* instr) {
1301 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1303 CallRuntime(Runtime::kThrow, 1, instr);
1311 void LCodeGen::DoAddI(LAddI* instr) {
1312 LOperand* left = instr->InputAt(0);
1313 LOperand* right = instr->InputAt(1);
1314 ASSERT(left->Equals(instr->result()));
1315 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1327 DeoptimizeIf(vs, instr->environment());
1332 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1333 DoubleRegister left = ToDoubleRegister(instr->InputAt(0));
1334 DoubleRegister right = ToDoubleRegister(instr->InputAt(1));
1335 switch (instr->op()) {
1358 __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result()));
1371 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1372 ASSERT(ToRegister(instr->InputAt(0)).is(r1));
1373 ASSERT(ToRegister(instr->InputAt(1)).is(r0));
1374 ASSERT(ToRegister(instr->result()).is(r0));
1376 TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
1377 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1409 void LCodeGen::DoBranch(LBranch* instr) {
1410 int true_block = chunk_->LookupDestination(instr->true_block_id());
1411 int false_block = chunk_->LookupDestination(instr->false_block_id());
1413 Representation r = instr->hydrogen()->representation();
1415 Register reg = ToRegister(instr->InputAt(0));
1419 DoubleRegister reg = ToDoubleRegister(instr->InputAt(0));
1428 Register reg = ToRegister(instr->InputAt(0));
1429 if (instr->hydrogen()->type().IsBoolean()) {
1499 void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
1501 CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr);
1505 void LCodeGen::DoGoto(LGoto* instr) {
1508 DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
1509 : LDeferredCode(codegen), instr_(instr) { }
1516 if (instr->include_stack_check()) {
1517 deferred = new DeferredStackCheck(this, instr);
1519 EmitGoto(instr->block_id(), deferred);
1556 void LCodeGen::DoCmpID(LCmpID* instr) {
1557 LOperand* left = instr->InputAt(0);
1558 LOperand* right = instr->InputAt(1);
1559 LOperand* result = instr->result();
1563 if (instr->is_double()) {
1574 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1584 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
1585 LOperand* left = instr->InputAt(0);
1586 LOperand* right = instr->InputAt(1);
1587 int false_block = chunk_->LookupDestination(instr->false_block_id());
1588 int true_block = chunk_->LookupDestination(instr->true_block_id());
1590 if (instr->is_double()) {
1601 Condition cc = TokenToCondition(instr->op(), instr->is_double());
1606 void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
1607 Register left = ToRegister(instr->InputAt(0));
1608 Register right = ToRegister(instr->InputAt(1));
1609 Register result = ToRegister(instr->result());
1617 void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
1618 Register left = ToRegister(instr->InputAt(0));
1619 Register right = ToRegister(instr->InputAt(1));
1620 int false_block = chunk_->LookupDestination(instr->false_block_id());
1621 int true_block = chunk_->LookupDestination(instr->true_block_id());
1628 void LCodeGen::DoIsNull(LIsNull* instr) {
1629 Register reg = ToRegister(instr->InputAt(0));
1630 Register result = ToRegister(instr->result());
1634 if (instr->is_strict()) {
1662 void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) {
1664 Register reg = ToRegister(instr->InputAt(0));
1669 int true_block = chunk_->LookupDestination(instr->true_block_id());
1670 int false_block = chunk_->LookupDestination(instr->false_block_id());
1674 if (instr->is_strict()) {
1722 void LCodeGen::DoIsObject(LIsObject* instr) {
1723 Register reg = ToRegister(instr->InputAt(0));
1724 Register result = ToRegister(instr->result());
1742 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1743 Register reg = ToRegister(instr->InputAt(0));
1744 Register temp1 = ToRegister(instr->TempAt(0));
1747 int true_block = chunk_->LookupDestination(instr->true_block_id());
1748 int false_block = chunk_->LookupDestination(instr->false_block_id());
1759 void LCodeGen::DoIsSmi(LIsSmi* instr) {
1760 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1761 Register result = ToRegister(instr->result());
1762 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1772 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
1773 int true_block = chunk_->LookupDestination(instr->true_block_id());
1774 int false_block = chunk_->LookupDestination(instr->false_block_id());
1776 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip);
1782 static InstanceType TestType(HHasInstanceType* instr) {
1783 InstanceType from = instr->from();
1784 InstanceType to = instr->to();
1791 static Condition BranchCondition(HHasInstanceType* instr) {
1792 InstanceType from = instr->from();
1793 InstanceType to = instr->to();
1802 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) {
1803 Register input = ToRegister(instr->InputAt(0));
1804 Register result = ToRegister(instr->result());
1806 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1811 __ CompareObjectType(input, result, result, TestType(instr->hydrogen()));
1812 Condition cond = BranchCondition(instr->hydrogen());
1819 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
1821 Register input = ToRegister(instr->InputAt(0));
1823 int true_block = chunk_->LookupDestination(instr->true_block_id());
1824 int false_block = chunk_->LookupDestination(instr->false_block_id());
1831 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen()));
1832 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1836 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1837 Register input = ToRegister(instr->InputAt(0));
1838 Register result = ToRegister(instr->result());
1849 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1850 Register input = ToRegister(instr->InputAt(0));
1851 Register result = ToRegister(instr->result());
1854 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1864 LHasCachedArrayIndexAndBranch* instr) {
1865 Register input = ToRegister(instr->InputAt(0));
1868 int true_block = chunk_->LookupDestination(instr->true_block_id());
1869 int false_block = chunk_->LookupDestination(instr->false_block_id());
1935 void LCodeGen::DoClassOfTest(LClassOfTest* instr) {
1936 Register input = ToRegister(instr->InputAt(0));
1937 Register result = ToRegister(instr->result());
1939 Handle<String> class_name = instr->hydrogen()->class_name();
1956 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1957 Register input = ToRegister(instr->InputAt(0));
1959 Register temp2 = ToRegister(instr->TempAt(0));
1960 Handle<String> class_name = instr->hydrogen()->class_name();
1962 int true_block = chunk_->LookupDestination(instr->true_block_id());
1963 int false_block = chunk_->LookupDestination(instr->false_block_id());
1974 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1975 Register reg = ToRegister(instr->InputAt(0));
1976 Register temp = ToRegister(instr->TempAt(0));
1977 int true_block = instr->true_block_id();
1978 int false_block = instr->false_block_id();
1981 __ cmp(temp, Operand(instr->map()));
1986 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1987 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
1988 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
1991 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1999 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
2000 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
2001 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
2003 int true_block = chunk_->LookupDestination(instr->true_block_id());
2004 int false_block = chunk_->LookupDestination(instr->false_block_id());
2007 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2013 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
2017 LInstanceOfKnownGlobal* instr)
2018 : LDeferredCode(codegen), instr_(instr) { }
2031 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
2034 Register object = ToRegister(instr->InputAt(0));
2035 Register temp = ToRegister(instr->TempAt(0));
2036 Register result = ToRegister(instr->result());
2088 void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
2090 Register result = ToRegister(instr->result());
2107 Register temp = ToRegister(instr->TempAt(0));
2109 __ mov(InstanceofStub::right(), Operand(instr->function()));
2119 instr,
2147 void LCodeGen::DoCmpT(LCmpT* instr) {
2148 Token::Value op = instr->op();
2151 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2158 __ LoadRoot(ToRegister(instr->result()),
2161 __ LoadRoot(ToRegister(instr->result()),
2167 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
2168 Token::Value op = instr->op();
2169 int true_block = chunk_->LookupDestination(instr->true_block_id());
2170 int false_block = chunk_->LookupDestination(instr->false_block_id());
2173 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2186 void LCodeGen::DoReturn(LReturn* instr) {
2201 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2202 Register result = ToRegister(instr->result());
2203 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
2205 if (instr->hydrogen()->check_hole_value()) {
2208 DeoptimizeIf(eq, instr->environment());
2213 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2214 ASSERT(ToRegister(instr->global_object()).is(r0));
2215 ASSERT(ToRegister(instr->result()).is(r0));
2217 __ mov(r2, Operand(instr->name()));
2218 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET
2221 CallCode(ic, mode, instr);
2225 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2226 Register value = ToRegister(instr->InputAt(0));
2230 __ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
2236 if (instr->hydrogen()->check_hole_value()) {
2237 Register scratch2 = ToRegister(instr->TempAt(0));
2242 DeoptimizeIf(eq, instr->environment());
2250 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2251 ASSERT(ToRegister(instr->global_object()).is(r1));
2252 ASSERT(ToRegister(instr->value()).is(r0));
2254 __ mov(r2, Operand(instr->name()));
2255 Handle<Code> ic = instr->strict_mode()
2258 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2262 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2263 Register context = ToRegister(instr->context());
2264 Register result = ToRegister(instr->result());
2265 __ ldr(result, ContextOperand(context, instr->slot_index()));
2269 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2270 Register context = ToRegister(instr->context());
2271 Register value = ToRegister(instr->value());
2272 __ str(value, ContextOperand(context, instr->slot_index()));
2273 if (instr->needs_write_barrier()) {
2274 int offset = Context::SlotOffset(instr->slot_index());
2280 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2281 Register object = ToRegister(instr->InputAt(0));
2282 Register result = ToRegister(instr->result());
2283 if (instr->hydrogen()->is_in_object()) {
2284 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
2287 __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset()));
2313 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2314 Register object = ToRegister(instr->object());
2315 Register result = ToRegister(instr->result());
2317 int map_count = instr->hydrogen()->types()->length();
2318 Handle<String> name = instr->hydrogen()->name();
2320 ASSERT(instr->hydrogen()->need_generic());
2323 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2328 Handle<Map> map = instr->hydrogen()->types()->at(i);
2336 Handle<Map> map = instr->hydrogen()->types()->last();
2338 if (instr->hydrogen()->need_generic()) {
2346 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2348 DeoptimizeIf(ne, instr->environment());
2356 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2357 ASSERT(ToRegister(instr->object()).is(r0));
2358 ASSERT(ToRegister(instr->result()).is(r0));
2361 __ mov(r2, Operand(instr->name()));
2363 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2367 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2369 Register function = ToRegister(instr->function());
2370 Register result = ToRegister(instr->result());
2375 DeoptimizeIf(ne, instr->environment());
2390 DeoptimizeIf(eq, instr->environment());
2411 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2412 Register result = ToRegister(instr->result());
2413 Register input = ToRegister(instr->InputAt(0));
2437 LLoadExternalArrayPointer* instr) {
2438 Register to_reg = ToRegister(instr->result());
2439 Register from_reg = ToRegister(instr->InputAt(0));
2445 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2446 Register arguments = ToRegister(instr->arguments());
2447 Register length = ToRegister(instr->length());
2448 Register index = ToRegister(instr->index());
2449 Register result = ToRegister(instr->result());
2454 DeoptimizeIf(ls, instr->environment());
2463 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2464 Register elements = ToRegister(instr->elements());
2465 Register key = EmitLoadRegister(instr->key(), scratch0());
2466 Register result = ToRegister(instr->result());
2477 DeoptimizeIf(eq, instr->environment());
2482 LLoadKeyedSpecializedArrayElement* instr) {
2483 Register external_pointer = ToRegister(instr->external_pointer());
2484 Register key = ToRegister(instr->key());
2485 ExternalArrayType array_type = instr->array_type();
2488 DwVfpRegister result(ToDoubleRegister(instr->result()));
2493 Register result(ToRegister(instr->result()));
2517 DeoptimizeIf(cs, instr->environment());
2527 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2528 ASSERT(ToRegister(instr->object()).is(r1));
2529 ASSERT(ToRegister(instr->key()).is(r0));
2532 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2536 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2538 Register result = ToRegister(instr->result());
2553 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
2554 Register elem = ToRegister(instr->InputAt(0));
2555 Register result = ToRegister(instr->result());
2575 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2576 Register receiver = ToRegister(instr->receiver());
2577 Register function = ToRegister(instr->function());
2578 Register length = ToRegister(instr->length());
2579 Register elements = ToRegister(instr->elements());
2583 ASSERT(ToRegister(instr->result()).is(r0));
2597 DeoptimizeIf(eq, instr->environment());
2599 DeoptimizeIf(lo, instr->environment());
2610 DeoptimizeIf(hi, instr->environment());
2632 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2633 LPointerMap* pointers = instr->pointer_map();
2634 LEnvironment* env = instr->deoptimization_environment();
2648 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2649 LOperand* argument = instr->InputAt(0);
2659 void LCodeGen::DoContext(LContext* instr) {
2660 Register result = ToRegister(instr->result());
2665 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2666 Register context = ToRegister(instr->context());
2667 Register result = ToRegister(instr->result());
2674 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2675 Register context = ToRegister(instr->context());
2676 Register result = ToRegister(instr->result());
2681 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2682 Register global = ToRegister(instr->global());
2683 Register result = ToRegister(instr->result());
2690 LInstruction* instr) {
2706 LPointerMap* pointers = instr->pointer_map();
2714 RegisterLazyDeoptimization(instr, RECORD_SIMPLE_SAFEPOINT);
2721 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2722 ASSERT(ToRegister(instr->result()).is(r0));
2723 __ mov(r1, Operand(instr->function()));
2724 CallKnownFunction(instr->function(), instr->arity(), instr);
2728 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2729 ASSERT(instr->InputAt(0)->Equals(instr->result()));
2730 Register input = ToRegister(instr->InputAt(0));
2737 DeoptimizeIf(ne, instr->environment());
2772 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
2794 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
2795 Register input = ToRegister(instr->InputAt(0));
2802 DeoptimizeIf(vs, instr->environment());
2806 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
2811 LUnaryMathOperation* instr)
2812 : LDeferredCode(codegen), instr_(instr) { }
2820 ASSERT(instr->InputAt(0)->Equals(instr->result()));
2821 Representation r = instr->hydrogen()->value()->representation();
2823 DwVfpRegister input = ToDoubleRegister(instr->InputAt(0));
2826 EmitIntegerMathAbs(instr);
2830 new DeferredMathAbsTaggedHeapNumber(this, instr);
2831 Register input = ToRegister(instr->InputAt(0));
2835 EmitIntegerMathAbs(instr);
2841 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
2842 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2843 Register result = ToRegister(instr->result());
2846 Register scratch2 = ToRegister(instr->TempAt(0));
2853 DeoptimizeIf(ne, instr->environment());
2858 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2865 DeoptimizeIf(ne, instr->environment());
2871 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2872 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2873 Register result = ToRegister(instr->result());
2881 DeoptimizeIf(ne, instr->environment());
2884 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2891 DeoptimizeIf(ne, instr->environment());
2897 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2898 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2899 ASSERT(ToDoubleRegister(instr->result()).is(input));
2904 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
2905 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2909 ASSERT(ToDoubleRegister(instr->result()).is(input));
2920 void LCodeGen::DoPower(LPower* instr) {
2921 LOperand* left = instr->InputAt(0);
2922 LOperand* right = instr->InputAt(1);
2924 DoubleRegister result_reg = ToDoubleRegister(instr->result());
2925 Representation exponent_type = instr->hydrogen()->right()->representation();
2943 ASSERT(instr->hydrogen()->left()->representation().IsDouble());
2963 DeoptimizeIf(ne, instr->environment());
2981 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
2982 ASSERT(ToDoubleRegister(instr->result()).is(d2));
2985 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2989 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
2990 ASSERT(ToDoubleRegister(instr->result()).is(d2));
2993 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2997 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
2998 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3001 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3005 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
3006 switch (instr->op()) {
3008 DoMathAbs(instr);
3011 DoMathFloor(instr);
3014 DoMathRound(instr);
3017 DoMathSqrt(instr);
3020 DoMathPowHalf(instr);
3023 DoMathCos(instr);
3026 DoMathSin(instr);
3029 DoMathLog(instr);
3038 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3039 ASSERT(ToRegister(instr->result()).is(r0));
3041 int arity = instr->arity();
3044 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3049 void LCodeGen::DoCallNamed(LCallNamed* instr) {
3050 ASSERT(ToRegister(instr->result()).is(r0));
3052 int arity = instr->arity();
3055 __ mov(r2, Operand(instr->name()));
3056 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3062 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3063 ASSERT(ToRegister(instr->result()).is(r0));
3065 int arity = instr->arity();
3067 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3073 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3074 ASSERT(ToRegister(instr->result()).is(r0));
3076 int arity = instr->arity();
3079 __ mov(r2, Operand(instr->name()));
3080 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
3085 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3086 ASSERT(ToRegister(instr->result()).is(r0));
3087 __ mov(r1, Operand(instr->target()));
3088 CallKnownFunction(instr->target(), instr->arity(), instr);
3092 void LCodeGen::DoCallNew(LCallNew* instr) {
3093 ASSERT(ToRegister(instr->InputAt(0)).is(r1));
3094 ASSERT(ToRegister(instr->result()).is(r0));
3097 __ mov(r0, Operand(instr->arity()));
3098 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
3102 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3103 CallRuntime(instr->function(), instr->arity(), instr);
3107 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3108 Register object = ToRegister(instr->object());
3109 Register value = ToRegister(instr->value());
3111 int offset = instr->offset();
3115 if (!instr->transition().is_null()) {
3116 __ mov(scratch, Operand(instr->transition()));
3121 if (instr->is_in_object()) {
3123 if (instr->needs_write_barrier()) {
3130 if (instr->needs_write_barrier()) {
3139 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3140 ASSERT(ToRegister(instr->object()).is(r1));
3141 ASSERT(ToRegister(instr->value()).is(r0));
3144 __ mov(r2, Operand(instr->name()));
3145 Handle<Code> ic = instr->strict_mode()
3148 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3152 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3153 __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
3154 DeoptimizeIf(hs, instr->environment());
3158 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3159 Register value = ToRegister(instr->value());
3160 Register elements = ToRegister(instr->object());
3161 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3165 if (instr->key()->IsConstantOperand()) {
3166 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3167 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3176 if (instr->hydrogen()->NeedsWriteBarrier()) {
3185 LStoreKeyedSpecializedArrayElement* instr) {
3187 Register external_pointer = ToRegister(instr->external_pointer());
3188 Register key = ToRegister(instr->key());
3189 ExternalArrayType array_type = instr->array_type();
3192 DwVfpRegister value(ToDoubleRegister(instr->value()));
3197 Register value(ToRegister(instr->value()));
3224 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3225 ASSERT(ToRegister(instr->object()).is(r2));
3226 ASSERT(ToRegister(instr->key()).is(r1));
3227 ASSERT(ToRegister(instr->value()).is(r0));
3229 Handle<Code> ic = instr->strict_mode()
3232 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3236 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
3239 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
3240 : LDeferredCode(codegen), instr_(instr) { }
3247 Register string = ToRegister(instr->string());
3250 if (instr->index()->IsConstantOperand()) {
3251 const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3264 index = ToRegister(instr->index());
3266 Register result = ToRegister(instr->result());
3269 new DeferredStringCharCodeAt(this, instr);
3313 if (instr->index()->IsConstantOperand()) {
3328 if (instr->index()->IsConstantOperand()) {
3342 void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
3343 Register string = ToRegister(instr->string());
3344 Register result = ToRegister(instr->result());
3356 if (instr->index()->IsConstantOperand()) {
3357 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3361 Register index = ToRegister(instr->index());
3365 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
3374 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3377 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3378 : LDeferredCode(codegen), instr_(instr) { }
3385 new DeferredStringCharFromCode(this, instr);
3387 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3388 Register char_code = ToRegister(instr->char_code());
3389 Register result = ToRegister(instr->result());
3404 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3405 Register char_code = ToRegister(instr->char_code());
3406 Register result = ToRegister(instr->result());
3416 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
3421 void LCodeGen::DoStringLength(LStringLength* instr) {
3422 Register string = ToRegister(instr->InputAt(0));
3423 Register result = ToRegister(instr->result());
3428 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3429 LOperand* input = instr->InputAt(0);
3431 LOperand* output = instr->result();
3445 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
3448 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
3449 : LDeferredCode(codegen), instr_(instr) { }
3455 LOperand* input = instr->InputAt(0);
3456 instr->result()));
3459 DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
3466 void LCodeGen::DoDeferredNumberTagI(LNumberTagI* instr) {
3468 Register reg = ToRegister(instr->InputAt(0));
3498 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3510 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
3513 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
3514 : LDeferredCode(codegen), instr_(instr) { }
3520 DoubleRegister input_reg = ToDoubleRegister(instr->InputAt(0));
3522 Register reg = ToRegister(instr->result());
3523 Register temp1 = ToRegister(instr->TempAt(0));
3524 Register temp2 = ToRegister(instr->TempAt(1));
3526 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
3539 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
3543 Register reg = ToRegister(instr->result());
3547 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
3552 void LCodeGen::DoSmiTag(LSmiTag* instr) {
3553 LOperand* input = instr->InputAt(0);
3554 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3555 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
3560 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3561 LOperand* input = instr->InputAt(0);
3562 ASSERT(input->IsRegister() && input->Equals(instr->result()));
3563 if (instr->needs_check()) {
3565 DeoptimizeIf(ne, instr->environment());
3624 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr)
3625 : LDeferredCode(codegen), instr_(instr) { }
3632 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
3633 Register input_reg = ToRegister(instr->InputAt(0));
3635 Register scratch2 = ToRegister(instr->TempAt(0));
3649 if (instr->truncating()) {
3650 Register scratch3 = ToRegister(instr->TempAt(1));
3651 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->TempAt(2));
3663 DeoptimizeIf(ne, instr->environment());
3681 DeoptimizeIf(ne, instr->environment());
3691 DeoptimizeIf(ne, instr->environment());
3695 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3700 DeoptimizeIf(ne, instr->environment());
3707 void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
3708 LOperand* input = instr->InputAt(0);
3710 ASSERT(input->Equals(instr->result()));
3714 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
3727 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3728 LOperand* input = instr->InputAt(0);
3730 LOperand* result = instr->result();
3737 instr->hydrogen()->deoptimize_on_undefined(),
3738 instr->environment());
3742 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3743 Register result_reg = ToRegister(instr->result());
3745 Register scratch2 = ToRegister(instr->TempAt(0));
3746 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0));
3752 if (instr->truncating()) {
3753 Register scratch3 = ToRegister(instr->TempAt(1));
3770 DeoptimizeIf(ne, instr->environment());
3778 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
3779 LOperand* input = instr->InputAt(0);
3781 DeoptimizeIf(ne, instr->environment());
3785 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
3786 LOperand* input = instr->InputAt(0);
3788 DeoptimizeIf(eq, instr->environment());
3792 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3793 Register input = ToRegister(instr->InputAt(0));
3795 InstanceType first = instr->hydrogen()->first();
3796 InstanceType last = instr->hydrogen()->last();
3804 DeoptimizeIf(ne, instr->environment());
3806 DeoptimizeIf(lo, instr->environment());
3810 DeoptimizeIf(hi, instr->environment());
3816 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3817 ASSERT(instr->InputAt(0)->IsRegister());
3818 Register reg = ToRegister(instr->InputAt(0));
3819 __ cmp(reg, Operand(instr->hydrogen()->target()));
3820 DeoptimizeIf(ne, instr->environment());
3824 void LCodeGen::DoCheckMap(LCheckMap* instr) {
3826 LOperand* input = instr->InputAt(0);
3830 __ cmp(scratch, Operand(instr->hydrogen()->map()));
3831 DeoptimizeIf(ne, instr->environment());
3848 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
3849 Register temp1 = ToRegister(instr->TempAt(0));
3850 Register temp2 = ToRegister(instr->TempAt(1));
3852 Handle<JSObject> holder = instr->holder();
3853 Handle<JSObject> current_prototype = instr->prototype();
3862 DeoptimizeIf(ne, instr->environment());
3872 DeoptimizeIf(ne, instr->environment());
3876 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
3879 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3880 __ mov(r1, Operand(instr->hydrogen()->constant_elements()));
3884 int length = instr->hydrogen()->length();
3885 if (instr->hydrogen()->IsCopyOnWrite()) {
3886 ASSERT(instr->hydrogen()->depth() == 1);
3890 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3891 } else if (instr->hydrogen()->depth() > 1) {
3892 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
3894 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
3899 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3904 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
3907 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
3908 __ mov(r2, Operand(instr->hydrogen()->constant_properties()));
3909 __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0)));
3913 if (instr->hydrogen()->depth() > 1) {
3914 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
3916 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
3921 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
3922 ASSERT(ToRegister(instr->InputAt(0)).is(r0));
3924 CallRuntime(Runtime::kToFastProperties, 1, instr);
3928 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
3939 instr->hydrogen()->literal_index() * kPointerSize;
3947 instr->hydrogen()->literal_index())));
3948 __ mov(r5, Operand(instr->hydrogen()->pattern()));
3949 __ mov(r4, Operand(instr->hydrogen()->flags()));
3951 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
3964 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
3983 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
3986 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
3987 bool pretenure = instr->hydrogen()->pretenure();
3993 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4000 CallRuntime(Runtime::kNewClosure, 3, instr);
4005 void LCodeGen::DoTypeof(LTypeof* instr) {
4006 Register input = ToRegister(instr->InputAt(0));
4008 CallRuntime(Runtime::kTypeof, 1, instr);
4012 void LCodeGen::DoTypeofIs(LTypeofIs* instr) {
4013 Register input = ToRegister(instr->InputAt(0));
4014 Register result = ToRegister(instr->result());
4022 instr->type_literal());
4035 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
4036 Register input = ToRegister(instr->InputAt(0));
4037 int true_block = chunk_->LookupDestination(instr->true_block_id());
4038 int false_block = chunk_->LookupDestination(instr->false_block_id());
4045 instr->type_literal());
4116 void LCodeGen::DoIsConstructCall(LIsConstructCall* instr) {
4117 Register result = ToRegister(instr->result());
4136 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
4137 Register temp1 = ToRegister(instr->TempAt(0));
4138 int true_block = chunk_->LookupDestination(instr->true_block_id());
4139 int false_block = chunk_->LookupDestination(instr->false_block_id());
4165 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
4171 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
4172 DeoptimizeIf(al, instr->environment());
4176 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
4177 Register object = ToRegister(instr->object());
4178 Register key = ToRegister(instr->key());
4182 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4183 LPointerMap* pointers = instr->pointer_map();
4184 LEnvironment* env = instr->deoptimization_environment();
4194 void LCodeGen::DoStackCheck(LStackCheck* instr) {
4201 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4206 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4210 LEnvironment* environment = instr->environment();
4211 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4212 instr->SpilledDoubleRegisterArray());