[turbofan] Remove obsolte value input to {Throw} nodes.

Nodes having the {Throw} operator are just used as terminators for
control-flow leaving the function body with an exception completion,
they turn into basic-block terminators within the schedule. Actually
raising an exception is done solely via runtime calls. Hence {Throw}
nodes no longer need any value input.

R=bmeurer@chromium.org

Change-Id: Id6d8e46b12c4b84f4e7a8ac96623c8efb1f27b26
Reviewed-on: https://chromium-review.googlesource.com/446501
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43445}
This commit is contained in:
Michael Starzinger 2017-02-27 11:57:58 +01:00 committed by Commit Bot
parent 8f42a3d8a0
commit 1ed1622ef2
10 changed files with 15 additions and 20 deletions

View File

@ -2700,7 +2700,7 @@ Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) {
const Operator* op = javascript()->CallRuntime(Runtime::kThrow);
Node* call = NewNode(op, exception);
PrepareFrameState(call, bailout_id);
Node* control = NewNode(common()->Throw(), call);
Node* control = NewNode(common()->Throw());
UpdateControlDependencyToLeaveFunction(control);
return call;
}
@ -2712,7 +2712,7 @@ Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable,
const Operator* op = javascript()->CallRuntime(Runtime::kThrowReferenceError);
Node* call = NewNode(op, variable_name);
PrepareFrameState(call, bailout_id);
Node* control = NewNode(common()->Throw(), call);
Node* control = NewNode(common()->Throw());
UpdateControlDependencyToLeaveFunction(control);
return call;
}
@ -2723,7 +2723,7 @@ Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) {
javascript()->CallRuntime(Runtime::kThrowConstAssignError);
Node* call = NewNode(op);
PrepareFrameState(call, bailout_id);
Node* control = NewNode(common()->Throw(), call);
Node* control = NewNode(common()->Throw());
UpdateControlDependencyToLeaveFunction(control);
return call;
}
@ -2744,7 +2744,7 @@ Node* AstGraphBuilder::BuildReturn(Node* return_value) {
Node* AstGraphBuilder::BuildThrow(Node* exception_value) {
NewNode(javascript()->CallRuntime(Runtime::kReThrow), exception_value);
Node* control = NewNode(common()->Throw(), exception_value);
Node* control = NewNode(common()->Throw());
UpdateControlDependencyToLeaveFunction(control);
return control;
}

View File

@ -1499,15 +1499,15 @@ void BytecodeGraphBuilder::VisitThrow() {
Node* value = environment()->LookupAccumulator();
Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
environment()->BindAccumulator(call, Environment::kAttachFrameState);
Node* control = NewNode(common()->Throw(), call);
Node* control = NewNode(common()->Throw());
MergeControlToLeaveFunction(control);
}
void BytecodeGraphBuilder::VisitReThrow() {
BuildLoopExitsForFunctionExit();
Node* value = environment()->LookupAccumulator();
Node* call = NewNode(javascript()->CallRuntime(Runtime::kReThrow), value);
Node* control = NewNode(common()->Throw(), call);
NewNode(javascript()->CallRuntime(Runtime::kReThrow), value);
Node* control = NewNode(common()->Throw());
MergeControlToLeaveFunction(control);
}

View File

@ -354,7 +354,7 @@ ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \
V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
V(Throw, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(OsrLoopEntry, Operator::kFoldable | Operator::kNoThrow, 0, 1, 1, 0, 1, 1) \

View File

@ -982,7 +982,7 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
}
case BasicBlock::kThrow:
DCHECK_EQ(IrOpcode::kThrow, input->opcode());
return VisitThrow(input->InputAt(0));
return VisitThrow(input);
case BasicBlock::kNone: {
// Exit block doesn't have control.
DCHECK_NULL(input);
@ -2562,8 +2562,7 @@ void InstructionSelector::VisitDeoptimize(DeoptimizeKind kind,
EmitDeoptimize(kArchDeoptimize, 0, nullptr, 0, nullptr, kind, reason, value);
}
void InstructionSelector::VisitThrow(Node* value) {
void InstructionSelector::VisitThrow(Node* node) {
OperandGenerator g(this);
Emit(kArchThrowTerminator, g.NoOutput());
}

View File

@ -365,7 +365,7 @@ class V8_EXPORT_PRIVATE InstructionSelector final {
void VisitDeoptimize(DeoptimizeKind kind, DeoptimizeReason reason,
Node* value);
void VisitReturn(Node* ret);
void VisitThrow(Node* value);
void VisitThrow(Node* node);
void VisitRetain(Node* node);
void EmitPrepareArguments(ZoneVector<compiler::PushParameter>* arguments,

View File

@ -714,7 +714,7 @@ Reduction JSTypedLowering::ReduceCreateConsString(Node* node) {
javascript()->CallRuntime(Runtime::kThrowInvalidStringLength),
context, frame_state, efalse, if_false);
if_false = graph()->NewNode(common()->IfSuccess(), vfalse);
if_false = graph()->NewNode(common()->Throw(), vfalse, efalse, if_false);
if_false = graph()->NewNode(common()->Throw(), efalse, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), if_false);
Revisit(graph()->end());

View File

@ -521,8 +521,6 @@ class MachineRepresentationChecker {
break;
}
case IrOpcode::kThrow:
CheckValueInputIsTagged(node, 0);
break;
case IrOpcode::kTypedStateValues:
case IrOpcode::kFrameState:
break;

View File

@ -167,8 +167,7 @@ void RawMachineAssembler::PopAndReturn(Node* pop, Node* v1, Node* v2,
void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); }
void RawMachineAssembler::Unreachable() {
Node* values[] = {UndefinedConstant()}; // Unused.
Node* ret = MakeNode(common()->Throw(), 1, values);
Node* ret = MakeNode(common()->Throw(), 0, nullptr);
schedule()->AddThrow(CurrentBlock(), ret);
current_block_ = nullptr;
}

View File

@ -347,8 +347,7 @@ class WasmTrapHelper : public ZoneObject {
if (false) {
// End the control flow with a throw
Node* thrw =
graph()->NewNode(common()->Throw(), jsgraph()->ZeroConstant(),
*effect_ptr, *control_ptr);
graph()->NewNode(common()->Throw(), *effect_ptr, *control_ptr);
MergeControlToEnd(jsgraph(), thrw);
} else {
// End the control flow with returning 0xdeadbeef

View File

@ -52,7 +52,7 @@ const SharedOperator kSharedOperators[] = {
SHARED(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
SHARED(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
SHARED(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1),
SHARED(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1),
SHARED(Throw, Operator::kKontrol, 0, 1, 1, 0, 0, 1),
SHARED(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1)
#undef SHARED
};