Reviewers: Sven Panne, Michael Starzinger, danno,
Message:
PTAL
Description:
Make RawMachineAssemblerTest always have a dummy End block
Frame Elider requires a sane CFG which should such dummy end block.
BUG=
Please review this at https://codereview.chromium.org/1166293004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+31, -50 lines):
M src/compiler/raw-machine-assembler.h
M src/compiler/raw-machine-assembler.cc
M test/cctest/compiler/test-run-machops.cc
Index: src/compiler/raw-machine-assembler.cc
diff --git a/src/compiler/raw-machine-assembler.cc
b/src/compiler/raw-machine-assembler.cc
index
6a339e7c918d0c60350c847e483209f7865daf53..996f2b95f4760a159f50d0b880bcbd40e1ea9bba
100644
--- a/src/compiler/raw-machine-assembler.cc
+++ b/src/compiler/raw-machine-assembler.cc
@@ -23,7 +23,6 @@ RawMachineAssembler::RawMachineAssembler(Isolate*
isolate, Graph* graph,
call_descriptor_(
Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)),
parameters_(NULL),
- exit_label_(schedule()->end()),
current_block_(schedule()->start()) {
int param_count = static_cast<int>(parameter_count());
Node* s = graph->NewNode(common_.Start(param_count));
@@ -54,12 +53,6 @@ Node* RawMachineAssembler::Parameter(size_t index) {
}
-RawMachineAssembler::Label* RawMachineAssembler::Exit() {
- exit_label_.used_ = true;
- return &exit_label_;
-}
-
-
void RawMachineAssembler::Goto(Label* label) {
DCHECK(current_block_ != schedule()->end());
schedule()->AddGoto(CurrentBlock(), Use(label));
Index: src/compiler/raw-machine-assembler.h
diff --git a/src/compiler/raw-machine-assembler.h
b/src/compiler/raw-machine-assembler.h
index
0cf4637ca0cbfad199732c00b99ed67249236872..d4aeab33c52efc927c64e862e2bfcd4f6f9d22c2
100644
--- a/src/compiler/raw-machine-assembler.h
+++ b/src/compiler/raw-machine-assembler.h
@@ -458,7 +458,6 @@ class RawMachineAssembler : public GraphBuilder {
}
// Control flow.
- Label* Exit();
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,
@@ -512,7 +511,6 @@ class RawMachineAssembler : public GraphBuilder {
const MachineSignature* machine_sig_;
CallDescriptor* call_descriptor_;
Node** parameters_;
- Label exit_label_;
BasicBlock* current_block_;
DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler);
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc
b/test/cctest/compiler/test-run-machops.cc
index
036c1fb5bca7af53b125ed564b2b032d02d9ab59..51e17e3e577f8d6bce80999fe61c306afc118d2f
100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -164,15 +164,14 @@ template <typename R>
static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node*
cond_node,
MachineType type, Node* true_node,
Node* false_node) {
- MLabel blocka, blockb;
- MLabel* end = m->Exit();
+ MLabel 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);
+ m->Bind(&end);
Node* phi = m->Phi(type, true_node, false_node);
m->Return(phi);
}
@@ -237,16 +236,15 @@ TEST(RunLoopPhiConst) {
Node* false_node = m.Int32Constant(false_val);
// x = false_val; while(false) { x = true_val; } return x;
- MLabel body, header;
- MLabel* end = m.Exit();
+ MLabel body, header, end;
m.Goto(&header);
m.Bind(&header);
Node* phi = m.Phi(kMachInt32, false_node, true_node);
- m.Branch(cond_node, &body, end);
+ 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());
@@ -256,20 +254,19 @@ TEST(RunLoopPhiConst) {
TEST(RunLoopPhiParam) {
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
- MLabel blocka, blockb;
- MLabel* end = m.Exit();
+ MLabel 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);
+ m.Branch(cond, &blockb, &end);
m.Bind(&blockb);
m.Goto(&blocka);
- m.Bind(end);
+ m.Bind(&end);
m.Return(phi);
int32_t c1 = 0xa81903b4;
@@ -287,22 +284,21 @@ TEST(RunLoopPhiInduction) {
int false_val = 0x10777;
// x = false_val; while(false) { x++; } return x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel 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);
+ 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());
@@ -314,21 +310,20 @@ TEST(RunLoopIncrement) {
Int32BinopTester bt(&m);
// x = 0; while(x ^ param) { x++; } return x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel 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);
+ 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));
@@ -342,21 +337,20 @@ TEST(RunLoopIncrement2) {
Int32BinopTester bt(&m);
// x = 0; while(x < param) { x++; } return x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel 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);
+ 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));
@@ -371,21 +365,20 @@ TEST(RunLoopIncrement3) {
Int32BinopTester bt(&m);
// x = 0; while(x < param) { x++; } return x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel 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);
+ 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));
@@ -400,20 +393,19 @@ TEST(RunLoopDecrement) {
Int32BinopTester bt(&m);
// x = param; while(x) { x--; } return x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel header, body, end;
m.Goto(&header);
m.Bind(&header);
Node* phi = m.Phi(kMachInt32, bt.param0, m.Int32Constant(0));
- m.Branch(phi, &body, end);
+ 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));
@@ -426,8 +418,7 @@ TEST(RunLoopIncrementFloat32) {
RawMachineAssemblerTester<int32_t> m;
// x = -3.0f; while(x < 10f) { x = x + 0.5f; } return (int) (double) x;
- MLabel header, body;
- MLabel* end = m.Exit();
+ MLabel header, body, end;
Node* minus_3 = m.Float32Constant(-3.0f);
Node* ten = m.Float32Constant(10.0f);
@@ -435,13 +426,13 @@ TEST(RunLoopIncrementFloat32) {
m.Bind(&header);
Node* phi = m.Phi(kMachFloat32, minus_3, ten);
- m.Branch(m.Float32LessThan(phi, ten), &body, end);
+ 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.Bind(&end);
m.Return(m.ChangeFloat64ToInt32(m.ChangeFloat32ToFloat64(phi)));
CHECK_EQ(10, m.Call());
@@ -452,8 +443,7 @@ 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();
+ MLabel header, body, end;
Node* minus_3 = m.Float64Constant(-3.0);
Node* ten = m.Float64Constant(10.0);
@@ -461,13 +451,13 @@ TEST(RunLoopIncrementFloat64) {
m.Bind(&header);
Node* phi = m.Phi(kMachFloat64, minus_3, ten);
- m.Branch(m.Float64LessThan(phi, ten), &body, end);
+ 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());
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.