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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 void set_is_resolved() { | 1600 void set_is_resolved() { |
1601 bit_field_ = IsResolvedField::update(bit_field_, true); | 1601 bit_field_ = IsResolvedField::update(bit_field_, true); |
1602 } | 1602 } |
1603 | 1603 |
1604 int end_position() const { return end_position_; } | 1604 int end_position() const { return end_position_; } |
1605 | 1605 |
1606 // Bind this proxy to the variable var. | 1606 // Bind this proxy to the variable var. |
1607 void BindTo(Variable* var); | 1607 void BindTo(Variable* var); |
1608 | 1608 |
1609 bool UsesVariableFeedbackSlot() const { | 1609 bool UsesVariableFeedbackSlot() const { |
1610 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); | 1610 return var()->IsUnallocated() || var()->IsLookupSlot(); |
1611 } | 1611 } |
1612 | 1612 |
1613 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1613 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1614 Isolate* isolate, const ICSlotCache* cache) override; | 1614 Isolate* isolate, const ICSlotCache* cache) override; |
1615 | 1615 |
1616 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1616 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1617 ICSlotCache* cache) override; | 1617 ICSlotCache* cache) override; |
1618 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 1618 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
1619 FeedbackVectorICSlot VariableFeedbackSlot() { | 1619 FeedbackVectorICSlot VariableFeedbackSlot() { |
1620 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); | 1620 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 bit_field_ = IsForCallField::update(bit_field_, true); | 1699 bit_field_ = IsForCallField::update(bit_field_, true); |
1700 } | 1700 } |
1701 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | 1701 bool is_for_call() const { return IsForCallField::decode(bit_field_); } |
1702 | 1702 |
1703 bool IsSuperAccess() { | 1703 bool IsSuperAccess() { |
1704 return obj()->IsSuperReference(); | 1704 return obj()->IsSuperReference(); |
1705 } | 1705 } |
1706 | 1706 |
1707 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1707 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1708 Isolate* isolate, const ICSlotCache* cache) override { | 1708 Isolate* isolate, const ICSlotCache* cache) override { |
1709 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1709 return FeedbackVectorRequirements(0, 1); |
1710 } | 1710 } |
1711 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1711 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1712 ICSlotCache* cache) override { | 1712 ICSlotCache* cache) override { |
1713 property_feedback_slot_ = slot; | 1713 property_feedback_slot_ = slot; |
1714 } | 1714 } |
1715 Code::Kind FeedbackICSlotKind(int index) override { | 1715 Code::Kind FeedbackICSlotKind(int index) override { |
1716 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; | 1716 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; |
1717 } | 1717 } |
1718 | 1718 |
1719 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1719 FeedbackVectorICSlot PropertyFeedbackSlot() const { |
1720 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); | 1720 DCHECK(!property_feedback_slot_.IsInvalid()); |
1721 return property_feedback_slot_; | 1721 return property_feedback_slot_; |
1722 } | 1722 } |
1723 | 1723 |
1724 protected: | 1724 protected: |
1725 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1725 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1726 : Expression(zone, pos), | 1726 : Expression(zone, pos), |
1727 bit_field_(IsForCallField::encode(false) | | 1727 bit_field_(IsForCallField::encode(false) | |
1728 IsStringAccessField::encode(false) | | 1728 IsStringAccessField::encode(false) | |
1729 InlineCacheStateField::encode(UNINITIALIZED)), | 1729 InlineCacheStateField::encode(UNINITIALIZED)), |
1730 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 1730 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 public: | 1947 public: |
1948 DECLARE_NODE_TYPE(CallRuntime) | 1948 DECLARE_NODE_TYPE(CallRuntime) |
1949 | 1949 |
1950 Handle<String> name() const { return raw_name_->string(); } | 1950 Handle<String> name() const { return raw_name_->string(); } |
1951 const AstRawString* raw_name() const { return raw_name_; } | 1951 const AstRawString* raw_name() const { return raw_name_; } |
1952 const Runtime::Function* function() const { return function_; } | 1952 const Runtime::Function* function() const { return function_; } |
1953 ZoneList<Expression*>* arguments() const { return arguments_; } | 1953 ZoneList<Expression*>* arguments() const { return arguments_; } |
1954 bool is_jsruntime() const { return function_ == NULL; } | 1954 bool is_jsruntime() const { return function_ == NULL; } |
1955 | 1955 |
1956 // Type feedback information. | 1956 // Type feedback information. |
1957 bool HasCallRuntimeFeedbackSlot() const { | 1957 bool HasCallRuntimeFeedbackSlot() const { return is_jsruntime(); } |
1958 return FLAG_vector_ics && is_jsruntime(); | |
1959 } | |
1960 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1958 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1961 Isolate* isolate, const ICSlotCache* cache) override { | 1959 Isolate* isolate, const ICSlotCache* cache) override { |
1962 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); | 1960 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); |
1963 } | 1961 } |
1964 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1962 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1965 ICSlotCache* cache) override { | 1963 ICSlotCache* cache) override { |
1966 callruntime_feedback_slot_ = slot; | 1964 callruntime_feedback_slot_ = slot; |
1967 } | 1965 } |
1968 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 1966 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
1969 | 1967 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 int index() const { | 2337 int index() const { |
2340 DCHECK_EQ(kDelegating, yield_kind()); | 2338 DCHECK_EQ(kDelegating, yield_kind()); |
2341 return index_; | 2339 return index_; |
2342 } | 2340 } |
2343 void set_index(int index) { | 2341 void set_index(int index) { |
2344 DCHECK_EQ(kDelegating, yield_kind()); | 2342 DCHECK_EQ(kDelegating, yield_kind()); |
2345 index_ = index; | 2343 index_ = index; |
2346 } | 2344 } |
2347 | 2345 |
2348 // Type feedback information. | 2346 // Type feedback information. |
2349 bool HasFeedbackSlots() const { | 2347 bool HasFeedbackSlots() const { return yield_kind() == kDelegating; } |
2350 return FLAG_vector_ics && (yield_kind() == kDelegating); | |
2351 } | |
2352 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2348 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2353 Isolate* isolate, const ICSlotCache* cache) override { | 2349 Isolate* isolate, const ICSlotCache* cache) override { |
2354 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); | 2350 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); |
2355 } | 2351 } |
2356 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 2352 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
2357 ICSlotCache* cache) override { | 2353 ICSlotCache* cache) override { |
2358 yield_first_feedback_slot_ = slot; | 2354 yield_first_feedback_slot_ = slot; |
2359 } | 2355 } |
2360 Code::Kind FeedbackICSlotKind(int index) override { | 2356 Code::Kind FeedbackICSlotKind(int index) override { |
2361 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; | 2357 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2699 DECLARE_NODE_TYPE(SuperReference) | 2695 DECLARE_NODE_TYPE(SuperReference) |
2700 | 2696 |
2701 VariableProxy* this_var() const { return this_var_; } | 2697 VariableProxy* this_var() const { return this_var_; } |
2702 | 2698 |
2703 static int num_ids() { return parent_num_ids() + 1; } | 2699 static int num_ids() { return parent_num_ids() + 1; } |
2704 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } | 2700 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } |
2705 | 2701 |
2706 // Type feedback information. | 2702 // Type feedback information. |
2707 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2703 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2708 Isolate* isolate, const ICSlotCache* cache) override { | 2704 Isolate* isolate, const ICSlotCache* cache) override { |
2709 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 2705 return FeedbackVectorRequirements(0, 1); |
2710 } | 2706 } |
2711 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 2707 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
2712 ICSlotCache* cache) override { | 2708 ICSlotCache* cache) override { |
2713 homeobject_feedback_slot_ = slot; | 2709 homeobject_feedback_slot_ = slot; |
2714 } | 2710 } |
2715 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } | 2711 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } |
2716 | 2712 |
2717 FeedbackVectorICSlot HomeObjectFeedbackSlot() { | 2713 FeedbackVectorICSlot HomeObjectFeedbackSlot() { |
2718 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); | 2714 DCHECK(!homeobject_feedback_slot_.IsInvalid()); |
2719 return homeobject_feedback_slot_; | 2715 return homeobject_feedback_slot_; |
2720 } | 2716 } |
2721 | 2717 |
2722 protected: | 2718 protected: |
2723 SuperReference(Zone* zone, VariableProxy* this_var, int pos) | 2719 SuperReference(Zone* zone, VariableProxy* this_var, int pos) |
2724 : Expression(zone, pos), | 2720 : Expression(zone, pos), |
2725 this_var_(this_var), | 2721 this_var_(this_var), |
2726 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { | 2722 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { |
2727 DCHECK(this_var->is_this()); | 2723 DCHECK(this_var->is_this()); |
2728 } | 2724 } |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3502 | 3498 |
3503 private: | 3499 private: |
3504 Zone* zone_; | 3500 Zone* zone_; |
3505 AstValueFactory* ast_value_factory_; | 3501 AstValueFactory* ast_value_factory_; |
3506 }; | 3502 }; |
3507 | 3503 |
3508 | 3504 |
3509 } } // namespace v8::internal | 3505 } } // namespace v8::internal |
3510 | 3506 |
3511 #endif // V8_AST_H_ | 3507 #endif // V8_AST_H_ |
OLD | NEW |