Commit 00624029 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Rip out the unused OsrGuard node.

BUG=v8:6325

Review-Url: https://codereview.chromium.org/2851723002
Cr-Commit-Position: refs/heads/master@{#44974}
parent 8707c615
......@@ -3016,8 +3016,9 @@ void AstGraphBuilder::Environment::PrepareForOsrEntry() {
// Set the control and effect to the OSR loop entry.
Node* osr_loop_entry = graph->NewNode(builder_->common()->OsrLoopEntry(),
graph->start(), graph->start());
Node* effect = osr_loop_entry;
UpdateControlDependency(osr_loop_entry);
UpdateEffectDependency(osr_loop_entry);
UpdateEffectDependency(effect);
// Set OSR values.
for (int i = 0; i < size; ++i) {
......@@ -3030,30 +3031,11 @@ void AstGraphBuilder::Environment::PrepareForOsrEntry() {
builder_->common()->OsrValue(Linkage::kOsrContextSpillSlotIndex);
contexts()->back() = graph->NewNode(op_inner, osr_loop_entry);
// Create a checkpoint.
Node* frame_state = Checkpoint(builder_->info()->osr_ast_id());
Node* checkpoint = graph->NewNode(common()->Checkpoint(), frame_state,
osr_loop_entry, osr_loop_entry);
UpdateEffectDependency(checkpoint);
// Create the OSR guard nodes.
const Operator* guard_op =
builder_->info()->is_deoptimization_enabled()
? builder_->common()->OsrGuard(OsrGuardType::kUninitialized)
: builder_->common()->OsrGuard(OsrGuardType::kAny);
Node* effect = checkpoint;
for (int i = 0; i < size; ++i) {
values()->at(i) = effect =
graph->NewNode(guard_op, values()->at(i), effect, osr_loop_entry);
}
contexts()->back() = effect =
graph->NewNode(guard_op, contexts()->back(), effect, osr_loop_entry);
// The innermost context is the OSR value, and the outer contexts are
// reconstructed by dynamically walking up the context chain.
const Operator* load_op =
builder_->javascript()->LoadContext(0, Context::PREVIOUS_INDEX, true);
Node* osr_context = effect = contexts()->back();
Node* osr_context = contexts()->back();
int last = static_cast<int>(contexts()->size() - 1);
for (int i = last - 1; i >= 0; i--) {
osr_context = effect = graph->NewNode(load_op, osr_context, effect);
......
......@@ -318,24 +318,6 @@ void BytecodeGraphBuilder::Environment::PrepareForOsrEntry() {
if (i >= accumulator_base()) idx = Linkage::kOsrAccumulatorRegisterIndex;
values()->at(i) = graph()->NewNode(common()->OsrValue(idx), entry);
}
BailoutId loop_id(builder_->bytecode_iterator().current_offset());
Node* frame_state =
Checkpoint(loop_id, OutputFrameStateCombine::Ignore(), false, nullptr);
Node* checkpoint =
graph()->NewNode(common()->Checkpoint(), frame_state, entry, entry);
UpdateEffectDependency(checkpoint);
// Create the OSR guard nodes.
const Operator* guard_op = common()->OsrGuard(OsrGuardType::kUninitialized);
Node* effect = checkpoint;
for (int i = 0; i < size; i++) {
values()->at(i) = effect =
graph()->NewNode(guard_op, values()->at(i), effect, entry);
}
Node* context = effect = graph()->NewNode(guard_op, Context(), effect, entry);
SetContext(context);
UpdateEffectDependency(effect);
}
bool BytecodeGraphBuilder::Environment::StateValuesRequireUpdate(
......
......@@ -307,26 +307,6 @@ int OsrValueIndexOf(Operator const* op) {
return OpParameter<int>(op);
}
size_t hash_value(OsrGuardType type) { return static_cast<size_t>(type); }
std::ostream& operator<<(std::ostream& os, OsrGuardType type) {
switch (type) {
case OsrGuardType::kUninitialized:
return os << "Uninitialized";
case OsrGuardType::kSignedSmall:
return os << "SignedSmall";
case OsrGuardType::kAny:
return os << "Any";
}
UNREACHABLE();
return os;
}
OsrGuardType OsrGuardTypeOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kOsrGuard, op->opcode());
return OpParameter<OsrGuardType>(op);
}
SparseInputMask SparseInputMaskOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kStateValues ||
op->opcode() == IrOpcode::kTypedStateValues);
......@@ -1010,14 +990,6 @@ const Operator* CommonOperatorBuilder::OsrValue(int index) {
index); // parameter
}
const Operator* CommonOperatorBuilder::OsrGuard(OsrGuardType type) {
return new (zone()) Operator1<OsrGuardType>( // --
IrOpcode::kOsrGuard, Operator::kNoThrow, // opcode
"OsrGuard", // name
1, 1, 1, 1, 1, 0, // counts
type); // parameter
}
const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) {
return new (zone()) Operator1<int32_t>( // --
IrOpcode::kInt32Constant, Operator::kPure, // opcode
......
......@@ -287,11 +287,6 @@ Type* TypeGuardTypeOf(Operator const*) WARN_UNUSED_RESULT;
int OsrValueIndexOf(Operator const*);
enum class OsrGuardType { kUninitialized, kSignedSmall, kAny };
size_t hash_value(OsrGuardType type);
std::ostream& operator<<(std::ostream&, OsrGuardType);
OsrGuardType OsrGuardTypeOf(Operator const*);
SparseInputMask SparseInputMaskOf(Operator const*);
ZoneVector<MachineType> const* MachineTypesOf(Operator const*)
......@@ -337,7 +332,6 @@ class V8_EXPORT_PRIVATE CommonOperatorBuilder final
const Operator* OsrNormalEntry();
const Operator* OsrLoopEntry();
const Operator* OsrValue(int index);
const Operator* OsrGuard(OsrGuardType type);
const Operator* Int32Constant(int32_t);
const Operator* Int64Constant(int64_t);
......
......@@ -16,8 +16,6 @@ Reduction JSFrameSpecialization::Reduce(Node* node) {
switch (node->opcode()) {
case IrOpcode::kOsrValue:
return ReduceOsrValue(node);
case IrOpcode::kOsrGuard:
return ReduceOsrGuard(node);
case IrOpcode::kParameter:
return ReduceParameter(node);
default:
......@@ -47,13 +45,6 @@ Reduction JSFrameSpecialization::ReduceOsrValue(Node* node) {
return Replace(jsgraph()->Constant(value));
}
Reduction JSFrameSpecialization::ReduceOsrGuard(Node* node) {
DCHECK_EQ(IrOpcode::kOsrGuard, node->opcode());
ReplaceWithValue(node, node->InputAt(0),
NodeProperties::GetEffectInput(node));
return Changed(node);
}
Reduction JSFrameSpecialization::ReduceParameter(Node* node) {
DCHECK_EQ(IrOpcode::kParameter, node->opcode());
Handle<Object> value;
......
......@@ -29,7 +29,6 @@ class JSFrameSpecialization final : public AdvancedReducer {
private:
Reduction ReduceOsrValue(Node* node);
Reduction ReduceOsrGuard(Node* node);
Reduction ReduceParameter(Node* node);
Isolate* isolate() const;
......
......@@ -66,7 +66,6 @@
V(Call) \
V(Parameter) \
V(OsrValue) \
V(OsrGuard) \
V(LoopExit) \
V(LoopExitValue) \
V(LoopExitEffect) \
......
......@@ -94,8 +94,7 @@ void PeelOuterLoopsForOsr(Graph* graph, CommonOperatorBuilder* common,
continue;
}
if (orig->InputCount() == 0 || orig->opcode() == IrOpcode::kParameter ||
orig->opcode() == IrOpcode::kOsrValue ||
orig->opcode() == IrOpcode::kOsrGuard) {
orig->opcode() == IrOpcode::kOsrValue) {
// No need to copy leaf nodes or parameters.
mapping->at(orig->id()) = orig;
continue;
......@@ -254,20 +253,6 @@ void PeelOuterLoopsForOsr(Graph* graph, CommonOperatorBuilder* common,
}
}
void SetTypeForOsrValue(Node* osr_value, Node* loop,
CommonOperatorBuilder* common) {
Node* osr_guard = nullptr;
for (Node* use : osr_value->uses()) {
if (use->opcode() == IrOpcode::kOsrGuard) {
DCHECK_EQ(use->InputAt(0), osr_value);
osr_guard = use;
break;
}
}
NodeProperties::ChangeOp(osr_guard, common->OsrGuard(OsrGuardType::kAny));
}
} // namespace
void OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
......@@ -297,12 +282,6 @@ void OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
CHECK(osr_loop); // Should have found the OSR loop.
for (Node* use : osr_loop_entry->uses()) {
if (use->opcode() == IrOpcode::kOsrValue) {
SetTypeForOsrValue(use, osr_loop, common);
}
}
// Analyze the graph to determine how deeply nested the OSR loop is.
LoopTree* loop_tree = LoopFinder::BuildLoopTree(graph, tmp_zone);
......
......@@ -1402,30 +1402,6 @@ class RepresentationSelector {
return;
}
void VisitOsrGuard(Node* node) {
VisitInputs(node);
// Insert a dynamic check for the OSR value type if necessary.
switch (OsrGuardTypeOf(node->op())) {
case OsrGuardType::kUninitialized:
// At this point, we should always have a type for the OsrValue.
UNREACHABLE();
break;
case OsrGuardType::kSignedSmall:
if (lower()) {
NodeProperties::ChangeOp(node,
simplified()->CheckedTaggedToTaggedSigned());
}
return SetOutput(node, MachineRepresentation::kTaggedSigned);
case OsrGuardType::kAny: // Nothing to check.
if (lower()) {
DeferReplacement(node, node->InputAt(0));
}
return SetOutput(node, MachineRepresentation::kTagged);
}
UNREACHABLE();
}
// Dispatching routine for visiting the node {node} with the usage {use}.
// Depending on the operator, propagate new usage info to the inputs.
void VisitNode(Node* node, Truncation truncation,
......@@ -2795,9 +2771,6 @@ class RepresentationSelector {
return;
}
case IrOpcode::kOsrGuard:
return VisitOsrGuard(node);
case IrOpcode::kFinishRegion:
VisitInputs(node);
// Assume the output is tagged pointer.
......
......@@ -607,19 +607,6 @@ Type* Typer::Visitor::TypeParameter(Node* node) {
Type* Typer::Visitor::TypeOsrValue(Node* node) { return Type::Any(); }
Type* Typer::Visitor::TypeOsrGuard(Node* node) {
switch (OsrGuardTypeOf(node->op())) {
case OsrGuardType::kUninitialized:
return Type::None();
case OsrGuardType::kSignedSmall:
return Type::SignedSmall();
case OsrGuardType::kAny:
return Type::Any();
}
UNREACHABLE();
return nullptr;
}
Type* Typer::Visitor::TypeRetain(Node* node) {
UNREACHABLE();
return nullptr;
......
......@@ -401,23 +401,6 @@ void Verifier::Visitor::Check(Node* node) {
// Type is merged from other values in the graph and could be any.
CheckTypeIs(node, Type::Any());
break;
case IrOpcode::kOsrGuard:
// OSR values have a value and a control input.
CHECK_EQ(1, value_count);
CHECK_EQ(1, effect_count);
CHECK_EQ(1, control_count);
switch (OsrGuardTypeOf(node->op())) {
case OsrGuardType::kUninitialized:
CheckTypeIs(node, Type::None());
break;
case OsrGuardType::kSignedSmall:
CheckTypeIs(node, Type::SignedSmall());
break;
case OsrGuardType::kAny:
CheckTypeIs(node, Type::Any());
break;
}
break;
case IrOpcode::kProjection: {
// Projection has an input that produces enough values.
int index = static_cast<int>(ProjectionIndexOf(node->op()));
......
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