Commit 86a63378 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[compiler] Remove untyped RelyOnMapsPreferStability

The typed version takes Effect/Control arguments instead of untyped
Node* arguments.

Bug: v8:8888
Change-Id: Ia4b9895256ab9ea2a22f9e590490280d7536eac7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2274609
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68626}
parent 76a60e15
......@@ -3204,8 +3204,8 @@ class IteratingArrayBuiltinHelper {
bool can_reduce() const { return can_reduce_; }
bool has_stability_dependency() const { return has_stability_dependency_; }
Node* effect() const { return effect_; }
Node* control() const { return control_; }
Effect effect() const { return effect_; }
Control control() const { return control_; }
MapInference* inference() { return &inference_; }
ElementsKind elements_kind() const { return elements_kind_; }
......@@ -3213,8 +3213,8 @@ class IteratingArrayBuiltinHelper {
bool can_reduce_ = false;
bool has_stability_dependency_ = false;
Node* receiver_;
Node* effect_;
Node* control_;
Effect effect_;
Control control_;
MapInference inference_;
ElementsKind elements_kind_;
};
......@@ -6273,15 +6273,15 @@ bool JSCallReducer::DoPromiseChecks(MapInference* inference) {
// ES section #sec-promise.prototype.catch
Reduction JSCallReducer::ReducePromisePrototypeCatch(Node* node) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallParameters const& p = CallParametersOf(node->op());
JSCallNode n(node);
CallParameters const& p = n.Parameters();
if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) {
return NoChange();
}
int arity = p.arity_without_implicit_args();
Node* receiver = NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* receiver = n.receiver();
Effect effect = n.effect();
Control control = n.control();
MapInference inference(broker(), receiver, effect);
if (!DoPromiseChecks(&inference)) return inference.NoChange();
......@@ -6845,16 +6845,16 @@ Reduction JSCallReducer::ReduceCollectionIteratorPrototypeNext(
Node* node, int entry_size, Handle<HeapObject> empty_collection,
InstanceType collection_iterator_instance_type_first,
InstanceType collection_iterator_instance_type_last) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallParameters const& p = CallParametersOf(node->op());
JSCallNode n(node);
CallParameters const& p = n.Parameters();
if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) {
return NoChange();
}
Node* receiver = NodeProperties::GetValueInput(node, 1);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* receiver = n.receiver();
Node* context = n.context();
Effect effect = n.effect();
Control control = n.control();
// A word of warning to begin with: This whole method might look a bit
// strange at times, but that's mostly because it was carefully handcrafted
......
......@@ -118,15 +118,12 @@ bool MapInference::RelyOnMapsViaStability(
}
bool MapInference::RelyOnMapsPreferStability(
CompilationDependencies* dependencies, JSGraph* jsgraph, Node** effect,
Node* control, const FeedbackSource& feedback) {
CompilationDependencies* dependencies, JSGraph* jsgraph, Effect* effect,
Control control, const FeedbackSource& feedback) {
CHECK(HaveMaps());
if (Safe()) return false;
if (RelyOnMapsViaStability(dependencies)) return true;
// TODO(jgruber): Change this to take (typed) Effect and Control parameters.
Effect e{*effect};
CHECK(RelyOnMapsHelper(nullptr, jsgraph, &e, Control{control}, feedback));
*effect = e;
CHECK(RelyOnMapsHelper(nullptr, jsgraph, effect, control, feedback));
return false;
}
......
......@@ -66,21 +66,10 @@ class MapInference {
// Records stability dependencies if possible, otherwise it inserts map
// checks. Does nothing if maps were already reliable. Returns true iff
// dependencies were taken.
bool RelyOnMapsPreferStability(CompilationDependencies* dependencies,
JSGraph* jsgraph, Node** effect, Node* control,
const FeedbackSource& feedback);
// TODO(jgruber): Once all callsites pass Effect/Control types,
// remove the untyped version above.
bool RelyOnMapsPreferStability(CompilationDependencies* dependencies,
JSGraph* jsgraph, Effect* effect,
Control control,
const FeedbackSource& feedback) {
Node* effect_node = *effect;
bool result = RelyOnMapsPreferStability(dependencies, jsgraph, &effect_node,
control, feedback);
*effect = effect_node;
return result;
}
const FeedbackSource& feedback);
// Inserts map checks even if maps were already reliable.
void InsertMapChecks(JSGraph* jsgraph, Effect* effect, Control control,
const FeedbackSource& feedback);
......
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