Commit c5b7b9f7 authored by mvstanton's avatar mvstanton Committed by Commit bot

Remove unnecessary TypeFeedbackIds, saves memory and simplifies TurboFan.

Consequence of going whole-hog for vector-based Load/KeyedLoad ICs.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28596}
parent 874c54e0
...@@ -1663,9 +1663,8 @@ class Property final : public Expression { ...@@ -1663,9 +1663,8 @@ class Property final : public Expression {
Expression* obj() const { return obj_; } Expression* obj() const { return obj_; }
Expression* key() const { return key_; } Expression* key() const { return key_; }
static int num_ids() { return parent_num_ids() + 2; } static int num_ids() { return parent_num_ids() + 1; }
BailoutId LoadId() const { return BailoutId(local_id(0)); } BailoutId LoadId() const { return BailoutId(local_id(0)); }
TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); }
bool IsStringAccess() const { bool IsStringAccess() const {
return IsStringAccessField::decode(bit_field_); return IsStringAccessField::decode(bit_field_);
...@@ -1972,10 +1971,7 @@ class CallRuntime final : public Expression { ...@@ -1972,10 +1971,7 @@ class CallRuntime final : public Expression {
return callruntime_feedback_slot_; return callruntime_feedback_slot_;
} }
static int num_ids() { return parent_num_ids() + 1; } static int num_ids() { return parent_num_ids(); }
TypeFeedbackId CallRuntimeFeedbackId() const {
return TypeFeedbackId(local_id(0));
}
protected: protected:
CallRuntime(Zone* zone, const AstRawString* name, CallRuntime(Zone* zone, const AstRawString* name,
...@@ -1989,8 +1985,6 @@ class CallRuntime final : public Expression { ...@@ -1989,8 +1985,6 @@ class CallRuntime final : public Expression {
static int parent_num_ids() { return Expression::num_ids(); } static int parent_num_ids() { return Expression::num_ids(); }
private: private:
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
const AstRawString* raw_name_; const AstRawString* raw_name_;
const Runtime::Function* function_; const Runtime::Function* function_;
ZoneList<Expression*>* arguments_; ZoneList<Expression*>* arguments_;
...@@ -2697,8 +2691,7 @@ class SuperReference final : public Expression { ...@@ -2697,8 +2691,7 @@ class SuperReference final : public Expression {
VariableProxy* this_var() const { return this_var_; } VariableProxy* this_var() const { return this_var_; }
static int num_ids() { return parent_num_ids() + 1; } static int num_ids() { return parent_num_ids(); }
TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
// Type feedback information. // Type feedback information.
virtual FeedbackVectorRequirements ComputeFeedbackRequirements( virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
...@@ -2726,8 +2719,6 @@ class SuperReference final : public Expression { ...@@ -2726,8 +2719,6 @@ class SuperReference final : public Expression {
static int parent_num_ids() { return Expression::num_ids(); } static int parent_num_ids() { return Expression::num_ids(); }
private: private:
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
VariableProxy* this_var_; VariableProxy* this_var_;
FeedbackVectorICSlot homeobject_feedback_slot_; FeedbackVectorICSlot homeobject_feedback_slot_;
}; };
......
...@@ -2129,8 +2129,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) { ...@@ -2129,8 +2129,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
VectorSlotPair pair = VectorSlotPair pair =
CreateVectorSlotPair(property->PropertyFeedbackSlot()); CreateVectorSlotPair(property->PropertyFeedbackSlot());
FrameStateBeforeAndAfter states(this, property->obj()->id()); FrameStateBeforeAndAfter states(this, property->obj()->id());
old_value = old_value = BuildNamedLoad(object, name, pair);
BuildNamedLoad(object, name, pair, property->PropertyFeedbackId());
states.AddToNode(old_value, property->LoadId(), states.AddToNode(old_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
break; break;
...@@ -2141,8 +2140,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) { ...@@ -2141,8 +2140,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
VectorSlotPair pair = VectorSlotPair pair =
CreateVectorSlotPair(property->PropertyFeedbackSlot()); CreateVectorSlotPair(property->PropertyFeedbackSlot());
FrameStateBeforeAndAfter states(this, property->key()->id()); FrameStateBeforeAndAfter states(this, property->key()->id());
old_value = old_value = BuildKeyedLoad(object, key, pair);
BuildKeyedLoad(object, key, pair, property->PropertyFeedbackId());
states.AddToNode(old_value, property->LoadId(), states.AddToNode(old_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
break; break;
...@@ -2227,7 +2225,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) { ...@@ -2227,7 +2225,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) {
FrameStateBeforeAndAfter states(this, expr->obj()->id()); FrameStateBeforeAndAfter states(this, expr->obj()->id());
Node* object = environment()->Pop(); Node* object = environment()->Pop();
Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName();
value = BuildNamedLoad(object, name, pair, expr->PropertyFeedbackId()); value = BuildNamedLoad(object, name, pair);
states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); states.AddToNode(value, expr->id(), ast_context()->GetStateCombine());
} else { } else {
VisitForValue(expr->obj()); VisitForValue(expr->obj());
...@@ -2235,7 +2233,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) { ...@@ -2235,7 +2233,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) {
FrameStateBeforeAndAfter states(this, expr->key()->id()); FrameStateBeforeAndAfter states(this, expr->key()->id());
Node* key = environment()->Pop(); Node* key = environment()->Pop();
Node* object = environment()->Pop(); Node* object = environment()->Pop();
value = BuildKeyedLoad(object, key, pair, expr->PropertyFeedbackId()); value = BuildKeyedLoad(object, key, pair);
states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); states.AddToNode(value, expr->id(), ast_context()->GetStateCombine());
} }
ast_context()->ProduceValue(value); ast_context()->ProduceValue(value);
...@@ -2286,16 +2284,14 @@ void AstGraphBuilder::VisitCall(Call* expr) { ...@@ -2286,16 +2284,14 @@ void AstGraphBuilder::VisitCall(Call* expr) {
if (property->key()->IsPropertyName()) { if (property->key()->IsPropertyName()) {
FrameStateBeforeAndAfter states(this, property->obj()->id()); FrameStateBeforeAndAfter states(this, property->obj()->id());
Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
callee_value = callee_value = BuildNamedLoad(object, name, pair);
BuildNamedLoad(object, name, pair, property->PropertyFeedbackId());
states.AddToNode(callee_value, property->LoadId(), states.AddToNode(callee_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
} else { } else {
VisitForValue(property->key()); VisitForValue(property->key());
FrameStateBeforeAndAfter states(this, property->key()->id()); FrameStateBeforeAndAfter states(this, property->key()->id());
Node* key = environment()->Pop(); Node* key = environment()->Pop();
callee_value = callee_value = BuildKeyedLoad(object, key, pair);
BuildKeyedLoad(object, key, pair, property->PropertyFeedbackId());
states.AddToNode(callee_value, property->LoadId(), states.AddToNode(callee_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
} }
...@@ -2410,8 +2406,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { ...@@ -2410,8 +2406,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
VectorSlotPair pair = CreateVectorSlotPair(expr->CallRuntimeFeedbackSlot()); VectorSlotPair pair = CreateVectorSlotPair(expr->CallRuntimeFeedbackSlot());
// TODO(jarin): bailout ids for runtime calls. // TODO(jarin): bailout ids for runtime calls.
FrameStateBeforeAndAfter states(this, BailoutId::None()); FrameStateBeforeAndAfter states(this, BailoutId::None());
Node* callee_value = Node* callee_value = BuildNamedLoad(receiver_value, name, pair);
BuildNamedLoad(receiver_value, name, pair, expr->CallRuntimeFeedbackId());
states.AddToNode(callee_value, BailoutId::None(), states.AddToNode(callee_value, BailoutId::None(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
environment()->Push(callee_value); environment()->Push(callee_value);
...@@ -2501,8 +2496,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) { ...@@ -2501,8 +2496,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
VectorSlotPair pair = VectorSlotPair pair =
CreateVectorSlotPair(property->PropertyFeedbackSlot()); CreateVectorSlotPair(property->PropertyFeedbackSlot());
old_value = old_value = BuildNamedLoad(object, name, pair);
BuildNamedLoad(object, name, pair, property->PropertyFeedbackId());
states.AddToNode(old_value, property->LoadId(), states.AddToNode(old_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
stack_depth = 1; stack_depth = 1;
...@@ -2516,8 +2510,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) { ...@@ -2516,8 +2510,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
Node* object = environment()->Peek(1); Node* object = environment()->Peek(1);
VectorSlotPair pair = VectorSlotPair pair =
CreateVectorSlotPair(property->PropertyFeedbackSlot()); CreateVectorSlotPair(property->PropertyFeedbackSlot());
old_value = old_value = BuildKeyedLoad(object, key, pair);
BuildKeyedLoad(object, key, pair, property->PropertyFeedbackId());
states.AddToNode(old_value, property->LoadId(), states.AddToNode(old_value, property->LoadId(),
OutputFrameStateCombine::Push()); OutputFrameStateCombine::Push());
stack_depth = 2; stack_depth = 2;
...@@ -3012,8 +3005,7 @@ Node* AstGraphBuilder::BuildVariableLoad(FrameStateBeforeAndAfter& states, ...@@ -3012,8 +3005,7 @@ Node* AstGraphBuilder::BuildVariableLoad(FrameStateBeforeAndAfter& states,
// Global var, const, or let variable. // Global var, const, or let variable.
Node* global = BuildLoadGlobalObject(); Node* global = BuildLoadGlobalObject();
Handle<Name> name = variable->name(); Handle<Name> name = variable->name();
Node* node = BuildNamedLoad(global, name, feedback, Node* node = BuildNamedLoad(global, name, feedback, contextual_mode);
TypeFeedbackId::None(), contextual_mode);
states.AddToNode(node, bailout_id, combine); states.AddToNode(node, bailout_id, combine);
return node; return node;
} }
...@@ -3218,38 +3210,43 @@ Node* AstGraphBuilder::BuildVariableAssignment( ...@@ -3218,38 +3210,43 @@ Node* AstGraphBuilder::BuildVariableAssignment(
static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node, static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node,
TypeFeedbackId id, FeedbackVectorICSlot slot) { FeedbackVectorICSlot slot) {
if (js_type_feedback) { if (js_type_feedback) {
js_type_feedback->Record(node, id);
js_type_feedback->Record(node, slot); js_type_feedback->Record(node, slot);
} }
return node; return node;
} }
static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node,
TypeFeedbackId id) {
if (js_type_feedback) {
js_type_feedback->Record(node, id);
}
return node;
}
Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key, Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key,
const VectorSlotPair& feedback, const VectorSlotPair& feedback) {
TypeFeedbackId id) {
const Operator* op = javascript()->LoadProperty(feedback); const Operator* op = javascript()->LoadProperty(feedback);
return Record(js_type_feedback_, NewNode(op, object, key), id, return Record(js_type_feedback_, NewNode(op, object, key), feedback.slot());
feedback.slot());
} }
Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name, Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name,
const VectorSlotPair& feedback, const VectorSlotPair& feedback,
TypeFeedbackId id, ContextualMode mode) { ContextualMode mode) {
const Operator* op = const Operator* op =
javascript()->LoadNamed(MakeUnique(name), feedback, mode); javascript()->LoadNamed(MakeUnique(name), feedback, mode);
return Record(js_type_feedback_, NewNode(op, object), id, feedback.slot()); return Record(js_type_feedback_, NewNode(op, object), feedback.slot());
} }
Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value,
TypeFeedbackId id) { TypeFeedbackId id) {
const Operator* op = javascript()->StoreProperty(language_mode()); const Operator* op = javascript()->StoreProperty(language_mode());
return Record(js_type_feedback_, NewNode(op, object, key, value), id, return Record(js_type_feedback_, NewNode(op, object, key, value), id);
FeedbackVectorICSlot::Invalid());
} }
...@@ -3257,8 +3254,7 @@ Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, ...@@ -3257,8 +3254,7 @@ Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name,
Node* value, TypeFeedbackId id) { Node* value, TypeFeedbackId id) {
const Operator* op = const Operator* op =
javascript()->StoreNamed(language_mode(), MakeUnique(name)); javascript()->StoreNamed(language_mode(), MakeUnique(name));
return Record(js_type_feedback_, NewNode(op, object, value), id, return Record(js_type_feedback_, NewNode(op, object, value), id);
FeedbackVectorICSlot::Invalid());
} }
......
...@@ -268,9 +268,9 @@ class AstGraphBuilder : public AstVisitor { ...@@ -268,9 +268,9 @@ class AstGraphBuilder : public AstVisitor {
// Builders for property loads and stores. // Builders for property loads and stores.
Node* BuildKeyedLoad(Node* receiver, Node* key, Node* BuildKeyedLoad(Node* receiver, Node* key,
const VectorSlotPair& feedback, TypeFeedbackId id); const VectorSlotPair& feedback);
Node* BuildNamedLoad(Node* receiver, Handle<Name> name, Node* BuildNamedLoad(Node* receiver, Handle<Name> name,
const VectorSlotPair& feedback, TypeFeedbackId id, const VectorSlotPair& feedback,
ContextualMode mode = NOT_CONTEXTUAL); ContextualMode mode = NOT_CONTEXTUAL);
Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, Node* BuildKeyedStore(Node* receiver, Node* key, Node* value,
TypeFeedbackId id); TypeFeedbackId id);
......
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