Revision: 23460
Author:   [email protected]
Date:     Wed Aug 27 13:49:30 2014 UTC
Log: Disable some changes tests on ARM64. Also, fix the changes lowering to not use the more expensive TruncateFloat64ToInt32, but to use ChangeFloat64ToInt32/ChangeFloat64ToUint32, as it was before.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/512753002
https://code.google.com/p/v8/source/detail?r=23460

Modified:
 /branches/bleeding_edge/src/compiler/change-lowering.cc
 /branches/bleeding_edge/src/compiler/change-lowering.h
 /branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc

=======================================
--- /branches/bleeding_edge/src/compiler/change-lowering.cc Wed Aug 20 08:13:00 2014 UTC +++ /branches/bleeding_edge/src/compiler/change-lowering.cc Wed Aug 27 13:49:30 2014 UTC
@@ -27,12 +27,9 @@
     case IrOpcode::kChangeTaggedToFloat64:
       return ChangeTaggedToFloat64(node->InputAt(0), control);
     case IrOpcode::kChangeTaggedToInt32:
+      return ChangeTaggedToI32(node->InputAt(0), control, true);
     case IrOpcode::kChangeTaggedToUint32:
-      // ToInt32 and ToUint32 perform exactly the same operation, just the
- // interpretation of the resulting 32 bit value is different, so we can
-      // use the same subgraph for both operations.
-      // See ECMA-262 9.5: ToInt32 and ECMA-262 9.6: ToUint32.
-      return ChangeTaggedToInt32(node->InputAt(0), control);
+      return ChangeTaggedToI32(node->InputAt(0), control, false);
     case IrOpcode::kChangeUint32ToTagged:
       return ChangeUint32ToTagged(node->InputAt(0), control);
     default:
@@ -170,7 +167,8 @@
 }


-Reduction ChangeLowering::ChangeTaggedToInt32(Node* val, Node* control) {
+Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control,
+                                            bool is_signed) {
   STATIC_ASSERT(kSmiTag == 0);
   STATIC_ASSERT(kSmiTagMask == 1);

@@ -179,8 +177,9 @@
   Node* branch = graph()->NewNode(common()->Branch(), tag, control);

   Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
-  Node* change = graph()->NewNode(machine()->TruncateFloat64ToInt32(),
-                                  LoadHeapNumberValue(val, if_true));
+  Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
+                           : machine()->ChangeFloat64ToUint32();
+  Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));

   Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
   Node* number = ChangeSmiToInt32(val);
=======================================
--- /branches/bleeding_edge/src/compiler/change-lowering.h Wed Aug 20 08:13:00 2014 UTC +++ /branches/bleeding_edge/src/compiler/change-lowering.h Wed Aug 27 13:49:30 2014 UTC
@@ -40,7 +40,7 @@
   Reduction ChangeFloat64ToTagged(Node* val, Node* control);
   Reduction ChangeInt32ToTagged(Node* val, Node* control);
   Reduction ChangeTaggedToFloat64(Node* val, Node* control);
-  Reduction ChangeTaggedToInt32(Node* val, Node* control);
+  Reduction ChangeTaggedToI32(Node* val, Node* control, bool is_signed);
   Reduction ChangeUint32ToTagged(Node* val, Node* control);

   Graph* graph() const;
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc Wed Aug 27 11:14:10 2014 UTC +++ /branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc Wed Aug 27 13:49:30 2014 UTC
@@ -14,6 +14,7 @@
 #include "src/compiler/typer.h"
 #include "src/compiler/verifier.h"
 #include "src/execution.h"
+#include "src/globals.h"
 #include "src/parser.h"
 #include "src/rewriter.h"
 #include "src/scopes.h"
@@ -302,7 +303,12 @@
 }


-TEST(RunChangeInt32ToTagged) {
+#ifndef V8_TARGET_ARCH_ARM64
+// TODO(titzer): disabled on ARM64 because calling into the runtime to
+// allocate uses the wrong stack pointer.
+// TODO(titzer): disabled on ARM
+
+TEST(RunChangeInt32ToTaggedSmi) {
   ChangesLoweringTester<Object*> t;
   int32_t input;
   t.BuildLoadAndLower(t.simplified()->ChangeInt32ToTagged(),
@@ -311,23 +317,15 @@
   if (Pipeline::SupportedTarget()) {
     FOR_INT32_INPUTS(i) {
       input = *i;
-      Object* result = t.CallWithPotentialGC<Object>();
+      if (!Smi::IsValid(input)) continue;
+      Object* result = t.Call();
       t.CheckNumber(static_cast<double>(input), result);
     }
   }
-
-  if (Pipeline::SupportedTarget()) {
-    FOR_INT32_INPUTS(i) {
-      input = *i;
-      CcTest::heap()->DisableInlineAllocation();
-      Object* result = t.CallWithPotentialGC<Object>();
-      t.CheckNumber(static_cast<double>(input), result);
-    }
-  }
 }


-TEST(RunChangeUint32ToTagged) {
+TEST(RunChangeUint32ToTaggedSmi) {
   ChangesLoweringTester<Object*> t;
   uint32_t input;
   t.BuildLoadAndLower(t.simplified()->ChangeUint32ToTagged(),
@@ -336,19 +334,55 @@
   if (Pipeline::SupportedTarget()) {
     FOR_UINT32_INPUTS(i) {
       input = *i;
-      Object* result = t.CallWithPotentialGC<Object>();
+      if (input > static_cast<uint32_t>(Smi::kMaxValue)) continue;
+      Object* result = t.Call();
       double expected = static_cast<double>(input);
       t.CheckNumber(expected, result);
     }
   }
+}
+
+
+TEST(RunChangeInt32ToTagged) {
+  ChangesLoweringTester<Object*> t;
+  int32_t input;
+  t.BuildLoadAndLower(t.simplified()->ChangeInt32ToTagged(),
+                      t.machine()->Load(kMachInt32), &input);

   if (Pipeline::SupportedTarget()) {
-    FOR_UINT32_INPUTS(i) {
-      input = *i;
-      CcTest::heap()->DisableInlineAllocation();
-      Object* result = t.CallWithPotentialGC<Object>();
-      double expected = static_cast<double>(static_cast<uint32_t>(input));
-      t.CheckNumber(expected, result);
+    for (int m = 0; m < 3; m++) {  // Try 3 GC modes.
+      FOR_INT32_INPUTS(i) {
+        if (m == 0) CcTest::heap()->EnableInlineAllocation();
+        if (m == 1) CcTest::heap()->DisableInlineAllocation();
+        if (m == 2) SimulateFullSpace(CcTest::heap()->new_space());
+
+        input = *i;
+        Object* result = t.CallWithPotentialGC<Object>();
+        t.CheckNumber(static_cast<double>(input), result);
+      }
+    }
+  }
+}
+
+
+TEST(RunChangeUint32ToTagged) {
+  ChangesLoweringTester<Object*> t;
+  uint32_t input;
+  t.BuildLoadAndLower(t.simplified()->ChangeUint32ToTagged(),
+                      t.machine()->Load(kMachUint32), &input);
+
+  if (Pipeline::SupportedTarget()) {
+    for (int m = 0; m < 3; m++) {  // Try 3 GC modes.
+      FOR_UINT32_INPUTS(i) {
+        if (m == 0) CcTest::heap()->EnableInlineAllocation();
+        if (m == 1) CcTest::heap()->DisableInlineAllocation();
+        if (m == 2) SimulateFullSpace(CcTest::heap()->new_space());
+
+        input = *i;
+        Object* result = t.CallWithPotentialGC<Object>();
+        double expected = static_cast<double>(input);
+        t.CheckNumber(expected, result);
+      }
     }
   }
 }
@@ -360,20 +394,19 @@
   t.BuildLoadAndLower(t.simplified()->ChangeFloat64ToTagged(),
                       t.machine()->Load(kMachFloat64), &input);

-  {
-    FOR_FLOAT64_INPUTS(i) {
-      input = *i;
-      Object* result = t.CallWithPotentialGC<Object>();
-      t.CheckNumber(input, result);
-    }
-  }
+  if (Pipeline::SupportedTarget()) {
+    for (int m = 0; m < 3; m++) {  // Try 3 GC modes.
+      FOR_FLOAT64_INPUTS(i) {
+        if (m == 0) CcTest::heap()->EnableInlineAllocation();
+        if (m == 1) CcTest::heap()->DisableInlineAllocation();
+        if (m == 2) SimulateFullSpace(CcTest::heap()->new_space());

-  {
-    FOR_FLOAT64_INPUTS(i) {
-      input = *i;
-      CcTest::heap()->DisableInlineAllocation();
-      Object* result = t.CallWithPotentialGC<Object>();
-      t.CheckNumber(input, result);
+        input = *i;
+        Object* result = t.CallWithPotentialGC<Object>();
+        t.CheckNumber(input, result);
+      }
     }
   }
 }
+
+#endif  // !V8_TARGET_ARCH_ARM64

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to