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-branch-combine.cc b/test/cctest/compiler/test-branch-combine.cc
index cd3472d..c3b4308 100644
--- a/test/cctest/compiler/test-branch-combine.cc
+++ b/test/cctest/compiler/test-branch-combine.cc
@@ -2,18 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/v8.h"
-
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/value-helper.h"
-#if V8_TURBOFAN_TARGET
-
-using namespace v8::internal;
-using namespace v8::internal::compiler;
-
-typedef RawMachineAssembler::Label MLabel;
+namespace v8 {
+namespace internal {
+namespace compiler {
static IrOpcode::Value int32cmp_opcodes[] = {
IrOpcode::kWord32Equal, IrOpcode::kInt32LessThan,
@@ -23,12 +18,12 @@
TEST(BranchCombineWord32EqualZero_1) {
// Test combining a branch with x == 0
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t eq_constant = -1033;
int32_t ne_constant = 825118;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(p0, m.Int32Constant(0)), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -49,9 +44,9 @@
int32_t ne_constant = 815118;
for (int k = 0; k < 6; k++) {
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
Node* cond = p0;
for (int j = 0; j < k; j++) {
cond = m.Word32Equal(cond, m.Int32Constant(0));
@@ -74,12 +69,12 @@
TEST(BranchCombineInt32LessThanZero_1) {
// Test combining a branch with x < 0
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t eq_constant = -1433;
int32_t ne_constant = 845118;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Int32LessThan(p0, m.Int32Constant(0)), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -96,12 +91,12 @@
TEST(BranchCombineUint32LessThan100_1) {
// Test combining a branch with x < 100
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
int32_t eq_constant = 1471;
int32_t ne_constant = 88845718;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Uint32LessThan(p0, m.Int32Constant(100)), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -118,12 +113,12 @@
TEST(BranchCombineUint32LessThanOrEqual100_1) {
// Test combining a branch with x <= 100
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
int32_t eq_constant = 1479;
int32_t ne_constant = 77845719;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Uint32LessThanOrEqual(p0, m.Int32Constant(100)), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -140,12 +135,12 @@
TEST(BranchCombineZeroLessThanInt32_1) {
// Test combining a branch with 0 < x
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t eq_constant = -2033;
int32_t ne_constant = 225118;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Int32LessThan(m.Int32Constant(0), p0), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -162,12 +157,12 @@
TEST(BranchCombineInt32GreaterThanZero_1) {
// Test combining a branch with x > 0
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t eq_constant = -1073;
int32_t ne_constant = 825178;
Node* p0 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Int32GreaterThan(p0, m.Int32Constant(0)), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -184,13 +179,14 @@
TEST(BranchCombineWord32EqualP) {
// Test combining a branch with an Word32Equal.
- RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+ MachineType::Int32());
int32_t eq_constant = -1035;
int32_t ne_constant = 825018;
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(p0, p1), &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(eq_constant));
@@ -214,13 +210,13 @@
for (int left = 0; left < 2; left++) {
FOR_INT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
if (left == 1) m.Branch(m.Word32Equal(p0, p1), &blocka, &blockb);
if (left == 0) m.Branch(m.Word32Equal(p1, p0), &blocka, &blockb);
m.Bind(&blocka);
@@ -243,11 +239,12 @@
int32_t ne_constant = 725018;
for (int op = 0; op < 2; op++) {
- RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
+ MachineType::Int32());
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
if (op == 0) m.Branch(m.Int32LessThan(p0, p1), &blocka, &blockb);
if (op == 1) m.Branch(m.Int32LessThanOrEqual(p0, p1), &blocka, &blockb);
m.Bind(&blocka);
@@ -275,12 +272,12 @@
for (int op = 0; op < 2; op++) {
FOR_INT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
if (op == 0) m.Branch(m.Int32LessThan(p0, p1), &blocka, &blockb);
if (op == 1) m.Branch(m.Int32LessThanOrEqual(p0, p1), &blocka, &blockb);
m.Bind(&blocka);
@@ -336,7 +333,7 @@
: w(opcode), invert(i), true_first(t), eq_constant(eq), ne_constant(ne) {}
virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) {
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
Node* cond = w.MakeNode(m, a, b);
if (invert) cond = m->Word32Equal(cond, m->Int32Constant(0));
m->Branch(cond, &blocka, &blockb);
@@ -415,7 +412,7 @@
TEST(BranchCombineFloat64Compares) {
double inf = V8_INFINITY;
- double nan = v8::base::OS::nan_value();
+ double nan = std::numeric_limits<double>::quiet_NaN();
double inputs[] = {0.0, 1.0, -1.0, -inf, inf, nan};
int32_t eq_constant = -1733;
@@ -432,10 +429,10 @@
CompareWrapper cmp = cmps[c];
for (int invert = 0; invert < 2; invert++) {
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());
- MLabel blocka, blockb;
+ RawMachineLabel blocka, blockb;
Node* cond = cmp.MakeNode(&m, a, b);
if (invert) cond = m.Word32Equal(cond, m.Int32Constant(0));
m.Branch(cond, &blocka, &blockb);
@@ -444,10 +441,10 @@
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- for (size_t i = 0; i < arraysize(inputs); i++) {
- for (size_t j = 0; j < arraysize(inputs); j += 2) {
+ for (size_t i = 0; i < arraysize(inputs); ++i) {
+ for (size_t j = 0; j < arraysize(inputs); ++j) {
input_a = inputs[i];
- input_b = inputs[i];
+ input_b = inputs[j];
int32_t expected =
invert ? (cmp.Float64Compare(input_a, input_b) ? ne_constant
: eq_constant)
@@ -459,4 +456,7 @@
}
}
}
-#endif // V8_TURBOFAN_TARGET
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8