Chromium Code Reviews| Index: test/cctest/compiler/test-changes-lowering.cc |
| diff --git a/test/cctest/compiler/test-changes-lowering.cc b/test/cctest/compiler/test-changes-lowering.cc |
| index b5227636b13a5d9b9a6828785461b7b7a5d3f948..f3ee4302f2a77db7ea826e8503d47b4621877643 100644 |
| --- a/test/cctest/compiler/test-changes-lowering.cc |
| +++ b/test/cctest/compiler/test-changes-lowering.cc |
| @@ -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,11 @@ TEST(RunChangeBitToBool) { |
| } |
| -TEST(RunChangeInt32ToTagged) { |
| +#ifndef V8_TARGET_ARCH_ARM64 |
| +// TODO(titzer): calling into the runtime to allocate is not supported |
| +// on ARM64 because the MachineCallTester uses CallAddress. |
| + |
| +TEST(RunChangeInt32ToTagged_smi) { |
|
Michael Starzinger
2014/08/27 13:29:22
nit: s/_smi/Smi/
titzer
2014/08/27 13:51:09
Done.
|
| ChangesLoweringTester<Object*> t; |
| int32_t input; |
| t.BuildLoadAndLower(t.simplified()->ChangeInt32ToTagged(), |
| @@ -311,23 +316,15 @@ TEST(RunChangeInt32ToTagged) { |
| if (Pipeline::SupportedTarget()) { |
| FOR_INT32_INPUTS(i) { |
| input = *i; |
| - Object* result = t.CallWithPotentialGC<Object>(); |
| - t.CheckNumber(static_cast<double>(input), result); |
| - } |
| - } |
| - |
| - if (Pipeline::SupportedTarget()) { |
| - FOR_INT32_INPUTS(i) { |
| - input = *i; |
| - CcTest::heap()->DisableInlineAllocation(); |
| - Object* result = t.CallWithPotentialGC<Object>(); |
| + if (!Smi::IsValid(input)) continue; |
| + Object* result = t.Call(); |
| t.CheckNumber(static_cast<double>(input), result); |
| } |
| } |
| } |
| -TEST(RunChangeUint32ToTagged) { |
| +TEST(RunChangeUint32ToTagged_smi) { |
|
Michael Starzinger
2014/08/27 13:29:22
nit: s/_smi/Smi/
titzer
2014/08/27 13:51:09
Done.
|
| ChangesLoweringTester<Object*> t; |
| uint32_t input; |
| t.BuildLoadAndLower(t.simplified()->ChangeUint32ToTagged(), |
| @@ -336,19 +333,55 @@ TEST(RunChangeUint32ToTagged) { |
| if (Pipeline::SupportedTarget()) { |
| FOR_UINT32_INPUTS(i) { |
| input = *i; |
| - Object* result = t.CallWithPotentialGC<Object>(); |
| + if (!Smi::IsValid(input)) 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 +393,19 @@ TEST(RunChangeFloat64ToTagged) { |
| 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); |
| - } |
| - } |
| - |
| - { |
| - FOR_FLOAT64_INPUTS(i) { |
| - input = *i; |
| - CcTest::heap()->DisableInlineAllocation(); |
| - 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()); |
| + |
| + input = *i; |
| + Object* result = t.CallWithPotentialGC<Object>(); |
| + t.CheckNumber(input, result); |
| + } |
| } |
| } |
| } |
| + |
| +#endif // !V8_TARGET_ARCH_ARM64 |