OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 V(WhileStatement) \ | 90 V(WhileStatement) \ |
91 V(ForStatement) \ | 91 V(ForStatement) \ |
92 V(ForInStatement) \ | 92 V(ForInStatement) \ |
93 V(ForOfStatement) \ | 93 V(ForOfStatement) \ |
94 V(TryCatchStatement) \ | 94 V(TryCatchStatement) \ |
95 V(TryFinallyStatement) \ | 95 V(TryFinallyStatement) \ |
96 V(DebuggerStatement) | 96 V(DebuggerStatement) |
97 | 97 |
98 #define EXPRESSION_NODE_LIST(V) \ | 98 #define EXPRESSION_NODE_LIST(V) \ |
99 V(FunctionLiteral) \ | 99 V(FunctionLiteral) \ |
100 V(SharedFunctionInfoLiteral) \ | 100 V(NativeFunctionLiteral) \ |
101 V(Conditional) \ | 101 V(Conditional) \ |
102 V(VariableProxy) \ | 102 V(VariableProxy) \ |
103 V(Literal) \ | 103 V(Literal) \ |
104 V(RegExpLiteral) \ | 104 V(RegExpLiteral) \ |
105 V(ObjectLiteral) \ | 105 V(ObjectLiteral) \ |
106 V(ArrayLiteral) \ | 106 V(ArrayLiteral) \ |
107 V(Assignment) \ | 107 V(Assignment) \ |
108 V(Yield) \ | 108 V(Yield) \ |
109 V(Throw) \ | 109 V(Throw) \ |
110 V(Property) \ | 110 V(Property) \ |
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 class IsExpression: public BitField<bool, 0, 1> {}; | 2373 class IsExpression: public BitField<bool, 0, 1> {}; |
2374 class IsAnonymous: public BitField<bool, 1, 1> {}; | 2374 class IsAnonymous: public BitField<bool, 1, 1> {}; |
2375 class Pretenure: public BitField<bool, 2, 1> {}; | 2375 class Pretenure: public BitField<bool, 2, 1> {}; |
2376 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; | 2376 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
2377 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; | 2377 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
2378 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; | 2378 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
2379 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; | 2379 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; |
2380 }; | 2380 }; |
2381 | 2381 |
2382 | 2382 |
2383 class SharedFunctionInfoLiteral V8_FINAL : public Expression { | 2383 class NativeFunctionLiteral V8_FINAL : public Expression { |
2384 public: | 2384 public: |
2385 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 2385 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
2386 | 2386 |
2387 Handle<SharedFunctionInfo> shared_function_info() const { | 2387 Handle<String> name() const { return name_; } |
2388 return shared_function_info_; | |
2389 } | |
2390 | 2388 |
2391 protected: | 2389 protected: |
2392 SharedFunctionInfoLiteral( | 2390 NativeFunctionLiteral(Isolate* isolate, Handle<String> name) |
2393 Isolate* isolate, | 2391 : Expression(isolate), name_(name) { } |
2394 Handle<SharedFunctionInfo> shared_function_info) | |
2395 : Expression(isolate), | |
2396 shared_function_info_(shared_function_info) { } | |
2397 | 2392 |
2398 private: | 2393 private: |
2399 Handle<SharedFunctionInfo> shared_function_info_; | 2394 Handle<String> name_; |
2400 }; | 2395 }; |
2401 | 2396 |
2402 | 2397 |
2403 class ThisFunction V8_FINAL : public Expression { | 2398 class ThisFunction V8_FINAL : public Expression { |
2404 public: | 2399 public: |
2405 DECLARE_NODE_TYPE(ThisFunction) | 2400 DECLARE_NODE_TYPE(ThisFunction) |
2406 | 2401 |
2407 protected: | 2402 protected: |
2408 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2403 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
2409 }; | 2404 }; |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 materialized_literal_count, expected_property_count, handler_count, | 3225 materialized_literal_count, expected_property_count, handler_count, |
3231 parameter_count, function_type, has_duplicate_parameters, is_function, | 3226 parameter_count, function_type, has_duplicate_parameters, is_function, |
3232 is_parenthesized, is_generator); | 3227 is_parenthesized, is_generator); |
3233 // Top-level literal doesn't count for the AST's properties. | 3228 // Top-level literal doesn't count for the AST's properties. |
3234 if (is_function == FunctionLiteral::kIsFunction) { | 3229 if (is_function == FunctionLiteral::kIsFunction) { |
3235 visitor_.VisitFunctionLiteral(lit); | 3230 visitor_.VisitFunctionLiteral(lit); |
3236 } | 3231 } |
3237 return lit; | 3232 return lit; |
3238 } | 3233 } |
3239 | 3234 |
3240 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral( | 3235 NativeFunctionLiteral* NewNativeFunctionLiteral(Handle<String> name) { |
3241 Handle<SharedFunctionInfo> shared_function_info) { | 3236 NativeFunctionLiteral* lit = |
3242 SharedFunctionInfoLiteral* lit = | 3237 new(zone_) NativeFunctionLiteral(isolate_, name); |
3243 new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info); | 3238 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
3244 VISIT_AND_RETURN(SharedFunctionInfoLiteral, lit) | |
3245 } | 3239 } |
3246 | 3240 |
3247 ThisFunction* NewThisFunction() { | 3241 ThisFunction* NewThisFunction() { |
3248 ThisFunction* fun = new(zone_) ThisFunction(isolate_); | 3242 ThisFunction* fun = new(zone_) ThisFunction(isolate_); |
3249 VISIT_AND_RETURN(ThisFunction, fun) | 3243 VISIT_AND_RETURN(ThisFunction, fun) |
3250 } | 3244 } |
3251 | 3245 |
3252 #undef VISIT_AND_RETURN | 3246 #undef VISIT_AND_RETURN |
3253 | 3247 |
3254 private: | 3248 private: |
3255 Isolate* isolate_; | 3249 Isolate* isolate_; |
3256 Zone* zone_; | 3250 Zone* zone_; |
3257 Visitor visitor_; | 3251 Visitor visitor_; |
3258 }; | 3252 }; |
3259 | 3253 |
3260 | 3254 |
3261 } } // namespace v8::internal | 3255 } } // namespace v8::internal |
3262 | 3256 |
3263 #endif // V8_AST_H_ | 3257 #endif // V8_AST_H_ |
OLD | NEW |