Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index 60f0068d37aebe855c31c352469af4d9ca058bf5..dbbb852c67279ecd0ffa1509d87c40de0966d53d 100644 |
| --- a/src/ast.h |
| +++ b/src/ast.h |
| @@ -2544,6 +2544,26 @@ class FunctionLiteral final : public Expression { |
| dont_optimize_reason_ = reason; |
| } |
| + static int num_ids() { return parent_num_ids() + 1; } |
| + TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } |
| + |
| + // Type feedback information. |
| + virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
| + Isolate* isolate, const ICSlotCache* cache) override { |
| + return FeedbackVectorRequirements(0, 1); |
| + } |
| + void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| + ICSlotCache* cache) override { |
| + DCHECK(!slot.IsInvalid()); |
| + home_object_feedback_slot_ = slot; |
| + } |
| + Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
| + |
| + FeedbackVectorICSlot HomeObjectFeedbackSlot() { |
| + DCHECK(!home_object_feedback_slot_.IsInvalid()); |
| + return home_object_feedback_slot_; |
| + } |
| + |
| protected: |
| FunctionLiteral(Zone* zone, const AstRawString* name, |
| AstValueFactory* ast_value_factory, Scope* scope, |
| @@ -2565,7 +2585,8 @@ class FunctionLiteral final : public Expression { |
| expected_property_count_(expected_property_count), |
| handler_count_(handler_count), |
| parameter_count_(parameter_count), |
| - function_token_position_(RelocInfo::kNoPosition) { |
| + function_token_position_(RelocInfo::kNoPosition), |
| + home_object_feedback_slot_(FeedbackVectorICSlot::Invalid()) { |
| bitfield_ = IsExpression::encode(function_type != DECLARATION) | |
| IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | |
| Pretenure::encode(false) | |
| @@ -2577,6 +2598,8 @@ class FunctionLiteral final : public Expression { |
| DCHECK(IsValidFunctionKind(kind)); |
| } |
| + static int parent_num_ids() { return Expression::num_ids(); } |
| + |
| private: |
| const AstRawString* raw_name_; |
| Handle<String> name_; |
| @@ -2594,6 +2617,9 @@ class FunctionLiteral final : public Expression { |
| int parameter_count_; |
| int function_token_position_; |
| + int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| + FeedbackVectorICSlot home_object_feedback_slot_; |
| + |
| unsigned bitfield_; |
| class IsExpression : public BitField<bool, 0, 1> {}; |
| class IsAnonymous : public BitField<bool, 1, 1> {}; |
| @@ -2695,6 +2721,7 @@ class SuperReference final : public Expression { |
| DECLARE_NODE_TYPE(SuperReference) |
| VariableProxy* this_var() const { return this_var_; } |
| + VariableProxy* home_object_var() const { return home_object_var_; } |
| static int num_ids() { return parent_num_ids() + 1; } |
| TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } |
| @@ -2706,29 +2733,35 @@ class SuperReference final : public Expression { |
| } |
| void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| ICSlotCache* cache) override { |
| - homeobject_feedback_slot_ = slot; |
| + home_object_feedback_slot_ = slot; |
|
arv (Not doing code reviews)
2015/05/26 17:17:48
Initially I removed this feedback slot but it seem
arv (Not doing code reviews)
2015/05/26 18:46:30
I figured it out. TF does not support super. It ca
|
| } |
| Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
| FeedbackVectorICSlot HomeObjectFeedbackSlot() { |
| - DCHECK(!homeobject_feedback_slot_.IsInvalid()); |
| - return homeobject_feedback_slot_; |
| + DCHECK(!home_object_feedback_slot_.IsInvalid()); |
| + return home_object_feedback_slot_; |
| } |
| protected: |
| - SuperReference(Zone* zone, VariableProxy* this_var, int pos) |
| + SuperReference(Zone* zone, VariableProxy* this_var, |
| + VariableProxy* home_object_var, int pos) |
| : Expression(zone, pos), |
| this_var_(this_var), |
| - homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { |
| + home_object_var_(home_object_var), |
| + home_object_feedback_slot_(FeedbackVectorICSlot::Invalid()) { |
| DCHECK(this_var->is_this()); |
| + DCHECK(home_object_var->raw_name()->IsOneByteEqualTo(".home_object")); |
| } |
| + |
| static int parent_num_ids() { return Expression::num_ids(); } |
| private: |
| int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| VariableProxy* this_var_; |
| - FeedbackVectorICSlot homeobject_feedback_slot_; |
| + VariableProxy* home_object_var_; |
| + |
| + FeedbackVectorICSlot home_object_feedback_slot_; |
| }; |
| @@ -3499,8 +3532,9 @@ class AstNodeFactory final BASE_EMBEDDED { |
| return new (zone_) ThisFunction(zone_, pos); |
| } |
| - SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { |
| - return new (zone_) SuperReference(zone_, this_var, pos); |
| + SuperReference* NewSuperReference(VariableProxy* this_var, |
| + VariableProxy* home_object_var, int pos) { |
| + return new (zone_) SuperReference(zone_, this_var, home_object_var, pos); |
| } |
| private: |