OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 Expression* key_; | 857 Expression* key_; |
858 int pos_; | 858 int pos_; |
859 | 859 |
860 // Dummy property used during preparsing | 860 // Dummy property used during preparsing |
861 static Property this_property_; | 861 static Property this_property_; |
862 }; | 862 }; |
863 | 863 |
864 | 864 |
865 class Call: public Expression { | 865 class Call: public Expression { |
866 public: | 866 public: |
| 867 enum EvalType { |
| 868 ALIASED, // Either not eval or an aliased eval. |
| 869 POTENTIALLY_DIRECT // Looks like a direct eval at codegen time. |
| 870 // Needs to be determined at runtime whether the |
| 871 // eval is direct. |
| 872 }; |
| 873 |
867 Call(Expression* expression, | 874 Call(Expression* expression, |
868 ZoneList<Expression*>* arguments, | 875 ZoneList<Expression*>* arguments, |
869 bool is_eval, | 876 EvalType eval_type, |
870 int pos) | 877 int pos) |
871 : expression_(expression), | 878 : expression_(expression), |
872 arguments_(arguments), | 879 arguments_(arguments), |
873 is_eval_(is_eval), | 880 eval_type_(eval_type), |
874 pos_(pos) { } | 881 pos_(pos) { } |
875 | 882 |
876 virtual void Accept(Visitor* v); | 883 virtual void Accept(Visitor* v); |
877 | 884 |
878 // Type testing and conversion. | 885 // Type testing and conversion. |
879 virtual Call* AsCall() { return this; } | 886 virtual Call* AsCall() { return this; } |
880 | 887 |
881 Expression* expression() const { return expression_; } | 888 Expression* expression() const { return expression_; } |
882 ZoneList<Expression*>* arguments() const { return arguments_; } | 889 ZoneList<Expression*>* arguments() const { return arguments_; } |
883 bool is_eval() { return is_eval_; } | 890 EvalType eval_type() { return eval_type_; } |
884 int position() { return pos_; } | 891 int position() { return pos_; } |
885 | 892 |
886 static Call* sentinel() { return &sentinel_; } | 893 static Call* sentinel() { return &sentinel_; } |
887 | 894 |
888 private: | 895 private: |
889 Expression* expression_; | 896 Expression* expression_; |
890 ZoneList<Expression*>* arguments_; | 897 ZoneList<Expression*>* arguments_; |
891 bool is_eval_; | 898 EvalType eval_type_; |
892 int pos_; | 899 int pos_; |
893 | 900 |
894 static Call sentinel_; | 901 static Call sentinel_; |
895 }; | 902 }; |
896 | 903 |
897 | 904 |
898 class CallNew: public Call { | 905 class CallNew: public Call { |
899 public: | 906 public: |
900 CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 907 CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
901 : Call(expression, arguments, false, pos) { } | 908 : Call(expression, arguments, ALIASED, pos) { } |
902 | 909 |
903 virtual void Accept(Visitor* v); | 910 virtual void Accept(Visitor* v); |
904 }; | 911 }; |
905 | 912 |
906 | 913 |
907 // The CallRuntime class does not represent any official JavaScript | 914 // The CallRuntime class does not represent any official JavaScript |
908 // language construct. Instead it is used to call a C or JS function | 915 // language construct. Instead it is used to call a C or JS function |
909 // with a set of arguments. This is used from the builtins that are | 916 // with a set of arguments. This is used from the builtins that are |
910 // implemented in JavaScript (see "v8natives.js"). | 917 // implemented in JavaScript (see "v8natives.js"). |
911 class CallRuntime: public Expression { | 918 class CallRuntime: public Expression { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 #undef DEF_VISIT | 1236 #undef DEF_VISIT |
1230 | 1237 |
1231 private: | 1238 private: |
1232 bool stack_overflow_; | 1239 bool stack_overflow_; |
1233 }; | 1240 }; |
1234 | 1241 |
1235 | 1242 |
1236 } } // namespace v8::internal | 1243 } } // namespace v8::internal |
1237 | 1244 |
1238 #endif // V8_AST_H_ | 1245 #endif // V8_AST_H_ |
OLD | NEW |