Index: runtime/vm/intermediate_language_arm.cc |
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc |
index 9f0fc6f0ff67fbba1310bc233b3c0f6f8da5ff38..6933936da6a8f43c5e871c2ed5ac30984c288e12 100644 |
--- a/runtime/vm/intermediate_language_arm.cc |
+++ b/runtime/vm/intermediate_language_arm.cc |
@@ -1361,6 +1361,128 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} |
+CompileType LoadCodeUnitsInstr::ComputeType() const { |
+ switch (class_id()) { |
+ case kOneByteStringCid: |
+ case kExternalOneByteStringCid: |
+ return CompileType::FromCid(element_count() < 4 ? kSmiCid : kMintCid); |
+ case kTwoByteStringCid: |
+ case kExternalTwoByteStringCid: |
+ return CompileType::FromCid(element_count() < 2 ? kSmiCid : kMintCid); |
+ default: |
+ UNIMPLEMENTED(); |
+ return CompileType::Dynamic(); |
+ } |
+} |
+ |
+ |
+Representation LoadCodeUnitsInstr::representation() const { |
+ switch (class_id()) { |
+ case kOneByteStringCid: |
+ case kExternalOneByteStringCid: |
+ return element_count() < 4 ? kTagged : kUnboxedMint; |
+ case kTwoByteStringCid: |
+ case kExternalTwoByteStringCid: |
+ return element_count() < 2 ? kTagged : kUnboxedMint; |
+ default: |
+ UNIMPLEMENTED(); |
+ return kTagged; |
+ } |
+} |
+ |
+ |
+LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, |
+ bool opt) const { |
+ const intptr_t kNumInputs = 2; |
+ const intptr_t kNumTemps = 0; |
+ LocationSummary* locs = new(isolate) LocationSummary( |
+ isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
+ locs->set_in(0, Location::RequiresRegister()); |
+ bool needs_base = false; |
+ if (CanBeImmediateIndex(index(), class_id(), IsExternal(), |
+ true, // Load. |
+ &needs_base)) { |
+ // CanBeImmediateIndex must return false for unsafe smis. |
+ locs->set_in(1, Location::Constant(index()->definition()->AsConstant())); |
+ } else { |
+ locs->set_in(1, Location::RequiresRegister()); |
+ } |
+ |
+ if (representation() == kUnboxedMint) { |
+ locs->set_out(0, Location::Pair(Location::RequiresRegister(), |
+ Location::RequiresRegister())); |
+ } else { |
+ ASSERT(representation() == kTagged); |
+ locs->set_out(0, Location::RequiresRegister()); |
+ } |
+ |
+ return locs; |
+} |
+ |
+ |
+void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ const Register array = locs()->in(0).reg(); |
+ const Location index = locs()->in(1); |
+ |
+ Address element_address = index.IsRegister() |
+ ? __ ElementAddressForRegIndex(true, // Load. |
+ IsExternal(), class_id(), index_scale(), |
+ array, |
+ index.reg()) |
+ : __ ElementAddressForIntIndex(true, // Load. |
+ IsExternal(), class_id(), index_scale(), |
+ array, Smi::Cast(index.constant()).Value(), |
+ IP); // Temp register. |
+ // Warning: element_address may use register IP as base. |
+ |
+ if (representation() == kUnboxedMint) { |
+ ASSERT(locs()->out(0).IsPairLocation()); |
+ PairLocation* result_pair = locs()->out(0).AsPairLocation(); |
+ Register result1 = result_pair->At(0).reg(); |
+ Register result2 = result_pair->At(1).reg(); |
+ switch (class_id()) { |
+ case kOneByteStringCid: |
+ case kExternalOneByteStringCid: |
+ ASSERT(element_count() == 4); |
+ __ ldr(result1, element_address); |
+ __ eor(result2, result2, Operand(result2)); |
+ break; |
+ case kTwoByteStringCid: |
+ case kExternalTwoByteStringCid: |
+ ASSERT(element_count() == 2); |
+ __ ldr(result1, element_address); |
+ __ eor(result2, result2, Operand(result2)); |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ } |
+ } else { |
+ ASSERT(representation() == kTagged); |
+ Register result = locs()->out(0).reg(); |
+ switch (class_id()) { |
+ case kOneByteStringCid: |
+ case kExternalOneByteStringCid: |
+ switch (element_count()) { |
+ case 1: __ ldrb(result, element_address); break; |
+ case 2: __ ldrsh(result, element_address); break; |
+ default: UNREACHABLE(); |
+ } |
+ __ SmiTag(result); |
+ break; |
+ case kTwoByteStringCid: |
+ case kExternalTwoByteStringCid: |
+ ASSERT(element_count() == 1); |
+ __ ldrsh(result, element_address); |
+ __ SmiTag(result); |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ break; |
+ } |
+ } |
+} |
+ |
+ |
Representation StoreIndexedInstr::RequiredInputRepresentation( |
intptr_t idx) const { |
// Array can be a Dart object or a pointer to external data. |
@@ -5107,6 +5229,28 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} |
+LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
+ Isolate* isolate, bool opt) const { |
+ const intptr_t kNumTemps = 0; |
+ LocationSummary* summary = new(isolate) LocationSummary( |
+ isolate, InputCount(), kNumTemps, LocationSummary::kCall); |
+ summary->set_in(0, Location::RegisterLocation(R0)); |
+ summary->set_in(1, Location::RegisterLocation(R1)); |
+ summary->set_in(2, Location::RegisterLocation(R2)); |
+ summary->set_in(3, Location::RegisterLocation(R3)); |
+ summary->set_out(0, Location::RegisterLocation(R0)); |
+ return summary; |
+} |
+ |
+ |
+void CaseInsensitiveCompareUC16Instr::EmitNativeCode( |
+ FlowGraphCompiler* compiler) { |
+ |
+ // Call the function. |
+ __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); |
+} |
+ |
+ |
LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, |
bool opt) const { |
if (result_cid() == kDoubleCid) { |
@@ -6851,6 +6995,19 @@ void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} |
+void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ __ Bind(compiler->GetJumpLabel(this)); |
+ if (!compiler->is_optimizing()) { |
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
+ deopt_id_, |
+ Scanner::kNoSourcePos); |
+ } |
+ if (HasParallelMove()) { |
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
+ } |
+} |
+ |
+ |
LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, |
bool opt) const { |
return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); |
@@ -6883,6 +7040,40 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} |
+LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, |
+ bool opt) const { |
+ const intptr_t kNumInputs = 1; |
+ const intptr_t kNumTemps = 1; |
+ |
+ LocationSummary* locs = new(isolate) LocationSummary( |
+ isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
+ |
+ locs->set_in(0, Location::RequiresRegister()); |
+ locs->set_temp(0, Location::RequiresRegister()); |
+ |
+ return locs; |
+} |
+ |
+ |
+void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ Register sum_reg = locs()->temp_slot(0)->reg(); |
+ |
+ // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
+ __ ldr(sum_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
+ |
+ // Subtract the entrypoint offset. |
+ __ AddImmediate(sum_reg, -Assembler::EntryPointToPcMarkerOffset()); |
+ |
+ // Add the offset. |
+ Register offset_reg = locs()->in(0).reg(); |
+ __ SmiUntag(offset_reg); |
+ __ add(sum_reg, sum_reg, Operand(offset_reg)); |
+ |
+ // Jump to the absolute address. |
+ __ bx(sum_reg); |
+} |
+ |
+ |
LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, |
bool opt) const { |
return LocationSummary::Make(isolate, |