| Index: runtime/vm/intermediate_language_x64.cc
|
| diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
|
| index a49bf9bcc2cd2b6c05048bc68e23b7872e046f09..24fb6e83dfa530e8ccac6cbd15da617965276e0d 100644
|
| --- a/runtime/vm/intermediate_language_x64.cc
|
| +++ b/runtime/vm/intermediate_language_x64.cc
|
| @@ -1094,6 +1094,100 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| }
|
|
|
|
|
| +CompileType LoadCodeUnitsInstr::ComputeType() const {
|
| + switch (class_id()) {
|
| + case kOneByteStringCid:
|
| + case kTwoByteStringCid:
|
| + case kExternalOneByteStringCid:
|
| + case kExternalTwoByteStringCid:
|
| + return CompileType::FromCid(kSmiCid);
|
| + default:
|
| + UNIMPLEMENTED();
|
| + return CompileType::Dynamic();
|
| + }
|
| +}
|
| +
|
| +
|
| +Representation LoadCodeUnitsInstr::representation() const {
|
| + switch (class_id()) {
|
| + case kOneByteStringCid:
|
| + case kTwoByteStringCid:
|
| + case kExternalOneByteStringCid:
|
| + case kExternalTwoByteStringCid:
|
| + return kTagged;
|
| + 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());
|
| + }
|
| +
|
| + 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());
|
| + }
|
| + 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;
|
| + case 4: __ movl(result, element_address); break;
|
| + default: UNREACHABLE();
|
| + }
|
| + __ SmiTag(result);
|
| + break;
|
| + case kTwoByteStringCid:
|
| + case kExternalTwoByteStringCid:
|
| + switch (element_count()) {
|
| + case 1: __ movzxw(result, element_address); break;
|
| + case 2: __ movl(result, element_address); break;
|
| + default: UNREACHABLE();
|
| + }
|
| + __ SmiTag(result);
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| + break;
|
| + }
|
| +}
|
| +
|
| +
|
| Representation StoreIndexedInstr::RequiredInputRepresentation(
|
| intptr_t idx) const {
|
| if (idx == 0) return kNoRepresentation;
|
| @@ -4472,6 +4566,38 @@ 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(CallingConventions::kArg1Reg));
|
| + summary->set_in(1, Location::RegisterLocation(CallingConventions::kArg2Reg));
|
| + summary->set_in(2, Location::RegisterLocation(CallingConventions::kArg3Reg));
|
| + summary->set_in(3, Location::RegisterLocation(CallingConventions::kArg4Reg));
|
| + // R13 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(R13));
|
| + summary->set_out(0, Location::RegisterLocation(RAX));
|
| + return summary;
|
| +}
|
| +
|
| +
|
| +void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
|
| + FlowGraphCompiler* compiler) {
|
| +
|
| + // Save RSP.
|
| + __ movq(locs()->temp(0).reg(), RSP);
|
| + __ ReserveAlignedFrameSpace(0);
|
| +
|
| + // Call the function. Parameters are already in their correct spots.
|
| + __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
|
| +
|
| + // Restore RSP.
|
| + __ movq(RSP, locs()->temp(0).reg());
|
| +}
|
| +
|
| +
|
| LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| const intptr_t kNumInputs = 1;
|
| @@ -5693,6 +5819,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);
|
| @@ -5725,6 +5864,42 @@ 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.
|
| + __ movq(sum_reg, Address(RBP, kPcMarkerSlotFromFp * kWordSize));
|
| +
|
| + // Subtract the entrypoint offset.
|
| + __ SubImmediate(sum_reg,
|
| + Immediate(Assembler::EntryPointToPcMarkerOffset()),
|
| + PP);
|
| +
|
| + // Add the offset.
|
| + Register offset_reg = locs()->in(0).reg();
|
| + __ SmiUntag(offset_reg);
|
| + __ addq(sum_reg, offset_reg);
|
| +
|
| + // Jump to the absolute address.
|
| + __ jmp(sum_reg);
|
| +}
|
| +
|
| LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| return LocationSummary::Make(isolate,
|
|
|