Commit d3ba9afe authored by vogelheim's avatar vogelheim Committed by Commit bot

Move RMA::Label out of the class, so it can be forward declared.

R=bmeurer@chromium.org, mstarzinger@chromium.org
BUG=chromium:508898
LOG=Y

Review URL: https://codereview.chromium.org/1477413002

Cr-Commit-Position: refs/heads/master@{#32400}
parent c11e7bc2
......@@ -548,7 +548,7 @@ void InterpreterAssembler::Jump(Node* delta) { DispatchTo(Advance(delta)); }
void InterpreterAssembler::JumpIfWordEqual(Node* lhs, Node* rhs, Node* delta) {
RawMachineAssembler::Label match, no_match;
RawMachineLabel match, no_match;
Node* condition = raw_assembler_->WordEqual(lhs, rhs);
raw_assembler_->Branch(condition, &match, &no_match);
raw_assembler_->Bind(&match);
......@@ -603,7 +603,7 @@ void InterpreterAssembler::Abort(BailoutReason bailout_reason) {
void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs,
BailoutReason bailout_reason) {
RawMachineAssembler::Label match, no_match;
RawMachineLabel match, no_match;
Node* condition = raw_assembler_->WordEqual(lhs, rhs);
raw_assembler_->Branch(condition, &match, &no_match);
raw_assembler_->Bind(&no_match);
......
......@@ -51,15 +51,15 @@ Node* RawMachineAssembler::Parameter(size_t index) {
}
void RawMachineAssembler::Goto(Label* label) {
void RawMachineAssembler::Goto(RawMachineLabel* label) {
DCHECK(current_block_ != schedule()->end());
schedule()->AddGoto(CurrentBlock(), Use(label));
current_block_ = nullptr;
}
void RawMachineAssembler::Branch(Node* condition, Label* true_val,
Label* false_val) {
void RawMachineAssembler::Branch(Node* condition, RawMachineLabel* true_val,
RawMachineLabel* false_val) {
DCHECK(current_block_ != schedule()->end());
Node* branch = AddNode(common()->Branch(), condition);
schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
......@@ -67,8 +67,9 @@ void RawMachineAssembler::Branch(Node* condition, Label* true_val,
}
void RawMachineAssembler::Switch(Node* index, Label* default_label,
int32_t* case_values, Label** case_labels,
void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label,
int32_t* case_values,
RawMachineLabel** case_labels,
size_t case_count) {
DCHECK_NE(schedule()->end(), current_block_);
size_t succ_count = case_count + 1;
......@@ -292,7 +293,7 @@ Node* RawMachineAssembler::CallCFunction8(
}
void RawMachineAssembler::Bind(Label* label) {
void RawMachineAssembler::Bind(RawMachineLabel* label) {
DCHECK(current_block_ == nullptr);
DCHECK(!label->bound_);
label->bound_ = true;
......@@ -300,13 +301,13 @@ void RawMachineAssembler::Bind(Label* label) {
}
BasicBlock* RawMachineAssembler::Use(Label* label) {
BasicBlock* RawMachineAssembler::Use(RawMachineLabel* label) {
label->used_ = true;
return EnsureBlock(label);
}
BasicBlock* RawMachineAssembler::EnsureBlock(Label* label) {
BasicBlock* RawMachineAssembler::EnsureBlock(RawMachineLabel* label) {
if (label->block_ == nullptr) label->block_ = schedule()->NewBasicBlock();
return label->block_;
}
......@@ -335,6 +336,13 @@ Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
return graph()->NewNodeUnchecked(op, input_count, inputs);
}
RawMachineLabel::RawMachineLabel()
: block_(NULL), used_(false), bound_(false) {}
RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); }
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -19,8 +19,10 @@ namespace internal {
namespace compiler {
class BasicBlock;
class RawMachineLabel;
class Schedule;
// The RawMachineAssembler produces a low-level IR graph. All nodes are wired
// into a graph and also placed into a schedule immediately, hence subsequent
// code generation can happen without the need for scheduling.
......@@ -34,19 +36,6 @@ class Schedule;
// non-schedulable due to missing control and effect dependencies.
class RawMachineAssembler {
public:
class Label {
public:
Label() : block_(NULL), used_(false), bound_(false) {}
~Label() { DCHECK(bound_ || !used_); }
private:
BasicBlock* block_;
bool used_;
bool bound_;
friend class RawMachineAssembler;
DISALLOW_COPY_AND_ASSIGN(Label);
};
RawMachineAssembler(Isolate* isolate, Graph* graph,
CallDescriptor* call_descriptor,
MachineType word = kMachPtr,
......@@ -587,14 +576,15 @@ class RawMachineAssembler {
// the current basic block or create new basic blocks for labels.
// Control flow.
void Goto(Label* label);
void Branch(Node* condition, Label* true_val, Label* false_val);
void Switch(Node* index, Label* default_label, int32_t* case_values,
Label** case_labels, size_t case_count);
void Goto(RawMachineLabel* label);
void Branch(Node* condition, RawMachineLabel* true_val,
RawMachineLabel* false_val);
void Switch(Node* index, RawMachineLabel* default_label, int32_t* case_values,
RawMachineLabel** case_labels, size_t case_count);
void Return(Node* value);
void Return(Node* v1, Node* v2);
void Return(Node* v1, Node* v2, Node* v3);
void Bind(Label* label);
void Bind(RawMachineLabel* label);
void Deoptimize(Node* state);
// Variables.
......@@ -627,8 +617,8 @@ class RawMachineAssembler {
private:
Node* MakeNode(const Operator* op, int input_count, Node** inputs);
BasicBlock* Use(Label* label);
BasicBlock* EnsureBlock(Label* label);
BasicBlock* Use(RawMachineLabel* label);
BasicBlock* EnsureBlock(RawMachineLabel* label);
BasicBlock* CurrentBlock();
Schedule* schedule() { return schedule_; }
......@@ -649,6 +639,20 @@ class RawMachineAssembler {
DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler);
};
class RawMachineLabel final {
public:
RawMachineLabel();
~RawMachineLabel();
private:
BasicBlock* block_;
bool used_;
bool bound_;
friend class RawMachineAssembler;
DISALLOW_COPY_AND_ASSIGN(RawMachineLabel);
};
} // namespace compiler
} // namespace internal
} // namespace v8
......
......@@ -13,8 +13,6 @@ namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
class BasicBlockProfilerTest : public RawMachineAssemblerTester<int32_t> {
public:
BasicBlockProfilerTest() : RawMachineAssemblerTester<int32_t>(kMachInt32) {
......@@ -41,7 +39,7 @@ class BasicBlockProfilerTest : public RawMachineAssemblerTester<int32_t> {
TEST(ProfileDiamond) {
BasicBlockProfilerTest m;
MLabel blocka, blockb, end;
RawMachineLabel blocka, blockb, end;
m.Branch(m.Parameter(0), &blocka, &blockb);
m.Bind(&blocka);
m.Goto(&end);
......@@ -81,7 +79,7 @@ TEST(ProfileDiamond) {
TEST(ProfileLoop) {
BasicBlockProfilerTest m;
MLabel header, body, end;
RawMachineLabel header, body, end;
Node* one = m.Int32Constant(1);
m.Goto(&header);
......
......@@ -13,8 +13,6 @@ namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
static IrOpcode::Value int32cmp_opcodes[] = {
IrOpcode::kWord32Equal, IrOpcode::kInt32LessThan,
IrOpcode::kInt32LessThanOrEqual, IrOpcode::kUint32LessThan,
......@@ -28,7 +26,7 @@ TEST(BranchCombineWord32EqualZero_1) {
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));
......@@ -51,7 +49,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
for (int k = 0; k < 6; k++) {
RawMachineAssemblerTester<int32_t> m(kMachInt32);
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));
......@@ -79,7 +77,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
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));
......@@ -101,7 +99,7 @@ TEST(BranchCombineUint32LessThan100_1) {
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));
......@@ -123,7 +121,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
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));
......@@ -145,7 +143,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
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));
......@@ -167,7 +165,7 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
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));
......@@ -190,7 +188,7 @@ TEST(BranchCombineWord32EqualP) {
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));
......@@ -220,7 +218,7 @@ TEST(BranchCombineWord32EqualI) {
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);
......@@ -247,7 +245,7 @@ TEST(BranchCombineInt32CmpP) {
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);
......@@ -280,7 +278,7 @@ TEST(BranchCombineInt32CmpI) {
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 +334,7 @@ class CmpBranchGen : public BinopGen<int32_t> {
: 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);
......@@ -435,7 +433,7 @@ TEST(BranchCombineFloat64Compares) {
Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
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);
......
This diff is collapsed.
......@@ -21,8 +21,6 @@ namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
#if V8_TARGET_ARCH_ARM64
// TODO(titzer): fix native stack parameters on arm64
#define DISABLE_NATIVE_STACK_PARAMS true
......
......@@ -12,7 +12,6 @@ namespace compiler {
namespace {
typedef RawMachineAssembler::Label MLabel;
typedef Node* (RawMachineAssembler::*Constructor)(Node*, Node*);
......@@ -247,7 +246,7 @@ TEST_P(InstructionSelectorDPITest, ShiftByImmediate) {
TEST_P(InstructionSelectorDPITest, BranchWithParameters) {
const DPI dpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -266,7 +265,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithImmediate) {
const DPI dpi = GetParam();
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)), &a,
&b);
m.Bind(&a);
......@@ -282,7 +281,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithImmediate) {
}
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Int32Constant(imm), m.Parameter(0)), &a,
&b);
m.Bind(&a);
......@@ -303,7 +302,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithShiftByParameter) {
const DPI dpi = GetParam();
TRACED_FOREACH(Shift, shift, kShifts) {
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(
m.Parameter(0),
(m.*shift.constructor)(m.Parameter(1), m.Parameter(2))),
......@@ -321,7 +320,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithShiftByParameter) {
}
TRACED_FOREACH(Shift, shift, kShifts) {
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(
(m.*shift.constructor)(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)),
......@@ -345,7 +344,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithShiftByImmediate) {
TRACED_FOREACH(Shift, shift, kShifts) {
TRACED_FORRANGE(int32_t, imm, shift.i_low, shift.i_high) {
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Parameter(0),
(m.*shift.constructor)(
m.Parameter(1), m.Int32Constant(imm))),
......@@ -367,7 +366,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithShiftByImmediate) {
TRACED_FOREACH(Shift, shift, kShifts) {
TRACED_FORRANGE(int32_t, imm, shift.i_low, shift.i_high) {
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(
(m.*shift.constructor)(m.Parameter(0), m.Int32Constant(imm)),
m.Parameter(1)),
......@@ -392,7 +391,7 @@ TEST_P(InstructionSelectorDPITest, BranchWithShiftByImmediate) {
TEST_P(InstructionSelectorDPITest, BranchIfZeroWithParameters) {
const DPI dpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32Equal((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)),
m.Int32Constant(0)),
&a, &b);
......@@ -412,7 +411,7 @@ TEST_P(InstructionSelectorDPITest, BranchIfZeroWithParameters) {
TEST_P(InstructionSelectorDPITest, BranchIfNotZeroWithParameters) {
const DPI dpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(
m.Word32NotEqual((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)),
m.Int32Constant(0)),
......@@ -434,7 +433,7 @@ TEST_P(InstructionSelectorDPITest, BranchIfZeroWithImmediate) {
const DPI dpi = GetParam();
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32Equal(
(m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)),
m.Int32Constant(0)),
......@@ -452,7 +451,7 @@ TEST_P(InstructionSelectorDPITest, BranchIfZeroWithImmediate) {
}
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32Equal(
(m.*dpi.constructor)(m.Int32Constant(imm), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -475,7 +474,7 @@ TEST_P(InstructionSelectorDPITest, BranchIfNotZeroWithImmediate) {
const DPI dpi = GetParam();
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32NotEqual(
(m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)),
m.Int32Constant(0)),
......@@ -493,7 +492,7 @@ TEST_P(InstructionSelectorDPITest, BranchIfNotZeroWithImmediate) {
}
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32NotEqual(
(m.*dpi.constructor)(m.Int32Constant(imm), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -892,7 +891,7 @@ TEST_P(InstructionSelectorODPITest, BothWithShiftByImmediate) {
TEST_P(InstructionSelectorODPITest, BranchWithParameters) {
const ODPI odpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*odpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......@@ -914,7 +913,7 @@ TEST_P(InstructionSelectorODPITest, BranchWithImmediate) {
const ODPI odpi = GetParam();
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*odpi.constructor)(m.Parameter(0), m.Int32Constant(imm));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......@@ -933,7 +932,7 @@ TEST_P(InstructionSelectorODPITest, BranchWithImmediate) {
}
TRACED_FOREACH(int32_t, imm, kImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*odpi.constructor)(m.Int32Constant(imm), m.Parameter(0));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......@@ -956,7 +955,7 @@ TEST_P(InstructionSelectorODPITest, BranchWithImmediate) {
TEST_P(InstructionSelectorODPITest, BranchIfZeroWithParameters) {
const ODPI odpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*odpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Branch(m.Word32Equal(m.Projection(1, n), m.Int32Constant(0)), &a, &b);
m.Bind(&a);
......@@ -977,7 +976,7 @@ TEST_P(InstructionSelectorODPITest, BranchIfZeroWithParameters) {
TEST_P(InstructionSelectorODPITest, BranchIfNotZeroWithParameters) {
const ODPI odpi = GetParam();
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*odpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Branch(m.Word32NotEqual(m.Projection(1, n), m.Int32Constant(0)), &a, &b);
m.Bind(&a);
......
......@@ -10,8 +10,6 @@ namespace compiler {
namespace {
typedef RawMachineAssembler::Label MLabel;
template <typename T>
struct MachInst {
T constructor;
......@@ -877,7 +875,7 @@ TEST_P(InstructionSelectorDPFlagSetTest, BranchWithParameters) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
MLabel a, b;
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -902,7 +900,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnRight) {
if (base::bits::CountPopulation32(imm) == 1) continue;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -925,7 +923,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnRight) {
if (base::bits::CountPopulation64(imm) == 1) continue;
StreamBuilder m(this, kMachInt64, kMachInt64);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -945,7 +943,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnRight) {
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Int32Add(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -963,7 +961,7 @@ TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnRight) {
TEST_F(InstructionSelectorTest, SubBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -984,7 +982,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnLeft) {
if (base::bits::CountPopulation32(imm) == 1) continue;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Int32Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1008,7 +1006,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnLeft) {
if (base::bits::CountPopulation64(imm) == 1) continue;
StreamBuilder m(this, kMachInt64, kMachInt64);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Int64Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1029,7 +1027,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnLeft) {
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1049,7 +1047,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(mask)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1067,7 +1065,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(
m.Word32BinaryNot(m.Word32And(m.Parameter(0), m.Int32Constant(mask))),
&a, &b);
......@@ -1090,7 +1088,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Int32Constant(mask), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1108,7 +1106,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(
m.Word32BinaryNot(m.Word32And(m.Int32Constant(mask), m.Parameter(0))),
&a, &b);
......@@ -1131,7 +1129,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1L << bit;
StreamBuilder m(this, kMachInt64, kMachInt64);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1152,7 +1150,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) {
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1L << bit;
StreamBuilder m(this, kMachInt64, kMachInt64);
MLabel a, b;
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
......@@ -1172,7 +1170,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) {
TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) {
{
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(p0, &a, &b);
m.Bind(&a);
......@@ -1189,7 +1187,7 @@ TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) {
{
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word32BinaryNot(p0), &a, &b);
m.Bind(&a);
......@@ -1321,7 +1319,7 @@ TEST_P(InstructionSelectorOvfAddSubTest, BranchWithParameters) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......@@ -1343,7 +1341,7 @@ TEST_P(InstructionSelectorOvfAddSubTest, BranchWithImmediateOnRight) {
const MachineType type = dpi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
MLabel a, b;
RawMachineLabel a, b;
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......@@ -1422,7 +1420,7 @@ TEST_F(InstructionSelectorTest, OvfBothAddImmediateOnLeft) {
TEST_F(InstructionSelectorTest, OvfBranchWithImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, kMachInt32, kMachInt32);
MLabel a, b;
RawMachineLabel a, b;
Node* n = m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
......
......@@ -14,12 +14,6 @@ namespace v8 {
namespace internal {
namespace compiler {
namespace {
typedef RawMachineAssembler::Label MLabel;
} // namespace
InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {}
......@@ -283,7 +277,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Doubleness) {
StreamBuilder m(this, type, type, type);
Node* param0 = m.Parameter(0);
Node* param1 = m.Parameter(1);
MLabel a, b, c;
RawMachineLabel a, b, c;
m.Branch(m.Int32Constant(0), &a, &b);
m.Bind(&a);
m.Goto(&c);
......@@ -303,7 +297,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
StreamBuilder m(this, type, type, type);
Node* param0 = m.Parameter(0);
Node* param1 = m.Parameter(1);
MLabel a, b, c;
RawMachineLabel a, b, c;
m.Branch(m.Int32Constant(1), &a, &b);
m.Bind(&a);
m.Goto(&c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment