Chromium Code Reviews| Index: runtime/vm/intermediate_language_arm.cc |
| diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc |
| index f3212d12ecfacd02bc187e2b5f28ae2dec5b98d2..98a3c0bb412beafc9b74eea5715f92467d9c9fc7 100644 |
| --- a/runtime/vm/intermediate_language_arm.cc |
| +++ b/runtime/vm/intermediate_language_arm.cc |
| @@ -1361,6 +1361,99 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| } |
| +Representation LoadCodeUnitsInstr::representation() const { |
| + switch (class_id()) { |
| + case kOneByteStringCid: |
| + case kExternalOneByteStringCid: |
| + // TODO(jgruber): kUnboxedUint32 could be a better choice. |
| + 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()); |
| + 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 = __ ElementAddressForRegIndex( |
| + true, IsExternal(), class_id(), index_scale(), array, index.reg()); |
| + // 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: __ ldrh(result, element_address); break; |
|
zerny-google
2014/10/07 12:18:35
Nit: the fact that case 3 is not missing would be
jgruber1
2014/10/07 15:00:25
Acknowledged.
|
| + default: UNREACHABLE(); |
| + } |
| + __ SmiTag(result); |
| + break; |
| + case kTwoByteStringCid: |
| + case kExternalTwoByteStringCid: |
| + ASSERT(element_count() == 1); |
| + __ ldrh(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. |
| @@ -5094,6 +5187,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) { |
| @@ -6870,6 +6985,38 @@ 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( |
|
zerny-google
2014/10/07 12:18:35
Nit: Not sure if locs or summary is the preferred
jgruber1
2014/10/07 15:00:25
Seems to be split 1:2 (locs:summary), I went with
|
| + 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 target_address_reg = locs()->temp_slot(0)->reg(); |
| + |
| + // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
| + __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
| + |
| + // Add the offset. |
| + Register offset_reg = locs()->in(0).reg(); |
| + __ add(target_address_reg, |
| + target_address_reg, |
| + Operand(offset_reg, ASR, kSmiTagSize)); |
| + |
| + // Jump to the absolute address. |
| + __ bx(target_address_reg); |
| +} |
| + |
| + |
| LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, |
| bool opt) const { |
| const intptr_t kNumInputs = 2; |