X87: Inline Math.fround in optimized code.
authorweiliang.lin@intel.com <weiliang.lin@intel.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 30 Jul 2014 06:46:25 +0000 (06:46 +0000)
committerweiliang.lin@intel.com <weiliang.lin@intel.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 30 Jul 2014 06:46:25 +0000 (06:46 +0000)
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 <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22691 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/x87/lithium-codegen-x87.cc
src/x87/lithium-x87.cc
src/x87/lithium-x87.h

index c32e5de..a7c5a9f 100644 (file)
@@ -3733,6 +3733,10 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
   UNIMPLEMENTED();
 }
 
+void LCodeGen::DoMathFround(LMathFround* instr) {
+  UNIMPLEMENTED();
+}
+
 
 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
   UNIMPLEMENTED();
index 290f4f2..361b20b 100644 (file)
@@ -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());
index ea76738..ec7418b 100644 (file)
@@ -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);