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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 return !is_this() && name().is_identical_to(n); | 998 return !is_this() && name().is_identical_to(n); |
999 } | 999 } |
1000 | 1000 |
1001 bool IsArguments() { | 1001 bool IsArguments() { |
1002 Variable* variable = AsVariable(); | 1002 Variable* variable = AsVariable(); |
1003 return (variable == NULL) ? false : variable->is_arguments(); | 1003 return (variable == NULL) ? false : variable->is_arguments(); |
1004 } | 1004 } |
1005 | 1005 |
1006 Handle<String> name() const { return name_; } | 1006 Handle<String> name() const { return name_; } |
1007 Variable* var() const { return var_; } | 1007 Variable* var() const { return var_; } |
1008 UseCount* var_uses() { return &var_uses_; } | |
1009 UseCount* obj_uses() { return &obj_uses_; } | |
1010 bool is_this() const { return is_this_; } | 1008 bool is_this() const { return is_this_; } |
1011 bool inside_with() const { return inside_with_; } | 1009 bool inside_with() const { return inside_with_; } |
1012 | 1010 |
1013 // Bind this proxy to the variable var. | 1011 // Bind this proxy to the variable var. |
1014 void BindTo(Variable* var); | 1012 void BindTo(Variable* var); |
1015 | 1013 |
1016 protected: | 1014 protected: |
1017 Handle<String> name_; | 1015 Handle<String> name_; |
1018 Variable* var_; // resolved variable, or NULL | 1016 Variable* var_; // resolved variable, or NULL |
1019 bool is_this_; | 1017 bool is_this_; |
1020 bool inside_with_; | 1018 bool inside_with_; |
1021 | 1019 |
1022 // VariableProxy usage info. | |
1023 UseCount var_uses_; // uses of the variable value | |
1024 UseCount obj_uses_; // uses of the object the variable points to | |
1025 | |
1026 VariableProxy(Handle<String> name, bool is_this, bool inside_with); | 1020 VariableProxy(Handle<String> name, bool is_this, bool inside_with); |
1027 explicit VariableProxy(bool is_this); | 1021 explicit VariableProxy(bool is_this); |
1028 | 1022 |
1029 friend class Scope; | 1023 friend class Scope; |
1030 }; | 1024 }; |
1031 | 1025 |
1032 | 1026 |
1033 class VariableProxySentinel: public VariableProxy { | 1027 class VariableProxySentinel: public VariableProxy { |
1034 public: | 1028 public: |
1035 virtual bool IsValidLeftHandSide() { return !is_this(); } | 1029 virtual bool IsValidLeftHandSide() { return !is_this(); } |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 #undef DEF_VISIT | 1902 #undef DEF_VISIT |
1909 | 1903 |
1910 private: | 1904 private: |
1911 bool stack_overflow_; | 1905 bool stack_overflow_; |
1912 }; | 1906 }; |
1913 | 1907 |
1914 | 1908 |
1915 } } // namespace v8::internal | 1909 } } // namespace v8::internal |
1916 | 1910 |
1917 #endif // V8_AST_H_ | 1911 #endif // V8_AST_H_ |
OLD | NEW |