Upgrade V8 to version 4.9.385.28

https://chromium.googlesource.com/v8/v8/+/4.9.385.28

FPIIM-449

Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index 974d4ce..11a3582 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -1,28 +1,25 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+// Copyright 2014 the V8 project authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
 
 #include <cmath>
 #include <functional>
 #include <limits>
 
 #include "src/base/bits.h"
+#include "src/base/utils/random-number-generator.h"
 #include "src/codegen.h"
 #include "test/cctest/cctest.h"
 #include "test/cctest/compiler/codegen-tester.h"
+#include "test/cctest/compiler/graph-builder-tester.h"
 #include "test/cctest/compiler/value-helper.h"
 
-#if V8_TURBOFAN_TARGET
-
 using namespace v8::base;
 
-#define CHECK_UINT32_EQ(x, y) \
-  CHECK_EQ(static_cast<int32_t>(x), static_cast<int32_t>(y))
+namespace v8 {
+namespace internal {
+namespace compiler {
 
-using namespace v8::internal;
-using namespace v8::internal::compiler;
-
-typedef RawMachineAssembler::Label MLabel;
 
 TEST(RunInt32Add) {
   RawMachineAssemblerTester<int32_t> m;
@@ -32,6 +29,278 @@
 }
 
 
+TEST(RunWord32Ctz) {
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+  if (!m.machine()->Word32Ctz().IsSupported()) {
+    // We can only test the operator if it exists on the testing platform.
+    return;
+  }
+  m.Return(m.AddNode(m.machine()->Word32Ctz().op(), m.Parameter(0)));
+
+  CHECK_EQ(32, m.Call(uint32_t(0x00000000)));
+  CHECK_EQ(31, m.Call(uint32_t(0x80000000)));
+  CHECK_EQ(30, m.Call(uint32_t(0x40000000)));
+  CHECK_EQ(29, m.Call(uint32_t(0x20000000)));
+  CHECK_EQ(28, m.Call(uint32_t(0x10000000)));
+  CHECK_EQ(27, m.Call(uint32_t(0xa8000000)));
+  CHECK_EQ(26, m.Call(uint32_t(0xf4000000)));
+  CHECK_EQ(25, m.Call(uint32_t(0x62000000)));
+  CHECK_EQ(24, m.Call(uint32_t(0x91000000)));
+  CHECK_EQ(23, m.Call(uint32_t(0xcd800000)));
+  CHECK_EQ(22, m.Call(uint32_t(0x09400000)));
+  CHECK_EQ(21, m.Call(uint32_t(0xaf200000)));
+  CHECK_EQ(20, m.Call(uint32_t(0xac100000)));
+  CHECK_EQ(19, m.Call(uint32_t(0xe0b80000)));
+  CHECK_EQ(18, m.Call(uint32_t(0x9ce40000)));
+  CHECK_EQ(17, m.Call(uint32_t(0xc7920000)));
+  CHECK_EQ(16, m.Call(uint32_t(0xb8f10000)));
+  CHECK_EQ(15, m.Call(uint32_t(0x3b9f8000)));
+  CHECK_EQ(14, m.Call(uint32_t(0xdb4c4000)));
+  CHECK_EQ(13, m.Call(uint32_t(0xe9a32000)));
+  CHECK_EQ(12, m.Call(uint32_t(0xfca61000)));
+  CHECK_EQ(11, m.Call(uint32_t(0x6c8a7800)));
+  CHECK_EQ(10, m.Call(uint32_t(0x8ce5a400)));
+  CHECK_EQ(9, m.Call(uint32_t(0xcb7d0200)));
+  CHECK_EQ(8, m.Call(uint32_t(0xcb4dc100)));
+  CHECK_EQ(7, m.Call(uint32_t(0xdfbec580)));
+  CHECK_EQ(6, m.Call(uint32_t(0x27a9db40)));
+  CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20)));
+  CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610)));
+  CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88)));
+  CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84)));
+  CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82)));
+  CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81)));
+}
+
+
+TEST(RunWord32Clz) {
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+  m.Return(m.Word32Clz(m.Parameter(0)));
+
+  CHECK_EQ(0, m.Call(uint32_t(0x80001000)));
+  CHECK_EQ(1, m.Call(uint32_t(0x40000500)));
+  CHECK_EQ(2, m.Call(uint32_t(0x20000300)));
+  CHECK_EQ(3, m.Call(uint32_t(0x10000003)));
+  CHECK_EQ(4, m.Call(uint32_t(0x08050000)));
+  CHECK_EQ(5, m.Call(uint32_t(0x04006000)));
+  CHECK_EQ(6, m.Call(uint32_t(0x02000000)));
+  CHECK_EQ(7, m.Call(uint32_t(0x010000a0)));
+  CHECK_EQ(8, m.Call(uint32_t(0x00800c00)));
+  CHECK_EQ(9, m.Call(uint32_t(0x00400000)));
+  CHECK_EQ(10, m.Call(uint32_t(0x0020000d)));
+  CHECK_EQ(11, m.Call(uint32_t(0x00100f00)));
+  CHECK_EQ(12, m.Call(uint32_t(0x00080000)));
+  CHECK_EQ(13, m.Call(uint32_t(0x00041000)));
+  CHECK_EQ(14, m.Call(uint32_t(0x00020020)));
+  CHECK_EQ(15, m.Call(uint32_t(0x00010300)));
+  CHECK_EQ(16, m.Call(uint32_t(0x00008040)));
+  CHECK_EQ(17, m.Call(uint32_t(0x00004005)));
+  CHECK_EQ(18, m.Call(uint32_t(0x00002050)));
+  CHECK_EQ(19, m.Call(uint32_t(0x00001700)));
+  CHECK_EQ(20, m.Call(uint32_t(0x00000870)));
+  CHECK_EQ(21, m.Call(uint32_t(0x00000405)));
+  CHECK_EQ(22, m.Call(uint32_t(0x00000203)));
+  CHECK_EQ(23, m.Call(uint32_t(0x00000101)));
+  CHECK_EQ(24, m.Call(uint32_t(0x00000089)));
+  CHECK_EQ(25, m.Call(uint32_t(0x00000041)));
+  CHECK_EQ(26, m.Call(uint32_t(0x00000022)));
+  CHECK_EQ(27, m.Call(uint32_t(0x00000013)));
+  CHECK_EQ(28, m.Call(uint32_t(0x00000008)));
+  CHECK_EQ(29, m.Call(uint32_t(0x00000004)));
+  CHECK_EQ(30, m.Call(uint32_t(0x00000002)));
+  CHECK_EQ(31, m.Call(uint32_t(0x00000001)));
+  CHECK_EQ(32, m.Call(uint32_t(0x00000000)));
+}
+
+
+TEST(RunWord32Popcnt) {
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+  if (!m.machine()->Word32Popcnt().IsSupported()) {
+    // We can only test the operator if it exists on the testing platform.
+    return;
+  }
+  m.Return(m.AddNode(m.machine()->Word32Popcnt().op(), m.Parameter(0)));
+
+  CHECK_EQ(0, m.Call(uint32_t(0x00000000)));
+  CHECK_EQ(1, m.Call(uint32_t(0x00000001)));
+  CHECK_EQ(1, m.Call(uint32_t(0x80000000)));
+  CHECK_EQ(32, m.Call(uint32_t(0xffffffff)));
+  CHECK_EQ(6, m.Call(uint32_t(0x000dc100)));
+  CHECK_EQ(9, m.Call(uint32_t(0xe00dc100)));
+  CHECK_EQ(11, m.Call(uint32_t(0xe00dc103)));
+  CHECK_EQ(9, m.Call(uint32_t(0x000dc107)));
+}
+
+
+#if V8_TARGET_ARCH_64_BIT
+TEST(RunWord64Clz) {
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint64());
+  m.Return(m.Word64Clz(m.Parameter(0)));
+
+  CHECK_EQ(0, m.Call(uint64_t(0x8000100000000000)));
+  CHECK_EQ(1, m.Call(uint64_t(0x4000050000000000)));
+  CHECK_EQ(2, m.Call(uint64_t(0x2000030000000000)));
+  CHECK_EQ(3, m.Call(uint64_t(0x1000000300000000)));
+  CHECK_EQ(4, m.Call(uint64_t(0x0805000000000000)));
+  CHECK_EQ(5, m.Call(uint64_t(0x0400600000000000)));
+  CHECK_EQ(6, m.Call(uint64_t(0x0200000000000000)));
+  CHECK_EQ(7, m.Call(uint64_t(0x010000a000000000)));
+  CHECK_EQ(8, m.Call(uint64_t(0x00800c0000000000)));
+  CHECK_EQ(9, m.Call(uint64_t(0x0040000000000000)));
+  CHECK_EQ(10, m.Call(uint64_t(0x0020000d00000000)));
+  CHECK_EQ(11, m.Call(uint64_t(0x00100f0000000000)));
+  CHECK_EQ(12, m.Call(uint64_t(0x0008000000000000)));
+  CHECK_EQ(13, m.Call(uint64_t(0x0004100000000000)));
+  CHECK_EQ(14, m.Call(uint64_t(0x0002002000000000)));
+  CHECK_EQ(15, m.Call(uint64_t(0x0001030000000000)));
+  CHECK_EQ(16, m.Call(uint64_t(0x0000804000000000)));
+  CHECK_EQ(17, m.Call(uint64_t(0x0000400500000000)));
+  CHECK_EQ(18, m.Call(uint64_t(0x0000205000000000)));
+  CHECK_EQ(19, m.Call(uint64_t(0x0000170000000000)));
+  CHECK_EQ(20, m.Call(uint64_t(0x0000087000000000)));
+  CHECK_EQ(21, m.Call(uint64_t(0x0000040500000000)));
+  CHECK_EQ(22, m.Call(uint64_t(0x0000020300000000)));
+  CHECK_EQ(23, m.Call(uint64_t(0x0000010100000000)));
+  CHECK_EQ(24, m.Call(uint64_t(0x0000008900000000)));
+  CHECK_EQ(25, m.Call(uint64_t(0x0000004100000000)));
+  CHECK_EQ(26, m.Call(uint64_t(0x0000002200000000)));
+  CHECK_EQ(27, m.Call(uint64_t(0x0000001300000000)));
+  CHECK_EQ(28, m.Call(uint64_t(0x0000000800000000)));
+  CHECK_EQ(29, m.Call(uint64_t(0x0000000400000000)));
+  CHECK_EQ(30, m.Call(uint64_t(0x0000000200000000)));
+  CHECK_EQ(31, m.Call(uint64_t(0x0000000100000000)));
+  CHECK_EQ(32, m.Call(uint64_t(0x0000000080001000)));
+  CHECK_EQ(33, m.Call(uint64_t(0x0000000040000500)));
+  CHECK_EQ(34, m.Call(uint64_t(0x0000000020000300)));
+  CHECK_EQ(35, m.Call(uint64_t(0x0000000010000003)));
+  CHECK_EQ(36, m.Call(uint64_t(0x0000000008050000)));
+  CHECK_EQ(37, m.Call(uint64_t(0x0000000004006000)));
+  CHECK_EQ(38, m.Call(uint64_t(0x0000000002000000)));
+  CHECK_EQ(39, m.Call(uint64_t(0x00000000010000a0)));
+  CHECK_EQ(40, m.Call(uint64_t(0x0000000000800c00)));
+  CHECK_EQ(41, m.Call(uint64_t(0x0000000000400000)));
+  CHECK_EQ(42, m.Call(uint64_t(0x000000000020000d)));
+  CHECK_EQ(43, m.Call(uint64_t(0x0000000000100f00)));
+  CHECK_EQ(44, m.Call(uint64_t(0x0000000000080000)));
+  CHECK_EQ(45, m.Call(uint64_t(0x0000000000041000)));
+  CHECK_EQ(46, m.Call(uint64_t(0x0000000000020020)));
+  CHECK_EQ(47, m.Call(uint64_t(0x0000000000010300)));
+  CHECK_EQ(48, m.Call(uint64_t(0x0000000000008040)));
+  CHECK_EQ(49, m.Call(uint64_t(0x0000000000004005)));
+  CHECK_EQ(50, m.Call(uint64_t(0x0000000000002050)));
+  CHECK_EQ(51, m.Call(uint64_t(0x0000000000001700)));
+  CHECK_EQ(52, m.Call(uint64_t(0x0000000000000870)));
+  CHECK_EQ(53, m.Call(uint64_t(0x0000000000000405)));
+  CHECK_EQ(54, m.Call(uint64_t(0x0000000000000203)));
+  CHECK_EQ(55, m.Call(uint64_t(0x0000000000000101)));
+  CHECK_EQ(56, m.Call(uint64_t(0x0000000000000089)));
+  CHECK_EQ(57, m.Call(uint64_t(0x0000000000000041)));
+  CHECK_EQ(58, m.Call(uint64_t(0x0000000000000022)));
+  CHECK_EQ(59, m.Call(uint64_t(0x0000000000000013)));
+  CHECK_EQ(60, m.Call(uint64_t(0x0000000000000008)));
+  CHECK_EQ(61, m.Call(uint64_t(0x0000000000000004)));
+  CHECK_EQ(62, m.Call(uint64_t(0x0000000000000002)));
+  CHECK_EQ(63, m.Call(uint64_t(0x0000000000000001)));
+  CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000)));
+}
+
+
+TEST(RunWord64Ctz) {
+  RawMachineAssemblerTester<int32_t> m(MachineType::Uint64());
+  if (!m.machine()->Word64Ctz().IsSupported()) {
+    return;
+  }
+
+  m.Return(m.AddNode(m.machine()->Word64Ctz().op(), m.Parameter(0)));
+
+  CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000)));
+  CHECK_EQ(63, m.Call(uint64_t(0x8000000000000000)));
+  CHECK_EQ(62, m.Call(uint64_t(0x4000000000000000)));
+  CHECK_EQ(61, m.Call(uint64_t(0x2000000000000000)));
+  CHECK_EQ(60, m.Call(uint64_t(0x1000000000000000)));
+  CHECK_EQ(59, m.Call(uint64_t(0xa800000000000000)));
+  CHECK_EQ(58, m.Call(uint64_t(0xf400000000000000)));
+  CHECK_EQ(57, m.Call(uint64_t(0x6200000000000000)));
+  CHECK_EQ(56, m.Call(uint64_t(0x9100000000000000)));
+  CHECK_EQ(55, m.Call(uint64_t(0xcd80000000000000)));
+  CHECK_EQ(54, m.Call(uint64_t(0x0940000000000000)));
+  CHECK_EQ(53, m.Call(uint64_t(0xaf20000000000000)));
+  CHECK_EQ(52, m.Call(uint64_t(0xac10000000000000)));
+  CHECK_EQ(51, m.Call(uint64_t(0xe0b8000000000000)));
+  CHECK_EQ(50, m.Call(uint64_t(0x9ce4000000000000)));
+  CHECK_EQ(49, m.Call(uint64_t(0xc792000000000000)));
+  CHECK_EQ(48, m.Call(uint64_t(0xb8f1000000000000)));
+  CHECK_EQ(47, m.Call(uint64_t(0x3b9f800000000000)));
+  CHECK_EQ(46, m.Call(uint64_t(0xdb4c400000000000)));
+  CHECK_EQ(45, m.Call(uint64_t(0xe9a3200000000000)));
+  CHECK_EQ(44, m.Call(uint64_t(0xfca6100000000000)));
+  CHECK_EQ(43, m.Call(uint64_t(0x6c8a780000000000)));
+  CHECK_EQ(42, m.Call(uint64_t(0x8ce5a40000000000)));
+  CHECK_EQ(41, m.Call(uint64_t(0xcb7d020000000000)));
+  CHECK_EQ(40, m.Call(uint64_t(0xcb4dc10000000000)));
+  CHECK_EQ(39, m.Call(uint64_t(0xdfbec58000000000)));
+  CHECK_EQ(38, m.Call(uint64_t(0x27a9db4000000000)));
+  CHECK_EQ(37, m.Call(uint64_t(0xde3bcb2000000000)));
+  CHECK_EQ(36, m.Call(uint64_t(0xd7e8a61000000000)));
+  CHECK_EQ(35, m.Call(uint64_t(0x9afdbc8800000000)));
+  CHECK_EQ(34, m.Call(uint64_t(0x9afdbc8400000000)));
+  CHECK_EQ(33, m.Call(uint64_t(0x9afdbc8200000000)));
+  CHECK_EQ(32, m.Call(uint64_t(0x9afdbc8100000000)));
+  CHECK_EQ(31, m.Call(uint64_t(0x0000000080000000)));
+  CHECK_EQ(30, m.Call(uint64_t(0x0000000040000000)));
+  CHECK_EQ(29, m.Call(uint64_t(0x0000000020000000)));
+  CHECK_EQ(28, m.Call(uint64_t(0x0000000010000000)));
+  CHECK_EQ(27, m.Call(uint64_t(0x00000000a8000000)));
+  CHECK_EQ(26, m.Call(uint64_t(0x00000000f4000000)));
+  CHECK_EQ(25, m.Call(uint64_t(0x0000000062000000)));
+  CHECK_EQ(24, m.Call(uint64_t(0x0000000091000000)));
+  CHECK_EQ(23, m.Call(uint64_t(0x00000000cd800000)));
+  CHECK_EQ(22, m.Call(uint64_t(0x0000000009400000)));
+  CHECK_EQ(21, m.Call(uint64_t(0x00000000af200000)));
+  CHECK_EQ(20, m.Call(uint64_t(0x00000000ac100000)));
+  CHECK_EQ(19, m.Call(uint64_t(0x00000000e0b80000)));
+  CHECK_EQ(18, m.Call(uint64_t(0x000000009ce40000)));
+  CHECK_EQ(17, m.Call(uint64_t(0x00000000c7920000)));
+  CHECK_EQ(16, m.Call(uint64_t(0x00000000b8f10000)));
+  CHECK_EQ(15, m.Call(uint64_t(0x000000003b9f8000)));
+  CHECK_EQ(14, m.Call(uint64_t(0x00000000db4c4000)));
+  CHECK_EQ(13, m.Call(uint64_t(0x00000000e9a32000)));
+  CHECK_EQ(12, m.Call(uint64_t(0x00000000fca61000)));
+  CHECK_EQ(11, m.Call(uint64_t(0x000000006c8a7800)));
+  CHECK_EQ(10, m.Call(uint64_t(0x000000008ce5a400)));
+  CHECK_EQ(9, m.Call(uint64_t(0x00000000cb7d0200)));
+  CHECK_EQ(8, m.Call(uint64_t(0x00000000cb4dc100)));
+  CHECK_EQ(7, m.Call(uint64_t(0x00000000dfbec580)));
+  CHECK_EQ(6, m.Call(uint64_t(0x0000000027a9db40)));
+  CHECK_EQ(5, m.Call(uint64_t(0x00000000de3bcb20)));
+  CHECK_EQ(4, m.Call(uint64_t(0x00000000d7e8a610)));
+  CHECK_EQ(3, m.Call(uint64_t(0x000000009afdbc88)));
+  CHECK_EQ(2, m.Call(uint64_t(0x000000009afdbc84)));
+  CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82)));
+  CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81)));
+}
+
+
+TEST(RunWord64Popcnt) {
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint64());
+  if (!m.machine()->Word64Popcnt().IsSupported()) {
+    return;
+  }
+
+  m.Return(m.AddNode(m.machine()->Word64Popcnt().op(), m.Parameter(0)));
+
+  CHECK_EQ(0, m.Call(uint64_t(0x0000000000000000)));
+  CHECK_EQ(1, m.Call(uint64_t(0x0000000000000001)));
+  CHECK_EQ(1, m.Call(uint64_t(0x8000000000000000)));
+  CHECK_EQ(64, m.Call(uint64_t(0xffffffffffffffff)));
+  CHECK_EQ(12, m.Call(uint64_t(0x000dc100000dc100)));
+  CHECK_EQ(18, m.Call(uint64_t(0xe00dc100e00dc100)));
+  CHECK_EQ(22, m.Call(uint64_t(0xe00dc103e00dc103)));
+  CHECK_EQ(18, m.Call(uint64_t(0x000dc107000dc107)));
+}
+#endif  // V8_TARGET_ARCH_64_BIT
+
+
 static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) {
   switch (index) {
     case 0:
@@ -49,7 +318,7 @@
     case 6:
       return m->Int32Constant(0x01234567);
     case 7:
-      return m->Load(kMachInt32, m->PointerConstant(NULL));
+      return m->Load(MachineType::Int32(), m->PointerConstant(NULL));
     default:
       return NULL;
   }
@@ -74,10 +343,11 @@
   for (size_t i = 0; i < arraysize(kOps); ++i) {
     for (int j = 0; j < 8; j++) {
       for (int k = 0; k < 8; k++) {
-        RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+        RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                             MachineType::Int32());
         Node* a = Int32Input(&m, j);
         Node* b = Int32Input(&m, k);
-        m.Return(m.NewNode(kOps[i], a, b));
+        m.Return(m.AddNode(kOps[i], a, b));
         m.GenerateCode();
       }
     }
@@ -85,11 +355,260 @@
 }
 
 
+TEST(CodeGenNop) {
+  RawMachineAssemblerTester<void> m;
+  m.Return(m.Int32Constant(0));
+  m.GenerateCode();
+}
+
+
+#if V8_TARGET_ARCH_64_BIT
+static Node* Int64Input(RawMachineAssemblerTester<int64_t>* m, int index) {
+  switch (index) {
+    case 0:
+      return m->Parameter(0);
+    case 1:
+      return m->Parameter(1);
+    case 2:
+      return m->Int64Constant(0);
+    case 3:
+      return m->Int64Constant(1);
+    case 4:
+      return m->Int64Constant(-1);
+    case 5:
+      return m->Int64Constant(0xff);
+    case 6:
+      return m->Int64Constant(0x0123456789abcdefLL);
+    case 7:
+      return m->Load(MachineType::Int64(), m->PointerConstant(NULL));
+    default:
+      return NULL;
+  }
+}
+
+
+TEST(CodeGenInt64Binop) {
+  RawMachineAssemblerTester<void> m;
+
+  const Operator* kOps[] = {
+      m.machine()->Word64And(), m.machine()->Word64Or(),
+      m.machine()->Word64Xor(), m.machine()->Word64Shl(),
+      m.machine()->Word64Shr(), m.machine()->Word64Sar(),
+      m.machine()->Word64Equal(), m.machine()->Int64Add(),
+      m.machine()->Int64Sub(), m.machine()->Int64Mul(), m.machine()->Int64Div(),
+      m.machine()->Uint64Div(), m.machine()->Int64Mod(),
+      m.machine()->Uint64Mod(), m.machine()->Int64LessThan(),
+      m.machine()->Int64LessThanOrEqual(), m.machine()->Uint64LessThan(),
+      m.machine()->Uint64LessThanOrEqual()};
+
+  for (size_t i = 0; i < arraysize(kOps); ++i) {
+    for (int j = 0; j < 8; j++) {
+      for (int k = 0; k < 8; k++) {
+        RawMachineAssemblerTester<int64_t> m(MachineType::Int64(),
+                                             MachineType::Int64());
+        Node* a = Int64Input(&m, j);
+        Node* b = Int64Input(&m, k);
+        m.Return(m.AddNode(kOps[i], a, b));
+        m.GenerateCode();
+      }
+    }
+  }
+}
+
+
+TEST(RunInt64AddWithOverflowP) {
+  int64_t actual_val = -1;
+  RawMachineAssemblerTester<int32_t> m;
+  Int64BinopTester bt(&m);
+  Node* add = m.Int64AddWithOverflow(bt.param0, bt.param1);
+  Node* val = m.Projection(0, add);
+  Node* ovf = m.Projection(1, add);
+  m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+  bt.AddReturn(ovf);
+  FOR_INT64_INPUTS(i) {
+    FOR_INT64_INPUTS(j) {
+      int64_t expected_val;
+      int expected_ovf = bits::SignedAddOverflow64(*i, *j, &expected_val);
+      CHECK_EQ(expected_ovf, bt.call(*i, *j));
+      CHECK_EQ(expected_val, actual_val);
+    }
+  }
+}
+
+
+TEST(RunInt64AddWithOverflowImm) {
+  int64_t actual_val = -1, expected_val = 0;
+  FOR_INT64_INPUTS(i) {
+    {
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
+      Node* add = m.Int64AddWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      FOR_INT64_INPUTS(j) {
+        int expected_ovf = bits::SignedAddOverflow64(*i, *j, &expected_val);
+        CHECK_EQ(expected_ovf, m.Call(*j));
+        CHECK_EQ(expected_val, actual_val);
+      }
+    }
+    {
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
+      Node* add = m.Int64AddWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      FOR_INT64_INPUTS(j) {
+        int expected_ovf = bits::SignedAddOverflow64(*i, *j, &expected_val);
+        CHECK_EQ(expected_ovf, m.Call(*j));
+        CHECK_EQ(expected_val, actual_val);
+      }
+    }
+    FOR_INT64_INPUTS(j) {
+      RawMachineAssemblerTester<int32_t> m;
+      Node* add =
+          m.Int64AddWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      int expected_ovf = bits::SignedAddOverflow64(*i, *j, &expected_val);
+      CHECK_EQ(expected_ovf, m.Call());
+      CHECK_EQ(expected_val, actual_val);
+    }
+  }
+}
+
+
+TEST(RunInt64AddWithOverflowInBranchP) {
+  int constant = 911777;
+  RawMachineLabel blocka, blockb;
+  RawMachineAssemblerTester<int32_t> m;
+  Int64BinopTester bt(&m);
+  Node* add = m.Int64AddWithOverflow(bt.param0, bt.param1);
+  Node* ovf = m.Projection(1, add);
+  m.Branch(ovf, &blocka, &blockb);
+  m.Bind(&blocka);
+  bt.AddReturn(m.Int64Constant(constant));
+  m.Bind(&blockb);
+  Node* val = m.Projection(0, add);
+  Node* truncated = m.TruncateInt64ToInt32(val);
+  bt.AddReturn(truncated);
+  FOR_INT64_INPUTS(i) {
+    FOR_INT64_INPUTS(j) {
+      int32_t expected = constant;
+      int64_t result;
+      if (!bits::SignedAddOverflow64(*i, *j, &result)) {
+        expected = static_cast<int32_t>(result);
+      }
+      CHECK_EQ(expected, bt.call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunInt64SubWithOverflowP) {
+  int64_t actual_val = -1;
+  RawMachineAssemblerTester<int32_t> m;
+  Int64BinopTester bt(&m);
+  Node* add = m.Int64SubWithOverflow(bt.param0, bt.param1);
+  Node* val = m.Projection(0, add);
+  Node* ovf = m.Projection(1, add);
+  m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+  bt.AddReturn(ovf);
+  FOR_INT64_INPUTS(i) {
+    FOR_INT64_INPUTS(j) {
+      int64_t expected_val;
+      int expected_ovf = bits::SignedSubOverflow64(*i, *j, &expected_val);
+      CHECK_EQ(expected_ovf, bt.call(*i, *j));
+      CHECK_EQ(expected_val, actual_val);
+    }
+  }
+}
+
+
+TEST(RunInt64SubWithOverflowImm) {
+  int64_t actual_val = -1, expected_val = 0;
+  FOR_INT64_INPUTS(i) {
+    {
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
+      Node* add = m.Int64SubWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      FOR_INT64_INPUTS(j) {
+        int expected_ovf = bits::SignedSubOverflow64(*i, *j, &expected_val);
+        CHECK_EQ(expected_ovf, m.Call(*j));
+        CHECK_EQ(expected_val, actual_val);
+      }
+    }
+    {
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
+      Node* add = m.Int64SubWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      FOR_INT64_INPUTS(j) {
+        int expected_ovf = bits::SignedSubOverflow64(*j, *i, &expected_val);
+        CHECK_EQ(expected_ovf, m.Call(*j));
+        CHECK_EQ(expected_val, actual_val);
+      }
+    }
+    FOR_INT64_INPUTS(j) {
+      RawMachineAssemblerTester<int32_t> m;
+      Node* add =
+          m.Int64SubWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+      Node* val = m.Projection(0, add);
+      Node* ovf = m.Projection(1, add);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
+      m.Return(ovf);
+      int expected_ovf = bits::SignedSubOverflow64(*i, *j, &expected_val);
+      CHECK_EQ(expected_ovf, m.Call());
+      CHECK_EQ(expected_val, actual_val);
+    }
+  }
+}
+
+
+TEST(RunInt64SubWithOverflowInBranchP) {
+  int constant = 911999;
+  RawMachineLabel blocka, blockb;
+  RawMachineAssemblerTester<int32_t> m;
+  Int64BinopTester bt(&m);
+  Node* sub = m.Int64SubWithOverflow(bt.param0, bt.param1);
+  Node* ovf = m.Projection(1, sub);
+  m.Branch(ovf, &blocka, &blockb);
+  m.Bind(&blocka);
+  bt.AddReturn(m.Int64Constant(constant));
+  m.Bind(&blockb);
+  Node* val = m.Projection(0, sub);
+  Node* truncated = m.TruncateInt64ToInt32(val);
+  bt.AddReturn(truncated);
+  FOR_INT64_INPUTS(i) {
+    FOR_INT64_INPUTS(j) {
+      int32_t expected = constant;
+      int64_t result;
+      if (!bits::SignedSubOverflow64(*i, *j, &result)) {
+        expected = static_cast<int32_t>(result);
+      }
+      CHECK_EQ(expected, static_cast<int32_t>(bt.call(*i, *j)));
+    }
+  }
+}
+
+
+// TODO(titzer): add tests that run 64-bit integer operations.
+#endif  // V8_TARGET_ARCH_64_BIT
+
+
 TEST(RunGoto) {
   RawMachineAssemblerTester<int32_t> m;
   int constant = 99999;
 
-  MLabel next;
+  RawMachineLabel next;
   m.Goto(&next);
   m.Bind(&next);
   m.Return(m.Int32Constant(constant));
@@ -102,7 +621,7 @@
   RawMachineAssemblerTester<int32_t> m;
   int constant = 9999977;
 
-  MLabel labels[10];
+  RawMachineLabel labels[10];
   for (size_t i = 0; i < arraysize(labels); i++) {
     m.Goto(&labels[i]);
     m.Bind(&labels[i]);
@@ -117,7 +636,7 @@
   RawMachineAssemblerTester<int32_t> m;
   int constant = 999777;
 
-  MLabel blocka, blockb;
+  RawMachineLabel blocka, blockb;
   m.Branch(m.Int32Constant(0), &blocka, &blockb);
   m.Bind(&blocka);
   m.Return(m.Int32Constant(0 - constant));
@@ -133,7 +652,7 @@
 
   int constant = 995666;
 
-  MLabel blocka, blockb, end;
+  RawMachineLabel blocka, blockb, end;
   m.Branch(m.Int32Constant(0), &blocka, &blockb);
   m.Bind(&blocka);
   m.Goto(&end);
@@ -150,7 +669,7 @@
   RawMachineAssemblerTester<int32_t> m;
   int constant = 999555;
 
-  MLabel header, body, exit;
+  RawMachineLabel header, body, exit;
   m.Goto(&header);
   m.Bind(&header);
   m.Branch(m.Int32Constant(0), &body, &exit);
@@ -165,62 +684,65 @@
 
 template <typename R>
 static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node* cond_node,
-                            MachineType type, Node* true_node,
+                            MachineRepresentation rep, Node* true_node,
                             Node* false_node) {
-  MLabel blocka, blockb;
-  MLabel* end = m->Exit();
+  RawMachineLabel blocka, blockb, end;
   m->Branch(cond_node, &blocka, &blockb);
   m->Bind(&blocka);
-  m->Goto(end);
+  m->Goto(&end);
   m->Bind(&blockb);
-  m->Goto(end);
+  m->Goto(&end);
 
-  m->Bind(end);
-  Node* phi = m->Phi(type, true_node, false_node);
+  m->Bind(&end);
+  Node* phi = m->Phi(rep, true_node, false_node);
   m->Return(phi);
 }
 
 
 TEST(RunDiamondPhiConst) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32);
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
   int false_val = 0xFF666;
   int true_val = 0x00DDD;
   Node* true_node = m.Int32Constant(true_val);
   Node* false_node = m.Int32Constant(false_val);
-  BuildDiamondPhi(&m, m.Parameter(0), kMachInt32, true_node, false_node);
+  BuildDiamondPhi(&m, m.Parameter(0), MachineRepresentation::kWord32, true_node,
+                  false_node);
   CHECK_EQ(false_val, m.Call(0));
   CHECK_EQ(true_val, m.Call(1));
 }
 
 
 TEST(RunDiamondPhiNumber) {
-  RawMachineAssemblerTester<Object*> m(kMachInt32);
+  RawMachineAssemblerTester<Object*> m(MachineType::Int32());
   double false_val = -11.1;
   double true_val = 200.1;
   Node* true_node = m.NumberConstant(true_val);
   Node* false_node = m.NumberConstant(false_val);
-  BuildDiamondPhi(&m, m.Parameter(0), kMachAnyTagged, true_node, false_node);
+  BuildDiamondPhi(&m, m.Parameter(0), MachineRepresentation::kTagged, true_node,
+                  false_node);
   m.CheckNumber(false_val, m.Call(0));
   m.CheckNumber(true_val, m.Call(1));
 }
 
 
 TEST(RunDiamondPhiString) {
-  RawMachineAssemblerTester<Object*> m(kMachInt32);
+  RawMachineAssemblerTester<Object*> m(MachineType::Int32());
   const char* false_val = "false";
   const char* true_val = "true";
   Node* true_node = m.StringConstant(true_val);
   Node* false_node = m.StringConstant(false_val);
-  BuildDiamondPhi(&m, m.Parameter(0), kMachAnyTagged, true_node, false_node);
+  BuildDiamondPhi(&m, m.Parameter(0), MachineRepresentation::kTagged, true_node,
+                  false_node);
   m.CheckString(false_val, m.Call(0));
   m.CheckString(true_val, m.Call(1));
 }
 
 
 TEST(RunDiamondPhiParam) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
-  BuildDiamondPhi(&m, m.Parameter(0), kMachInt32, m.Parameter(1),
-                  m.Parameter(2));
+  RawMachineAssemblerTester<int32_t> m(
+      MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
+  BuildDiamondPhi(&m, m.Parameter(0), MachineRepresentation::kWord32,
+                  m.Parameter(1), m.Parameter(2));
   int32_t c1 = 0x260cb75a;
   int32_t c2 = 0xcd3e9c8b;
   int result = m.Call(0, c1, c2);
@@ -240,16 +762,15 @@
   Node* false_node = m.Int32Constant(false_val);
 
   // x = false_val; while(false) { x = true_val; } return x;
-  MLabel body, header;
-  MLabel* end = m.Exit();
+  RawMachineLabel body, header, end;
 
   m.Goto(&header);
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, false_node, true_node);
-  m.Branch(cond_node, &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, false_node, true_node);
+  m.Branch(cond_node, &body, &end);
   m.Bind(&body);
   m.Goto(&header);
-  m.Bind(end);
+  m.Bind(&end);
   m.Return(phi);
 
   CHECK_EQ(false_val, m.Call());
@@ -257,22 +778,24 @@
 
 
 TEST(RunLoopPhiParam) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+  RawMachineAssemblerTester<int32_t> m(
+      MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
 
-  MLabel blocka, blockb;
-  MLabel* end = m.Exit();
+  RawMachineLabel blocka, blockb, end;
 
   m.Goto(&blocka);
 
   m.Bind(&blocka);
-  Node* phi = m.Phi(kMachInt32, m.Parameter(1), m.Parameter(2));
-  Node* cond = m.Phi(kMachInt32, m.Parameter(0), m.Int32Constant(0));
-  m.Branch(cond, &blockb, end);
+  Node* phi =
+      m.Phi(MachineRepresentation::kWord32, m.Parameter(1), m.Parameter(2));
+  Node* cond =
+      m.Phi(MachineRepresentation::kWord32, m.Parameter(0), m.Int32Constant(0));
+  m.Branch(cond, &blockb, &end);
 
   m.Bind(&blockb);
   m.Goto(&blocka);
 
-  m.Bind(end);
+  m.Bind(&end);
   m.Return(phi);
 
   int32_t c1 = 0xa81903b4;
@@ -290,22 +813,21 @@
   int false_val = 0x10777;
 
   // x = false_val; while(false) { x++; } return x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
   Node* false_node = m.Int32Constant(false_val);
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, false_node, false_node);
-  m.Branch(m.Int32Constant(0), &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, false_node, false_node);
+  m.Branch(m.Int32Constant(0), &body, &end);
 
   m.Bind(&body);
   Node* add = m.Int32Add(phi, m.Int32Constant(1));
   phi->ReplaceInput(1, add);
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   m.Return(phi);
 
   CHECK_EQ(false_val, m.Call());
@@ -317,21 +839,20 @@
   Int32BinopTester bt(&m);
 
   // x = 0; while(x ^ param) { x++; } return x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
   Node* zero = m.Int32Constant(0);
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, zero, zero);
-  m.Branch(m.WordXor(phi, bt.param0), &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  m.Branch(m.WordXor(phi, bt.param0), &body, &end);
 
   m.Bind(&body);
   phi->ReplaceInput(1, m.Int32Add(phi, m.Int32Constant(1)));
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   bt.AddReturn(phi);
 
   CHECK_EQ(11, bt.call(11, 0));
@@ -345,21 +866,20 @@
   Int32BinopTester bt(&m);
 
   // x = 0; while(x < param) { x++; } return x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
   Node* zero = m.Int32Constant(0);
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, zero, zero);
-  m.Branch(m.Int32LessThan(phi, bt.param0), &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  m.Branch(m.Int32LessThan(phi, bt.param0), &body, &end);
 
   m.Bind(&body);
   phi->ReplaceInput(1, m.Int32Add(phi, m.Int32Constant(1)));
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   bt.AddReturn(phi);
 
   CHECK_EQ(11, bt.call(11, 0));
@@ -374,21 +894,20 @@
   Int32BinopTester bt(&m);
 
   // x = 0; while(x < param) { x++; } return x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
   Node* zero = m.Int32Constant(0);
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, zero, zero);
-  m.Branch(m.Uint32LessThan(phi, bt.param0), &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  m.Branch(m.Uint32LessThan(phi, bt.param0), &body, &end);
 
   m.Bind(&body);
   phi->ReplaceInput(1, m.Int32Add(phi, m.Int32Constant(1)));
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   bt.AddReturn(phi);
 
   CHECK_EQ(11, bt.call(11, 0));
@@ -403,20 +922,20 @@
   Int32BinopTester bt(&m);
 
   // x = param; while(x) { x--; } return x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, bt.param0, m.Int32Constant(0));
-  m.Branch(phi, &body, end);
+  Node* phi =
+      m.Phi(MachineRepresentation::kWord32, bt.param0, m.Int32Constant(0));
+  m.Branch(phi, &body, &end);
 
   m.Bind(&body);
   phi->ReplaceInput(1, m.Int32Sub(phi, m.Int32Constant(1)));
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   bt.AddReturn(phi);
 
   CHECK_EQ(0, bt.call(11, 0));
@@ -425,37 +944,172 @@
 }
 
 
+TEST(RunLoopIncrementFloat32) {
+  RawMachineAssemblerTester<int32_t> m;
+
+  // x = -3.0f; while(x < 10f) { x = x + 0.5f; } return (int) (double) x;
+  RawMachineLabel header, body, end;
+  Node* minus_3 = m.Float32Constant(-3.0f);
+  Node* ten = m.Float32Constant(10.0f);
+
+  m.Goto(&header);
+
+  m.Bind(&header);
+  Node* phi = m.Phi(MachineRepresentation::kFloat32, minus_3, ten);
+  m.Branch(m.Float32LessThan(phi, ten), &body, &end);
+
+  m.Bind(&body);
+  phi->ReplaceInput(1, m.Float32Add(phi, m.Float32Constant(0.5f)));
+  m.Goto(&header);
+
+  m.Bind(&end);
+  m.Return(m.ChangeFloat64ToInt32(m.ChangeFloat32ToFloat64(phi)));
+
+  CHECK_EQ(10, m.Call());
+}
+
+
 TEST(RunLoopIncrementFloat64) {
   RawMachineAssemblerTester<int32_t> m;
 
   // x = -3.0; while(x < 10) { x = x + 0.5; } return (int) x;
-  MLabel header, body;
-  MLabel* end = m.Exit();
+  RawMachineLabel header, body, end;
   Node* minus_3 = m.Float64Constant(-3.0);
   Node* ten = m.Float64Constant(10.0);
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* phi = m.Phi(kMachFloat64, minus_3, ten);
-  m.Branch(m.Float64LessThan(phi, ten), &body, end);
+  Node* phi = m.Phi(MachineRepresentation::kFloat64, minus_3, ten);
+  m.Branch(m.Float64LessThan(phi, ten), &body, &end);
 
   m.Bind(&body);
   phi->ReplaceInput(1, m.Float64Add(phi, m.Float64Constant(0.5)));
   m.Goto(&header);
 
-  m.Bind(end);
+  m.Bind(&end);
   m.Return(m.ChangeFloat64ToInt32(phi));
 
   CHECK_EQ(10, m.Call());
 }
 
 
+TEST(RunSwitch1) {
+  RawMachineAssemblerTester<int32_t> m;
+
+  int constant = 11223344;
+
+  RawMachineLabel block0, block1, def, end;
+  RawMachineLabel* case_labels[] = {&block0, &block1};
+  int32_t case_values[] = {0, 1};
+  m.Switch(m.Int32Constant(0), &def, case_values, case_labels,
+           arraysize(case_labels));
+  m.Bind(&block0);
+  m.Goto(&end);
+  m.Bind(&block1);
+  m.Goto(&end);
+  m.Bind(&def);
+  m.Goto(&end);
+  m.Bind(&end);
+  m.Return(m.Int32Constant(constant));
+
+  CHECK_EQ(constant, m.Call());
+}
+
+
+TEST(RunSwitch2) {
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+
+  RawMachineLabel blocka, blockb, blockc;
+  RawMachineLabel* case_labels[] = {&blocka, &blockb};
+  int32_t case_values[] = {std::numeric_limits<int32_t>::min(),
+                           std::numeric_limits<int32_t>::max()};
+  m.Switch(m.Parameter(0), &blockc, case_values, case_labels,
+           arraysize(case_labels));
+  m.Bind(&blocka);
+  m.Return(m.Int32Constant(-1));
+  m.Bind(&blockb);
+  m.Return(m.Int32Constant(1));
+  m.Bind(&blockc);
+  m.Return(m.Int32Constant(0));
+
+  CHECK_EQ(1, m.Call(std::numeric_limits<int32_t>::max()));
+  CHECK_EQ(-1, m.Call(std::numeric_limits<int32_t>::min()));
+  for (int i = -100; i < 100; i += 25) {
+    CHECK_EQ(0, m.Call(i));
+  }
+}
+
+
+TEST(RunSwitch3) {
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+
+  RawMachineLabel blocka, blockb, blockc;
+  RawMachineLabel* case_labels[] = {&blocka, &blockb};
+  int32_t case_values[] = {std::numeric_limits<int32_t>::min() + 0,
+                           std::numeric_limits<int32_t>::min() + 1};
+  m.Switch(m.Parameter(0), &blockc, case_values, case_labels,
+           arraysize(case_labels));
+  m.Bind(&blocka);
+  m.Return(m.Int32Constant(0));
+  m.Bind(&blockb);
+  m.Return(m.Int32Constant(1));
+  m.Bind(&blockc);
+  m.Return(m.Int32Constant(2));
+
+  CHECK_EQ(0, m.Call(std::numeric_limits<int32_t>::min() + 0));
+  CHECK_EQ(1, m.Call(std::numeric_limits<int32_t>::min() + 1));
+  for (int i = -100; i < 100; i += 25) {
+    CHECK_EQ(2, m.Call(i));
+  }
+}
+
+
+TEST(RunSwitch4) {
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+
+  const size_t kNumCases = 512;
+  const size_t kNumValues = kNumCases + 1;
+  int32_t values[kNumValues];
+  m.main_isolate()->random_number_generator()->NextBytes(values,
+                                                         sizeof(values));
+  RawMachineLabel end, def;
+  int32_t case_values[kNumCases];
+  RawMachineLabel* case_labels[kNumCases];
+  Node* results[kNumValues];
+  for (size_t i = 0; i < kNumCases; ++i) {
+    case_values[i] = static_cast<int32_t>(i);
+    case_labels[i] =
+        new (m.main_zone()->New(sizeof(RawMachineLabel))) RawMachineLabel;
+  }
+  m.Switch(m.Parameter(0), &def, case_values, case_labels,
+           arraysize(case_labels));
+  for (size_t i = 0; i < kNumCases; ++i) {
+    m.Bind(case_labels[i]);
+    results[i] = m.Int32Constant(values[i]);
+    m.Goto(&end);
+  }
+  m.Bind(&def);
+  results[kNumCases] = m.Int32Constant(values[kNumCases]);
+  m.Goto(&end);
+  m.Bind(&end);
+  const int num_results = static_cast<int>(arraysize(results));
+  Node* phi =
+      m.AddNode(m.common()->Phi(MachineRepresentation::kWord32, num_results),
+                num_results, results);
+  m.Return(phi);
+
+  for (size_t i = 0; i < kNumValues; ++i) {
+    CHECK_EQ(values[i], m.Call(static_cast<int>(i)));
+  }
+}
+
+
 TEST(RunLoadInt32) {
   RawMachineAssemblerTester<int32_t> m;
 
   int32_t p1 = 0;  // loads directly from this location.
-  m.Return(m.LoadFromPointer(&p1, kMachInt32));
+  m.Return(m.LoadFromPointer(&p1, MachineType::Int32()));
 
   FOR_INT32_INPUTS(i) {
     p1 = *i;
@@ -475,7 +1129,7 @@
     int32_t offset = offsets[i];
     byte* pointer = reinterpret_cast<byte*>(&p1) - offset;
     // generate load [#base + #index]
-    m.Return(m.LoadFromPointer(pointer, kMachInt32, offset));
+    m.Return(m.LoadFromPointer(pointer, MachineType::Int32(), offset));
 
     FOR_INT32_INPUTS(j) {
       p1 = *j;
@@ -485,6 +1139,33 @@
 }
 
 
+TEST(RunLoadStoreFloat32Offset) {
+  float p1 = 0.0f;  // loads directly from this location.
+  float p2 = 0.0f;  // and stores directly into this location.
+
+  FOR_INT32_INPUTS(i) {
+    int32_t magic = 0x2342aabb + *i * 3;
+    RawMachineAssemblerTester<int32_t> m;
+    int32_t offset = *i;
+    byte* from = reinterpret_cast<byte*>(&p1) - offset;
+    byte* to = reinterpret_cast<byte*>(&p2) - offset;
+    // generate load [#base + #index]
+    Node* load = m.Load(MachineType::Float32(), m.PointerConstant(from),
+                        m.IntPtrConstant(offset));
+    m.Store(MachineRepresentation::kFloat32, m.PointerConstant(to),
+            m.IntPtrConstant(offset), load, kNoWriteBarrier);
+    m.Return(m.Int32Constant(magic));
+
+    FOR_FLOAT32_INPUTS(j) {
+      p1 = *j;
+      p2 = *j - 5;
+      CHECK_EQ(magic, m.Call());
+      CheckDoubleEq(p1, p2);
+    }
+  }
+}
+
+
 TEST(RunLoadStoreFloat64Offset) {
   double p1 = 0;  // loads directly from this location.
   double p2 = 0;  // and stores directly into this location.
@@ -496,16 +1177,17 @@
     byte* from = reinterpret_cast<byte*>(&p1) - offset;
     byte* to = reinterpret_cast<byte*>(&p2) - offset;
     // generate load [#base + #index]
-    Node* load =
-        m.Load(kMachFloat64, m.PointerConstant(from), m.Int32Constant(offset));
-    m.Store(kMachFloat64, m.PointerConstant(to), m.Int32Constant(offset), load);
+    Node* load = m.Load(MachineType::Float64(), m.PointerConstant(from),
+                        m.IntPtrConstant(offset));
+    m.Store(MachineRepresentation::kFloat64, m.PointerConstant(to),
+            m.IntPtrConstant(offset), load, kNoWriteBarrier);
     m.Return(m.Int32Constant(magic));
 
     FOR_FLOAT64_INPUTS(j) {
       p1 = *j;
       p2 = *j - 5;
       CHECK_EQ(magic, m.Call());
-      CHECK_EQ(p1, p2);
+      CheckDoubleEq(p1, p2);
     }
   }
 }
@@ -529,7 +1211,8 @@
 
 TEST(RunInt32AddAndWord32EqualP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(m.Int32Add(m.Parameter(0),
                         m.Word32Equal(m.Parameter(1), m.Parameter(2))));
     FOR_INT32_INPUTS(i) {
@@ -544,7 +1227,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(m.Int32Add(m.Word32Equal(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -564,7 +1248,8 @@
 TEST(RunInt32AddAndWord32EqualImm) {
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                           MachineType::Int32());
       m.Return(m.Int32Add(m.Int32Constant(*i),
                           m.Word32Equal(m.Parameter(0), m.Parameter(1))));
       FOR_INT32_INPUTS(j) {
@@ -579,7 +1264,8 @@
   }
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                           MachineType::Int32());
       m.Return(m.Int32Add(m.Word32Equal(m.Int32Constant(*i), m.Parameter(0)),
                           m.Parameter(1)));
       FOR_INT32_INPUTS(j) {
@@ -597,7 +1283,8 @@
 
 TEST(RunInt32AddAndWord32NotEqualP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(m.Int32Add(m.Parameter(0),
                         m.Word32NotEqual(m.Parameter(1), m.Parameter(2))));
     FOR_INT32_INPUTS(i) {
@@ -612,7 +1299,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(m.Int32Add(m.Word32NotEqual(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -632,7 +1320,8 @@
 TEST(RunInt32AddAndWord32NotEqualImm) {
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                           MachineType::Int32());
       m.Return(m.Int32Add(m.Int32Constant(*i),
                           m.Word32NotEqual(m.Parameter(0), m.Parameter(1))));
       FOR_INT32_INPUTS(j) {
@@ -647,7 +1336,8 @@
   }
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                           MachineType::Int32());
       m.Return(m.Int32Add(m.Word32NotEqual(m.Int32Constant(*i), m.Parameter(0)),
                           m.Parameter(1)));
       FOR_INT32_INPUTS(j) {
@@ -665,7 +1355,8 @@
 
 TEST(RunInt32AddAndWord32SarP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Parameter(0),
                         m.Word32Sar(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -679,7 +1370,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -697,7 +1389,8 @@
 
 TEST(RunInt32AddAndWord32ShlP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Parameter(0),
                         m.Word32Shl(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -711,7 +1404,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -729,7 +1423,8 @@
 
 TEST(RunInt32AddAndWord32ShrP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Parameter(0),
                         m.Word32Shr(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -743,7 +1438,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Add(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_UINT32_INPUTS(i) {
@@ -763,8 +1459,8 @@
   static const int32_t constant = 987654321;
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -781,8 +1477,8 @@
   }
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32NotEqual(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -799,8 +1495,8 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -810,14 +1506,14 @@
       m.Return(m.Int32Constant(0 - constant));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
                                 m.Int32Constant(0)),
                &blocka, &blockb);
@@ -827,7 +1523,7 @@
       m.Return(m.Int32Constant(0 - constant));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -837,11 +1533,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0),
-                                        m.NewNode(shops[n], m.Parameter(1),
+                                        m.AddNode(shops[n], m.Parameter(1),
                                                   m.Parameter(2))),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -885,7 +1581,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i + *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -897,29 +1593,29 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i + *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i + *j) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(*i)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*j + *i) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -929,11 +1625,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
       m.Return(m.Word32Equal(
           m.Int32Add(m.Parameter(0),
-                     m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
+                     m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))),
           m.Int32Constant(0)));
       FOR_UINT32_INPUTS(i) {
         FOR_INT32_INPUTS(j) {
@@ -971,7 +1667,7 @@
   FOR_UINT32_INPUTS(i) {
     FOR_UINT32_INPUTS(j) {
       uint32_t expected = static_cast<int32_t>(*i - *j);
-      CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+      CHECK_EQ(expected, bt.call(*i, *j));
     }
   }
 }
@@ -980,21 +1676,21 @@
 TEST(RunInt32SubImm) {
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i - *j;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *j - *i;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1003,7 +1699,8 @@
 
 TEST(RunInt32SubAndWord32SarP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Parameter(0),
                         m.Word32Sar(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -1016,7 +1713,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -1033,7 +1731,8 @@
 
 TEST(RunInt32SubAndWord32ShlP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Parameter(0),
                         m.Word32Shl(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -1046,7 +1745,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -1064,30 +1764,30 @@
 
 TEST(RunInt32SubAndWord32ShrP) {
   {
-    RawMachineAssemblerTester<uint32_t> m(kMachUint32, kMachUint32,
-                                          kMachUint32);
+    RawMachineAssemblerTester<uint32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Parameter(0),
                         m.Word32Shr(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         FOR_UINT32_SHIFTS(shift) {
           // Use uint32_t because signed overflow is UB in C.
-          int32_t expected = *i - (*j >> shift);
-          CHECK_UINT32_EQ(expected, m.Call(*i, *j, shift));
+          uint32_t expected = *i - (*j >> shift);
+          CHECK_EQ(expected, m.Call(*i, *j, shift));
         }
       }
     }
   }
   {
-    RawMachineAssemblerTester<uint32_t> m(kMachUint32, kMachUint32,
-                                          kMachUint32);
+    RawMachineAssemblerTester<uint32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Int32Sub(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
                         m.Parameter(2)));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         FOR_UINT32_INPUTS(k) {
           // Use uint32_t because signed overflow is UB in C.
-          int32_t expected = (*i >> shift) - *k;
+          uint32_t expected = (*i >> shift) - *k;
           CHECK_EQ(expected, m.Call(*i, shift, *k));
         }
       }
@@ -1100,8 +1800,8 @@
   static const int constant = 987654321;
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -1118,8 +1818,8 @@
   }
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32NotEqual(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -1136,8 +1836,8 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -1146,15 +1846,15 @@
       m.Bind(&blockb);
       m.Return(m.Int32Constant(0 - constant));
       FOR_UINT32_INPUTS(j) {
-        int32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
+        uint32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
         CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
                                 m.Int32Constant(0)),
                &blocka, &blockb);
@@ -1174,11 +1874,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0),
-                                        m.NewNode(shops[n], m.Parameter(1),
+                                        m.AddNode(shops[n], m.Parameter(1),
                                                   m.Parameter(2))),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -1222,7 +1922,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i - *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1234,29 +1934,29 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i - *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i - *j) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*j - *i) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1266,11 +1966,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
       m.Return(m.Word32Equal(
           m.Int32Sub(m.Parameter(0),
-                     m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
+                     m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))),
           m.Int32Constant(0)));
       FOR_UINT32_INPUTS(i) {
         FOR_INT32_INPUTS(j) {
@@ -1318,7 +2018,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i * *j;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1342,21 +2042,21 @@
 TEST(RunInt32MulImm) {
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Int32Mul(m.Int32Constant(*i), m.Parameter(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i * *j;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(*i)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *j * *i;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1367,7 +2067,7 @@
   {
     FOR_INT32_INPUTS(i) {
       FOR_INT32_INPUTS(j) {
-        RawMachineAssemblerTester<int32_t> m(kMachInt32);
+        RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
         int32_t p0 = *i;
         int32_t p1 = *j;
         m.Return(m.Int32Add(m.Int32Constant(p0),
@@ -1381,7 +2081,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(
         m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2))));
     FOR_INT32_INPUTS(i) {
@@ -1397,7 +2098,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
     m.Return(
         m.Int32Add(m.Int32Mul(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -1433,7 +2135,8 @@
 
 TEST(RunInt32MulAndInt32SubP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Int32(), MachineType::Int32());
     m.Return(
         m.Int32Sub(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -1527,7 +2230,7 @@
         uint32_t p0 = *i;
         uint32_t p1 = *j;
         if (p1 != 0) {
-          uint32_t expected = static_cast<uint32_t>(p0 / p1);
+          int32_t expected = bit_cast<int32_t>(p0 / p1);
           CHECK_EQ(expected, bt.call(p0, p1));
         }
       }
@@ -1542,7 +2245,7 @@
         uint32_t p0 = *i;
         uint32_t p1 = *j;
         if (p1 != 0) {
-          uint32_t expected = static_cast<uint32_t>(p0 + (p0 / p1));
+          int32_t expected = bit_cast<int32_t>(p0 + (p0 / p1));
           CHECK_EQ(expected, bt.call(p0, p1));
         }
       }
@@ -1588,7 +2291,7 @@
 TEST(RunUint32ModP) {
   {
     RawMachineAssemblerTester<int32_t> m;
-    Int32BinopTester bt(&m);
+    Uint32BinopTester bt(&m);
     bt.AddReturn(m.Uint32Mod(bt.param0, bt.param1));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
@@ -1603,7 +2306,7 @@
   }
   {
     RawMachineAssemblerTester<int32_t> m;
-    Int32BinopTester bt(&m);
+    Uint32BinopTester bt(&m);
     bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Mod(bt.param0, bt.param1)));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
@@ -1626,7 +2329,7 @@
     bt.AddReturn(m.Word32And(bt.param0, bt.param1));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
-        uint32_t expected = *i & *j;
+        int32_t expected = *i & *j;
         CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
@@ -1637,7 +2340,7 @@
     bt.AddReturn(m.Word32And(bt.param0, m.Word32Not(bt.param1)));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
-        uint32_t expected = *i & ~(*j);
+        int32_t expected = *i & ~(*j);
         CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
@@ -1648,7 +2351,7 @@
     bt.AddReturn(m.Word32And(m.Word32Not(bt.param0), bt.param1));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
-        uint32_t expected = ~(*i) & *j;
+        int32_t expected = ~(*i) & *j;
         CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
@@ -1665,7 +2368,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i << (*j & 0x1f);
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1677,7 +2380,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i << (0x1f & *j);
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1693,7 +2396,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i >> (*j & 0x1f);
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1705,7 +2408,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i >> (0x1f & *j);
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1732,7 +2435,7 @@
         m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1)));
     FOR_INT32_INPUTS(i) {
       FOR_INT32_INPUTS(j) {
-        uint32_t expected = *i >> (0x1f & *j);
+        int32_t expected = *i >> (0x1f & *j);
         CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
@@ -1743,21 +2446,21 @@
 TEST(RunWord32AndImm) {
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32And(m.Int32Constant(*i), m.Parameter(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i & *j;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32And(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i & ~(*j);
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1768,8 +2471,8 @@
   static const int constant = 987654321;
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -1786,8 +2489,8 @@
   }
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    Int32BinopTester bt(&m);
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32NotEqual(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -1804,8 +2507,8 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -1821,8 +2524,8 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(
           m.Word32NotEqual(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
                            m.Int32Constant(0)),
@@ -1843,11 +2546,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0),
-                                         m.NewNode(shops[n], m.Parameter(1),
+                                         m.AddNode(shops[n], m.Parameter(1),
                                                    m.Parameter(2))),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -1891,7 +2594,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i & *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1903,29 +2606,29 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i & *j) == 0;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i & *j) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(*i)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*j & *i) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1940,7 +2643,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i | *j;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1951,7 +2654,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i | ~(*j);
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1962,7 +2665,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = ~(*i) | *j;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -1972,21 +2675,21 @@
 TEST(RunWord32OrImm) {
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i | *j;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Or(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i | ~(*j);
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -1998,7 +2701,7 @@
   {
     RawMachineAssemblerTester<int32_t> m;
     Int32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -2016,7 +2719,7 @@
   {
     RawMachineAssemblerTester<int32_t> m;
     Int32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32NotEqual(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -2033,8 +2736,8 @@
   }
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -2050,8 +2753,8 @@
   }
   {
     FOR_INT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
                                 m.Int32Constant(0)),
                &blocka, &blockb);
@@ -2071,11 +2774,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0),
-                                        m.NewNode(shops[n], m.Parameter(1),
+                                        m.AddNode(shops[n], m.Parameter(1),
                                                   m.Parameter(2))),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -2113,7 +2816,7 @@
 TEST(RunWord32OrInComparison) {
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
+    Int32BinopTester bt(&m);
     bt.AddReturn(
         m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)));
     FOR_UINT32_INPUTS(i) {
@@ -2125,7 +2828,7 @@
   }
   {
     RawMachineAssemblerTester<int32_t> m;
-    Uint32BinopTester bt(&m);
+    Int32BinopTester bt(&m);
     bt.AddReturn(
         m.Word32Equal(m.Int32Constant(0), m.Word32Or(bt.param0, bt.param1)));
     FOR_UINT32_INPUTS(i) {
@@ -2137,23 +2840,23 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i | *j) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(*i)),
                              m.Int32Constant(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*j | *i) == 0;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2163,11 +2866,11 @@
 TEST(RunWord32XorP) {
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i ^ *j;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2177,8 +2880,8 @@
     bt.AddReturn(m.Word32Xor(bt.param0, bt.param1));
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
-        int32_t expected = *i ^ *j;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        uint32_t expected = *i ^ *j;
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
@@ -2206,11 +2909,11 @@
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Xor(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *i ^ ~(*j);
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2222,7 +2925,7 @@
   {
     RawMachineAssemblerTester<int32_t> m;
     Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32Equal(m.Word32Xor(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -2233,14 +2936,14 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
   {
     RawMachineAssemblerTester<int32_t> m;
     Uint32BinopTester bt(&m);
-    MLabel blocka, blockb;
+    RawMachineLabel blocka, blockb;
     m.Branch(
         m.Word32NotEqual(m.Word32Xor(bt.param0, bt.param1), m.Int32Constant(0)),
         &blocka, &blockb);
@@ -2251,14 +2954,14 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+        CHECK_EQ(expected, bt.call(*i, *j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -2268,14 +2971,14 @@
       m.Return(m.Int32Constant(0 - constant));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
   {
     FOR_UINT32_INPUTS(i) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(
           m.Word32NotEqual(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
                            m.Int32Constant(0)),
@@ -2286,7 +2989,7 @@
       m.Return(m.Int32Constant(0 - constant));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2296,11 +2999,11 @@
                                m.machine()->Word32Shl(),
                                m.machine()->Word32Shr()};
     for (size_t n = 0; n < arraysize(shops); n++) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
-                                           kMachUint32);
-      MLabel blocka, blockb;
+      RawMachineAssemblerTester<int32_t> m(
+          MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+      RawMachineLabel blocka, blockb;
       m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0),
-                                         m.NewNode(shops[n], m.Parameter(1),
+                                         m.AddNode(shops[n], m.Parameter(1),
                                                    m.Parameter(2))),
                              m.Int32Constant(0)),
                &blocka, &blockb);
@@ -2338,11 +3041,11 @@
 TEST(RunWord32ShlP) {
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *j << shift;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2353,7 +3056,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = *i << shift;
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
@@ -2369,7 +3072,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == (*i << shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
@@ -2381,31 +3084,31 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == (*i << shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Int32Constant(0),
                         m.Word32Shl(m.Parameter(0), m.Int32Constant(shift))));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == (*i << shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)),
                         m.Int32Constant(0)));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == (*i << shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
@@ -2415,11 +3118,11 @@
 TEST(RunWord32ShrP) {
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<uint32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)));
       FOR_UINT32_INPUTS(j) {
         uint32_t expected = *j >> shift;
-        CHECK_UINT32_EQ(expected, m.Call(*j));
+        CHECK_EQ(expected, m.Call(*j));
       }
     }
   }
@@ -2430,10 +3133,10 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = *i >> shift;
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
-    CHECK_EQ(0x00010000, bt.call(0x80000000, 15));
+    CHECK_EQ(0x00010000u, bt.call(0x80000000, 15));
   }
 }
 
@@ -2447,7 +3150,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == (*i >> shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
@@ -2459,31 +3162,31 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == (*i >> shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Int32Constant(0),
                         m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == (*i >> shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
                         m.Int32Constant(0)));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == (*i >> shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
@@ -2493,7 +3196,7 @@
 TEST(RunWord32SarP) {
   {
     FOR_INT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       m.Return(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)));
       FOR_INT32_INPUTS(j) {
         int32_t expected = *j >> shift;
@@ -2511,7 +3214,7 @@
         CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
-    CHECK_EQ(0xFFFF0000, bt.call(0x80000000, 15));
+    CHECK_EQ(bit_cast<int32_t>(0xFFFF0000), bt.call(0x80000000, 15));
   }
 }
 
@@ -2543,7 +3246,7 @@
   }
   {
     FOR_INT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       m.Return(
           m.Word32Equal(m.Int32Constant(0),
                         m.Word32Sar(m.Parameter(0), m.Int32Constant(shift))));
@@ -2555,12 +3258,12 @@
   }
   {
     FOR_INT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       m.Return(
           m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)),
                         m.Int32Constant(0)));
       FOR_INT32_INPUTS(i) {
-        uint32_t expected = 0 == (*i >> shift);
+        int32_t expected = 0 == (*i >> shift);
         CHECK_EQ(expected, m.Call(*i));
       }
     }
@@ -2571,7 +3274,7 @@
 TEST(RunWord32RorP) {
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
       m.Return(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)));
       FOR_UINT32_INPUTS(j) {
         int32_t expected = bits::RotateRight32(*j, shift);
@@ -2586,7 +3289,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = bits::RotateRight32(*i, shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
@@ -2602,7 +3305,7 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == bits::RotateRight32(*i, shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
@@ -2614,31 +3317,31 @@
     FOR_UINT32_INPUTS(i) {
       FOR_UINT32_SHIFTS(shift) {
         uint32_t expected = 0 == bits::RotateRight32(*i, shift);
-        CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+        CHECK_EQ(expected, bt.call(*i, shift));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Int32Constant(0),
                         m.Word32Ror(m.Parameter(0), m.Int32Constant(shift))));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == bits::RotateRight32(*i, shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
   {
     FOR_UINT32_SHIFTS(shift) {
-      RawMachineAssemblerTester<int32_t> m(kMachUint32);
+      RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
       m.Return(
           m.Word32Equal(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)),
                         m.Int32Constant(0)));
       FOR_UINT32_INPUTS(i) {
         uint32_t expected = 0 == bits::RotateRight32(*i, shift);
-        CHECK_UINT32_EQ(expected, m.Call(*i));
+        CHECK_EQ(expected, m.Call(*i));
       }
     }
   }
@@ -2646,7 +3349,7 @@
 
 
 TEST(RunWord32NotP) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32);
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
   m.Return(m.Word32Not(m.Parameter(0)));
   FOR_INT32_INPUTS(i) {
     int expected = ~(*i);
@@ -2656,7 +3359,7 @@
 
 
 TEST(RunInt32NegP) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32);
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
   m.Return(m.Int32Neg(m.Parameter(0)));
   FOR_INT32_INPUTS(i) {
     int expected = -*i;
@@ -2667,7 +3370,8 @@
 
 TEST(RunWord32EqualAndWord32SarP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Int32(), MachineType::Uint32());
     m.Return(m.Word32Equal(m.Parameter(0),
                            m.Word32Sar(m.Parameter(1), m.Parameter(2))));
     FOR_INT32_INPUTS(i) {
@@ -2680,7 +3384,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachUint32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Int32(), MachineType::Uint32(), MachineType::Int32());
     m.Return(m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
                            m.Parameter(2)));
     FOR_INT32_INPUTS(i) {
@@ -2697,7 +3402,8 @@
 
 TEST(RunWord32EqualAndWord32ShlP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Word32Equal(m.Parameter(0),
                            m.Word32Shl(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -2710,7 +3416,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
                            m.Parameter(2)));
     FOR_UINT32_INPUTS(i) {
@@ -2727,7 +3434,8 @@
 
 TEST(RunWord32EqualAndWord32ShrP) {
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Word32Equal(m.Parameter(0),
                            m.Word32Shr(m.Parameter(1), m.Parameter(2))));
     FOR_UINT32_INPUTS(i) {
@@ -2740,7 +3448,8 @@
     }
   }
   {
-    RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachUint32, kMachUint32);
+    RawMachineAssemblerTester<int32_t> m(
+        MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
     m.Return(m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
                            m.Parameter(2)));
     FOR_UINT32_INPUTS(i) {
@@ -2757,7 +3466,8 @@
 
 TEST(RunDeadNodes) {
   for (int i = 0; true; i++) {
-    RawMachineAssemblerTester<int32_t> m(i == 5 ? kMachInt32 : kMachNone);
+    RawMachineAssemblerTester<int32_t> m(i == 5 ? MachineType::Int32()
+                                                : MachineType::None());
     int constant = 0x55 + i;
     switch (i) {
       case 0:
@@ -2773,7 +3483,7 @@
         m.PointerConstant(&constant);
         break;
       case 4:
-        m.LoadFromPointer(&constant, kMachInt32);
+        m.LoadFromPointer(&constant, MachineType::Int32());
         break;
       case 5:
         m.Parameter(0);
@@ -2808,9 +3518,10 @@
       m.machine()->Uint32LessThanOrEqual()};
 
   for (size_t i = 0; i < arraysize(kOps); ++i) {
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+    RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                         MachineType::Int32());
     int32_t constant = static_cast<int32_t>(0x55555 + i);
-    m.NewNode(kOps[i], m.Parameter(0), m.Parameter(1));
+    m.AddNode(kOps[i], m.Parameter(0), m.Parameter(1));
     m.Return(m.Int32Constant(constant));
 
     CHECK_EQ(constant, m.Call(1, 1));
@@ -2846,16 +3557,16 @@
 
 
 TEST(RunLoadImmIndex) {
-  RunLoadImmIndex<int8_t>(kMachInt8);
-  RunLoadImmIndex<uint8_t>(kMachUint8);
-  RunLoadImmIndex<int16_t>(kMachInt16);
-  RunLoadImmIndex<uint16_t>(kMachUint16);
-  RunLoadImmIndex<int32_t>(kMachInt32);
-  RunLoadImmIndex<uint32_t>(kMachUint32);
-  RunLoadImmIndex<int32_t*>(kMachAnyTagged);
+  RunLoadImmIndex<int8_t>(MachineType::Int8());
+  RunLoadImmIndex<uint8_t>(MachineType::Uint8());
+  RunLoadImmIndex<int16_t>(MachineType::Int16());
+  RunLoadImmIndex<uint16_t>(MachineType::Uint16());
+  RunLoadImmIndex<int32_t>(MachineType::Int32());
+  RunLoadImmIndex<uint32_t>(MachineType::Uint32());
+  RunLoadImmIndex<int32_t*>(MachineType::AnyTagged());
 
   // TODO(titzer): test kRepBit loads
-  // TODO(titzer): test kMachFloat64 loads
+  // TODO(titzer): test MachineType::Float64() loads
   // TODO(titzer): test various indexing modes.
 }
 
@@ -2876,10 +3587,10 @@
     RawMachineAssemblerTester<int32_t> m;
     int32_t OK = 0x29000 + x;
     Node* base = m.PointerConstant(buffer);
-    Node* index0 = m.Int32Constant(x * sizeof(buffer[0]));
+    Node* index0 = m.IntPtrConstant(x * sizeof(buffer[0]));
     Node* load = m.Load(rep, base, index0);
-    Node* index1 = m.Int32Constant(y * sizeof(buffer[0]));
-    m.Store(rep, base, index1, load);
+    Node* index1 = m.IntPtrConstant(y * sizeof(buffer[0]));
+    m.Store(rep.representation(), base, index1, load, kNoWriteBarrier);
     m.Return(m.Int32Constant(OK));
 
     CHECK(buffer[x] != buffer[y]);
@@ -2890,50 +3601,154 @@
 
 
 TEST(RunLoadStore) {
-  RunLoadStore<int8_t>(kMachInt8);
-  RunLoadStore<uint8_t>(kMachUint8);
-  RunLoadStore<int16_t>(kMachInt16);
-  RunLoadStore<uint16_t>(kMachUint16);
-  RunLoadStore<int32_t>(kMachInt32);
-  RunLoadStore<uint32_t>(kMachUint32);
-  RunLoadStore<void*>(kMachAnyTagged);
-  RunLoadStore<float>(kMachFloat32);
-  RunLoadStore<double>(kMachFloat64);
+  RunLoadStore<int8_t>(MachineType::Int8());
+  RunLoadStore<uint8_t>(MachineType::Uint8());
+  RunLoadStore<int16_t>(MachineType::Int16());
+  RunLoadStore<uint16_t>(MachineType::Uint16());
+  RunLoadStore<int32_t>(MachineType::Int32());
+  RunLoadStore<uint32_t>(MachineType::Uint32());
+  RunLoadStore<void*>(MachineType::AnyTagged());
+  RunLoadStore<float>(MachineType::Float32());
+  RunLoadStore<double>(MachineType::Float64());
 }
 
 
-TEST(RunFloat64Binop) {
+TEST(RunFloat32Add) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(),
+                                             MachineType::Float32());
+  m.Return(m.Float32Add(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT32_INPUTS(i) {
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *i + *j;
+      CheckFloatEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat32Sub) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(),
+                                             MachineType::Float32());
+  m.Return(m.Float32Sub(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT32_INPUTS(i) {
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *i - *j;
+      CheckFloatEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat32Mul) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(),
+                                             MachineType::Float32());
+  m.Return(m.Float32Mul(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT32_INPUTS(i) {
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *i * *j;
+      CheckFloatEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat32Div) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(),
+                                             MachineType::Float32());
+  m.Return(m.Float32Div(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT32_INPUTS(i) {
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *i / *j;
+      CheckFloatEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64Add) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Float64());
+  m.Return(m.Float64Add(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      volatile double expected = *i + *j;
+      CheckDoubleEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64Sub) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Float64());
+  m.Return(m.Float64Sub(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      volatile double expected = *i - *j;
+      CheckDoubleEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64Mul) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Float64());
+  m.Return(m.Float64Mul(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      volatile double expected = *i * *j;
+      CheckDoubleEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64Div) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Float64());
+  m.Return(m.Float64Div(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      volatile double expected = *i / *j;
+      CheckDoubleEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64Mod) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Float64());
+  m.Return(m.Float64Mod(m.Parameter(0), m.Parameter(1)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) { CheckDoubleEq(modulo(*i, *j), m.Call(*i, *j)); }
+  }
+}
+
+
+TEST(RunDeadFloat32Binops) {
   RawMachineAssemblerTester<int32_t> m;
-  double result;
 
-  const Operator* ops[] = {m.machine()->Float64Add(), m.machine()->Float64Sub(),
-                           m.machine()->Float64Mul(), m.machine()->Float64Div(),
-                           m.machine()->Float64Mod(), NULL};
-
-  double inf = V8_INFINITY;
-  const Operator* inputs[] = {
-      m.common()->Float64Constant(0),     m.common()->Float64Constant(1),
-      m.common()->Float64Constant(1),     m.common()->Float64Constant(0),
-      m.common()->Float64Constant(0),     m.common()->Float64Constant(-1),
-      m.common()->Float64Constant(-1),    m.common()->Float64Constant(0),
-      m.common()->Float64Constant(0.22),  m.common()->Float64Constant(-1.22),
-      m.common()->Float64Constant(-1.22), m.common()->Float64Constant(0.22),
-      m.common()->Float64Constant(inf),   m.common()->Float64Constant(0.22),
-      m.common()->Float64Constant(inf),   m.common()->Float64Constant(-inf),
-      NULL};
+  const Operator* ops[] = {m.machine()->Float32Add(), m.machine()->Float32Sub(),
+                           m.machine()->Float32Mul(), m.machine()->Float32Div(),
+                           NULL};
 
   for (int i = 0; ops[i] != NULL; i++) {
-    for (int j = 0; inputs[j] != NULL; j += 2) {
-      RawMachineAssemblerTester<int32_t> m;
-      Node* a = m.NewNode(inputs[j]);
-      Node* b = m.NewNode(inputs[j + 1]);
-      Node* binop = m.NewNode(ops[i], a, b);
-      Node* base = m.PointerConstant(&result);
-      Node* zero = m.Int32Constant(0);
-      m.Store(kMachFloat64, base, zero, binop);
-      m.Return(m.Int32Constant(i + j));
-      CHECK_EQ(i + j, m.Call());
-    }
+    RawMachineAssemblerTester<int32_t> m;
+    int constant = 0x53355 + i;
+    m.AddNode(ops[i], m.Float32Constant(0.1f), m.Float32Constant(1.11f));
+    m.Return(m.Int32Constant(constant));
+    CHECK_EQ(constant, m.Call());
   }
 }
 
@@ -2948,13 +3763,28 @@
   for (int i = 0; ops[i] != NULL; i++) {
     RawMachineAssemblerTester<int32_t> m;
     int constant = 0x53355 + i;
-    m.NewNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11));
+    m.AddNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11));
     m.Return(m.Int32Constant(constant));
     CHECK_EQ(constant, m.Call());
   }
 }
 
 
+TEST(RunFloat32AddP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
+
+  bt.AddReturn(m.Float32Add(bt.param0, bt.param1));
+
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      float expected = *pl + *pr;
+      CheckFloatEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
 TEST(RunFloat64AddP) {
   RawMachineAssemblerTester<int32_t> m;
   Float64BinopTester bt(&m);
@@ -2964,12 +3794,137 @@
   FOR_FLOAT64_INPUTS(pl) {
     FOR_FLOAT64_INPUTS(pr) {
       double expected = *pl + *pr;
-      CHECK_EQ(expected, bt.call(*pl, *pr));
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
     }
   }
 }
 
 
+TEST(RunFloa32MaxP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
+  if (!m.machine()->Float32Max().IsSupported()) return;
+
+  bt.AddReturn(m.Float32Max(bt.param0, bt.param1));
+
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      double expected = *pl > *pr ? *pl : *pr;
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
+TEST(RunFloat64MaxP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float64BinopTester bt(&m);
+  if (!m.machine()->Float64Max().IsSupported()) return;
+
+  bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
+
+  FOR_FLOAT64_INPUTS(pl) {
+    FOR_FLOAT64_INPUTS(pr) {
+      double expected = *pl > *pr ? *pl : *pr;
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
+TEST(RunFloat32MinP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
+  if (!m.machine()->Float32Min().IsSupported()) return;
+
+  bt.AddReturn(m.Float32Min(bt.param0, bt.param1));
+
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      double expected = *pl < *pr ? *pl : *pr;
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
+TEST(RunFloat64MinP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float64BinopTester bt(&m);
+  if (!m.machine()->Float64Min().IsSupported()) return;
+
+  bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
+
+  FOR_FLOAT64_INPUTS(pl) {
+    FOR_FLOAT64_INPUTS(pr) {
+      double expected = *pl < *pr ? *pl : *pr;
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
+TEST(RunFloat32SubP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
+
+  bt.AddReturn(m.Float32Sub(bt.param0, bt.param1));
+
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      float expected = *pl - *pr;
+      CheckFloatEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
+TEST(RunFloat32SubImm1) {
+  FOR_FLOAT32_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+    m.Return(m.Float32Sub(m.Float32Constant(*i), m.Parameter(0)));
+
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *i - *j;
+      CheckFloatEq(expected, m.Call(*j));
+    }
+  }
+}
+
+
+TEST(RunFloat32SubImm2) {
+  FOR_FLOAT32_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+    m.Return(m.Float32Sub(m.Parameter(0), m.Float32Constant(*i)));
+
+    FOR_FLOAT32_INPUTS(j) {
+      volatile float expected = *j - *i;
+      CheckFloatEq(expected, m.Call(*j));
+    }
+  }
+}
+
+
+TEST(RunFloat64SubImm1) {
+  FOR_FLOAT64_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+    m.Return(m.Float64Sub(m.Float64Constant(*i), m.Parameter(0)));
+
+    FOR_FLOAT64_INPUTS(j) { CheckFloatEq(*i - *j, m.Call(*j)); }
+  }
+}
+
+
+TEST(RunFloat64SubImm2) {
+  FOR_FLOAT64_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+    m.Return(m.Float64Sub(m.Parameter(0), m.Float64Constant(*i)));
+
+    FOR_FLOAT64_INPUTS(j) { CheckFloatEq(*j - *i, m.Call(*j)); }
+  }
+}
+
+
 TEST(RunFloat64SubP) {
   RawMachineAssemblerTester<int32_t> m;
   Float64BinopTester bt(&m);
@@ -2979,47 +3934,22 @@
   FOR_FLOAT64_INPUTS(pl) {
     FOR_FLOAT64_INPUTS(pr) {
       double expected = *pl - *pr;
-      CHECK_EQ(expected, bt.call(*pl, *pr));
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
     }
   }
 }
 
 
-TEST(RunFloat64SubImm1) {
-  double input = 0.0;
-  double output = 0.0;
+TEST(RunFloat32MulP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
 
-  FOR_FLOAT64_INPUTS(i) {
-    RawMachineAssemblerTester<int32_t> m;
-    Node* t0 = m.LoadFromPointer(&input, kMachFloat64);
-    Node* t1 = m.Float64Sub(m.Float64Constant(*i), t0);
-    m.StoreToPointer(&output, kMachFloat64, t1);
-    m.Return(m.Int32Constant(0));
-    FOR_FLOAT64_INPUTS(j) {
-      input = *j;
-      double expected = *i - input;
-      CHECK_EQ(0, m.Call());
-      CHECK_EQ(expected, output);
-    }
-  }
-}
+  bt.AddReturn(m.Float32Mul(bt.param0, bt.param1));
 
-
-TEST(RunFloat64SubImm2) {
-  double input = 0.0;
-  double output = 0.0;
-
-  FOR_FLOAT64_INPUTS(i) {
-    RawMachineAssemblerTester<int32_t> m;
-    Node* t0 = m.LoadFromPointer(&input, kMachFloat64);
-    Node* t1 = m.Float64Sub(t0, m.Float64Constant(*i));
-    m.StoreToPointer(&output, kMachFloat64, t1);
-    m.Return(m.Int32Constant(0));
-    FOR_FLOAT64_INPUTS(j) {
-      input = *j;
-      double expected = input - *i;
-      CHECK_EQ(0, m.Call());
-      CHECK_EQ(expected, output);
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      float expected = *pl * *pr;
+      CheckFloatEq(expected, bt.call(*pl, *pr));
     }
   }
 }
@@ -3034,131 +3964,111 @@
   FOR_FLOAT64_INPUTS(pl) {
     FOR_FLOAT64_INPUTS(pr) {
       double expected = *pl * *pr;
-      CHECK_EQ(expected, bt.call(*pl, *pr));
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
     }
   }
 }
 
 
-TEST(RunFloat64MulAndFloat64AddP) {
-  double input_a = 0.0;
-  double input_b = 0.0;
-  double input_c = 0.0;
-  double output = 0.0;
-
-  {
-    RawMachineAssemblerTester<int32_t> m;
-    Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
-    Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
-    Node* c = m.LoadFromPointer(&input_c, kMachFloat64);
-    m.StoreToPointer(&output, kMachFloat64,
-                     m.Float64Add(m.Float64Mul(a, b), c));
-    m.Return(m.Int32Constant(0));
-    FOR_FLOAT64_INPUTS(i) {
-      FOR_FLOAT64_INPUTS(j) {
-        FOR_FLOAT64_INPUTS(k) {
-          input_a = *i;
-          input_b = *j;
-          input_c = *k;
-          volatile double temp = input_a * input_b;
-          volatile double expected = temp + input_c;
-          CHECK_EQ(0, m.Call());
-          CHECK_EQ(expected, output);
-        }
-      }
-    }
-  }
-  {
-    RawMachineAssemblerTester<int32_t> m;
-    Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
-    Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
-    Node* c = m.LoadFromPointer(&input_c, kMachFloat64);
-    m.StoreToPointer(&output, kMachFloat64,
-                     m.Float64Add(a, m.Float64Mul(b, c)));
-    m.Return(m.Int32Constant(0));
-    FOR_FLOAT64_INPUTS(i) {
-      FOR_FLOAT64_INPUTS(j) {
-        FOR_FLOAT64_INPUTS(k) {
-          input_a = *i;
-          input_b = *j;
-          input_c = *k;
-          volatile double temp = input_b * input_c;
-          volatile double expected = input_a + temp;
-          CHECK_EQ(0, m.Call());
-          CHECK_EQ(expected, output);
-        }
-      }
-    }
-  }
-}
-
-
-TEST(RunFloat64MulAndFloat64SubP) {
-  double input_a = 0.0;
-  double input_b = 0.0;
-  double input_c = 0.0;
-  double output = 0.0;
-
-  RawMachineAssemblerTester<int32_t> m;
-  Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
-  Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
-  Node* c = m.LoadFromPointer(&input_c, kMachFloat64);
-  m.StoreToPointer(&output, kMachFloat64, m.Float64Sub(a, m.Float64Mul(b, c)));
-  m.Return(m.Int32Constant(0));
+TEST(RunFloat64MulAndFloat64Add1) {
+  BufferedRawMachineAssemblerTester<double> m(
+      MachineType::Float64(), MachineType::Float64(), MachineType::Float64());
+  m.Return(m.Float64Add(m.Float64Mul(m.Parameter(0), m.Parameter(1)),
+                        m.Parameter(2)));
 
   FOR_FLOAT64_INPUTS(i) {
     FOR_FLOAT64_INPUTS(j) {
       FOR_FLOAT64_INPUTS(k) {
-        input_a = *i;
-        input_b = *j;
-        input_c = *k;
-        volatile double temp = input_b * input_c;
-        volatile double expected = input_a - temp;
-        CHECK_EQ(0, m.Call());
-        CHECK_EQ(expected, output);
+        CheckDoubleEq((*i * *j) + *k, m.Call(*i, *j, *k));
       }
     }
   }
 }
 
 
-TEST(RunFloat64MulImm) {
-  double input = 0.0;
-  double output = 0.0;
+TEST(RunFloat64MulAndFloat64Add2) {
+  BufferedRawMachineAssemblerTester<double> m(
+      MachineType::Float64(), MachineType::Float64(), MachineType::Float64());
+  m.Return(m.Float64Add(m.Parameter(0),
+                        m.Float64Mul(m.Parameter(1), m.Parameter(2))));
 
-  {
-    FOR_FLOAT64_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m;
-      Node* t0 = m.LoadFromPointer(&input, kMachFloat64);
-      Node* t1 = m.Float64Mul(m.Float64Constant(*i), t0);
-      m.StoreToPointer(&output, kMachFloat64, t1);
-      m.Return(m.Int32Constant(0));
-      FOR_FLOAT64_INPUTS(j) {
-        input = *j;
-        double expected = *i * input;
-        CHECK_EQ(0, m.Call());
-        CHECK_EQ(expected, output);
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      FOR_FLOAT64_INPUTS(k) {
+        CheckDoubleEq(*i + (*j * *k), m.Call(*i, *j, *k));
       }
     }
   }
-  {
-    FOR_FLOAT64_INPUTS(i) {
-      RawMachineAssemblerTester<int32_t> m;
-      Node* t0 = m.LoadFromPointer(&input, kMachFloat64);
-      Node* t1 = m.Float64Mul(t0, m.Float64Constant(*i));
-      m.StoreToPointer(&output, kMachFloat64, t1);
-      m.Return(m.Int32Constant(0));
-      FOR_FLOAT64_INPUTS(j) {
-        input = *j;
-        double expected = input * *i;
-        CHECK_EQ(0, m.Call());
-        CHECK_EQ(expected, output);
+}
+
+
+TEST(RunFloat64MulAndFloat64Sub1) {
+  BufferedRawMachineAssemblerTester<double> m(
+      MachineType::Float64(), MachineType::Float64(), MachineType::Float64());
+  m.Return(m.Float64Sub(m.Float64Mul(m.Parameter(0), m.Parameter(1)),
+                        m.Parameter(2)));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      FOR_FLOAT64_INPUTS(k) {
+        CheckDoubleEq((*i * *j) - *k, m.Call(*i, *j, *k));
       }
     }
   }
 }
 
 
+TEST(RunFloat64MulAndFloat64Sub2) {
+  BufferedRawMachineAssemblerTester<double> m(
+      MachineType::Float64(), MachineType::Float64(), MachineType::Float64());
+  m.Return(m.Float64Sub(m.Parameter(0),
+                        m.Float64Mul(m.Parameter(1), m.Parameter(2))));
+
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_FLOAT64_INPUTS(j) {
+      FOR_FLOAT64_INPUTS(k) {
+        CheckDoubleEq(*i - (*j * *k), m.Call(*i, *j, *k));
+      }
+    }
+  }
+}
+
+
+TEST(RunFloat64MulImm1) {
+  FOR_FLOAT64_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+    m.Return(m.Float64Mul(m.Float64Constant(*i), m.Parameter(0)));
+
+    FOR_FLOAT64_INPUTS(j) { CheckFloatEq(*i * *j, m.Call(*j)); }
+  }
+}
+
+
+TEST(RunFloat64MulImm2) {
+  FOR_FLOAT64_INPUTS(i) {
+    BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+    m.Return(m.Float64Mul(m.Parameter(0), m.Float64Constant(*i)));
+
+    FOR_FLOAT64_INPUTS(j) { CheckFloatEq(*j * *i, m.Call(*j)); }
+  }
+}
+
+
+TEST(RunFloat32DivP) {
+  RawMachineAssemblerTester<int32_t> m;
+  Float32BinopTester bt(&m);
+
+  bt.AddReturn(m.Float32Div(bt.param0, bt.param1));
+
+  FOR_FLOAT32_INPUTS(pl) {
+    FOR_FLOAT32_INPUTS(pr) {
+      float expected = *pl / *pr;
+      CheckFloatEq(expected, bt.call(*pl, *pr));
+    }
+  }
+}
+
+
 TEST(RunFloat64DivP) {
   RawMachineAssemblerTester<int32_t> m;
   Float64BinopTester bt(&m);
@@ -3168,7 +4078,7 @@
   FOR_FLOAT64_INPUTS(pl) {
     FOR_FLOAT64_INPUTS(pr) {
       double expected = *pl / *pr;
-      CHECK_EQ(expected, bt.call(*pl, *pr));
+      CheckDoubleEq(expected, bt.call(*pl, *pr));
     }
   }
 }
@@ -3184,292 +4094,87 @@
     FOR_FLOAT64_INPUTS(j) {
       double expected = modulo(*i, *j);
       double found = bt.call(*i, *j);
-      CHECK_EQ(expected, found);
+      CheckDoubleEq(expected, found);
     }
   }
 }
 
 
 TEST(RunChangeInt32ToFloat64_A) {
-  RawMachineAssemblerTester<int32_t> m;
   int32_t magic = 0x986234;
-  double result = 0;
-
-  Node* convert = m.ChangeInt32ToFloat64(m.Int32Constant(magic));
-  m.Store(kMachFloat64, m.PointerConstant(&result), m.Int32Constant(0),
-          convert);
-  m.Return(m.Int32Constant(magic));
-
-  CHECK_EQ(magic, m.Call());
-  CHECK_EQ(static_cast<double>(magic), result);
+  BufferedRawMachineAssemblerTester<double> m;
+  m.Return(m.ChangeInt32ToFloat64(m.Int32Constant(magic)));
+  CheckDoubleEq(static_cast<double>(magic), m.Call());
 }
 
 
 TEST(RunChangeInt32ToFloat64_B) {
-  RawMachineAssemblerTester<int32_t> m(kMachInt32);
-  double output = 0;
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Int32());
+  m.Return(m.ChangeInt32ToFloat64(m.Parameter(0)));
 
-  Node* convert = m.ChangeInt32ToFloat64(m.Parameter(0));
-  m.Store(kMachFloat64, m.PointerConstant(&output), m.Int32Constant(0),
-          convert);
-  m.Return(m.Parameter(0));
-
-  FOR_INT32_INPUTS(i) {
-    int32_t expect = *i;
-    CHECK_EQ(expect, m.Call(expect));
-    CHECK_EQ(static_cast<double>(expect), output);
-  }
+  FOR_INT32_INPUTS(i) { CheckDoubleEq(static_cast<double>(*i), m.Call(*i)); }
 }
 
 
-TEST(RunChangeUint32ToFloat64_B) {
-  RawMachineAssemblerTester<int32_t> m(kMachUint32);
-  double output = 0;
+TEST(RunChangeUint32ToFloat64) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Uint32());
+  m.Return(m.ChangeUint32ToFloat64(m.Parameter(0)));
 
-  Node* convert = m.ChangeUint32ToFloat64(m.Parameter(0));
-  m.Store(kMachFloat64, m.PointerConstant(&output), m.Int32Constant(0),
-          convert);
-  m.Return(m.Parameter(0));
-
-  FOR_UINT32_INPUTS(i) {
-    uint32_t expect = *i;
-    CHECK_EQ(expect, m.Call(expect));
-    CHECK_EQ(static_cast<double>(expect), output);
-  }
-}
-
-
-TEST(RunChangeUint32ToFloat64_spilled) {
-  RawMachineAssemblerTester<int32_t> m;
-  const int kNumInputs = 32;
-  int32_t magic = 0x786234;
-  uint32_t input[kNumInputs];
-  double result[kNumInputs];
-  Node* input_node[kNumInputs];
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input_node[i] =
-        m.Load(kMachUint32, m.PointerConstant(&input), m.Int32Constant(i * 4));
-  }
-
-  for (int i = 0; i < kNumInputs; i++) {
-    m.Store(kMachFloat64, m.PointerConstant(&result), m.Int32Constant(i * 8),
-            m.ChangeUint32ToFloat64(input_node[i]));
-  }
-
-  m.Return(m.Int32Constant(magic));
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input[i] = 100 + i;
-  }
-
-  CHECK_EQ(magic, m.Call());
-
-  for (int i = 0; i < kNumInputs; i++) {
-    CHECK_EQ(result[i], static_cast<double>(100 + i));
-  }
+  FOR_UINT32_INPUTS(i) { CheckDoubleEq(static_cast<double>(*i), m.Call(*i)); }
 }
 
 
 TEST(RunChangeFloat64ToInt32_A) {
-  RawMachineAssemblerTester<int32_t> m;
-  int32_t magic = 0x786234;
-  double input = 11.1;
-  int32_t result = 0;
-
-  m.Store(kMachInt32, m.PointerConstant(&result), m.Int32Constant(0),
-          m.ChangeFloat64ToInt32(m.Float64Constant(input)));
-  m.Return(m.Int32Constant(magic));
-
-  CHECK_EQ(magic, m.Call());
-  CHECK_EQ(static_cast<int32_t>(input), result);
+  BufferedRawMachineAssemblerTester<int32_t> m;
+  double magic = 11.1;
+  m.Return(m.ChangeFloat64ToInt32(m.Float64Constant(magic)));
+  CHECK_EQ(static_cast<int32_t>(magic), m.Call());
 }
 
 
 TEST(RunChangeFloat64ToInt32_B) {
-  RawMachineAssemblerTester<int32_t> m;
-  double input = 0;
-  int32_t output = 0;
+  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Float64());
+  m.Return(m.ChangeFloat64ToInt32(m.Parameter(0)));
 
-  Node* load =
-      m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(0));
-  Node* convert = m.ChangeFloat64ToInt32(load);
-  m.Store(kMachInt32, m.PointerConstant(&output), m.Int32Constant(0), convert);
-  m.Return(convert);
+  // Note we don't check fractional inputs, or inputs outside the range of
+  // int32, because these Convert operators really should be Change operators.
+  FOR_INT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
+
+  for (int32_t n = 1; n < 31; ++n) {
+    CHECK_EQ(1 << n, m.Call(static_cast<double>(1 << n)));
+  }
+
+  for (int32_t n = 1; n < 31; ++n) {
+    CHECK_EQ(3 << n, m.Call(static_cast<double>(3 << n)));
+  }
+}
+
+
+TEST(RunChangeFloat64ToUint32) {
+  BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
+  m.Return(m.ChangeFloat64ToUint32(m.Parameter(0)));
 
   {
-    FOR_INT32_INPUTS(i) {
-      input = *i;
-      int32_t expect = *i;
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
+    FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
   }
 
   // Check various powers of 2.
   for (int32_t n = 1; n < 31; ++n) {
-    {
-      input = 1 << n;
-      int32_t expect = static_cast<int32_t>(input);
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
+    { CHECK_EQ(1u << n, m.Call(static_cast<double>(1u << n))); }
 
-    {
-      input = 3 << n;
-      int32_t expect = static_cast<int32_t>(input);
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
+    { CHECK_EQ(3u << n, m.Call(static_cast<double>(3u << n))); }
   }
   // Note we don't check fractional inputs, because these Convert operators
   // really should be Change operators.
 }
 
 
-TEST(RunChangeFloat64ToUint32_B) {
-  RawMachineAssemblerTester<int32_t> m;
-  double input = 0;
-  int32_t output = 0;
+TEST(RunTruncateFloat64ToFloat32) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float64());
 
-  Node* load =
-      m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(0));
-  Node* convert = m.ChangeFloat64ToUint32(load);
-  m.Store(kMachInt32, m.PointerConstant(&output), m.Int32Constant(0), convert);
-  m.Return(convert);
+  m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
 
-  {
-    FOR_UINT32_INPUTS(i) {
-      input = *i;
-      // TODO(titzer): add a CheckEqualsHelper overload for uint32_t.
-      int32_t expect = static_cast<int32_t>(*i);
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
-  }
-
-  // Check various powers of 2.
-  for (int32_t n = 1; n < 31; ++n) {
-    {
-      input = 1u << n;
-      int32_t expect = static_cast<int32_t>(static_cast<uint32_t>(input));
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
-
-    {
-      input = 3u << n;
-      int32_t expect = static_cast<int32_t>(static_cast<uint32_t>(input));
-      CHECK_EQ(expect, m.Call());
-      CHECK_EQ(expect, output);
-    }
-  }
-  // Note we don't check fractional inputs, because these Convert operators
-  // really should be Change operators.
-}
-
-
-TEST(RunChangeFloat64ToInt32_spilled) {
-  RawMachineAssemblerTester<int32_t> m;
-  const int kNumInputs = 32;
-  int32_t magic = 0x786234;
-  double input[kNumInputs];
-  int32_t result[kNumInputs];
-  Node* input_node[kNumInputs];
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input_node[i] =
-        m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
-  }
-
-  for (int i = 0; i < kNumInputs; i++) {
-    m.Store(kMachInt32, m.PointerConstant(&result), m.Int32Constant(i * 4),
-            m.ChangeFloat64ToInt32(input_node[i]));
-  }
-
-  m.Return(m.Int32Constant(magic));
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input[i] = 100.9 + i;
-  }
-
-  CHECK_EQ(magic, m.Call());
-
-  for (int i = 0; i < kNumInputs; i++) {
-    CHECK_EQ(result[i], 100 + i);
-  }
-}
-
-
-TEST(RunChangeFloat64ToUint32_spilled) {
-  RawMachineAssemblerTester<uint32_t> m;
-  const int kNumInputs = 32;
-  int32_t magic = 0x786234;
-  double input[kNumInputs];
-  uint32_t result[kNumInputs];
-  Node* input_node[kNumInputs];
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input_node[i] =
-        m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
-  }
-
-  for (int i = 0; i < kNumInputs; i++) {
-    m.Store(kMachUint32, m.PointerConstant(&result), m.Int32Constant(i * 4),
-            m.ChangeFloat64ToUint32(input_node[i]));
-  }
-
-  m.Return(m.Int32Constant(magic));
-
-  for (int i = 0; i < kNumInputs; i++) {
-    if (i % 2) {
-      input[i] = 100 + i + 2147483648u;
-    } else {
-      input[i] = 100 + i;
-    }
-  }
-
-  CHECK_EQ(magic, m.Call());
-
-  for (int i = 0; i < kNumInputs; i++) {
-    if (i % 2) {
-      CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i + 2147483648u));
-    } else {
-      CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i));
-    }
-  }
-}
-
-
-TEST(RunTruncateFloat64ToFloat32_spilled) {
-  RawMachineAssemblerTester<uint32_t> m;
-  const int kNumInputs = 32;
-  int32_t magic = 0x786234;
-  double input[kNumInputs];
-  float result[kNumInputs];
-  Node* input_node[kNumInputs];
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input_node[i] =
-        m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
-  }
-
-  for (int i = 0; i < kNumInputs; i++) {
-    m.Store(kMachFloat32, m.PointerConstant(&result), m.Int32Constant(i * 4),
-            m.TruncateFloat64ToFloat32(input_node[i]));
-  }
-
-  m.Return(m.Int32Constant(magic));
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input[i] = 0.1 + i;
-  }
-
-  CHECK_EQ(magic, m.Call());
-
-  for (int i = 0; i < kNumInputs; i++) {
-    CHECK_EQ(result[i], DoubleToFloat32(input[i]));
-  }
+  FOR_FLOAT64_INPUTS(i) { CheckFloatEq(DoubleToFloat32(*i), m.Call(*i)); }
 }
 
 
@@ -3497,11 +4202,11 @@
   int false_val = 0x10777;
 
   // x = false_val; while(false) { x++; } return x;
-  MLabel header, body, end;
+  RawMachineLabel header, body, end;
   Node* false_node = m.Int32Constant(false_val);
   m.Goto(&header);
   m.Bind(&header);
-  Node* phi = m.Phi(kMachInt32, false_node, false_node);
+  Node* phi = m.Phi(MachineRepresentation::kWord32, false_node, false_node);
   m.Branch(m.Int32Constant(0), &body, &end);
   m.Bind(&body);
   Node* add = m.Int32Add(phi, m.Int32Constant(1));
@@ -3514,6 +4219,32 @@
 }
 
 
+TEST(RunFloatDiamond) {
+  RawMachineAssemblerTester<int32_t> m;
+
+  const int magic = 99645;
+  float buffer = 0.1f;
+  float constant = 99.99f;
+
+  RawMachineLabel blocka, blockb, end;
+  Node* k1 = m.Float32Constant(constant);
+  Node* k2 = m.Float32Constant(0 - constant);
+  m.Branch(m.Int32Constant(0), &blocka, &blockb);
+  m.Bind(&blocka);
+  m.Goto(&end);
+  m.Bind(&blockb);
+  m.Goto(&end);
+  m.Bind(&end);
+  Node* phi = m.Phi(MachineRepresentation::kFloat32, k2, k1);
+  m.Store(MachineRepresentation::kFloat32, m.PointerConstant(&buffer),
+          m.IntPtrConstant(0), phi, kNoWriteBarrier);
+  m.Return(m.Int32Constant(magic));
+
+  CHECK_EQ(magic, m.Call());
+  CHECK(constant == buffer);
+}
+
+
 TEST(RunDoubleDiamond) {
   RawMachineAssemblerTester<int32_t> m;
 
@@ -3521,7 +4252,7 @@
   double buffer = 0.1;
   double constant = 99.99;
 
-  MLabel blocka, blockb, end;
+  RawMachineLabel blocka, blockb, end;
   Node* k1 = m.Float64Constant(constant);
   Node* k2 = m.Float64Constant(0 - constant);
   m.Branch(m.Int32Constant(0), &blocka, &blockb);
@@ -3530,8 +4261,9 @@
   m.Bind(&blockb);
   m.Goto(&end);
   m.Bind(&end);
-  Node* phi = m.Phi(kMachFloat64, k2, k1);
-  m.Store(kMachFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+  Node* phi = m.Phi(MachineRepresentation::kFloat64, k2, k1);
+  m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&buffer),
+          m.Int32Constant(0), phi, kNoWriteBarrier);
   m.Return(m.Int32Constant(magic));
 
   CHECK_EQ(magic, m.Call());
@@ -3547,7 +4279,7 @@
       CcTest::i_isolate()->factory()->InternalizeUtf8String("A");
   String* buffer;
 
-  MLabel blocka, blockb, end;
+  RawMachineLabel blocka, blockb, end;
   Node* k1 = m.StringConstant("A");
   Node* k2 = m.StringConstant("B");
   m.Branch(m.Int32Constant(0), &blocka, &blockb);
@@ -3556,8 +4288,9 @@
   m.Bind(&blockb);
   m.Goto(&end);
   m.Bind(&end);
-  Node* phi = m.Phi(kMachAnyTagged, k2, k1);
-  m.Store(kMachAnyTagged, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+  Node* phi = m.Phi(MachineRepresentation::kTagged, k2, k1);
+  m.Store(MachineRepresentation::kTagged, m.PointerConstant(&buffer),
+          m.Int32Constant(0), phi, kNoWriteBarrier);
   m.Return(m.Int32Constant(magic));
 
   CHECK_EQ(magic, m.Call());
@@ -3575,7 +4308,7 @@
       CcTest::i_isolate()->factory()->InternalizeUtf8String("AX");
   String* rbuffer;
 
-  MLabel blocka, blockb, end;
+  RawMachineLabel blocka, blockb, end;
   Node* d1 = m.Float64Constant(dconstant);
   Node* d2 = m.Float64Constant(0 - dconstant);
   Node* r1 = m.StringConstant("AX");
@@ -3586,11 +4319,12 @@
   m.Bind(&blockb);
   m.Goto(&end);
   m.Bind(&end);
-  Node* dphi = m.Phi(kMachFloat64, d2, d1);
-  Node* rphi = m.Phi(kMachAnyTagged, r2, r1);
-  m.Store(kMachFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi);
-  m.Store(kMachAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
-          rphi);
+  Node* dphi = m.Phi(MachineRepresentation::kFloat64, d2, d1);
+  Node* rphi = m.Phi(MachineRepresentation::kTagged, r2, r1);
+  m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
+          m.Int32Constant(0), dphi, kNoWriteBarrier);
+  m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+          m.Int32Constant(0), rphi, kNoWriteBarrier);
   m.Return(m.Int32Constant(magic));
 
   CHECK_EQ(magic, m.Call());
@@ -3609,7 +4343,7 @@
       CcTest::i_isolate()->factory()->InternalizeUtf8String("AD");
   String* rbuffer;
 
-  MLabel blocka, blockb, mid, blockd, blocke, end;
+  RawMachineLabel blocka, blockb, mid, blockd, blocke, end;
   Node* d1 = m.Float64Constant(dconstant);
   Node* d2 = m.Float64Constant(0 - dconstant);
   Node* r1 = m.StringConstant("AD");
@@ -3620,8 +4354,8 @@
   m.Bind(&blockb);
   m.Goto(&mid);
   m.Bind(&mid);
-  Node* dphi1 = m.Phi(kMachFloat64, d2, d1);
-  Node* rphi1 = m.Phi(kMachAnyTagged, r2, r1);
+  Node* dphi1 = m.Phi(MachineRepresentation::kFloat64, d2, d1);
+  Node* rphi1 = m.Phi(MachineRepresentation::kTagged, r2, r1);
   m.Branch(m.Int32Constant(0), &blockd, &blocke);
 
   m.Bind(&blockd);
@@ -3629,12 +4363,13 @@
   m.Bind(&blocke);
   m.Goto(&end);
   m.Bind(&end);
-  Node* dphi2 = m.Phi(kMachFloat64, d1, dphi1);
-  Node* rphi2 = m.Phi(kMachAnyTagged, r1, rphi1);
+  Node* dphi2 = m.Phi(MachineRepresentation::kFloat64, d1, dphi1);
+  Node* rphi2 = m.Phi(MachineRepresentation::kTagged, r1, rphi1);
 
-  m.Store(kMachFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi2);
-  m.Store(kMachAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
-          rphi2);
+  m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
+          m.Int32Constant(0), dphi2, kNoWriteBarrier);
+  m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+          m.Int32Constant(0), rphi2, kNoWriteBarrier);
   m.Return(m.Int32Constant(magic));
 
   CHECK_EQ(magic, m.Call());
@@ -3645,7 +4380,7 @@
 
 TEST(RunDoubleLoopPhi) {
   RawMachineAssemblerTester<int32_t> m;
-  MLabel header, body, end;
+  RawMachineLabel header, body, end;
 
   int magic = 99773;
   double buffer = 0.99;
@@ -3656,13 +4391,14 @@
 
   m.Goto(&header);
   m.Bind(&header);
-  Node* phi = m.Phi(kMachFloat64, dk, dk);
+  Node* phi = m.Phi(MachineRepresentation::kFloat64, dk, dk);
   phi->ReplaceInput(1, phi);
   m.Branch(zero, &body, &end);
   m.Bind(&body);
   m.Goto(&header);
   m.Bind(&end);
-  m.Store(kMachFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+  m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&buffer),
+          m.Int32Constant(0), phi, kNoWriteBarrier);
   m.Return(m.Int32Constant(magic));
 
   CHECK_EQ(magic, m.Call());
@@ -3676,13 +4412,13 @@
   Node* ten = m.Int32Constant(10);
   Node* one = m.Int32Constant(1);
 
-  MLabel header, body, body_cont, end;
+  RawMachineLabel header, body, body_cont, end;
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* i = m.Phi(kMachInt32, zero, zero);
-  Node* j = m.Phi(kMachInt32, zero, zero);
+  Node* i = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  Node* j = m.Phi(MachineRepresentation::kWord32, zero, zero);
   m.Goto(&body);
 
   m.Bind(&body);
@@ -3709,14 +4445,14 @@
   Node* ten = m.Int32Constant(10);
   Node* one = m.Int32Constant(1);
 
-  MLabel header, body, body_cont, end;
+  RawMachineLabel header, body, body_cont, end;
 
   m.Goto(&header);
 
   m.Bind(&header);
-  Node* i = m.Phi(kMachInt32, zero, zero);
-  Node* j = m.Phi(kMachInt32, zero, zero);
-  Node* k = m.Phi(kMachInt32, zero, zero);
+  Node* i = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  Node* j = m.Phi(MachineRepresentation::kWord32, zero, zero);
+  Node* k = m.Phi(MachineRepresentation::kWord32, zero, zero);
   m.Goto(&body);
 
   m.Bind(&body);
@@ -3743,14 +4479,22 @@
   int32_t inputs[] = {11, 12, 13, 14, 15, 16, 17, 18};
 
   Node* base = m.PointerConstant(inputs);
-  Node* n0 = m.Load(kMachInt32, base, m.Int32Constant(0 * sizeof(int32_t)));
-  Node* n1 = m.Load(kMachInt32, base, m.Int32Constant(1 * sizeof(int32_t)));
-  Node* n2 = m.Load(kMachInt32, base, m.Int32Constant(2 * sizeof(int32_t)));
-  Node* n3 = m.Load(kMachInt32, base, m.Int32Constant(3 * sizeof(int32_t)));
-  Node* n4 = m.Load(kMachInt32, base, m.Int32Constant(4 * sizeof(int32_t)));
-  Node* n5 = m.Load(kMachInt32, base, m.Int32Constant(5 * sizeof(int32_t)));
-  Node* n6 = m.Load(kMachInt32, base, m.Int32Constant(6 * sizeof(int32_t)));
-  Node* n7 = m.Load(kMachInt32, base, m.Int32Constant(7 * sizeof(int32_t)));
+  Node* n0 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(0 * sizeof(int32_t)));
+  Node* n1 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(1 * sizeof(int32_t)));
+  Node* n2 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(2 * sizeof(int32_t)));
+  Node* n3 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(3 * sizeof(int32_t)));
+  Node* n4 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(4 * sizeof(int32_t)));
+  Node* n5 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(5 * sizeof(int32_t)));
+  Node* n6 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(6 * sizeof(int32_t)));
+  Node* n7 =
+      m.Load(MachineType::Int32(), base, m.Int32Constant(7 * sizeof(int32_t)));
 
   Node* i1 = m.Int32Add(n0, n1);
   Node* i2 = m.Int32Add(n2, n3);
@@ -3782,10 +4526,12 @@
   CHECK(x < y);
   bool load_a = node_type / 2 == 1;
   bool load_b = node_type % 2 == 1;
-  Node* a = load_a ? m->Load(kMachFloat64, m->PointerConstant(&buffer[0]))
-                   : m->Float64Constant(x);
-  Node* b = load_b ? m->Load(kMachFloat64, m->PointerConstant(&buffer[1]))
-                   : m->Float64Constant(y);
+  Node* a =
+      load_a ? m->Load(MachineType::Float64(), m->PointerConstant(&buffer[0]))
+             : m->Float64Constant(x);
+  Node* b =
+      load_b ? m->Load(MachineType::Float64(), m->PointerConstant(&buffer[1]))
+             : m->Float64Constant(y);
   Node* cmp = NULL;
   bool expected = false;
   switch (test_case) {
@@ -3890,7 +4636,7 @@
                                  m.machine()->Float64LessThan(),
                                  m.machine()->Float64LessThanOrEqual()};
 
-  double nan = v8::base::OS::nan_value();
+  double nan = std::numeric_limits<double>::quiet_NaN();
 
   FOR_FLOAT64_INPUTS(i) {
     for (size_t o = 0; o < arraysize(operators); ++o) {
@@ -3899,7 +4645,7 @@
         Node* a = m.Float64Constant(*i);
         Node* b = m.Float64Constant(nan);
         if (j == 1) std::swap(a, b);
-        m.Return(m.NewNode(operators[o], a, b));
+        m.Return(m.AddNode(operators[o], a, b));
         CHECK_EQ(0, m.Call());
       }
     }
@@ -3912,8 +4658,8 @@
   double input_b = 0.0;
 
   RawMachineAssemblerTester<int32_t> m;
-  Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
-  Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
+  Node* a = m.LoadFromPointer(&input_a, MachineType::Float64());
+  Node* b = m.LoadFromPointer(&input_b, MachineType::Float64());
   m.Return(m.Float64Equal(a, b));
 
   CompareWrapper cmp(IrOpcode::kFloat64Equal);
@@ -3933,8 +4679,8 @@
   double input_b = 0.0;
 
   RawMachineAssemblerTester<int32_t> m;
-  Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
-  Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
+  Node* a = m.LoadFromPointer(&input_a, MachineType::Float64());
+  Node* b = m.LoadFromPointer(&input_b, MachineType::Float64());
   m.Return(m.Float64LessThan(a, b));
 
   CompareWrapper cmp(IrOpcode::kFloat64LessThan);
@@ -3949,14 +4695,14 @@
 }
 
 
-template <typename IntType, MachineType kRepresentation>
-static void LoadStoreTruncation() {
+template <typename IntType>
+static void LoadStoreTruncation(MachineType kRepresentation) {
   IntType input;
 
   RawMachineAssemblerTester<int32_t> m;
   Node* a = m.LoadFromPointer(&input, kRepresentation);
   Node* ap1 = m.Int32Add(a, m.Int32Constant(1));
-  m.StoreToPointer(&input, kRepresentation, ap1);
+  m.StoreToPointer(&input, kRepresentation.representation(), ap1);
   m.Return(ap1);
 
   const IntType max = std::numeric_limits<IntType>::max();
@@ -3983,14 +4729,15 @@
 
 
 TEST(RunLoadStoreTruncation) {
-  LoadStoreTruncation<int8_t, kMachInt8>();
-  LoadStoreTruncation<int16_t, kMachInt16>();
+  LoadStoreTruncation<int8_t>(MachineType::Int8());
+  LoadStoreTruncation<int16_t>(MachineType::Int16());
 }
 
 
 static void IntPtrCompare(intptr_t left, intptr_t right) {
   for (int test = 0; test < 7; test++) {
-    RawMachineAssemblerTester<bool> m(kMachPtr, kMachPtr);
+    RawMachineAssemblerTester<bool> m(MachineType::Pointer(),
+                                      MachineType::Pointer());
     Node* p0 = m.Parameter(0);
     Node* p1 = m.Parameter(1);
     Node* res = NULL;
@@ -4057,9 +4804,10 @@
   RawMachineAssemblerTester<int32_t*> m;
   Node* input = m.PointerConstant(&inputs[0]);
   Node* output = m.PointerConstant(&outputs[kInputSize - 1]);
-  Node* elem_size = m.ConvertInt32ToIntPtr(m.Int32Constant(sizeof(inputs[0])));
+  Node* elem_size = m.IntPtrConstant(sizeof(inputs[0]));
   for (int i = 0; i < kInputSize; i++) {
-    m.Store(kMachInt32, output, m.Load(kMachInt32, input));
+    m.Store(MachineRepresentation::kWord32, output,
+            m.Load(MachineType::Int32(), input), kNoWriteBarrier);
     input = m.IntPtrAdd(input, elem_size);
     output = m.IntPtrSub(output, elem_size);
   }
@@ -4074,7 +4822,7 @@
 
 TEST(RunSpillLotsOfThings) {
   static const int kInputSize = 1000;
-  RawMachineAssemblerTester<void> m;
+  RawMachineAssemblerTester<int32_t> m;
   Node* accs[kInputSize];
   int32_t outputs[kInputSize];
   Node* one = m.Int32Constant(1);
@@ -4084,7 +4832,7 @@
     accs[i] = acc;
   }
   for (int i = 0; i < kInputSize; i++) {
-    m.StoreToPointer(&outputs[i], kMachInt32, accs[i]);
+    m.StoreToPointer(&outputs[i], MachineRepresentation::kWord32, accs[i]);
   }
   m.Return(one);
   m.Call();
@@ -4097,7 +4845,8 @@
 TEST(RunSpillConstantsAndParameters) {
   static const int kInputSize = 1000;
   static const int32_t kBase = 987;
-  RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                       MachineType::Int32());
   int32_t outputs[kInputSize];
   Node* csts[kInputSize];
   Node* accs[kInputSize];
@@ -4110,7 +4859,7 @@
     accs[i] = acc;
   }
   for (int i = 0; i < kInputSize; i++) {
-    m.StoreToPointer(&outputs[i], kMachInt32, accs[i]);
+    m.StoreToPointer(&outputs[i], MachineRepresentation::kWord32, accs[i]);
   }
   m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1))));
   FOR_INT32_INPUTS(i) {
@@ -4131,7 +4880,7 @@
 
 
 TEST(RunNewSpaceConstantsInPhi) {
-  RawMachineAssemblerTester<Object*> m(kMachInt32);
+  RawMachineAssemblerTester<Object*> m(MachineType::Int32());
 
   Isolate* isolate = CcTest::i_isolate();
   Handle<HeapNumber> true_val = isolate->factory()->NewHeapNumber(11.2);
@@ -4139,7 +4888,7 @@
   Node* true_node = m.HeapConstant(true_val);
   Node* false_node = m.HeapConstant(false_val);
 
-  MLabel blocka, blockb, end;
+  RawMachineLabel blocka, blockb, end;
   m.Branch(m.Parameter(0), &blocka, &blockb);
   m.Bind(&blocka);
   m.Goto(&end);
@@ -4147,7 +4896,7 @@
   m.Goto(&end);
 
   m.Bind(&end);
-  Node* phi = m.Phi(kMachAnyTagged, true_node, false_node);
+  Node* phi = m.Phi(MachineRepresentation::kTagged, true_node, false_node);
   m.Return(phi);
 
   CHECK_EQ(*false_val, m.Call(0));
@@ -4162,7 +4911,7 @@
   Node* add = m.Int32AddWithOverflow(bt.param0, bt.param1);
   Node* val = m.Projection(0, add);
   Node* ovf = m.Projection(1, add);
-  m.StoreToPointer(&actual_val, kMachInt32, val);
+  m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
   bt.AddReturn(ovf);
   FOR_INT32_INPUTS(i) {
     FOR_INT32_INPUTS(j) {
@@ -4179,11 +4928,11 @@
   int32_t actual_val = -1, expected_val = 0;
   FOR_INT32_INPUTS(i) {
     {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       Node* add = m.Int32AddWithOverflow(m.Int32Constant(*i), m.Parameter(0));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       FOR_INT32_INPUTS(j) {
         int expected_ovf = bits::SignedAddOverflow32(*i, *j, &expected_val);
@@ -4192,11 +4941,11 @@
       }
     }
     {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(*i));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       FOR_INT32_INPUTS(j) {
         int expected_ovf = bits::SignedAddOverflow32(*i, *j, &expected_val);
@@ -4210,7 +4959,7 @@
           m.Int32AddWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       int expected_ovf = bits::SignedAddOverflow32(*i, *j, &expected_val);
       CHECK_EQ(expected_ovf, m.Call());
@@ -4222,7 +4971,7 @@
 
 TEST(RunInt32AddWithOverflowInBranchP) {
   int constant = 911777;
-  MLabel blocka, blockb;
+  RawMachineLabel blocka, blockb;
   RawMachineAssemblerTester<int32_t> m;
   Int32BinopTester bt(&m);
   Node* add = m.Int32AddWithOverflow(bt.param0, bt.param1);
@@ -4250,7 +4999,7 @@
   Node* add = m.Int32SubWithOverflow(bt.param0, bt.param1);
   Node* val = m.Projection(0, add);
   Node* ovf = m.Projection(1, add);
-  m.StoreToPointer(&actual_val, kMachInt32, val);
+  m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
   bt.AddReturn(ovf);
   FOR_INT32_INPUTS(i) {
     FOR_INT32_INPUTS(j) {
@@ -4267,11 +5016,11 @@
   int32_t actual_val = -1, expected_val = 0;
   FOR_INT32_INPUTS(i) {
     {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       Node* add = m.Int32SubWithOverflow(m.Int32Constant(*i), m.Parameter(0));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       FOR_INT32_INPUTS(j) {
         int expected_ovf = bits::SignedSubOverflow32(*i, *j, &expected_val);
@@ -4280,11 +5029,11 @@
       }
     }
     {
-      RawMachineAssemblerTester<int32_t> m(kMachInt32);
+      RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
       Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(*i));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       FOR_INT32_INPUTS(j) {
         int expected_ovf = bits::SignedSubOverflow32(*j, *i, &expected_val);
@@ -4298,7 +5047,7 @@
           m.Int32SubWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
       Node* val = m.Projection(0, add);
       Node* ovf = m.Projection(1, add);
-      m.StoreToPointer(&actual_val, kMachInt32, val);
+      m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
       m.Return(ovf);
       int expected_ovf = bits::SignedSubOverflow32(*i, *j, &expected_val);
       CHECK_EQ(expected_ovf, m.Call());
@@ -4310,7 +5059,7 @@
 
 TEST(RunInt32SubWithOverflowInBranchP) {
   int constant = 911999;
-  MLabel blocka, blockb;
+  RawMachineLabel blocka, blockb;
   RawMachineAssemblerTester<int32_t> m;
   Int32BinopTester bt(&m);
   Node* sub = m.Int32SubWithOverflow(bt.param0, bt.param1);
@@ -4331,11 +5080,32 @@
 }
 
 
+TEST(RunWord64EqualInBranchP) {
+  int64_t input;
+  RawMachineLabel blocka, blockb;
+  RawMachineAssemblerTester<int64_t> m;
+  if (!m.machine()->Is64()) return;
+  Node* value = m.LoadFromPointer(&input, MachineType::Int64());
+  m.Branch(m.Word64Equal(value, m.Int64Constant(0)), &blocka, &blockb);
+  m.Bind(&blocka);
+  m.Return(m.Int32Constant(1));
+  m.Bind(&blockb);
+  m.Return(m.Int32Constant(2));
+  input = V8_INT64_C(0);
+  CHECK_EQ(1, m.Call());
+  input = V8_INT64_C(1);
+  CHECK_EQ(2, m.Call());
+  input = V8_INT64_C(0x100000000);
+  CHECK_EQ(2, m.Call());
+}
+
+
 TEST(RunChangeInt32ToInt64P) {
   if (kPointerSize < 8) return;
   int64_t actual = -1;
-  RawMachineAssemblerTester<int32_t> m(kMachInt32);
-  m.StoreToPointer(&actual, kMachInt64, m.ChangeInt32ToInt64(m.Parameter(0)));
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+  m.StoreToPointer(&actual, MachineRepresentation::kWord64,
+                   m.ChangeInt32ToInt64(m.Parameter(0)));
   m.Return(m.Int32Constant(0));
   FOR_INT32_INPUTS(i) {
     int64_t expected = *i;
@@ -4348,8 +5118,8 @@
 TEST(RunChangeUint32ToUint64P) {
   if (kPointerSize < 8) return;
   int64_t actual = -1;
-  RawMachineAssemblerTester<int32_t> m(kMachUint32);
-  m.StoreToPointer(&actual, kMachUint64,
+  RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
+  m.StoreToPointer(&actual, MachineRepresentation::kWord64,
                    m.ChangeUint32ToUint64(m.Parameter(0)));
   m.Return(m.Int32Constant(0));
   FOR_UINT32_INPUTS(i) {
@@ -4364,11 +5134,12 @@
   if (kPointerSize < 8) return;
   int64_t expected = -1;
   RawMachineAssemblerTester<int32_t> m;
-  m.Return(m.TruncateInt64ToInt32(m.LoadFromPointer(&expected, kMachInt64)));
+  m.Return(m.TruncateInt64ToInt32(
+      m.LoadFromPointer(&expected, MachineType::Int64())));
   FOR_UINT32_INPUTS(i) {
     FOR_UINT32_INPUTS(j) {
       expected = (static_cast<uint64_t>(*j) << 32) | *i;
-      CHECK_UINT32_EQ(expected, m.Call());
+      CHECK_EQ(static_cast<int32_t>(expected), m.Call());
     }
   }
 }
@@ -4385,9 +5156,9 @@
                  {-1.5, -1},
                  {5.5, 5},
                  {-5.0, -5},
-                 {v8::base::OS::nan_value(), 0},
+                 {std::numeric_limits<double>::quiet_NaN(), 0},
                  {std::numeric_limits<double>::infinity(), 0},
-                 {-v8::base::OS::nan_value(), 0},
+                 {-std::numeric_limits<double>::quiet_NaN(), 0},
                  {-std::numeric_limits<double>::infinity(), 0},
                  {4.94065645841e-324, 0},
                  {-4.94065645841e-324, 0},
@@ -4435,7 +5206,9 @@
                  {-1.7976931348623157e+308, 0}};
   double input = -1.0;
   RawMachineAssemblerTester<int32_t> m;
-  m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64)));
+  m.Return(m.TruncateFloat64ToInt32(
+      TruncationMode::kJavaScript,
+      m.LoadFromPointer(&input, MachineType::Float64())));
   for (size_t i = 0; i < arraysize(kValues); ++i) {
     input = kValues[i].from;
     uint64_t expected = static_cast<int64_t>(kValues[i].raw);
@@ -4445,83 +5218,87 @@
 
 
 TEST(RunChangeFloat32ToFloat64) {
-  double actual = 0.0f;
-  float expected = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  m.StoreToPointer(
-      &actual, kMachFloat64,
-      m.ChangeFloat32ToFloat64(m.LoadFromPointer(&expected, kMachFloat32)));
-  m.Return(m.Int32Constant(0));
-  FOR_FLOAT32_INPUTS(i) {
-    expected = *i;
-    CHECK_EQ(0, m.Call());
-    CHECK_EQ(expected, actual);
-  }
-}
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float32());
 
+  m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0)));
 
-TEST(RunChangeFloat32ToFloat64_spilled) {
-  RawMachineAssemblerTester<int32_t> m;
-  const int kNumInputs = 32;
-  int32_t magic = 0x786234;
-  float input[kNumInputs];
-  double result[kNumInputs];
-  Node* input_node[kNumInputs];
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input_node[i] =
-        m.Load(kMachFloat32, m.PointerConstant(&input), m.Int32Constant(i * 4));
-  }
-
-  for (int i = 0; i < kNumInputs; i++) {
-    m.Store(kMachFloat64, m.PointerConstant(&result), m.Int32Constant(i * 8),
-            m.ChangeFloat32ToFloat64(input_node[i]));
-  }
-
-  m.Return(m.Int32Constant(magic));
-
-  for (int i = 0; i < kNumInputs; i++) {
-    input[i] = 100.9f + i;
-  }
-
-  CHECK_EQ(magic, m.Call());
-
-  for (int i = 0; i < kNumInputs; i++) {
-    CHECK_EQ(result[i], static_cast<double>(input[i]));
-  }
-}
-
-
-TEST(RunTruncateFloat64ToFloat32) {
-  float actual = 0.0f;
-  double input = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  m.StoreToPointer(
-      &actual, kMachFloat32,
-      m.TruncateFloat64ToFloat32(m.LoadFromPointer(&input, kMachFloat64)));
-  m.Return(m.Int32Constant(0));
-  FOR_FLOAT64_INPUTS(i) {
-    input = *i;
-    volatile double expected = DoubleToFloat32(input);
-    CHECK_EQ(0, m.Call());
-    CHECK_EQ(expected, actual);
-  }
+  FOR_FLOAT32_INPUTS(i) { CheckDoubleEq(static_cast<double>(*i), m.Call(*i)); }
 }
 
 
 TEST(RunFloat32Constant) {
   FOR_FLOAT32_INPUTS(i) {
-    float expected = *i;
-    float actual = *i;
-    RawMachineAssemblerTester<int32_t> m;
-    m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected));
-    m.Return(m.Int32Constant(0));
-    CHECK_EQ(0, m.Call());
-    CHECK_EQ(expected, actual);
+    BufferedRawMachineAssemblerTester<float> m;
+    m.Return(m.Float32Constant(*i));
+    CheckFloatEq(*i, m.Call());
   }
 }
 
 
+TEST(RunFloat64ExtractLowWord32) {
+  BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
+  m.Return(m.Float64ExtractLowWord32(m.Parameter(0)));
+  FOR_FLOAT64_INPUTS(i) {
+    uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i));
+    CHECK_EQ(expected, m.Call(*i));
+  }
+}
+
+
+TEST(RunFloat64ExtractHighWord32) {
+  BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
+  m.Return(m.Float64ExtractHighWord32(m.Parameter(0)));
+  FOR_FLOAT64_INPUTS(i) {
+    uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i) >> 32);
+    CHECK_EQ(expected, m.Call(*i));
+  }
+}
+
+
+TEST(RunFloat64InsertLowWord32) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Int32());
+  m.Return(m.Float64InsertLowWord32(m.Parameter(0), m.Parameter(1)));
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_INT32_INPUTS(j) {
+      double expected = bit_cast<double>(
+          (bit_cast<uint64_t>(*i) & ~(V8_UINT64_C(0xFFFFFFFF))) |
+          (static_cast<uint64_t>(bit_cast<uint32_t>(*j))));
+      CheckDoubleEq(expected, m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat64InsertHighWord32) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(),
+                                              MachineType::Uint32());
+  m.Return(m.Float64InsertHighWord32(m.Parameter(0), m.Parameter(1)));
+  FOR_FLOAT64_INPUTS(i) {
+    FOR_UINT32_INPUTS(j) {
+      uint64_t expected = (bit_cast<uint64_t>(*i) & 0xFFFFFFFF) |
+                          (static_cast<uint64_t>(*j) << 32);
+
+      CheckDoubleEq(bit_cast<double>(expected), m.Call(*i, *j));
+    }
+  }
+}
+
+
+TEST(RunFloat32Abs) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+  m.Return(m.Float32Abs(m.Parameter(0)));
+  FOR_FLOAT32_INPUTS(i) { CheckFloatEq(std::abs(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat64Abs) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  m.Return(m.Float64Abs(m.Parameter(0)));
+  FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::abs(*i), m.Call(*i)); }
+}
+
+
 static double two_30 = 1 << 30;             // 2^30 is a smi boundary.
 static double two_52 = two_30 * (1 << 22);  // 2^52 is a precision boundary.
 static double kValues[] = {0.1,
@@ -4620,72 +5397,677 @@
                            -two_52 + 1 - 0.7};
 
 
-TEST(RunFloat64Floor) {
-  double input = -1.0;
-  double result = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat64Floor()) return;
-  m.StoreToPointer(&result, kMachFloat64,
-                   m.Float64Floor(m.LoadFromPointer(&input, kMachFloat64)));
-  m.Return(m.Int32Constant(0));
+TEST(RunFloat32RoundDown) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+  if (!m.machine()->Float32RoundDown().IsSupported()) return;
+
+  m.Return(m.Float32RoundDown(m.Parameter(0)));
+
+  FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floorf(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat64RoundDown1) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundDown().IsSupported()) return;
+
+  m.Return(m.Float64RoundDown(m.Parameter(0)));
+
+  FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(floor(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat64RoundDown2) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundDown().IsSupported()) return;
+  m.Return(m.Float64Sub(m.Float64Constant(-0.0),
+                        m.Float64RoundDown(m.Float64Sub(m.Float64Constant(-0.0),
+                                                        m.Parameter(0)))));
+
   for (size_t i = 0; i < arraysize(kValues); ++i) {
-    input = kValues[i];
-    CHECK_EQ(0, m.Call());
-    double expected = std::floor(kValues[i]);
-    CHECK_EQ(expected, result);
+    CHECK_EQ(ceil(kValues[i]), m.Call(kValues[i]));
   }
 }
 
 
-TEST(RunFloat64Ceil) {
-  double input = -1.0;
-  double result = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat64Ceil()) return;
-  m.StoreToPointer(&result, kMachFloat64,
-                   m.Float64Ceil(m.LoadFromPointer(&input, kMachFloat64)));
-  m.Return(m.Int32Constant(0));
-  for (size_t i = 0; i < arraysize(kValues); ++i) {
-    input = kValues[i];
-    CHECK_EQ(0, m.Call());
-    double expected = std::ceil(kValues[i]);
-    CHECK_EQ(expected, result);
-  }
+TEST(RunFloat32RoundUp) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+  if (!m.machine()->Float32RoundUp().IsSupported()) return;
+  m.Return(m.Float32RoundUp(m.Parameter(0)));
+
+  FOR_FLOAT32_INPUTS(i) { CheckFloatEq(ceilf(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat64RoundUp) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundUp().IsSupported()) return;
+  m.Return(m.Float64RoundUp(m.Parameter(0)));
+
+  FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(ceil(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat32RoundTiesEven) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+  if (!m.machine()->Float32RoundTiesEven().IsSupported()) return;
+  m.Return(m.Float32RoundTiesEven(m.Parameter(0)));
+
+  FOR_FLOAT32_INPUTS(i) { CheckFloatEq(nearbyint(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat64RoundTiesEven) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundTiesEven().IsSupported()) return;
+  m.Return(m.Float64RoundTiesEven(m.Parameter(0)));
+
+  FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(nearbyint(*i), m.Call(*i)); }
+}
+
+
+TEST(RunFloat32RoundTruncate) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
+  if (!m.machine()->Float32RoundTruncate().IsSupported()) return;
+
+  m.Return(m.Float32RoundTruncate(m.Parameter(0)));
+
+  FOR_FLOAT32_INPUTS(i) { CheckFloatEq(truncf(*i), m.Call(*i)); }
 }
 
 
 TEST(RunFloat64RoundTruncate) {
-  double input = -1.0;
-  double result = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat64Ceil()) return;
-  m.StoreToPointer(
-      &result, kMachFloat64,
-      m.Float64RoundTruncate(m.LoadFromPointer(&input, kMachFloat64)));
-  m.Return(m.Int32Constant(0));
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundTruncate().IsSupported()) return;
+  m.Return(m.Float64RoundTruncate(m.Parameter(0)));
   for (size_t i = 0; i < arraysize(kValues); ++i) {
-    input = kValues[i];
-    CHECK_EQ(0, m.Call());
-    double expected = trunc(kValues[i]);
-    CHECK_EQ(expected, result);
+    CHECK_EQ(trunc(kValues[i]), m.Call(kValues[i]));
   }
 }
 
 
 TEST(RunFloat64RoundTiesAway) {
-  double input = -1.0;
-  double result = 0.0;
-  RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat64RoundTiesAway()) return;
-  m.StoreToPointer(
-      &result, kMachFloat64,
-      m.Float64RoundTiesAway(m.LoadFromPointer(&input, kMachFloat64)));
-  m.Return(m.Int32Constant(0));
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
+  if (!m.machine()->Float64RoundTiesAway().IsSupported()) return;
+  m.Return(m.Float64RoundTiesAway(m.Parameter(0)));
   for (size_t i = 0; i < arraysize(kValues); ++i) {
-    input = kValues[i];
-    CHECK_EQ(0, m.Call());
-    double expected = round(kValues[i]);
-    CHECK_EQ(expected, result);
+    CHECK_EQ(round(kValues[i]), m.Call(kValues[i]));
   }
 }
-#endif  // V8_TURBOFAN_TARGET
+
+
+#if !USE_SIMULATOR
+
+namespace {
+
+int32_t const kMagicFoo0 = 0xdeadbeef;
+
+
+int32_t foo0() { return kMagicFoo0; }
+
+
+int32_t foo1(int32_t x) { return x; }
+
+
+int32_t foo2(int32_t x, int32_t y) { return x - y; }
+
+
+int32_t foo8(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, int32_t f,
+             int32_t g, int32_t h) {
+  return a + b + c + d + e + f + g + h;
+}
+
+}  // namespace
+
+
+TEST(RunCallCFunction0) {
+  auto* foo0_ptr = &foo0;
+  RawMachineAssemblerTester<int32_t> m;
+  Node* function = m.LoadFromPointer(&foo0_ptr, MachineType::Pointer());
+  m.Return(m.CallCFunction0(MachineType::Int32(), function));
+  CHECK_EQ(kMagicFoo0, m.Call());
+}
+
+
+TEST(RunCallCFunction1) {
+  auto* foo1_ptr = &foo1;
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+  Node* function = m.LoadFromPointer(&foo1_ptr, MachineType::Pointer());
+  m.Return(m.CallCFunction1(MachineType::Int32(), MachineType::Int32(),
+                            function, m.Parameter(0)));
+  FOR_INT32_INPUTS(i) {
+    int32_t const expected = *i;
+    CHECK_EQ(expected, m.Call(expected));
+  }
+}
+
+
+TEST(RunCallCFunction2) {
+  auto* foo2_ptr = &foo2;
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+                                       MachineType::Int32());
+  Node* function = m.LoadFromPointer(&foo2_ptr, MachineType::Pointer());
+  m.Return(m.CallCFunction2(MachineType::Int32(), MachineType::Int32(),
+                            MachineType::Int32(), function, m.Parameter(0),
+                            m.Parameter(1)));
+  FOR_INT32_INPUTS(i) {
+    int32_t const x = *i;
+    FOR_INT32_INPUTS(j) {
+      int32_t const y = *j;
+      CHECK_EQ(x - y, m.Call(x, y));
+    }
+  }
+}
+
+
+TEST(RunCallCFunction8) {
+  auto* foo8_ptr = &foo8;
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+  Node* function = m.LoadFromPointer(&foo8_ptr, MachineType::Pointer());
+  Node* param = m.Parameter(0);
+  m.Return(m.CallCFunction8(
+      MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
+      MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
+      MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
+      function, param, param, param, param, param, param, param, param));
+  FOR_INT32_INPUTS(i) {
+    int32_t const x = *i;
+    CHECK_EQ(x * 8, m.Call(x));
+  }
+}
+#endif  // USE_SIMULATOR
+
+#if V8_TARGET_ARCH_64_BIT
+// TODO(titzer): run int64 tests on all platforms when supported.
+TEST(RunCheckedLoadInt64) {
+  int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL};
+  RawMachineAssemblerTester<int64_t> m(MachineType::Int32());
+  Node* base = m.PointerConstant(buffer);
+  Node* index = m.Parameter(0);
+  Node* length = m.Int32Constant(16);
+  Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base,
+                         index, length);
+  m.Return(load);
+
+  CHECK_EQ(buffer[0], m.Call(0));
+  CHECK_EQ(buffer[1], m.Call(8));
+  CHECK_EQ(0, m.Call(16));
+}
+
+
+TEST(RunCheckedStoreInt64) {
+  const int64_t write = 0x5566778899aabbLL;
+  const int64_t before = 0x33bbccddeeff0011LL;
+  int64_t buffer[] = {before, before};
+  RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
+  Node* base = m.PointerConstant(buffer);
+  Node* index = m.Parameter(0);
+  Node* length = m.Int32Constant(16);
+  Node* value = m.Int64Constant(write);
+  Node* store =
+      m.AddNode(m.machine()->CheckedStore(MachineRepresentation::kWord64), base,
+                index, length, value);
+  USE(store);
+  m.Return(m.Int32Constant(11));
+
+  CHECK_EQ(11, m.Call(16));
+  CHECK_EQ(before, buffer[0]);
+  CHECK_EQ(before, buffer[1]);
+
+  CHECK_EQ(11, m.Call(0));
+  CHECK_EQ(write, buffer[0]);
+  CHECK_EQ(before, buffer[1]);
+
+  CHECK_EQ(11, m.Call(8));
+  CHECK_EQ(write, buffer[0]);
+  CHECK_EQ(write, buffer[1]);
+}
+
+
+TEST(RunBitcastInt64ToFloat64) {
+  int64_t input = 1;
+  double output = 0.0;
+  RawMachineAssemblerTester<int32_t> m;
+  m.StoreToPointer(
+      &output, MachineRepresentation::kFloat64,
+      m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, MachineType::Int64())));
+  m.Return(m.Int32Constant(11));
+  FOR_INT64_INPUTS(i) {
+    input = *i;
+    CHECK_EQ(11, m.Call());
+    double expected = bit_cast<double>(input);
+    CHECK_EQ(bit_cast<int64_t>(expected), bit_cast<int64_t>(output));
+  }
+}
+
+
+TEST(RunBitcastFloat64ToInt64) {
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
+
+  m.Return(m.BitcastFloat64ToInt64(m.Parameter(0)));
+  FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); }
+}
+
+
+TEST(RunTryTruncateFloat32ToInt64WithoutCheck) {
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float32());
+  m.Return(m.TryTruncateFloat32ToInt64(m.Parameter(0)));
+
+  FOR_INT64_INPUTS(i) {
+    float input = static_cast<float>(*i);
+    if (input < static_cast<float>(INT64_MAX) &&
+        input >= static_cast<float>(INT64_MIN)) {
+      CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat32ToInt64WithCheck) {
+  int64_t success = 0;
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float32());
+  Node* trunc = m.TryTruncateFloat32ToInt64(m.Parameter(0));
+  Node* val = m.Projection(0, trunc);
+  Node* check = m.Projection(1, trunc);
+  m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
+  m.Return(val);
+
+  FOR_FLOAT32_INPUTS(i) {
+    if (*i < static_cast<float>(INT64_MAX) &&
+        *i >= static_cast<float>(INT64_MIN)) {
+      CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+      CHECK_NE(0, success);
+    } else {
+      m.Call(*i);
+      CHECK_EQ(0, success);
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
+  m.Return(m.TryTruncateFloat64ToInt64(m.Parameter(0)));
+
+  FOR_INT64_INPUTS(i) {
+    double input = static_cast<double>(*i);
+    CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
+  }
+}
+
+
+TEST(RunTryTruncateFloat64ToInt64WithCheck) {
+  int64_t success = 0;
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
+  Node* trunc = m.TryTruncateFloat64ToInt64(m.Parameter(0));
+  Node* val = m.Projection(0, trunc);
+  Node* check = m.Projection(1, trunc);
+  m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
+  m.Return(val);
+
+  FOR_FLOAT64_INPUTS(i) {
+    if (*i < static_cast<double>(INT64_MAX) &&
+        *i >= static_cast<double>(INT64_MIN)) {
+      // Conversions within this range should succeed.
+      CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+      CHECK_NE(0, success);
+    } else {
+      m.Call(*i);
+      CHECK_EQ(0, success);
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat32ToUint64WithoutCheck) {
+  BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float32());
+  m.Return(m.TryTruncateFloat32ToUint64(m.Parameter(0)));
+
+  FOR_UINT64_INPUTS(i) {
+    float input = static_cast<float>(*i);
+    // This condition on 'input' is required because
+    // static_cast<float>(UINT64_MAX) results in a value outside uint64 range.
+    if (input < static_cast<float>(UINT64_MAX)) {
+      CHECK_EQ(static_cast<uint64_t>(input), m.Call(input));
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat32ToUint64WithCheck) {
+  int64_t success = 0;
+  BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float32());
+  Node* trunc = m.TryTruncateFloat32ToUint64(m.Parameter(0));
+  Node* val = m.Projection(0, trunc);
+  Node* check = m.Projection(1, trunc);
+  m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
+  m.Return(val);
+
+  FOR_FLOAT32_INPUTS(i) {
+    if (*i < static_cast<float>(UINT64_MAX) && *i > -1.0) {
+      // Conversions within this range should succeed.
+      CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i));
+      CHECK_NE(0, success);
+    } else {
+      m.Call(*i);
+      CHECK_EQ(0, success);
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat64ToUint64WithoutCheck) {
+  BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float64());
+  m.Return(m.TruncateFloat64ToUint64(m.Parameter(0)));
+
+  FOR_UINT64_INPUTS(j) {
+    double input = static_cast<double>(*j);
+
+    if (input < static_cast<float>(UINT64_MAX)) {
+      CHECK_EQ(static_cast<uint64_t>(input), m.Call(input));
+    }
+  }
+}
+
+
+TEST(RunTryTruncateFloat64ToUint64WithCheck) {
+  int64_t success = 0;
+  BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
+  Node* trunc = m.TryTruncateFloat64ToUint64(m.Parameter(0));
+  Node* val = m.Projection(0, trunc);
+  Node* check = m.Projection(1, trunc);
+  m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
+  m.Return(val);
+
+  FOR_FLOAT64_INPUTS(i) {
+    if (*i < 18446744073709551616.0 && *i > -1) {
+      // Conversions within this range should succeed.
+      CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i));
+      CHECK_NE(0, success);
+    } else {
+      m.Call(*i);
+      CHECK_EQ(0, success);
+    }
+  }
+}
+
+
+TEST(RunRoundInt64ToFloat32) {
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Int64());
+  m.Return(m.RoundInt64ToFloat32(m.Parameter(0)));
+  FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); }
+}
+
+
+TEST(RunRoundInt64ToFloat64) {
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Int64());
+  m.Return(m.RoundInt64ToFloat64(m.Parameter(0)));
+  FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); }
+}
+
+
+TEST(RunRoundUint64ToFloat64) {
+  struct {
+    uint64_t input;
+    uint64_t expected;
+  } values[] = {{0x0, 0x0},
+                {0x1, 0x3ff0000000000000},
+                {0xffffffff, 0x41efffffffe00000},
+                {0x1b09788b, 0x41bb09788b000000},
+                {0x4c5fce8, 0x419317f3a0000000},
+                {0xcc0de5bf, 0x41e981bcb7e00000},
+                {0x2, 0x4000000000000000},
+                {0x3, 0x4008000000000000},
+                {0x4, 0x4010000000000000},
+                {0x5, 0x4014000000000000},
+                {0x8, 0x4020000000000000},
+                {0x9, 0x4022000000000000},
+                {0xffffffffffffffff, 0x43f0000000000000},
+                {0xfffffffffffffffe, 0x43f0000000000000},
+                {0xfffffffffffffffd, 0x43f0000000000000},
+                {0x100000000, 0x41f0000000000000},
+                {0xffffffff00000000, 0x43efffffffe00000},
+                {0x1b09788b00000000, 0x43bb09788b000000},
+                {0x4c5fce800000000, 0x439317f3a0000000},
+                {0xcc0de5bf00000000, 0x43e981bcb7e00000},
+                {0x200000000, 0x4200000000000000},
+                {0x300000000, 0x4208000000000000},
+                {0x400000000, 0x4210000000000000},
+                {0x500000000, 0x4214000000000000},
+                {0x800000000, 0x4220000000000000},
+                {0x900000000, 0x4222000000000000},
+                {0x273a798e187937a3, 0x43c39d3cc70c3c9c},
+                {0xece3af835495a16b, 0x43ed9c75f06a92b4},
+                {0xb668ecc11223344, 0x43a6cd1d98224467},
+                {0x9e, 0x4063c00000000000},
+                {0x43, 0x4050c00000000000},
+                {0xaf73, 0x40e5ee6000000000},
+                {0x116b, 0x40b16b0000000000},
+                {0x658ecc, 0x415963b300000000},
+                {0x2b3b4c, 0x41459da600000000},
+                {0x88776655, 0x41e10eeccaa00000},
+                {0x70000000, 0x41dc000000000000},
+                {0x7200000, 0x419c800000000000},
+                {0x7fffffff, 0x41dfffffffc00000},
+                {0x56123761, 0x41d5848dd8400000},
+                {0x7fffff00, 0x41dfffffc0000000},
+                {0x761c4761eeeeeeee, 0x43dd8711d87bbbbc},
+                {0x80000000eeeeeeee, 0x43e00000001dddde},
+                {0x88888888dddddddd, 0x43e11111111bbbbc},
+                {0xa0000000dddddddd, 0x43e40000001bbbbc},
+                {0xddddddddaaaaaaaa, 0x43ebbbbbbbb55555},
+                {0xe0000000aaaaaaaa, 0x43ec000000155555},
+                {0xeeeeeeeeeeeeeeee, 0x43edddddddddddde},
+                {0xfffffffdeeeeeeee, 0x43efffffffbdddde},
+                {0xf0000000dddddddd, 0x43ee0000001bbbbc},
+                {0x7fffffdddddddd, 0x435ffffff7777777},
+                {0x3fffffaaaaaaaa, 0x434fffffd5555555},
+                {0x1fffffaaaaaaaa, 0x433fffffaaaaaaaa},
+                {0xfffff, 0x412ffffe00000000},
+                {0x7ffff, 0x411ffffc00000000},
+                {0x3ffff, 0x410ffff800000000},
+                {0x1ffff, 0x40fffff000000000},
+                {0xffff, 0x40efffe000000000},
+                {0x7fff, 0x40dfffc000000000},
+                {0x3fff, 0x40cfff8000000000},
+                {0x1fff, 0x40bfff0000000000},
+                {0xfff, 0x40affe0000000000},
+                {0x7ff, 0x409ffc0000000000},
+                {0x3ff, 0x408ff80000000000},
+                {0x1ff, 0x407ff00000000000},
+                {0x3fffffffffff, 0x42cfffffffffff80},
+                {0x1fffffffffff, 0x42bfffffffffff00},
+                {0xfffffffffff, 0x42affffffffffe00},
+                {0x7ffffffffff, 0x429ffffffffffc00},
+                {0x3ffffffffff, 0x428ffffffffff800},
+                {0x1ffffffffff, 0x427ffffffffff000},
+                {0x8000008000000000, 0x43e0000010000000},
+                {0x8000008000000001, 0x43e0000010000000},
+                {0x8000000000000400, 0x43e0000000000000},
+                {0x8000000000000401, 0x43e0000000000001}};
+
+  BufferedRawMachineAssemblerTester<double> m(MachineType::Uint64());
+  m.Return(m.RoundUint64ToFloat64(m.Parameter(0)));
+
+  for (size_t i = 0; i < arraysize(values); i++) {
+    CHECK_EQ(bit_cast<double>(values[i].expected), m.Call(values[i].input));
+  }
+}
+
+
+TEST(RunRoundUint64ToFloat32) {
+  struct {
+    uint64_t input;
+    uint32_t expected;
+  } values[] = {{0x0, 0x0},
+                {0x1, 0x3f800000},
+                {0xffffffff, 0x4f800000},
+                {0x1b09788b, 0x4dd84bc4},
+                {0x4c5fce8, 0x4c98bf9d},
+                {0xcc0de5bf, 0x4f4c0de6},
+                {0x2, 0x40000000},
+                {0x3, 0x40400000},
+                {0x4, 0x40800000},
+                {0x5, 0x40a00000},
+                {0x8, 0x41000000},
+                {0x9, 0x41100000},
+                {0xffffffffffffffff, 0x5f800000},
+                {0xfffffffffffffffe, 0x5f800000},
+                {0xfffffffffffffffd, 0x5f800000},
+                {0x0, 0x0},
+                {0x100000000, 0x4f800000},
+                {0xffffffff00000000, 0x5f800000},
+                {0x1b09788b00000000, 0x5dd84bc4},
+                {0x4c5fce800000000, 0x5c98bf9d},
+                {0xcc0de5bf00000000, 0x5f4c0de6},
+                {0x200000000, 0x50000000},
+                {0x300000000, 0x50400000},
+                {0x400000000, 0x50800000},
+                {0x500000000, 0x50a00000},
+                {0x800000000, 0x51000000},
+                {0x900000000, 0x51100000},
+                {0x273a798e187937a3, 0x5e1ce9e6},
+                {0xece3af835495a16b, 0x5f6ce3b0},
+                {0xb668ecc11223344, 0x5d3668ed},
+                {0x9e, 0x431e0000},
+                {0x43, 0x42860000},
+                {0xaf73, 0x472f7300},
+                {0x116b, 0x458b5800},
+                {0x658ecc, 0x4acb1d98},
+                {0x2b3b4c, 0x4a2ced30},
+                {0x88776655, 0x4f087766},
+                {0x70000000, 0x4ee00000},
+                {0x7200000, 0x4ce40000},
+                {0x7fffffff, 0x4f000000},
+                {0x56123761, 0x4eac246f},
+                {0x7fffff00, 0x4efffffe},
+                {0x761c4761eeeeeeee, 0x5eec388f},
+                {0x80000000eeeeeeee, 0x5f000000},
+                {0x88888888dddddddd, 0x5f088889},
+                {0xa0000000dddddddd, 0x5f200000},
+                {0xddddddddaaaaaaaa, 0x5f5dddde},
+                {0xe0000000aaaaaaaa, 0x5f600000},
+                {0xeeeeeeeeeeeeeeee, 0x5f6eeeef},
+                {0xfffffffdeeeeeeee, 0x5f800000},
+                {0xf0000000dddddddd, 0x5f700000},
+                {0x7fffffdddddddd, 0x5b000000},
+                {0x3fffffaaaaaaaa, 0x5a7fffff},
+                {0x1fffffaaaaaaaa, 0x59fffffd},
+                {0xfffff, 0x497ffff0},
+                {0x7ffff, 0x48ffffe0},
+                {0x3ffff, 0x487fffc0},
+                {0x1ffff, 0x47ffff80},
+                {0xffff, 0x477fff00},
+                {0x7fff, 0x46fffe00},
+                {0x3fff, 0x467ffc00},
+                {0x1fff, 0x45fff800},
+                {0xfff, 0x457ff000},
+                {0x7ff, 0x44ffe000},
+                {0x3ff, 0x447fc000},
+                {0x1ff, 0x43ff8000},
+                {0x3fffffffffff, 0x56800000},
+                {0x1fffffffffff, 0x56000000},
+                {0xfffffffffff, 0x55800000},
+                {0x7ffffffffff, 0x55000000},
+                {0x3ffffffffff, 0x54800000},
+                {0x1ffffffffff, 0x54000000},
+                {0x8000008000000000, 0x5f000000},
+                {0x8000008000000001, 0x5f000001},
+                {0x8000000000000400, 0x5f000000},
+                {0x8000000000000401, 0x5f000000}};
+
+  BufferedRawMachineAssemblerTester<float> m(MachineType::Uint64());
+  m.Return(m.RoundUint64ToFloat32(m.Parameter(0)));
+
+  for (size_t i = 0; i < arraysize(values); i++) {
+    CHECK_EQ(bit_cast<float>(values[i].expected), m.Call(values[i].input));
+  }
+}
+
+
+#endif
+
+
+TEST(RunBitcastFloat32ToInt32) {
+  float input = 32.25;
+  RawMachineAssemblerTester<int32_t> m;
+  m.Return(m.BitcastFloat32ToInt32(
+      m.LoadFromPointer(&input, MachineType::Float32())));
+  FOR_FLOAT32_INPUTS(i) {
+    input = *i;
+    int32_t expected = bit_cast<int32_t>(input);
+    CHECK_EQ(expected, m.Call());
+  }
+}
+
+
+TEST(RunBitcastInt32ToFloat32) {
+  int32_t input = 1;
+  float output = 0.0;
+  RawMachineAssemblerTester<int32_t> m;
+  m.StoreToPointer(
+      &output, MachineRepresentation::kFloat32,
+      m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32())));
+  m.Return(m.Int32Constant(11));
+  FOR_INT32_INPUTS(i) {
+    input = *i;
+    CHECK_EQ(11, m.Call());
+    float expected = bit_cast<float>(input);
+    CHECK_EQ(bit_cast<int32_t>(expected), bit_cast<int32_t>(output));
+  }
+}
+
+
+TEST(RunComputedCodeObject) {
+  GraphBuilderTester<int32_t> a;
+  a.Return(a.Int32Constant(33));
+  a.End();
+  Handle<Code> code_a = a.GetCode();
+
+  GraphBuilderTester<int32_t> b;
+  b.Return(b.Int32Constant(44));
+  b.End();
+  Handle<Code> code_b = b.GetCode();
+
+  RawMachineAssemblerTester<int32_t> r(MachineType::Int32());
+  RawMachineLabel tlabel;
+  RawMachineLabel flabel;
+  RawMachineLabel merge;
+  r.Branch(r.Parameter(0), &tlabel, &flabel);
+  r.Bind(&tlabel);
+  Node* fa = r.HeapConstant(code_a);
+  r.Goto(&merge);
+  r.Bind(&flabel);
+  Node* fb = r.HeapConstant(code_b);
+  r.Goto(&merge);
+  r.Bind(&merge);
+  Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
+
+  // TODO(titzer): all this descriptor hackery is just to call the above
+  // functions as code objects instead of direct addresses.
+  CSignature0<int32_t> sig;
+  CallDescriptor* c = Linkage::GetSimplifiedCDescriptor(r.zone(), &sig);
+  LinkageLocation ret[] = {c->GetReturnLocation(0)};
+  Signature<LinkageLocation> loc(1, 0, ret);
+  CallDescriptor* desc = new (r.zone()) CallDescriptor(  // --
+      CallDescriptor::kCallCodeObject,                   // kind
+      MachineType::AnyTagged(),                          // target_type
+      c->GetInputLocation(0),                            // target_loc
+      &sig,                                              // machine_sig
+      &loc,                                              // location_sig
+      0,                                                 // stack count
+      Operator::kNoProperties,                           // properties
+      c->CalleeSavedRegisters(),                         // callee saved
+      c->CalleeSavedFPRegisters(),                       // callee saved FP
+      CallDescriptor::kNoFlags,                          // flags
+      "c-call-as-code");
+  Node* call = r.AddNode(r.common()->Call(desc), phi);
+  r.Return(call);
+
+  CHECK_EQ(33, r.Call(1));
+  CHECK_EQ(44, r.Call(0));
+}
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8