Index: src/ast.cc |
diff --git a/src/ast.cc b/src/ast.cc |
index 1a9919b5aa52c0343d60cac4cffd4dcf2ee4d24e..6b2f48f0172b9bea33bcc7457ce7425d26963eab 100644 |
--- a/src/ast.cc |
+++ b/src/ast.cc |
@@ -593,6 +593,17 @@ void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { |
} |
+int Call::ComputeFeedbackSlotCount(Isolate* isolate) { |
+ CallType call_type = GetCallType(isolate); |
+ if (call_type == LOOKUP_SLOT_CALL || call_type == OTHER_CALL) { |
+ // Call only uses a slot in some cases. |
+ return 1; |
+ } |
+ |
+ return 0; |
+} |
+ |
+ |
Call::CallType Call::GetCallType(Isolate* isolate) const { |
VariableProxy* proxy = expression()->AsVariableProxy(); |
if (proxy != NULL) { |
@@ -633,10 +644,10 @@ bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
allocation_site_ = |
- oracle->GetCallNewAllocationSite(CallNewFeedbackId()); |
- is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackId()); |
+ oracle->GetCallNewAllocationSite(CallNewFeedbackSlot()); |
+ is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot()); |
if (is_monomorphic_) { |
- target_ = oracle->GetCallNewTarget(CallNewFeedbackId()); |
+ target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot()); |
if (!allocation_site_.is_null()) { |
elements_kind_ = allocation_site_->GetElementsKind(); |
} |
@@ -1039,6 +1050,11 @@ CaseClause::CaseClause(Zone* zone, |
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
increase_node_count(); \ |
} |
+#define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
+ void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
+ increase_node_count(); \ |
+ add_slot_node(node); \ |
+ } |
#define DONT_OPTIMIZE_NODE(NodeType) \ |
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
increase_node_count(); \ |
@@ -1051,6 +1067,12 @@ CaseClause::CaseClause(Zone* zone, |
increase_node_count(); \ |
add_flag(kDontSelfOptimize); \ |
} |
+#define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
+ void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
+ increase_node_count(); \ |
+ add_slot_node(node); \ |
+ add_flag(kDontSelfOptimize); \ |
+ } |
#define DONT_CACHE_NODE(NodeType) \ |
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
increase_node_count(); \ |
@@ -1085,8 +1107,8 @@ REGULAR_NODE(CountOperation) |
REGULAR_NODE(BinaryOperation) |
REGULAR_NODE(CompareOperation) |
REGULAR_NODE(ThisFunction) |
-REGULAR_NODE(Call) |
-REGULAR_NODE(CallNew) |
+REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call) |
+REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew) |
// In theory, for VariableProxy we'd have to add: |
// if (node->var()->IsLookupSlot()) add_flag(kDontInline); |
// But node->var() is usually not bound yet at VariableProxy creation time, and |
@@ -1111,11 +1133,12 @@ DONT_OPTIMIZE_NODE(NativeFunctionLiteral) |
DONT_SELFOPTIMIZE_NODE(DoWhileStatement) |
DONT_SELFOPTIMIZE_NODE(WhileStatement) |
DONT_SELFOPTIMIZE_NODE(ForStatement) |
-DONT_SELFOPTIMIZE_NODE(ForInStatement) |
+DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) |
DONT_SELFOPTIMIZE_NODE(ForOfStatement) |
DONT_CACHE_NODE(ModuleLiteral) |
+ |
void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { |
increase_node_count(); |
if (node->is_jsruntime()) { |