OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 void set_is_resolved() { | 1585 void set_is_resolved() { |
1586 bit_field_ = IsResolvedField::update(bit_field_, true); | 1586 bit_field_ = IsResolvedField::update(bit_field_, true); |
1587 } | 1587 } |
1588 | 1588 |
1589 int end_position() const { return end_position_; } | 1589 int end_position() const { return end_position_; } |
1590 | 1590 |
1591 // Bind this proxy to the variable var. | 1591 // Bind this proxy to the variable var. |
1592 void BindTo(Variable* var); | 1592 void BindTo(Variable* var); |
1593 | 1593 |
1594 bool UsesVariableFeedbackSlot() const { | 1594 bool UsesVariableFeedbackSlot() const { |
1595 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); | 1595 return var()->IsUnallocated() || var()->IsLookupSlot(); |
1596 } | 1596 } |
1597 | 1597 |
1598 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1598 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1599 Isolate* isolate, const ICSlotCache* cache) override; | 1599 Isolate* isolate, const ICSlotCache* cache) override; |
1600 | 1600 |
1601 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1601 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1602 ICSlotCache* cache) override; | 1602 ICSlotCache* cache) override; |
1603 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 1603 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
1604 FeedbackVectorICSlot VariableFeedbackSlot() { | 1604 FeedbackVectorICSlot VariableFeedbackSlot() { |
1605 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); | 1605 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 bit_field_ = IsForCallField::update(bit_field_, true); | 1684 bit_field_ = IsForCallField::update(bit_field_, true); |
1685 } | 1685 } |
1686 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | 1686 bool is_for_call() const { return IsForCallField::decode(bit_field_); } |
1687 | 1687 |
1688 bool IsSuperAccess() { | 1688 bool IsSuperAccess() { |
1689 return obj()->IsSuperReference(); | 1689 return obj()->IsSuperReference(); |
1690 } | 1690 } |
1691 | 1691 |
1692 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1692 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1693 Isolate* isolate, const ICSlotCache* cache) override { | 1693 Isolate* isolate, const ICSlotCache* cache) override { |
1694 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1694 return FeedbackVectorRequirements(0, 1); |
1695 } | 1695 } |
1696 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1696 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1697 ICSlotCache* cache) override { | 1697 ICSlotCache* cache) override { |
1698 property_feedback_slot_ = slot; | 1698 property_feedback_slot_ = slot; |
1699 } | 1699 } |
1700 Code::Kind FeedbackICSlotKind(int index) override { | 1700 Code::Kind FeedbackICSlotKind(int index) override { |
1701 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; | 1701 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; |
1702 } | 1702 } |
1703 | 1703 |
1704 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1704 FeedbackVectorICSlot PropertyFeedbackSlot() const { |
1705 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); | 1705 DCHECK(!property_feedback_slot_.IsInvalid()); |
1706 return property_feedback_slot_; | 1706 return property_feedback_slot_; |
1707 } | 1707 } |
1708 | 1708 |
1709 protected: | 1709 protected: |
1710 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1710 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1711 : Expression(zone, pos), | 1711 : Expression(zone, pos), |
1712 bit_field_(IsForCallField::encode(false) | | 1712 bit_field_(IsForCallField::encode(false) | |
1713 IsStringAccessField::encode(false) | | 1713 IsStringAccessField::encode(false) | |
1714 InlineCacheStateField::encode(UNINITIALIZED)), | 1714 InlineCacheStateField::encode(UNINITIALIZED)), |
1715 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 1715 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 public: | 1932 public: |
1933 DECLARE_NODE_TYPE(CallRuntime) | 1933 DECLARE_NODE_TYPE(CallRuntime) |
1934 | 1934 |
1935 Handle<String> name() const { return raw_name_->string(); } | 1935 Handle<String> name() const { return raw_name_->string(); } |
1936 const AstRawString* raw_name() const { return raw_name_; } | 1936 const AstRawString* raw_name() const { return raw_name_; } |
1937 const Runtime::Function* function() const { return function_; } | 1937 const Runtime::Function* function() const { return function_; } |
1938 ZoneList<Expression*>* arguments() const { return arguments_; } | 1938 ZoneList<Expression*>* arguments() const { return arguments_; } |
1939 bool is_jsruntime() const { return function_ == NULL; } | 1939 bool is_jsruntime() const { return function_ == NULL; } |
1940 | 1940 |
1941 // Type feedback information. | 1941 // Type feedback information. |
1942 bool HasCallRuntimeFeedbackSlot() const { | 1942 bool HasCallRuntimeFeedbackSlot() const { return is_jsruntime(); } |
1943 return FLAG_vector_ics && is_jsruntime(); | |
1944 } | |
1945 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1943 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1946 Isolate* isolate, const ICSlotCache* cache) override { | 1944 Isolate* isolate, const ICSlotCache* cache) override { |
1947 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); | 1945 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); |
1948 } | 1946 } |
1949 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1947 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1950 ICSlotCache* cache) override { | 1948 ICSlotCache* cache) override { |
1951 callruntime_feedback_slot_ = slot; | 1949 callruntime_feedback_slot_ = slot; |
1952 } | 1950 } |
1953 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 1951 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
1954 | 1952 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 int index() const { | 2322 int index() const { |
2325 DCHECK_EQ(kDelegating, yield_kind()); | 2323 DCHECK_EQ(kDelegating, yield_kind()); |
2326 return index_; | 2324 return index_; |
2327 } | 2325 } |
2328 void set_index(int index) { | 2326 void set_index(int index) { |
2329 DCHECK_EQ(kDelegating, yield_kind()); | 2327 DCHECK_EQ(kDelegating, yield_kind()); |
2330 index_ = index; | 2328 index_ = index; |
2331 } | 2329 } |
2332 | 2330 |
2333 // Type feedback information. | 2331 // Type feedback information. |
2334 bool HasFeedbackSlots() const { | 2332 bool HasFeedbackSlots() const { return yield_kind() == kDelegating; } |
2335 return FLAG_vector_ics && (yield_kind() == kDelegating); | |
2336 } | |
2337 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2333 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2338 Isolate* isolate, const ICSlotCache* cache) override { | 2334 Isolate* isolate, const ICSlotCache* cache) override { |
2339 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); | 2335 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); |
2340 } | 2336 } |
2341 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 2337 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
2342 ICSlotCache* cache) override { | 2338 ICSlotCache* cache) override { |
2343 yield_first_feedback_slot_ = slot; | 2339 yield_first_feedback_slot_ = slot; |
2344 } | 2340 } |
2345 Code::Kind FeedbackICSlotKind(int index) override { | 2341 Code::Kind FeedbackICSlotKind(int index) override { |
2346 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; | 2342 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 DECLARE_NODE_TYPE(SuperReference) | 2680 DECLARE_NODE_TYPE(SuperReference) |
2685 | 2681 |
2686 VariableProxy* this_var() const { return this_var_; } | 2682 VariableProxy* this_var() const { return this_var_; } |
2687 | 2683 |
2688 static int num_ids() { return parent_num_ids() + 1; } | 2684 static int num_ids() { return parent_num_ids() + 1; } |
2689 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } | 2685 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } |
2690 | 2686 |
2691 // Type feedback information. | 2687 // Type feedback information. |
2692 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2688 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2693 Isolate* isolate, const ICSlotCache* cache) override { | 2689 Isolate* isolate, const ICSlotCache* cache) override { |
2694 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 2690 return FeedbackVectorRequirements(0, 1); |
2695 } | 2691 } |
2696 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 2692 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
2697 ICSlotCache* cache) override { | 2693 ICSlotCache* cache) override { |
2698 homeobject_feedback_slot_ = slot; | 2694 homeobject_feedback_slot_ = slot; |
2699 } | 2695 } |
2700 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 2696 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
2701 | 2697 |
2702 FeedbackVectorICSlot HomeObjectFeedbackSlot() { | 2698 FeedbackVectorICSlot HomeObjectFeedbackSlot() { |
2703 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); | 2699 DCHECK(!homeobject_feedback_slot_.IsInvalid()); |
2704 return homeobject_feedback_slot_; | 2700 return homeobject_feedback_slot_; |
2705 } | 2701 } |
2706 | 2702 |
2707 protected: | 2703 protected: |
2708 SuperReference(Zone* zone, VariableProxy* this_var, int pos) | 2704 SuperReference(Zone* zone, VariableProxy* this_var, int pos) |
2709 : Expression(zone, pos), | 2705 : Expression(zone, pos), |
2710 this_var_(this_var), | 2706 this_var_(this_var), |
2711 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { | 2707 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { |
2712 DCHECK(this_var->is_this()); | 2708 DCHECK(this_var->is_this()); |
2713 } | 2709 } |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 | 3484 |
3489 private: | 3485 private: |
3490 Zone* zone_; | 3486 Zone* zone_; |
3491 AstValueFactory* ast_value_factory_; | 3487 AstValueFactory* ast_value_factory_; |
3492 }; | 3488 }; |
3493 | 3489 |
3494 | 3490 |
3495 } } // namespace v8::internal | 3491 } } // namespace v8::internal |
3496 | 3492 |
3497 #endif // V8_AST_H_ | 3493 #endif // V8_AST_H_ |
OLD | NEW |