Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index 07227b105c50818d32ff4219ef0038436ba28bfe..e026f94e0a2b3a99686b737ae6129fbec88d3d83 100644 |
| --- a/src/ast.h |
| +++ b/src/ast.h |
| @@ -213,6 +213,11 @@ class AstNode: public ZoneObject { |
| virtual NodeType node_type() const = 0; |
| int position() const { return position_; } |
| + static const int kInvalidFeedbackSlot = -1; |
| + virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) { |
|
danno
2014/01/28 08:27:17
Is it really consuming? Isn't it more like earmark
mvstanton
2014/01/30 15:13:41
Changed the approach quite a bit.
|
| + return current_slot; |
| + } |
| + |
| // Type testing & conversion functions overridden by concrete subclasses. |
| #define DECLARE_NODE_FUNCTIONS(type) \ |
| bool Is##type() { return node_type() == AstNode::k##type; } \ |
| @@ -922,7 +927,16 @@ class ForInStatement V8_FINAL : public ForEachStatement { |
| return subject(); |
| } |
| - TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
| + // Type feedback information. |
| + virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) { |
| + for_in_feedback_slot_ = current_slot; |
| + return current_slot + 1; |
| + } |
| + int ForInFeedbackSlot() { |
| + ASSERT(for_in_feedback_slot_ != kInvalidFeedbackSlot); |
| + return for_in_feedback_slot_; |
| + } |
| + |
| enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| ForInType for_in_type() const { return for_in_type_; } |
| void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| @@ -936,11 +950,13 @@ class ForInStatement V8_FINAL : public ForEachStatement { |
| ForInStatement(Zone* zone, ZoneStringList* labels, int pos) |
| : ForEachStatement(zone, labels, pos), |
| for_in_type_(SLOW_FOR_IN), |
| + for_in_feedback_slot_(kInvalidFeedbackSlot), |
| body_id_(GetNextId(zone)), |
| prepare_id_(GetNextId(zone)) { |
| } |
| ForInType for_in_type_; |
| + int for_in_feedback_slot_; |
| const BailoutId body_id_; |
| const BailoutId prepare_id_; |
| }; |
| @@ -1740,6 +1756,12 @@ class Call V8_FINAL : public Expression { |
| Expression* expression() const { return expression_; } |
| ZoneList<Expression*>* arguments() const { return arguments_; } |
| + virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot); |
| + bool HasCallFeedbackSlot() const { |
| + return call_feedback_slot_ != kInvalidFeedbackSlot; |
| + } |
| + int CallFeedbackSlot() const { return call_feedback_slot_; } |
| + |
| // Type feedback information. |
| TypeFeedbackId CallFeedbackId() const { return reuse(id()); } |
| void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| @@ -1811,6 +1833,7 @@ class Call V8_FINAL : public Expression { |
| is_monomorphic_(false), |
| keyed_array_call_is_holey_(true), |
| check_type_(RECEIVER_MAP_CHECK), |
| + call_feedback_slot_(kInvalidFeedbackSlot), |
| return_id_(GetNextId(zone)) { } |
| private: |
| @@ -1824,6 +1847,7 @@ class Call V8_FINAL : public Expression { |
| Handle<JSFunction> target_; |
| Handle<JSObject> holder_; |
| Handle<Cell> cell_; |
| + int call_feedback_slot_; |
| const BailoutId return_id_; |
| }; |
| @@ -1837,6 +1861,15 @@ class CallNew V8_FINAL : public Expression { |
| ZoneList<Expression*>* arguments() const { return arguments_; } |
| // Type feedback information. |
| + virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) { |
|
danno
2014/01/28 08:27:17
Somehow, this seems a little clunky. It seems like
|
| + callnew_feedback_slot_ = current_slot; |
| + return current_slot + 1; |
| + } |
| + int CallNewFeedbackSlot() { |
| + ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot); |
| + return callnew_feedback_slot_; |
| + } |
| + |
| TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
| void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| @@ -1846,6 +1879,8 @@ class CallNew V8_FINAL : public Expression { |
| return allocation_site_; |
| } |
| + static int feedback_slots() { return 1; } |
| + |
| BailoutId ReturnId() const { return return_id_; } |
| protected: |
| @@ -1858,6 +1893,7 @@ class CallNew V8_FINAL : public Expression { |
| arguments_(arguments), |
| is_monomorphic_(false), |
| elements_kind_(GetInitialFastElementsKind()), |
| + callnew_feedback_slot_(kInvalidFeedbackSlot), |
| return_id_(GetNextId(zone)) { } |
| private: |
| @@ -1868,6 +1904,8 @@ class CallNew V8_FINAL : public Expression { |
| Handle<JSFunction> target_; |
| ElementsKind elements_kind_; |
| Handle<AllocationSite> allocation_site_; |
| + Handle<Cell> allocation_info_cell_; |
| + int callnew_feedback_slot_; |
| const BailoutId return_id_; |
| }; |