| Index: runtime/vm/intermediate_language_ia32.cc
|
| diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
|
| index d931ba692a8fbbaeef9b2a7e5362058f99da9937..5eb81d2fce419b6e947edd0375d82ae6c52dbff3 100644
|
| --- a/runtime/vm/intermediate_language_ia32.cc
|
| +++ b/runtime/vm/intermediate_language_ia32.cc
|
| @@ -1216,6 +1216,132 @@ 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());
|
| + // The smi index is either untagged (element size == 1), or it is left smi
|
| + // tagged (for all element sizes > 1).
|
| + if (index_scale() == 1) {
|
| + locs->set_in(1, CanBeImmediateIndex(index(), class_id())
|
| + ? Location::Constant(index()->definition()->AsConstant())
|
| + : Location::WritableRegister());
|
| + } else {
|
| + locs->set_in(1, CanBeImmediateIndex(index(), class_id())
|
| + ? Location::Constant(index()->definition()->AsConstant())
|
| + : 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()
|
| + ? Assembler::ElementAddressForRegIndex(
|
| + IsExternal(), class_id(), index_scale(), array, index.reg())
|
| + : Assembler::ElementAddressForIntIndex(
|
| + IsExternal(), class_id(), index_scale(),
|
| + array, Smi::Cast(index.constant()).Value());
|
| +
|
| + if ((index_scale() == 1) && index.IsRegister()) {
|
| + __ SmiUntag(index.reg());
|
| + }
|
| +
|
| + 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);
|
| + __ movl(result1, element_address);
|
| + __ xorl(result2, result2);
|
| + break;
|
| + case kTwoByteStringCid:
|
| + case kExternalTwoByteStringCid:
|
| + ASSERT(element_count() == 2);
|
| + __ movl(result1, element_address);
|
| + __ xorl(result2, 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: __ movzxb(result, element_address); break;
|
| + case 2: __ movzxw(result, element_address); break;
|
| + default: UNREACHABLE();
|
| + }
|
| + __ SmiTag(result);
|
| + break;
|
| + case kTwoByteStringCid:
|
| + case kExternalTwoByteStringCid:
|
| + switch (element_count()) {
|
| + case 1: __ movzxw(result, element_address); break;
|
| + default: UNREACHABLE();
|
| + }
|
| + __ 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.
|
| @@ -4678,6 +4804,43 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| }
|
|
|
|
|
| +LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
|
| + Isolate* isolate, bool opt) const {
|
| + const intptr_t kNumTemps = 1;
|
| + LocationSummary* summary = new(isolate) LocationSummary(
|
| + isolate, InputCount(), kNumTemps, LocationSummary::kCall);
|
| + summary->set_in(0, Location::RegisterLocation(EAX));
|
| + summary->set_in(1, Location::RegisterLocation(ECX));
|
| + summary->set_in(2, Location::RegisterLocation(EDX));
|
| + summary->set_in(3, Location::RegisterLocation(EBX));
|
| + // EDI is chosen because it is callee saved so we do not need to back it
|
| + // up before calling into the runtime.
|
| + summary->set_temp(0, Location::RegisterLocation(EDI));
|
| + summary->set_out(0, Location::RegisterLocation(EAX));
|
| + return summary;
|
| +}
|
| +
|
| +
|
| +void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
|
| + FlowGraphCompiler* compiler) {
|
| +
|
| + // Save ESP.
|
| + __ movl(locs()->temp(0).reg(), ESP);
|
| + __ ReserveAlignedFrameSpace(kWordSize * TargetFunction().argument_count());
|
| +
|
| + __ movl(Address(ESP, + 0 * kWordSize), locs()->in(0).reg());
|
| + __ movl(Address(ESP, + 1 * kWordSize), locs()->in(1).reg());
|
| + __ movl(Address(ESP, + 2 * kWordSize), locs()->in(2).reg());
|
| + __ movl(Address(ESP, + 3 * kWordSize), locs()->in(3).reg());
|
| +
|
| + // Call the function.
|
| + __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
|
| +
|
| + // Restore ESP.
|
| + __ movl(ESP, locs()->temp(0).reg());
|
| +}
|
| +
|
| +
|
| LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| if (result_cid() == kDoubleCid) {
|
| @@ -6488,6 +6651,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);
|
| @@ -6520,6 +6696,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.
|
| + __ movl(sum_reg, Address(EBP, kPcMarkerSlotFromFp * kWordSize));
|
| +
|
| + // Subtract the entrypoint offset.
|
| + __ SubImmediate(sum_reg, Immediate(Assembler::EntryPointToPcMarkerOffset()));
|
| +
|
| + // Add the offset.
|
| + Register offset_reg = locs()->in(0).reg();
|
| + __ SmiUntag(offset_reg);
|
| + __ addl(sum_reg, offset_reg);
|
| +
|
| + // Jump to the absolute address.
|
| + __ jmp(sum_reg);
|
| +}
|
| +
|
| +
|
| LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| return LocationSummary::Make(isolate,
|
|
|