Commit 54b0109d authored by Michael Stanton's avatar Michael Stanton

Make use of post-scoping information to compute feedback vector requirements.

This avoids allocating vector ic slots that we don't use.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/758543002

Cr-Commit-Position: refs/heads/master@{#25485}
parent d8a56168
......@@ -66,7 +66,8 @@ class AstNumberingVisitor FINAL : public AstVisitor {
template <typename Node>
void ReserveFeedbackSlots(Node* node) {
FeedbackVectorRequirements reqs = node->ComputeFeedbackRequirements();
FeedbackVectorRequirements reqs =
node->ComputeFeedbackRequirements(isolate());
if (reqs.slots() > 0) {
node->SetFirstFeedbackSlot(
FeedbackVectorSlot(properties_.feedback_slots()));
......
......@@ -573,6 +573,12 @@ bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const {
}
FeedbackVectorRequirements Call::ComputeFeedbackRequirements(Isolate* isolate) {
int ic_slots = IsUsingCallFeedbackSlot(isolate) ? 1 : 0;
return FeedbackVectorRequirements(0, ic_slots);
}
Call::CallType Call::GetCallType(Isolate* isolate) const {
VariableProxy* proxy = expression()->AsVariableProxy();
if (proxy != NULL) {
......
......@@ -237,7 +237,8 @@ class AstNode: public ZoneObject {
// node types which don't actually have this. Note that this is conceptually
// not really nice, but multiple inheritance would introduce yet another
// vtable entry per node, something we don't want for space reasons.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) {
return FeedbackVectorRequirements(0, 0);
}
virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); }
......@@ -923,7 +924,8 @@ class ForInStatement FINAL : public ForEachStatement {
}
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(1, 0);
}
virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
......@@ -1696,7 +1698,8 @@ class VariableProxy FINAL : public Expression {
// Bind this proxy to the variable var. Interfaces must match.
void BindTo(Variable* var);
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
}
virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
......@@ -1782,7 +1785,8 @@ class Property FINAL : public Expression {
return obj()->IsSuperReference();
}
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
}
virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
......@@ -1827,9 +1831,8 @@ class Call FINAL : public Expression {
ZoneList<Expression*>* arguments() const { return arguments_; }
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
return FeedbackVectorRequirements(0, 1);
}
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE;
virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
call_feedback_slot_ = slot;
}
......@@ -1940,7 +1943,8 @@ class CallNew FINAL : public Expression {
ZoneList<Expression*>* arguments() const { return arguments_; }
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
}
virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
......@@ -2005,7 +2009,8 @@ class CallRuntime FINAL : public Expression {
bool is_jsruntime() const { return function_ == NULL; }
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(
0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0);
}
......@@ -2384,7 +2389,8 @@ class Yield FINAL : public Expression {
}
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(
0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0);
}
......@@ -2721,7 +2727,8 @@ class SuperReference FINAL : public Expression {
TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
// Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
Isolate* isolate) OVERRIDE {
return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
}
virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
......
......@@ -510,16 +510,20 @@ void AstTyper::VisitProperty(Property* expr) {
void AstTyper::VisitCall(Call* expr) {
// Collect type feedback.
RECURSE(Visit(expr->expression()));
FeedbackVectorICSlot slot = expr->CallFeedbackSlot();
expr->set_is_uninitialized(oracle()->CallIsUninitialized(slot));
if (!expr->expression()->IsProperty() &&
expr->IsUsingCallFeedbackSlot(isolate()) &&
oracle()->CallIsMonomorphic(slot)) {
expr->set_target(oracle()->GetCallTarget(slot));
Handle<AllocationSite> site = oracle()->GetCallAllocationSite(slot);
expr->set_allocation_site(site);
bool is_uninitialized = true;
if (expr->IsUsingCallFeedbackSlot(isolate())) {
FeedbackVectorICSlot slot = expr->CallFeedbackSlot();
is_uninitialized = oracle()->CallIsUninitialized(slot);
if (!expr->expression()->IsProperty() &&
oracle()->CallIsMonomorphic(slot)) {
expr->set_target(oracle()->GetCallTarget(slot));
Handle<AllocationSite> site = oracle()->GetCallAllocationSite(slot);
expr->set_allocation_site(site);
}
}
expr->set_is_uninitialized(is_uninitialized);
ZoneList<Expression*>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i);
......
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