Skip to content

Commit c602a91

Browse files
mi-acCommit bot
authored andcommitted
Revert of [turbofan] Checking of input counts on node creation (patchset v8#4 id:60001 of https://codereview.chromium.org/1347353003/ )
Reason for revert: [Sheriff] Breaks mips cross-compile: http://build.chromium.org/p/client.v8/builders/V8%20Mips%20-%20builder/builds/4315 Original issue's description: > [turbofan] Checking of input counts on node creation > > This required fixing bunch of tests with wrong input counts. > > Committed: https://crrev.com/260ec46efd74c45cdc4b156d95086b7de06621ad > Cr-Commit-Position: refs/heads/master@{#30877} TBR=bmeurer@chromium.org,mstarzinger@chromium.org,jarin@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1362783004 Cr-Commit-Position: refs/heads/master@{#30878}
1 parent 260ec46 commit c602a91

25 files changed

Lines changed: 458 additions & 456 deletions

src/compiler/basic-block-instrumentor.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
8181
// Construct increment operation.
8282
Node* base = graph->NewNode(
8383
PointerConstant(&common, data->GetCounterAddress(block_number)));
84-
Node* load = graph->NewNode(machine.Load(kMachUint32), base, zero,
85-
graph->start(), graph->start());
84+
Node* load = graph->NewNode(machine.Load(kMachUint32), base, zero);
8685
Node* inc = graph->NewNode(machine.Int32Add(), load, one);
8786
Node* store = graph->NewNode(
8887
machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base,
89-
zero, inc, graph->start(), graph->start());
88+
zero, inc);
9089
// Insert the new nodes.
9190
static const int kArraySize = 6;
9291
Node* to_insert[kArraySize] = {zero, one, base, load, inc, store};

src/compiler/graph.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "src/base/bits.h"
1010
#include "src/compiler/node.h"
11-
#include "src/compiler/operator-properties.h"
1211

1312
namespace v8 {
1413
namespace internal {
@@ -44,13 +43,7 @@ void Graph::RemoveDecorator(GraphDecorator* decorator) {
4443

4544
Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
4645
bool incomplete) {
47-
DCHECK_EQ(OperatorProperties::GetTotalInputCount(op), input_count);
48-
return NewNodeUnchecked(op, input_count, inputs, incomplete);
49-
}
50-
51-
52-
Node* Graph::NewNodeUnchecked(const Operator* op, int input_count,
53-
Node** inputs, bool incomplete) {
46+
DCHECK_LE(op->ValueInputCount(), input_count);
5447
Node* const node =
5548
Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
5649
Decorate(node);

src/compiler/graph.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class Graph : public ZoneObject {
3434
explicit Graph(Zone* zone);
3535

3636
// Base implementation used by all factory methods.
37-
Node* NewNodeUnchecked(const Operator* op, int input_count, Node** inputs,
38-
bool incomplete = false);
39-
40-
// Factory that checks the input count.
4137
Node* NewNode(const Operator* op, int input_count, Node** inputs,
4238
bool incomplete = false);
4339

src/compiler/raw-machine-assembler.cc

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph,
3232
parameters_ = zone()->NewArray<Node*>(param_count);
3333
for (size_t i = 0; i < parameter_count(); ++i) {
3434
parameters_[i] =
35-
AddNode(common()->Parameter(static_cast<int>(i)), graph->start());
35+
NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
3636
}
3737
}
3838

@@ -64,7 +64,7 @@ void RawMachineAssembler::Goto(Label* label) {
6464
void RawMachineAssembler::Branch(Node* condition, Label* true_val,
6565
Label* false_val) {
6666
DCHECK(current_block_ != schedule()->end());
67-
Node* branch = AddNode(common()->Branch(), condition);
67+
Node* branch = NewNode(common()->Branch(), condition);
6868
schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
6969
current_block_ = nullptr;
7070
}
@@ -75,7 +75,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
7575
size_t case_count) {
7676
DCHECK_NE(schedule()->end(), current_block_);
7777
size_t succ_count = case_count + 1;
78-
Node* switch_node = AddNode(common()->Switch(succ_count), index);
78+
Node* switch_node = NewNode(common()->Switch(succ_count), index);
7979
BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count);
8080
for (size_t index = 0; index < case_count; ++index) {
8181
int32_t case_value = case_values[index];
@@ -95,7 +95,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
9595

9696

9797
void RawMachineAssembler::Return(Node* value) {
98-
Node* ret = MakeNode(common()->Return(), 1, &value);
98+
Node* ret = graph()->NewNode(common()->Return(), value);
9999
schedule()->AddReturn(CurrentBlock(), ret);
100100
current_block_ = nullptr;
101101
}
@@ -114,7 +114,9 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
114114
}
115115
buffer[index++] = graph()->start();
116116
buffer[index++] = graph()->start();
117-
return AddNode(common()->Call(desc), input_count, buffer);
117+
Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
118+
schedule()->AddNode(CurrentBlock(), call);
119+
return call;
118120
}
119121

120122

@@ -134,7 +136,9 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
134136
buffer[index++] = frame_state;
135137
buffer[index++] = graph()->start();
136138
buffer[index++] = graph()->start();
137-
return AddNode(common()->Call(desc), input_count, buffer);
139+
Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
140+
schedule()->AddNode(CurrentBlock(), call);
141+
return call;
138142
}
139143

140144

@@ -151,7 +155,8 @@ Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
151155
}
152156
buffer[index++] = graph()->start();
153157
buffer[index++] = graph()->start();
154-
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
158+
Node* tail_call =
159+
graph()->NewNode(common()->TailCall(desc), input_count, buffer);
155160
schedule()->AddTailCall(CurrentBlock(), tail_call);
156161
return tail_call;
157162
}
@@ -165,8 +170,11 @@ Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
165170
isolate(), zone(), callable.descriptor(), 1,
166171
CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
167172
Node* stub_code = HeapConstant(callable.code());
168-
return AddNode(common()->Call(desc), stub_code, function, receiver, context,
169-
frame_state, graph()->start(), graph()->start());
173+
Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
174+
receiver, context, frame_state,
175+
graph()->start(), graph()->start());
176+
schedule()->AddNode(CurrentBlock(), call);
177+
return call;
170178
}
171179

172180

@@ -176,12 +184,15 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
176184
zone(), function, 1, Operator::kNoProperties, false);
177185

178186
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
179-
Node* ref = AddNode(
187+
Node* ref = NewNode(
180188
common()->ExternalConstant(ExternalReference(function, isolate())));
181189
Node* arity = Int32Constant(1);
182190

183-
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context,
184-
graph()->start(), graph()->start());
191+
Node* call =
192+
graph()->NewNode(common()->Call(descriptor), centry, arg1, ref, arity,
193+
context, graph()->start(), graph()->start());
194+
schedule()->AddNode(CurrentBlock(), call);
195+
return call;
185196
}
186197

187198

@@ -191,12 +202,15 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
191202
zone(), function, 2, Operator::kNoProperties, false);
192203

193204
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
194-
Node* ref = AddNode(
205+
Node* ref = NewNode(
195206
common()->ExternalConstant(ExternalReference(function, isolate())));
196207
Node* arity = Int32Constant(2);
197208

198-
return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity,
199-
context, graph()->start(), graph()->start());
209+
Node* call =
210+
graph()->NewNode(common()->Call(descriptor), centry, arg1, arg2, ref,
211+
arity, context, graph()->start(), graph()->start());
212+
schedule()->AddNode(CurrentBlock(), call);
213+
return call;
200214
}
201215

202216

@@ -207,8 +221,10 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
207221
const CallDescriptor* descriptor =
208222
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
209223

210-
return AddNode(common()->Call(descriptor), function, graph()->start(),
211-
graph()->start());
224+
Node* call = graph()->NewNode(common()->Call(descriptor), function,
225+
graph()->start(), graph()->start());
226+
schedule()->AddNode(CurrentBlock(), call);
227+
return call;
212228
}
213229

214230

@@ -221,8 +237,10 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
221237
const CallDescriptor* descriptor =
222238
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
223239

224-
return AddNode(common()->Call(descriptor), function, arg0, graph()->start(),
225-
graph()->start());
240+
Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
241+
graph()->start(), graph()->start());
242+
schedule()->AddNode(CurrentBlock(), call);
243+
return call;
226244
}
227245

228246

@@ -237,8 +255,10 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
237255
const CallDescriptor* descriptor =
238256
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
239257

240-
return AddNode(common()->Call(descriptor), function, arg0, arg1,
241-
graph()->start(), graph()->start());
258+
Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
259+
arg1, graph()->start(), graph()->start());
260+
schedule()->AddNode(CurrentBlock(), call);
261+
return call;
242262
}
243263

244264

@@ -271,7 +291,10 @@ Node* RawMachineAssembler::CallCFunction8(
271291
graph()->start()};
272292
const CallDescriptor* descriptor =
273293
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
274-
return AddNode(common()->Call(descriptor), arraysize(args), args);
294+
Node* call =
295+
graph()->NewNode(common()->Call(descriptor), arraysize(args), args);
296+
schedule()->AddNode(CurrentBlock(), call);
297+
return call;
275298
}
276299

277300

@@ -301,23 +324,15 @@ BasicBlock* RawMachineAssembler::CurrentBlock() {
301324
}
302325

303326

304-
Node* RawMachineAssembler::AddNode(const Operator* op, int input_count,
305-
Node** inputs) {
327+
Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
328+
Node** inputs) {
306329
DCHECK_NOT_NULL(schedule_);
307330
DCHECK(current_block_ != nullptr);
308-
Node* node = MakeNode(op, input_count, inputs);
331+
Node* node = graph()->NewNode(op, input_count, inputs);
309332
schedule()->AddNode(CurrentBlock(), node);
310333
return node;
311334
}
312335

313-
314-
Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
315-
Node** inputs) {
316-
// The raw machine assembler nodes do not have effect and control inputs,
317-
// so we disable checking input counts here.
318-
return graph()->NewNodeUnchecked(op, input_count, inputs);
319-
}
320-
321336
} // namespace compiler
322337
} // namespace internal
323338
} // namespace v8

0 commit comments

Comments
 (0)