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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 typedef ZoneList<Handle<String>> ZoneStringList; | 131 typedef ZoneList<Handle<String>> ZoneStringList; |
132 typedef ZoneList<Handle<Object>> ZoneObjectList; | 132 typedef ZoneList<Handle<Object>> ZoneObjectList; |
133 | 133 |
134 | 134 |
135 #define DECLARE_NODE_TYPE(type) \ | 135 #define DECLARE_NODE_TYPE(type) \ |
136 void Accept(AstVisitor* v) override; \ | 136 void Accept(AstVisitor* v) override; \ |
137 AstNode::NodeType node_type() const final { return AstNode::k##type; } \ | 137 AstNode::NodeType node_type() const final { return AstNode::k##type; } \ |
138 friend class AstNodeFactory; | 138 friend class AstNodeFactory; |
139 | 139 |
140 | 140 |
141 class ICSlotCache { | 141 class FeedbackVectorSlotCache { |
142 public: | 142 public: |
143 explicit ICSlotCache(Zone* zone) | 143 explicit FeedbackVectorSlotCache(Zone* zone) |
144 : zone_(zone), | 144 : zone_(zone), |
145 hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, | 145 hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, |
146 ZoneAllocationPolicy(zone)) {} | 146 ZoneAllocationPolicy(zone)) {} |
147 | 147 |
148 void Put(Variable* variable, FeedbackVectorICSlot slot) { | 148 void Put(Variable* variable, FeedbackVectorSlot slot) { |
149 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( | 149 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
150 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); | 150 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
151 entry->value = reinterpret_cast<void*>(slot.ToInt()); | 151 entry->value = reinterpret_cast<void*>(slot.ToInt()); |
152 } | 152 } |
153 | 153 |
154 ZoneHashMap::Entry* Get(Variable* variable) const { | 154 ZoneHashMap::Entry* Get(Variable* variable) const { |
155 return hash_map_.Lookup(variable, ComputePointerHash(variable)); | 155 return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
156 } | 156 } |
157 | 157 |
158 private: | 158 private: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 223 virtual BreakableStatement* AsBreakableStatement() { return NULL; } |
224 virtual IterationStatement* AsIterationStatement() { return NULL; } | 224 virtual IterationStatement* AsIterationStatement() { return NULL; } |
225 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 225 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } |
226 | 226 |
227 // The interface for feedback slots, with default no-op implementations for | 227 // The interface for feedback slots, with default no-op implementations for |
228 // node types which don't actually have this. Note that this is conceptually | 228 // node types which don't actually have this. Note that this is conceptually |
229 // not really nice, but multiple inheritance would introduce yet another | 229 // not really nice, but multiple inheritance would introduce yet another |
230 // vtable entry per node, something we don't want for space reasons. | 230 // vtable entry per node, something we don't want for space reasons. |
231 virtual void AssignFeedbackVectorSlots(Isolate* isolate, | 231 virtual void AssignFeedbackVectorSlots(Isolate* isolate, |
232 FeedbackVectorSpec* spec, | 232 FeedbackVectorSpec* spec, |
233 ICSlotCache* cache) {} | 233 FeedbackVectorSlotCache* cache) {} |
234 | 234 |
235 private: | 235 private: |
236 // Hidden to prevent accidental usage. It would have to load the | 236 // Hidden to prevent accidental usage. It would have to load the |
237 // current zone from the TLS. | 237 // current zone from the TLS. |
238 void* operator new(size_t size); | 238 void* operator new(size_t size); |
239 | 239 |
240 friend class CaseClause; // Generates AST IDs. | 240 friend class CaseClause; // Generates AST IDs. |
241 | 241 |
242 int position_; | 242 int position_; |
243 }; | 243 }; |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 void Initialize(Expression* each, Expression* subject, Statement* body) { | 770 void Initialize(Expression* each, Expression* subject, Statement* body) { |
771 IterationStatement::Initialize(body); | 771 IterationStatement::Initialize(body); |
772 each_ = each; | 772 each_ = each; |
773 subject_ = subject; | 773 subject_ = subject; |
774 } | 774 } |
775 | 775 |
776 Expression* each() const { return each_; } | 776 Expression* each() const { return each_; } |
777 Expression* subject() const { return subject_; } | 777 Expression* subject() const { return subject_; } |
778 | 778 |
779 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 779 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
780 ICSlotCache* cache) override; | 780 FeedbackVectorSlotCache* cache) override; |
781 FeedbackVectorICSlot EachFeedbackSlot() const { return each_slot_; } | 781 FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; } |
782 | 782 |
783 protected: | 783 protected: |
784 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 784 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
785 : IterationStatement(zone, labels, pos), | 785 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} |
786 each_(NULL), | |
787 subject_(NULL), | |
788 each_slot_(FeedbackVectorICSlot::Invalid()) {} | |
789 | 786 |
790 private: | 787 private: |
791 Expression* each_; | 788 Expression* each_; |
792 Expression* subject_; | 789 Expression* subject_; |
793 FeedbackVectorICSlot each_slot_; | 790 FeedbackVectorSlot each_slot_; |
794 }; | 791 }; |
795 | 792 |
796 | 793 |
797 class ForInStatement final : public ForEachStatement { | 794 class ForInStatement final : public ForEachStatement { |
798 public: | 795 public: |
799 DECLARE_NODE_TYPE(ForInStatement) | 796 DECLARE_NODE_TYPE(ForInStatement) |
800 | 797 |
801 Expression* enumerable() const { | 798 Expression* enumerable() const { |
802 return subject(); | 799 return subject(); |
803 } | 800 } |
804 | 801 |
805 // Type feedback information. | 802 // Type feedback information. |
806 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 803 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
807 ICSlotCache* cache) override { | 804 FeedbackVectorSlotCache* cache) override { |
808 ForEachStatement::AssignFeedbackVectorSlots(isolate, spec, cache); | 805 ForEachStatement::AssignFeedbackVectorSlots(isolate, spec, cache); |
809 for_in_feedback_slot_ = spec->AddStubSlot(); | 806 for_in_feedback_slot_ = spec->AddStubSlot(); |
810 } | 807 } |
811 | 808 |
812 FeedbackVectorSlot ForInFeedbackSlot() { | 809 FeedbackVectorSlot ForInFeedbackSlot() { |
813 DCHECK(!for_in_feedback_slot_.IsInvalid()); | 810 DCHECK(!for_in_feedback_slot_.IsInvalid()); |
814 return for_in_feedback_slot_; | 811 return for_in_feedback_slot_; |
815 } | 812 } |
816 | 813 |
817 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 814 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
818 ForInType for_in_type() const { return for_in_type_; } | 815 ForInType for_in_type() const { return for_in_type_; } |
819 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 816 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
820 | 817 |
821 static int num_ids() { return parent_num_ids() + 6; } | 818 static int num_ids() { return parent_num_ids() + 6; } |
822 BailoutId BodyId() const { return BailoutId(local_id(0)); } | 819 BailoutId BodyId() const { return BailoutId(local_id(0)); } |
823 BailoutId PrepareId() const { return BailoutId(local_id(1)); } | 820 BailoutId PrepareId() const { return BailoutId(local_id(1)); } |
824 BailoutId EnumId() const { return BailoutId(local_id(2)); } | 821 BailoutId EnumId() const { return BailoutId(local_id(2)); } |
825 BailoutId ToObjectId() const { return BailoutId(local_id(3)); } | 822 BailoutId ToObjectId() const { return BailoutId(local_id(3)); } |
826 BailoutId FilterId() const { return BailoutId(local_id(4)); } | 823 BailoutId FilterId() const { return BailoutId(local_id(4)); } |
827 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } | 824 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } |
828 BailoutId ContinueId() const override { return EntryId(); } | 825 BailoutId ContinueId() const override { return EntryId(); } |
829 BailoutId StackCheckId() const override { return BodyId(); } | 826 BailoutId StackCheckId() const override { return BodyId(); } |
830 | 827 |
831 protected: | 828 protected: |
832 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 829 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
833 : ForEachStatement(zone, labels, pos), | 830 : ForEachStatement(zone, labels, pos), for_in_type_(SLOW_FOR_IN) {} |
834 for_in_type_(SLOW_FOR_IN), | |
835 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} | |
836 static int parent_num_ids() { return ForEachStatement::num_ids(); } | 831 static int parent_num_ids() { return ForEachStatement::num_ids(); } |
837 | 832 |
838 private: | 833 private: |
839 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 834 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
840 | 835 |
841 ForInType for_in_type_; | 836 ForInType for_in_type_; |
842 FeedbackVectorSlot for_in_feedback_slot_; | 837 FeedbackVectorSlot for_in_feedback_slot_; |
843 }; | 838 }; |
844 | 839 |
845 | 840 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1376 Handle<Map> GetReceiverType() { return receiver_type_; } | 1371 Handle<Map> GetReceiverType() { return receiver_type_; } |
1377 | 1372 |
1378 bool IsCompileTimeValue(); | 1373 bool IsCompileTimeValue(); |
1379 | 1374 |
1380 void set_emit_store(bool emit_store); | 1375 void set_emit_store(bool emit_store); |
1381 bool emit_store(); | 1376 bool emit_store(); |
1382 | 1377 |
1383 bool is_static() const { return is_static_; } | 1378 bool is_static() const { return is_static_; } |
1384 bool is_computed_name() const { return is_computed_name_; } | 1379 bool is_computed_name() const { return is_computed_name_; } |
1385 | 1380 |
1386 FeedbackVectorICSlot GetSlot(int offset = 0) const { | 1381 FeedbackVectorSlot GetSlot(int offset = 0) const { |
1387 if (slot_.IsInvalid()) return slot_; | 1382 DCHECK_LT(offset, static_cast<int>(arraysize(slots_))); |
1388 int slot = slot_.ToInt(); | 1383 return slots_[offset]; |
1389 return FeedbackVectorICSlot(slot + offset); | |
1390 } | 1384 } |
1391 FeedbackVectorICSlot slot() const { return slot_; } | 1385 void SetSlot(FeedbackVectorSlot slot, int offset = 0) { |
1392 void set_slot(FeedbackVectorICSlot slot) { slot_ = slot; } | 1386 DCHECK_LT(offset, static_cast<int>(arraysize(slots_))); |
1387 slots_[offset] = slot; | |
1388 } | |
1393 | 1389 |
1394 void set_receiver_type(Handle<Map> map) { receiver_type_ = map; } | 1390 void set_receiver_type(Handle<Map> map) { receiver_type_ = map; } |
1395 | 1391 |
1396 protected: | 1392 protected: |
1397 friend class AstNodeFactory; | 1393 friend class AstNodeFactory; |
1398 | 1394 |
1399 ObjectLiteralProperty(Expression* key, Expression* value, Kind kind, | 1395 ObjectLiteralProperty(Expression* key, Expression* value, Kind kind, |
1400 bool is_static, bool is_computed_name); | 1396 bool is_static, bool is_computed_name); |
1401 ObjectLiteralProperty(AstValueFactory* ast_value_factory, Expression* key, | 1397 ObjectLiteralProperty(AstValueFactory* ast_value_factory, Expression* key, |
1402 Expression* value, bool is_static, | 1398 Expression* value, bool is_static, |
1403 bool is_computed_name); | 1399 bool is_computed_name); |
1404 | 1400 |
1405 private: | 1401 private: |
1406 Expression* key_; | 1402 Expression* key_; |
1407 Expression* value_; | 1403 Expression* value_; |
1408 FeedbackVectorICSlot slot_; | 1404 FeedbackVectorSlot slots_[2]; |
1409 Kind kind_; | 1405 Kind kind_; |
1410 bool emit_store_; | 1406 bool emit_store_; |
1411 bool is_static_; | 1407 bool is_static_; |
1412 bool is_computed_name_; | 1408 bool is_computed_name_; |
1413 Handle<Map> receiver_type_; | 1409 Handle<Map> receiver_type_; |
1414 }; | 1410 }; |
1415 | 1411 |
1416 | 1412 |
1417 // An object literal has a boilerplate object that is used | 1413 // An object literal has a boilerplate object that is used |
1418 // for minimizing the work when constructing it at runtime. | 1414 // for minimizing the work when constructing it at runtime. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1479 // Return an AST id for a property that is used in simulate instructions. | 1475 // Return an AST id for a property that is used in simulate instructions. |
1480 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 1)); } | 1476 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 1)); } |
1481 | 1477 |
1482 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1478 // Unlike other AST nodes, this number of bailout IDs allocated for an |
1483 // ObjectLiteral can vary, so num_ids() is not a static method. | 1479 // ObjectLiteral can vary, so num_ids() is not a static method. |
1484 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } | 1480 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } |
1485 | 1481 |
1486 // Object literals need one feedback slot for each non-trivial value, as well | 1482 // Object literals need one feedback slot for each non-trivial value, as well |
1487 // as some slots for home objects. | 1483 // as some slots for home objects. |
1488 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1484 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1489 ICSlotCache* cache) override; | 1485 FeedbackVectorSlotCache* cache) override; |
1490 | 1486 |
1491 protected: | 1487 protected: |
1492 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, | 1488 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, |
1493 int boilerplate_properties, bool has_function, bool is_strong, | 1489 int boilerplate_properties, bool has_function, bool is_strong, |
1494 int pos) | 1490 int pos) |
1495 : MaterializedLiteral(zone, literal_index, is_strong, pos), | 1491 : MaterializedLiteral(zone, literal_index, is_strong, pos), |
1496 properties_(properties), | 1492 properties_(properties), |
1497 boilerplate_properties_(boilerplate_properties), | 1493 boilerplate_properties_(boilerplate_properties), |
1498 fast_elements_(false), | 1494 fast_elements_(false), |
1499 has_elements_(false), | 1495 has_elements_(false), |
1500 may_store_doubles_(false), | 1496 may_store_doubles_(false), |
1501 has_function_(has_function), | 1497 has_function_(has_function) {} |
1502 slot_(FeedbackVectorICSlot::Invalid()) { | |
1503 } | |
1504 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1498 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
1505 | 1499 |
1506 private: | 1500 private: |
1507 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1501 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1508 Handle<FixedArray> constant_properties_; | 1502 Handle<FixedArray> constant_properties_; |
1509 ZoneList<Property*>* properties_; | 1503 ZoneList<Property*>* properties_; |
1510 int boilerplate_properties_; | 1504 int boilerplate_properties_; |
1511 bool fast_elements_; | 1505 bool fast_elements_; |
1512 bool has_elements_; | 1506 bool has_elements_; |
1513 bool may_store_doubles_; | 1507 bool may_store_doubles_; |
1514 bool has_function_; | 1508 bool has_function_; |
1515 FeedbackVectorICSlot slot_; | 1509 FeedbackVectorSlot slot_; |
1516 }; | 1510 }; |
1517 | 1511 |
1518 | 1512 |
1519 // Node for capturing a regexp literal. | 1513 // Node for capturing a regexp literal. |
1520 class RegExpLiteral final : public MaterializedLiteral { | 1514 class RegExpLiteral final : public MaterializedLiteral { |
1521 public: | 1515 public: |
1522 DECLARE_NODE_TYPE(RegExpLiteral) | 1516 DECLARE_NODE_TYPE(RegExpLiteral) |
1523 | 1517 |
1524 Handle<String> pattern() const { return pattern_->string(); } | 1518 Handle<String> pattern() const { return pattern_->string(); } |
1525 Handle<String> flags() const { return flags_->string(); } | 1519 Handle<String> flags() const { return flags_->string(); } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1649 int end_position() const { return end_position_; } | 1643 int end_position() const { return end_position_; } |
1650 | 1644 |
1651 // Bind this proxy to the variable var. | 1645 // Bind this proxy to the variable var. |
1652 void BindTo(Variable* var); | 1646 void BindTo(Variable* var); |
1653 | 1647 |
1654 bool UsesVariableFeedbackSlot() const { | 1648 bool UsesVariableFeedbackSlot() const { |
1655 return var()->IsUnallocated() || var()->IsLookupSlot(); | 1649 return var()->IsUnallocated() || var()->IsLookupSlot(); |
1656 } | 1650 } |
1657 | 1651 |
1658 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1652 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1659 ICSlotCache* cache) override; | 1653 FeedbackVectorSlotCache* cache) override; |
1660 | 1654 |
1661 FeedbackVectorICSlot VariableFeedbackSlot() { | 1655 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } |
1662 return variable_feedback_slot_; | |
1663 } | |
1664 | 1656 |
1665 static int num_ids() { return parent_num_ids() + 1; } | 1657 static int num_ids() { return parent_num_ids() + 1; } |
1666 BailoutId BeforeId() const { return BailoutId(local_id(0)); } | 1658 BailoutId BeforeId() const { return BailoutId(local_id(0)); } |
1667 | 1659 |
1668 protected: | 1660 protected: |
1669 VariableProxy(Zone* zone, Variable* var, int start_position, | 1661 VariableProxy(Zone* zone, Variable* var, int start_position, |
1670 int end_position); | 1662 int end_position); |
1671 | 1663 |
1672 VariableProxy(Zone* zone, const AstRawString* name, | 1664 VariableProxy(Zone* zone, const AstRawString* name, |
1673 Variable::Kind variable_kind, int start_position, | 1665 Variable::Kind variable_kind, int start_position, |
1674 int end_position); | 1666 int end_position); |
1675 static int parent_num_ids() { return Expression::num_ids(); } | 1667 static int parent_num_ids() { return Expression::num_ids(); } |
1676 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1668 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1677 | 1669 |
1678 class IsThisField : public BitField8<bool, 0, 1> {}; | 1670 class IsThisField : public BitField8<bool, 0, 1> {}; |
1679 class IsAssignedField : public BitField8<bool, 1, 1> {}; | 1671 class IsAssignedField : public BitField8<bool, 1, 1> {}; |
1680 class IsResolvedField : public BitField8<bool, 2, 1> {}; | 1672 class IsResolvedField : public BitField8<bool, 2, 1> {}; |
1681 class IsNewTargetField : public BitField8<bool, 3, 1> {}; | 1673 class IsNewTargetField : public BitField8<bool, 3, 1> {}; |
1682 | 1674 |
1683 // Start with 16-bit (or smaller) field, which should get packed together | 1675 // Start with 16-bit (or smaller) field, which should get packed together |
1684 // with Expression's trailing 16-bit field. | 1676 // with Expression's trailing 16-bit field. |
1685 uint8_t bit_field_; | 1677 uint8_t bit_field_; |
1686 FeedbackVectorICSlot variable_feedback_slot_; | 1678 FeedbackVectorSlot variable_feedback_slot_; |
1687 union { | 1679 union { |
1688 const AstRawString* raw_name_; // if !is_resolved_ | 1680 const AstRawString* raw_name_; // if !is_resolved_ |
1689 Variable* var_; // if is_resolved_ | 1681 Variable* var_; // if is_resolved_ |
1690 }; | 1682 }; |
1691 // Position is stored in the AstNode superclass, but VariableProxy needs to | 1683 // Position is stored in the AstNode superclass, but VariableProxy needs to |
1692 // know its end position too (for error messages). It cannot be inferred from | 1684 // know its end position too (for error messages). It cannot be inferred from |
1693 // the variable name length because it can contain escapes. | 1685 // the variable name length because it can contain escapes. |
1694 int end_position_; | 1686 int end_position_; |
1695 }; | 1687 }; |
1696 | 1688 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1748 bit_field_ = InlineCacheStateField::update(bit_field_, state); | 1740 bit_field_ = InlineCacheStateField::update(bit_field_, state); |
1749 } | 1741 } |
1750 void mark_for_call() { | 1742 void mark_for_call() { |
1751 bit_field_ = IsForCallField::update(bit_field_, true); | 1743 bit_field_ = IsForCallField::update(bit_field_, true); |
1752 } | 1744 } |
1753 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | 1745 bool is_for_call() const { return IsForCallField::decode(bit_field_); } |
1754 | 1746 |
1755 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } | 1747 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } |
1756 | 1748 |
1757 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1749 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1758 ICSlotCache* cache) override { | 1750 FeedbackVectorSlotCache* cache) override { |
1759 FeedbackVectorSlotKind kind = key()->IsPropertyName() | 1751 FeedbackVectorSlotKind kind = key()->IsPropertyName() |
1760 ? FeedbackVectorSlotKind::LOAD_IC | 1752 ? FeedbackVectorSlotKind::LOAD_IC |
1761 : FeedbackVectorSlotKind::KEYED_LOAD_IC; | 1753 : FeedbackVectorSlotKind::KEYED_LOAD_IC; |
1762 property_feedback_slot_ = spec->AddSlot(kind); | 1754 property_feedback_slot_ = spec->AddSlot(kind); |
1763 } | 1755 } |
1764 | 1756 |
1765 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1757 FeedbackVectorSlot PropertyFeedbackSlot() const { |
1766 return property_feedback_slot_; | 1758 return property_feedback_slot_; |
1767 } | 1759 } |
1768 | 1760 |
1769 static LhsKind GetAssignType(Property* property) { | 1761 static LhsKind GetAssignType(Property* property) { |
1770 if (property == NULL) return VARIABLE; | 1762 if (property == NULL) return VARIABLE; |
1771 bool super_access = property->IsSuperAccess(); | 1763 bool super_access = property->IsSuperAccess(); |
1772 return (property->key()->IsPropertyName()) | 1764 return (property->key()->IsPropertyName()) |
1773 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) | 1765 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) |
1774 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY); | 1766 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY); |
1775 } | 1767 } |
1776 | 1768 |
1777 protected: | 1769 protected: |
1778 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1770 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1779 : Expression(zone, pos), | 1771 : Expression(zone, pos), |
1780 bit_field_(IsForCallField::encode(false) | | 1772 bit_field_(IsForCallField::encode(false) | |
1781 IsStringAccessField::encode(false) | | 1773 IsStringAccessField::encode(false) | |
1782 InlineCacheStateField::encode(UNINITIALIZED)), | 1774 InlineCacheStateField::encode(UNINITIALIZED)), |
1783 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), | |
1784 obj_(obj), | 1775 obj_(obj), |
1785 key_(key) {} | 1776 key_(key) {} |
1786 static int parent_num_ids() { return Expression::num_ids(); } | 1777 static int parent_num_ids() { return Expression::num_ids(); } |
1787 | 1778 |
1788 private: | 1779 private: |
1789 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1780 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1790 | 1781 |
1791 class IsForCallField : public BitField8<bool, 0, 1> {}; | 1782 class IsForCallField : public BitField8<bool, 0, 1> {}; |
1792 class IsStringAccessField : public BitField8<bool, 1, 1> {}; | 1783 class IsStringAccessField : public BitField8<bool, 1, 1> {}; |
1793 class KeyTypeField : public BitField8<IcCheckType, 2, 1> {}; | 1784 class KeyTypeField : public BitField8<IcCheckType, 2, 1> {}; |
1794 class InlineCacheStateField : public BitField8<InlineCacheState, 3, 4> {}; | 1785 class InlineCacheStateField : public BitField8<InlineCacheState, 3, 4> {}; |
1795 uint8_t bit_field_; | 1786 uint8_t bit_field_; |
1796 FeedbackVectorICSlot property_feedback_slot_; | 1787 FeedbackVectorSlot property_feedback_slot_; |
1797 Expression* obj_; | 1788 Expression* obj_; |
1798 Expression* key_; | 1789 Expression* key_; |
1799 SmallMapList receiver_types_; | 1790 SmallMapList receiver_types_; |
1800 }; | 1791 }; |
1801 | 1792 |
1802 | 1793 |
1803 class Call final : public Expression { | 1794 class Call final : public Expression { |
1804 public: | 1795 public: |
1805 DECLARE_NODE_TYPE(Call) | 1796 DECLARE_NODE_TYPE(Call) |
1806 | 1797 |
1807 Expression* expression() const { return expression_; } | 1798 Expression* expression() const { return expression_; } |
1808 ZoneList<Expression*>* arguments() const { return arguments_; } | 1799 ZoneList<Expression*>* arguments() const { return arguments_; } |
1809 | 1800 |
1810 // Type feedback information. | 1801 // Type feedback information. |
1811 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1802 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1812 ICSlotCache* cache) override; | 1803 FeedbackVectorSlotCache* cache) override; |
1813 | 1804 |
1814 FeedbackVectorSlot CallFeedbackSlot() const { return slot_; } | 1805 FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; } |
1815 | 1806 |
1816 FeedbackVectorICSlot CallFeedbackICSlot() const { return ic_slot_; } | 1807 FeedbackVectorSlot CallFeedbackICSlot() const { return ic_slot_; } |
1817 | 1808 |
1818 SmallMapList* GetReceiverTypes() override { | 1809 SmallMapList* GetReceiverTypes() override { |
1819 if (expression()->IsProperty()) { | 1810 if (expression()->IsProperty()) { |
1820 return expression()->AsProperty()->GetReceiverTypes(); | 1811 return expression()->AsProperty()->GetReceiverTypes(); |
1821 } | 1812 } |
1822 return NULL; | 1813 return NULL; |
1823 } | 1814 } |
1824 | 1815 |
1825 bool IsMonomorphic() override { | 1816 bool IsMonomorphic() override { |
1826 if (expression()->IsProperty()) { | 1817 if (expression()->IsProperty()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1879 | 1870 |
1880 #ifdef DEBUG | 1871 #ifdef DEBUG |
1881 // Used to assert that the FullCodeGenerator records the return site. | 1872 // Used to assert that the FullCodeGenerator records the return site. |
1882 bool return_is_recorded_; | 1873 bool return_is_recorded_; |
1883 #endif | 1874 #endif |
1884 | 1875 |
1885 protected: | 1876 protected: |
1886 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1877 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
1887 int pos) | 1878 int pos) |
1888 : Expression(zone, pos), | 1879 : Expression(zone, pos), |
1889 ic_slot_(FeedbackVectorICSlot::Invalid()), | |
1890 slot_(FeedbackVectorSlot::Invalid()), | |
1891 expression_(expression), | 1880 expression_(expression), |
1892 arguments_(arguments), | 1881 arguments_(arguments), |
1893 bit_field_(IsUninitializedField::encode(false)) { | 1882 bit_field_(IsUninitializedField::encode(false)) { |
1894 if (expression->IsProperty()) { | 1883 if (expression->IsProperty()) { |
1895 expression->AsProperty()->mark_for_call(); | 1884 expression->AsProperty()->mark_for_call(); |
1896 } | 1885 } |
1897 } | 1886 } |
1898 static int parent_num_ids() { return Expression::num_ids(); } | 1887 static int parent_num_ids() { return Expression::num_ids(); } |
1899 | 1888 |
1900 private: | 1889 private: |
1901 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1890 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1902 | 1891 |
1903 FeedbackVectorICSlot ic_slot_; | 1892 FeedbackVectorSlot ic_slot_; |
1904 FeedbackVectorSlot slot_; | 1893 FeedbackVectorSlot stub_slot_; |
1905 Expression* expression_; | 1894 Expression* expression_; |
1906 ZoneList<Expression*>* arguments_; | 1895 ZoneList<Expression*>* arguments_; |
1907 Handle<JSFunction> target_; | 1896 Handle<JSFunction> target_; |
1908 Handle<AllocationSite> allocation_site_; | 1897 Handle<AllocationSite> allocation_site_; |
1909 class IsUninitializedField : public BitField8<bool, 0, 1> {}; | 1898 class IsUninitializedField : public BitField8<bool, 0, 1> {}; |
1910 uint8_t bit_field_; | 1899 uint8_t bit_field_; |
1911 }; | 1900 }; |
1912 | 1901 |
1913 | 1902 |
1914 class CallNew final : public Expression { | 1903 class CallNew final : public Expression { |
1915 public: | 1904 public: |
1916 DECLARE_NODE_TYPE(CallNew) | 1905 DECLARE_NODE_TYPE(CallNew) |
1917 | 1906 |
1918 Expression* expression() const { return expression_; } | 1907 Expression* expression() const { return expression_; } |
1919 ZoneList<Expression*>* arguments() const { return arguments_; } | 1908 ZoneList<Expression*>* arguments() const { return arguments_; } |
1920 | 1909 |
1921 // Type feedback information. | 1910 // Type feedback information. |
1922 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1911 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1923 ICSlotCache* cache) override { | 1912 FeedbackVectorSlotCache* cache) override { |
1924 callnew_feedback_slot_ = spec->AddStubSlot(); | 1913 callnew_feedback_slot_ = spec->AddStubSlot(); |
1925 } | 1914 } |
1926 | 1915 |
1927 FeedbackVectorSlot CallNewFeedbackSlot() { | 1916 FeedbackVectorSlot CallNewFeedbackSlot() { |
1928 DCHECK(!callnew_feedback_slot_.IsInvalid()); | 1917 DCHECK(!callnew_feedback_slot_.IsInvalid()); |
1929 return callnew_feedback_slot_; | 1918 return callnew_feedback_slot_; |
1930 } | 1919 } |
1931 | 1920 |
1932 bool IsMonomorphic() override { return is_monomorphic_; } | 1921 bool IsMonomorphic() override { return is_monomorphic_; } |
1933 Handle<JSFunction> target() const { return target_; } | 1922 Handle<JSFunction> target() const { return target_; } |
(...skipping 14 matching lines...) Expand all Loading... | |
1948 target_ = target; | 1937 target_ = target; |
1949 is_monomorphic_ = true; | 1938 is_monomorphic_ = true; |
1950 } | 1939 } |
1951 | 1940 |
1952 protected: | 1941 protected: |
1953 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1942 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
1954 int pos) | 1943 int pos) |
1955 : Expression(zone, pos), | 1944 : Expression(zone, pos), |
1956 expression_(expression), | 1945 expression_(expression), |
1957 arguments_(arguments), | 1946 arguments_(arguments), |
1958 is_monomorphic_(false), | 1947 is_monomorphic_(false) {} |
1959 callnew_feedback_slot_(FeedbackVectorSlot::Invalid()) {} | |
1960 | 1948 |
1961 static int parent_num_ids() { return Expression::num_ids(); } | 1949 static int parent_num_ids() { return Expression::num_ids(); } |
1962 | 1950 |
1963 private: | 1951 private: |
1964 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1952 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1965 | 1953 |
1966 Expression* expression_; | 1954 Expression* expression_; |
1967 ZoneList<Expression*>* arguments_; | 1955 ZoneList<Expression*>* arguments_; |
1968 bool is_monomorphic_; | 1956 bool is_monomorphic_; |
1969 Handle<JSFunction> target_; | 1957 Handle<JSFunction> target_; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2144 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } | 2132 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |
2145 BailoutId ToNumberId() const { return BailoutId(local_id(1)); } | 2133 BailoutId ToNumberId() const { return BailoutId(local_id(1)); } |
2146 TypeFeedbackId CountBinOpFeedbackId() const { | 2134 TypeFeedbackId CountBinOpFeedbackId() const { |
2147 return TypeFeedbackId(local_id(2)); | 2135 return TypeFeedbackId(local_id(2)); |
2148 } | 2136 } |
2149 TypeFeedbackId CountStoreFeedbackId() const { | 2137 TypeFeedbackId CountStoreFeedbackId() const { |
2150 return TypeFeedbackId(local_id(3)); | 2138 return TypeFeedbackId(local_id(3)); |
2151 } | 2139 } |
2152 | 2140 |
2153 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2141 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
2154 ICSlotCache* cache) override; | 2142 FeedbackVectorSlotCache* cache) override; |
2155 FeedbackVectorICSlot CountSlot() const { return slot_; } | 2143 FeedbackVectorSlot CountSlot() const { return slot_; } |
2156 | 2144 |
2157 protected: | 2145 protected: |
2158 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, | 2146 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, |
2159 int pos) | 2147 int pos) |
2160 : Expression(zone, pos), | 2148 : Expression(zone, pos), |
2161 bit_field_( | 2149 bit_field_( |
2162 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | | 2150 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | |
2163 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), | 2151 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), |
2164 type_(NULL), | 2152 type_(NULL), |
2165 expression_(expr), | 2153 expression_(expr) {} |
2166 slot_(FeedbackVectorICSlot::Invalid()) {} | |
2167 static int parent_num_ids() { return Expression::num_ids(); } | 2154 static int parent_num_ids() { return Expression::num_ids(); } |
2168 | 2155 |
2169 private: | 2156 private: |
2170 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2157 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2171 | 2158 |
2172 class IsPrefixField : public BitField16<bool, 0, 1> {}; | 2159 class IsPrefixField : public BitField16<bool, 0, 1> {}; |
2173 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; | 2160 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; |
2174 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 3> {}; | 2161 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 3> {}; |
2175 class TokenField : public BitField16<Token::Value, 5, 8> {}; | 2162 class TokenField : public BitField16<Token::Value, 5, 8> {}; |
2176 | 2163 |
2177 // Starts with 16-bit field, which should get packed together with | 2164 // Starts with 16-bit field, which should get packed together with |
2178 // Expression's trailing 16-bit field. | 2165 // Expression's trailing 16-bit field. |
2179 uint16_t bit_field_; | 2166 uint16_t bit_field_; |
2180 Type* type_; | 2167 Type* type_; |
2181 Expression* expression_; | 2168 Expression* expression_; |
2182 SmallMapList receiver_types_; | 2169 SmallMapList receiver_types_; |
2183 FeedbackVectorICSlot slot_; | 2170 FeedbackVectorSlot slot_; |
2184 }; | 2171 }; |
2185 | 2172 |
2186 | 2173 |
2187 class CompareOperation final : public Expression { | 2174 class CompareOperation final : public Expression { |
2188 public: | 2175 public: |
2189 DECLARE_NODE_TYPE(CompareOperation) | 2176 DECLARE_NODE_TYPE(CompareOperation) |
2190 | 2177 |
2191 Token::Value op() const { return op_; } | 2178 Token::Value op() const { return op_; } |
2192 Expression* left() const { return left_; } | 2179 Expression* left() const { return left_; } |
2193 Expression* right() const { return right_; } | 2180 Expression* right() const { return right_; } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2317 bit_field_ = IsUninitializedField::update(bit_field_, b); | 2304 bit_field_ = IsUninitializedField::update(bit_field_, b); |
2318 } | 2305 } |
2319 void set_key_type(IcCheckType key_type) { | 2306 void set_key_type(IcCheckType key_type) { |
2320 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 2307 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
2321 } | 2308 } |
2322 void set_store_mode(KeyedAccessStoreMode mode) { | 2309 void set_store_mode(KeyedAccessStoreMode mode) { |
2323 bit_field_ = StoreModeField::update(bit_field_, mode); | 2310 bit_field_ = StoreModeField::update(bit_field_, mode); |
2324 } | 2311 } |
2325 | 2312 |
2326 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2313 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
2327 ICSlotCache* cache) override; | 2314 FeedbackVectorSlotCache* cache) override; |
2328 FeedbackVectorICSlot AssignmentSlot() const { return slot_; } | 2315 FeedbackVectorSlot AssignmentSlot() const { return slot_; } |
2329 | 2316 |
2330 protected: | 2317 protected: |
2331 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2318 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
2332 int pos); | 2319 int pos); |
2333 static int parent_num_ids() { return Expression::num_ids(); } | 2320 static int parent_num_ids() { return Expression::num_ids(); } |
2334 | 2321 |
2335 private: | 2322 private: |
2336 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2323 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2337 | 2324 |
2338 class IsUninitializedField : public BitField16<bool, 0, 1> {}; | 2325 class IsUninitializedField : public BitField16<bool, 0, 1> {}; |
2339 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; | 2326 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; |
2340 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 3> {}; | 2327 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 3> {}; |
2341 class TokenField : public BitField16<Token::Value, 5, 8> {}; | 2328 class TokenField : public BitField16<Token::Value, 5, 8> {}; |
2342 | 2329 |
2343 // Starts with 16-bit field, which should get packed together with | 2330 // Starts with 16-bit field, which should get packed together with |
2344 // Expression's trailing 16-bit field. | 2331 // Expression's trailing 16-bit field. |
2345 uint16_t bit_field_; | 2332 uint16_t bit_field_; |
2346 Expression* target_; | 2333 Expression* target_; |
2347 Expression* value_; | 2334 Expression* value_; |
2348 BinaryOperation* binary_operation_; | 2335 BinaryOperation* binary_operation_; |
2349 SmallMapList receiver_types_; | 2336 SmallMapList receiver_types_; |
2350 FeedbackVectorICSlot slot_; | 2337 FeedbackVectorSlot slot_; |
2351 }; | 2338 }; |
2352 | 2339 |
2353 | 2340 |
2354 class Yield final : public Expression { | 2341 class Yield final : public Expression { |
2355 public: | 2342 public: |
2356 DECLARE_NODE_TYPE(Yield) | 2343 DECLARE_NODE_TYPE(Yield) |
2357 | 2344 |
2358 enum Kind { | 2345 enum Kind { |
2359 kInitial, // The initial yield that returns the unboxed generator object. | 2346 kInitial, // The initial yield that returns the unboxed generator object. |
2360 kSuspend, // A normal yield: { value: EXPRESSION, done: false } | 2347 kSuspend, // A normal yield: { value: EXPRESSION, done: false } |
2361 kDelegating, // A yield*. | 2348 kDelegating, // A yield*. |
2362 kFinal // A return: { value: EXPRESSION, done: true } | 2349 kFinal // A return: { value: EXPRESSION, done: true } |
2363 }; | 2350 }; |
2364 | 2351 |
2365 Expression* generator_object() const { return generator_object_; } | 2352 Expression* generator_object() const { return generator_object_; } |
2366 Expression* expression() const { return expression_; } | 2353 Expression* expression() const { return expression_; } |
2367 Kind yield_kind() const { return yield_kind_; } | 2354 Kind yield_kind() const { return yield_kind_; } |
2368 | 2355 |
2369 // Type feedback information. | 2356 // Type feedback information. |
2370 bool HasFeedbackSlots() const { return yield_kind() == kDelegating; } | 2357 bool HasFeedbackSlots() const { return yield_kind() == kDelegating; } |
2371 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2358 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
2372 ICSlotCache* cache) override { | 2359 FeedbackVectorSlotCache* cache) override { |
2373 if (HasFeedbackSlots()) { | 2360 if (HasFeedbackSlots()) { |
2374 yield_first_feedback_slot_ = spec->AddKeyedLoadICSlot(); | 2361 yield_first_feedback_slot_ = spec->AddKeyedLoadICSlot(); |
2375 spec->AddLoadICSlots(2); | 2362 keyed_load_feedback_slot_ = spec->AddLoadICSlot(); |
2363 done_feedback_slot_ = spec->AddLoadICSlot(); | |
2376 } | 2364 } |
2377 } | 2365 } |
2378 | 2366 |
2379 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { | 2367 FeedbackVectorSlot KeyedLoadFeedbackSlot() { |
2380 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); | 2368 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); |
2381 return yield_first_feedback_slot_; | 2369 return yield_first_feedback_slot_; |
2382 } | 2370 } |
2383 | 2371 |
2384 FeedbackVectorICSlot DoneFeedbackSlot() { | 2372 FeedbackVectorSlot DoneFeedbackSlot() { return keyed_load_feedback_slot_; } |
2385 return KeyedLoadFeedbackSlot().next(); | |
2386 } | |
2387 | 2373 |
2388 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); } | 2374 FeedbackVectorSlot ValueFeedbackSlot() { return done_feedback_slot_; } |
2389 | 2375 |
2390 protected: | 2376 protected: |
2391 Yield(Zone* zone, Expression* generator_object, Expression* expression, | 2377 Yield(Zone* zone, Expression* generator_object, Expression* expression, |
2392 Kind yield_kind, int pos) | 2378 Kind yield_kind, int pos) |
2393 : Expression(zone, pos), | 2379 : Expression(zone, pos), |
2394 generator_object_(generator_object), | 2380 generator_object_(generator_object), |
2395 expression_(expression), | 2381 expression_(expression), |
2396 yield_kind_(yield_kind), | 2382 yield_kind_(yield_kind) {} |
2397 yield_first_feedback_slot_(FeedbackVectorICSlot::Invalid()) {} | |
2398 | 2383 |
2399 private: | 2384 private: |
2400 Expression* generator_object_; | 2385 Expression* generator_object_; |
2401 Expression* expression_; | 2386 Expression* expression_; |
2402 Kind yield_kind_; | 2387 Kind yield_kind_; |
2403 FeedbackVectorICSlot yield_first_feedback_slot_; | 2388 FeedbackVectorSlot yield_first_feedback_slot_; |
mvstanton
2015/10/01 10:24:31
It's okay to make the size of Yield bigger, but if
Igor Sheludko
2015/10/01 12:46:29
Yes, it's possible but let's leave it simple for n
| |
2389 FeedbackVectorSlot keyed_load_feedback_slot_; | |
2390 FeedbackVectorSlot done_feedback_slot_; | |
2404 }; | 2391 }; |
2405 | 2392 |
2406 | 2393 |
2407 class Throw final : public Expression { | 2394 class Throw final : public Expression { |
2408 public: | 2395 public: |
2409 DECLARE_NODE_TYPE(Throw) | 2396 DECLARE_NODE_TYPE(Throw) |
2410 | 2397 |
2411 Expression* exception() const { return exception_; } | 2398 Expression* exception() const { return exception_; } |
2412 | 2399 |
2413 protected: | 2400 protected: |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2635 // Return an AST id for a property that is used in simulate instructions. | 2622 // Return an AST id for a property that is used in simulate instructions. |
2636 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 4)); } | 2623 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 4)); } |
2637 | 2624 |
2638 // Unlike other AST nodes, this number of bailout IDs allocated for an | 2625 // Unlike other AST nodes, this number of bailout IDs allocated for an |
2639 // ClassLiteral can vary, so num_ids() is not a static method. | 2626 // ClassLiteral can vary, so num_ids() is not a static method. |
2640 int num_ids() const { return parent_num_ids() + 4 + properties()->length(); } | 2627 int num_ids() const { return parent_num_ids() + 4 + properties()->length(); } |
2641 | 2628 |
2642 // Object literals need one feedback slot for each non-trivial value, as well | 2629 // Object literals need one feedback slot for each non-trivial value, as well |
2643 // as some slots for home objects. | 2630 // as some slots for home objects. |
2644 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2631 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
2645 ICSlotCache* cache) override; | 2632 FeedbackVectorSlotCache* cache) override; |
2646 | 2633 |
2647 bool NeedsProxySlot() const { | 2634 bool NeedsProxySlot() const { |
2648 return FLAG_vector_stores && scope() != NULL && | 2635 return FLAG_vector_stores && scope() != NULL && |
2649 class_variable_proxy()->var()->IsUnallocated(); | 2636 class_variable_proxy()->var()->IsUnallocated(); |
2650 } | 2637 } |
2651 | 2638 |
2652 FeedbackVectorICSlot ProxySlot() const { return slot_; } | 2639 FeedbackVectorSlot ProxySlot() const { return slot_; } |
2653 | 2640 |
2654 protected: | 2641 protected: |
2655 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, | 2642 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, |
2656 VariableProxy* class_variable_proxy, Expression* extends, | 2643 VariableProxy* class_variable_proxy, Expression* extends, |
2657 FunctionLiteral* constructor, ZoneList<Property*>* properties, | 2644 FunctionLiteral* constructor, ZoneList<Property*>* properties, |
2658 int start_position, int end_position) | 2645 int start_position, int end_position) |
2659 : Expression(zone, start_position), | 2646 : Expression(zone, start_position), |
2660 raw_name_(name), | 2647 raw_name_(name), |
2661 scope_(scope), | 2648 scope_(scope), |
2662 class_variable_proxy_(class_variable_proxy), | 2649 class_variable_proxy_(class_variable_proxy), |
2663 extends_(extends), | 2650 extends_(extends), |
2664 constructor_(constructor), | 2651 constructor_(constructor), |
2665 properties_(properties), | 2652 properties_(properties), |
2666 end_position_(end_position), | 2653 end_position_(end_position) {} |
2667 slot_(FeedbackVectorICSlot::Invalid()) { | |
2668 } | |
2669 | 2654 |
2670 static int parent_num_ids() { return Expression::num_ids(); } | 2655 static int parent_num_ids() { return Expression::num_ids(); } |
2671 | 2656 |
2672 private: | 2657 private: |
2673 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2658 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2674 | 2659 |
2675 const AstRawString* raw_name_; | 2660 const AstRawString* raw_name_; |
2676 Scope* scope_; | 2661 Scope* scope_; |
2677 VariableProxy* class_variable_proxy_; | 2662 VariableProxy* class_variable_proxy_; |
2678 Expression* extends_; | 2663 Expression* extends_; |
2679 FunctionLiteral* constructor_; | 2664 FunctionLiteral* constructor_; |
2680 ZoneList<Property*>* properties_; | 2665 ZoneList<Property*>* properties_; |
2681 int end_position_; | 2666 int end_position_; |
2682 FeedbackVectorICSlot slot_; | 2667 FeedbackVectorSlot slot_; |
2683 }; | 2668 }; |
2684 | 2669 |
2685 | 2670 |
2686 class NativeFunctionLiteral final : public Expression { | 2671 class NativeFunctionLiteral final : public Expression { |
2687 public: | 2672 public: |
2688 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2673 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
2689 | 2674 |
2690 Handle<String> name() const { return name_->string(); } | 2675 Handle<String> name() const { return name_->string(); } |
2691 v8::Extension* extension() const { return extension_; } | 2676 v8::Extension* extension() const { return extension_; } |
2692 | 2677 |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3619 // the parser-level zone. | 3604 // the parser-level zone. |
3620 Zone* parser_zone_; | 3605 Zone* parser_zone_; |
3621 AstValueFactory* ast_value_factory_; | 3606 AstValueFactory* ast_value_factory_; |
3622 }; | 3607 }; |
3623 | 3608 |
3624 | 3609 |
3625 } // namespace internal | 3610 } // namespace internal |
3626 } // namespace v8 | 3611 } // namespace v8 |
3627 | 3612 |
3628 #endif // V8_AST_H_ | 3613 #endif // V8_AST_H_ |
OLD | NEW |