OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 Property(Literal* key, Expression* value); | 826 Property(Literal* key, Expression* value); |
827 Property(bool is_getter, FunctionLiteral* value); | 827 Property(bool is_getter, FunctionLiteral* value); |
828 | 828 |
829 Literal* key() { return key_; } | 829 Literal* key() { return key_; } |
830 Expression* value() { return value_; } | 830 Expression* value() { return value_; } |
831 Kind kind() { return kind_; } | 831 Kind kind() { return kind_; } |
832 | 832 |
833 bool IsCompileTimeValue(); | 833 bool IsCompileTimeValue(); |
834 | 834 |
| 835 void set_emit_store(bool emit_store); |
| 836 bool emit_store(); |
| 837 |
835 private: | 838 private: |
836 Literal* key_; | 839 Literal* key_; |
837 Expression* value_; | 840 Expression* value_; |
838 Kind kind_; | 841 Kind kind_; |
| 842 bool emit_store_; |
839 }; | 843 }; |
840 | 844 |
841 ObjectLiteral(Handle<FixedArray> constant_properties, | 845 ObjectLiteral(Handle<FixedArray> constant_properties, |
842 ZoneList<Property*>* properties, | 846 ZoneList<Property*>* properties, |
843 int literal_index, | 847 int literal_index, |
844 bool is_simple, | 848 bool is_simple, |
845 bool fast_elements, | 849 bool fast_elements, |
846 int depth) | 850 int depth) |
847 : MaterializedLiteral(literal_index, is_simple, depth), | 851 : MaterializedLiteral(literal_index, is_simple, depth), |
848 constant_properties_(constant_properties), | 852 constant_properties_(constant_properties), |
849 properties_(properties), | 853 properties_(properties), |
850 fast_elements_(fast_elements) {} | 854 fast_elements_(fast_elements) {} |
851 | 855 |
852 DECLARE_NODE_TYPE(ObjectLiteral) | 856 DECLARE_NODE_TYPE(ObjectLiteral) |
853 | 857 |
854 Handle<FixedArray> constant_properties() const { | 858 Handle<FixedArray> constant_properties() const { |
855 return constant_properties_; | 859 return constant_properties_; |
856 } | 860 } |
857 ZoneList<Property*>* properties() const { return properties_; } | 861 ZoneList<Property*>* properties() const { return properties_; } |
858 | 862 |
859 bool fast_elements() const { return fast_elements_; } | 863 bool fast_elements() const { return fast_elements_; } |
860 | 864 |
| 865 |
| 866 // Mark all computed expressions that are bound to a key that |
| 867 // is shadowed by a later occurrence of the same key. For the |
| 868 // marked expressions, no store code is emitted. |
| 869 void CalculateEmitStore(); |
| 870 |
861 private: | 871 private: |
862 Handle<FixedArray> constant_properties_; | 872 Handle<FixedArray> constant_properties_; |
863 ZoneList<Property*>* properties_; | 873 ZoneList<Property*>* properties_; |
864 bool fast_elements_; | 874 bool fast_elements_; |
865 }; | 875 }; |
866 | 876 |
867 | 877 |
868 // Node for capturing a regexp literal. | 878 // Node for capturing a regexp literal. |
869 class RegExpLiteral: public MaterializedLiteral { | 879 class RegExpLiteral: public MaterializedLiteral { |
870 public: | 880 public: |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 AST_NODE_LIST(DEF_VISIT) | 1896 AST_NODE_LIST(DEF_VISIT) |
1887 #undef DEF_VISIT | 1897 #undef DEF_VISIT |
1888 | 1898 |
1889 private: | 1899 private: |
1890 bool stack_overflow_; | 1900 bool stack_overflow_; |
1891 }; | 1901 }; |
1892 | 1902 |
1893 } } // namespace v8::internal | 1903 } } // namespace v8::internal |
1894 | 1904 |
1895 #endif // V8_AST_H_ | 1905 #endif // V8_AST_H_ |
OLD | NEW |