Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1645)

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 172653002: Unbox/Box Float64x2 and inline typed array loads and stores (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index e060657a517a8cf258d4b32f603fed2e9bb93bc3..2269fffee90f5acbbcbc886562b78a430681e0b5 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -834,6 +834,8 @@ CompileType LoadIndexedInstr::ComputeType() const {
return CompileType::FromCid(kFloat32x4Cid);
case kTypedDataInt32x4ArrayCid:
return CompileType::FromCid(kInt32x4Cid);
+ case kTypedDataFloat64x2ArrayCid:
+ return CompileType::FromCid(kFloat64x2Cid);
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
@@ -887,6 +889,8 @@ Representation LoadIndexedInstr::representation() const {
return kUnboxedFloat32x4;
case kTypedDataInt32x4ArrayCid:
return kUnboxedInt32x4;
+ case kTypedDataFloat64x2ArrayCid:
+ return kUnboxedFloat64x2;
default:
UNIMPLEMENTED();
return kTagged;
@@ -912,7 +916,8 @@ LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const {
}
if ((representation() == kUnboxedDouble) ||
(representation() == kUnboxedFloat32x4) ||
- (representation() == kUnboxedInt32x4)) {
+ (representation() == kUnboxedInt32x4) ||
+ (representation() == kUnboxedFloat64x2)) {
locs->set_out(Location::RequiresFpuRegister());
} else {
locs->set_out(Location::RequiresRegister());
@@ -945,7 +950,8 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if ((representation() == kUnboxedDouble) ||
(representation() == kUnboxedMint) ||
(representation() == kUnboxedFloat32x4) ||
- (representation() == kUnboxedInt32x4)) {
+ (representation() == kUnboxedInt32x4) ||
+ (representation() == kUnboxedFloat64x2)) {
XmmRegister result = locs()->out().fpu_reg();
if ((index_scale() == 1) && index.IsRegister()) {
__ SmiUntag(index.reg());
@@ -969,6 +975,7 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
+ case kTypedDataFloat64x2ArrayCid:
__ movups(result, element_address);
break;
}
@@ -1056,6 +1063,8 @@ Representation StoreIndexedInstr::RequiredInputRepresentation(
return kUnboxedFloat32x4;
case kTypedDataInt32x4ArrayCid:
return kUnboxedInt32x4;
+ case kTypedDataFloat64x2ArrayCid:
+ return kUnboxedFloat64x2;
default:
UNIMPLEMENTED();
return kTagged;
@@ -1118,6 +1127,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const {
break;
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
+ case kTypedDataFloat64x2ArrayCid:
locs->set_in(2, Location::RequiresFpuRegister());
break;
default:
@@ -1239,6 +1249,7 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
+ case kTypedDataFloat64x2ArrayCid:
__ movups(element_address, locs()->in(2).fpu_reg());
break;
default:
@@ -1995,6 +2006,37 @@ class BoxFloat32x4SlowPath : public SlowPathCode {
};
+class BoxFloat64x2SlowPath : public SlowPathCode {
+ public:
+ explicit BoxFloat64x2SlowPath(Instruction* instruction)
+ : instruction_(instruction) { }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Comment("BoxFloat64x2SlowPath");
+ __ Bind(entry_label());
+ const Class& float64x2_class = compiler->float64x2_class();
+ const Code& stub =
+ Code::Handle(StubCode::GetAllocationStubForClass(float64x2_class));
+ const ExternalLabel label(float64x2_class.ToCString(), stub.EntryPoint());
+
+ LocationSummary* locs = instruction_->locs();
+ locs->live_registers()->Remove(locs->out());
+
+ compiler->SaveLiveRegisters(locs);
+ compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
+ &label,
+ PcDescriptors::kOther,
+ locs);
+ __ MoveRegister(locs->out().reg(), EAX);
+ compiler->RestoreLiveRegisters(locs);
+
+ __ jmp(exit_label());
+ }
+
+ private:
+ Instruction* instruction_;
+};
+
LocationSummary* LoadFieldInstr::MakeLocationSummary(bool opt) const {
const intptr_t kNumInputs = 1;
@@ -3042,6 +3084,69 @@ void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs,
+ kNumTemps,
+ LocationSummary::kCallOnSlowPath);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_out(Location::RequiresRegister());
+ return summary;
+}
+
+
+void BoxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ BoxFloat64x2SlowPath* slow_path = new BoxFloat64x2SlowPath(this);
+ compiler->AddSlowPathCode(slow_path);
+
+ Register out_reg = locs()->out().reg();
+ XmmRegister value = locs()->in(0).fpu_reg();
+
+ __ TryAllocate(compiler->float64x2_class(),
+ slow_path->entry_label(),
+ Assembler::kFarJump,
+ out_reg,
+ kNoRegister);
+ __ Bind(slow_path->exit_label());
+ __ movups(FieldAddress(out_reg, Float64x2::value_offset()), value);
+}
+
+
+LocationSummary* UnboxFloat64x2Instr::MakeLocationSummary(bool opt) const {
+ const intptr_t value_cid = value()->Type()->ToCid();
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = value_cid == kFloat64x2Cid ? 0 : 1;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresRegister());
+ if (kNumTemps > 0) {
+ ASSERT(kNumTemps == 1);
+ summary->set_temp(0, Location::RequiresRegister());
+ }
+ summary->set_out(Location::RequiresFpuRegister());
+ return summary;
+}
+
+
+void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const intptr_t value_cid = value()->Type()->ToCid();
+ const Register value = locs()->in(0).reg();
+ const XmmRegister result = locs()->out().fpu_reg();
+
+ if (value_cid != kFloat64x2Cid) {
+ const Register temp = locs()->temp(0).reg();
+ Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass);
+ __ testl(value, Immediate(kSmiTagMask));
+ __ j(ZERO, deopt);
+ __ CompareClassId(value, kFloat64x2Cid, temp);
+ __ j(NOT_EQUAL, deopt);
+ }
+ __ movups(result, FieldAddress(value, Float64x2::value_offset()));
+}
+
+
LocationSummary* BoxInt32x4Instr::MakeLocationSummary(bool opt) const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698