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 { ...@@ -3204,8 +3204,8 @@ class IteratingArrayBuiltinHelper {
bool can_reduce() const { return can_reduce_; } bool can_reduce() const { return can_reduce_; }
bool has_stability_dependency() const { return has_stability_dependency_; } bool has_stability_dependency() const { return has_stability_dependency_; }
Node* effect() const { return effect_; } Effect effect() const { return effect_; }
Node* control() const { return control_; } Control control() const { return control_; }
MapInference* inference() { return &inference_; } MapInference* inference() { return &inference_; }
ElementsKind elements_kind() const { return elements_kind_; } ElementsKind elements_kind() const { return elements_kind_; }
...@@ -3213,8 +3213,8 @@ class IteratingArrayBuiltinHelper { ...@@ -3213,8 +3213,8 @@ class IteratingArrayBuiltinHelper {
bool can_reduce_ = false; bool can_reduce_ = false;
bool has_stability_dependency_ = false; bool has_stability_dependency_ = false;
Node* receiver_; Node* receiver_;
Node* effect_; Effect effect_;
Node* control_; Control control_;
MapInference inference_; MapInference inference_;
ElementsKind elements_kind_; ElementsKind elements_kind_;
}; };
...@@ -6273,15 +6273,15 @@ bool JSCallReducer::DoPromiseChecks(MapInference* inference) { ...@@ -6273,15 +6273,15 @@ bool JSCallReducer::DoPromiseChecks(MapInference* inference) {
// ES section #sec-promise.prototype.catch // ES section #sec-promise.prototype.catch
Reduction JSCallReducer::ReducePromisePrototypeCatch(Node* node) { Reduction JSCallReducer::ReducePromisePrototypeCatch(Node* node) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); JSCallNode n(node);
CallParameters const& p = CallParametersOf(node->op()); CallParameters const& p = n.Parameters();
if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) { if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) {
return NoChange(); return NoChange();
} }
int arity = p.arity_without_implicit_args(); int arity = p.arity_without_implicit_args();
Node* receiver = NodeProperties::GetValueInput(node, 1); Node* receiver = n.receiver();
Node* effect = NodeProperties::GetEffectInput(node); Effect effect = n.effect();
Node* control = NodeProperties::GetControlInput(node); Control control = n.control();
MapInference inference(broker(), receiver, effect); MapInference inference(broker(), receiver, effect);
if (!DoPromiseChecks(&inference)) return inference.NoChange(); if (!DoPromiseChecks(&inference)) return inference.NoChange();
...@@ -6845,16 +6845,16 @@ Reduction JSCallReducer::ReduceCollectionIteratorPrototypeNext( ...@@ -6845,16 +6845,16 @@ Reduction JSCallReducer::ReduceCollectionIteratorPrototypeNext(
Node* node, int entry_size, Handle<HeapObject> empty_collection, Node* node, int entry_size, Handle<HeapObject> empty_collection,
InstanceType collection_iterator_instance_type_first, InstanceType collection_iterator_instance_type_first,
InstanceType collection_iterator_instance_type_last) { InstanceType collection_iterator_instance_type_last) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); JSCallNode n(node);
CallParameters const& p = CallParametersOf(node->op()); CallParameters const& p = n.Parameters();
if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) { if (p.speculation_mode() == SpeculationMode::kDisallowSpeculation) {
return NoChange(); return NoChange();
} }
Node* receiver = NodeProperties::GetValueInput(node, 1); Node* receiver = n.receiver();
Node* context = NodeProperties::GetContextInput(node); Node* context = n.context();
Node* effect = NodeProperties::GetEffectInput(node); Effect effect = n.effect();
Node* control = NodeProperties::GetControlInput(node); Control control = n.control();
// A word of warning to begin with: This whole method might look a bit // 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 // strange at times, but that's mostly because it was carefully handcrafted
......
...@@ -118,15 +118,12 @@ bool MapInference::RelyOnMapsViaStability( ...@@ -118,15 +118,12 @@ bool MapInference::RelyOnMapsViaStability(
} }
bool MapInference::RelyOnMapsPreferStability( bool MapInference::RelyOnMapsPreferStability(
CompilationDependencies* dependencies, JSGraph* jsgraph, Node** effect, CompilationDependencies* dependencies, JSGraph* jsgraph, Effect* effect,
Node* control, const FeedbackSource& feedback) { Control control, const FeedbackSource& feedback) {
CHECK(HaveMaps()); CHECK(HaveMaps());
if (Safe()) return false; if (Safe()) return false;
if (RelyOnMapsViaStability(dependencies)) return true; if (RelyOnMapsViaStability(dependencies)) return true;
// TODO(jgruber): Change this to take (typed) Effect and Control parameters. CHECK(RelyOnMapsHelper(nullptr, jsgraph, effect, control, feedback));
Effect e{*effect};
CHECK(RelyOnMapsHelper(nullptr, jsgraph, &e, Control{control}, feedback));
*effect = e;
return false; return false;
} }
......
...@@ -66,21 +66,10 @@ class MapInference { ...@@ -66,21 +66,10 @@ class MapInference {
// Records stability dependencies if possible, otherwise it inserts map // Records stability dependencies if possible, otherwise it inserts map
// checks. Does nothing if maps were already reliable. Returns true iff // checks. Does nothing if maps were already reliable. Returns true iff
// dependencies were taken. // 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, bool RelyOnMapsPreferStability(CompilationDependencies* dependencies,
JSGraph* jsgraph, Effect* effect, JSGraph* jsgraph, Effect* effect,
Control control, Control control,
const FeedbackSource& feedback) { const FeedbackSource& feedback);
Node* effect_node = *effect;
bool result = RelyOnMapsPreferStability(dependencies, jsgraph, &effect_node,
control, feedback);
*effect = effect_node;
return result;
}
// Inserts map checks even if maps were already reliable. // Inserts map checks even if maps were already reliable.
void InsertMapChecks(JSGraph* jsgraph, Effect* effect, Control control, void InsertMapChecks(JSGraph* jsgraph, Effect* effect, Control control,
const FeedbackSource& feedback); 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