From 49e83ec90360e75417653aa4e0fa2297db28b87a Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Wed, 30 Jul 2014 06:46:25 +0000 Subject: [PATCH] X87: Inline Math.fround in optimized code. port r22665. original commit message: Inline Math.fround in optimized code. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/429143003 Patch from Chunyang Dai . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22691 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x87/lithium-codegen-x87.cc | 4 ++++ src/x87/lithium-x87.cc | 8 ++++++++ src/x87/lithium-x87.h | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index c32e5de..a7c5a9f 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -3733,6 +3733,10 @@ void LCodeGen::DoMathRound(LMathRound* instr) { UNIMPLEMENTED(); } +void LCodeGen::DoMathFround(LMathFround* instr) { + UNIMPLEMENTED(); +} + void LCodeGen::DoMathSqrt(LMathSqrt* instr) { UNIMPLEMENTED(); diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc index 290f4f2..361b20b 100644 --- a/src/x87/lithium-x87.cc +++ b/src/x87/lithium-x87.cc @@ -1148,6 +1148,7 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { switch (instr->op()) { case kMathFloor: return DoMathFloor(instr); case kMathRound: return DoMathRound(instr); + case kMathFround: return DoMathFround(instr); case kMathAbs: return DoMathAbs(instr); case kMathLog: return DoMathLog(instr); case kMathExp: return DoMathExp(instr); @@ -1175,6 +1176,13 @@ LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { } +LInstruction* LChunkBuilder::DoMathFround(HUnaryMathOperation* instr) { + LOperand* input = UseRegisterAtStart(instr->value()); + LMathFround* result = new (zone()) LMathFround(input); + return AssignEnvironment(DefineAsRegister(result)); +} + + LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { LOperand* context = UseAny(instr->context()); // Deferred use. LOperand* input = UseRegisterAtStart(instr->value()); diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h index ea76738..ec7418b 100644 --- a/src/x87/lithium-x87.h +++ b/src/x87/lithium-x87.h @@ -112,6 +112,7 @@ class LCodeGen; V(MathClz32) \ V(MathExp) \ V(MathFloor) \ + V(MathFround) \ V(MathLog) \ V(MathMinMax) \ V(MathPowHalf) \ @@ -873,6 +874,16 @@ class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 0> { }; +class LMathFround V8_FINAL : public LTemplateInstruction<1, 1, 0> { + public: + explicit LMathFround(LOperand* value) { inputs_[0] = value; } + + LOperand* value() { return inputs_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround") +}; + + class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> { public: LMathAbs(LOperand* context, LOperand* value) { @@ -2751,6 +2762,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase { LInstruction* DoMathFloor(HUnaryMathOperation* instr); LInstruction* DoMathRound(HUnaryMathOperation* instr); + LInstruction* DoMathFround(HUnaryMathOperation* instr); LInstruction* DoMathAbs(HUnaryMathOperation* instr); LInstruction* DoMathLog(HUnaryMathOperation* instr); LInstruction* DoMathExp(HUnaryMathOperation* instr); -- 2.7.4