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(NativeFunctionLiteral) \ | 100 V(SharedFunctionInfoLiteral) \ |
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 NativeFunctionLiteral V8_FINAL : public Expression { | 2383 class SharedFunctionInfoLiteral V8_FINAL : public Expression { |
2384 public: | 2384 public: |
2385 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2385 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) |
2386 | 2386 |
2387 Handle<String> name() const { return name_; } | 2387 Handle<SharedFunctionInfo> shared_function_info() const { |
| 2388 return shared_function_info_; |
| 2389 } |
2388 | 2390 |
2389 protected: | 2391 protected: |
2390 NativeFunctionLiteral(Isolate* isolate, Handle<String> name) | 2392 SharedFunctionInfoLiteral( |
2391 : Expression(isolate), name_(name) { } | 2393 Isolate* isolate, |
| 2394 Handle<SharedFunctionInfo> shared_function_info) |
| 2395 : Expression(isolate), |
| 2396 shared_function_info_(shared_function_info) { } |
2392 | 2397 |
2393 private: | 2398 private: |
2394 Handle<String> name_; | 2399 Handle<SharedFunctionInfo> shared_function_info_; |
2395 }; | 2400 }; |
2396 | 2401 |
2397 | 2402 |
2398 class ThisFunction V8_FINAL : public Expression { | 2403 class ThisFunction V8_FINAL : public Expression { |
2399 public: | 2404 public: |
2400 DECLARE_NODE_TYPE(ThisFunction) | 2405 DECLARE_NODE_TYPE(ThisFunction) |
2401 | 2406 |
2402 protected: | 2407 protected: |
2403 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2408 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
2404 }; | 2409 }; |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 materialized_literal_count, expected_property_count, handler_count, | 3230 materialized_literal_count, expected_property_count, handler_count, |
3226 parameter_count, function_type, has_duplicate_parameters, is_function, | 3231 parameter_count, function_type, has_duplicate_parameters, is_function, |
3227 is_parenthesized, is_generator); | 3232 is_parenthesized, is_generator); |
3228 // Top-level literal doesn't count for the AST's properties. | 3233 // Top-level literal doesn't count for the AST's properties. |
3229 if (is_function == FunctionLiteral::kIsFunction) { | 3234 if (is_function == FunctionLiteral::kIsFunction) { |
3230 visitor_.VisitFunctionLiteral(lit); | 3235 visitor_.VisitFunctionLiteral(lit); |
3231 } | 3236 } |
3232 return lit; | 3237 return lit; |
3233 } | 3238 } |
3234 | 3239 |
3235 NativeFunctionLiteral* NewNativeFunctionLiteral(Handle<String> name) { | 3240 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral( |
3236 NativeFunctionLiteral* lit = | 3241 Handle<SharedFunctionInfo> shared_function_info) { |
3237 new(zone_) NativeFunctionLiteral(isolate_, name); | 3242 SharedFunctionInfoLiteral* lit = |
3238 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3243 new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info); |
| 3244 VISIT_AND_RETURN(SharedFunctionInfoLiteral, lit) |
3239 } | 3245 } |
3240 | 3246 |
3241 ThisFunction* NewThisFunction() { | 3247 ThisFunction* NewThisFunction() { |
3242 ThisFunction* fun = new(zone_) ThisFunction(isolate_); | 3248 ThisFunction* fun = new(zone_) ThisFunction(isolate_); |
3243 VISIT_AND_RETURN(ThisFunction, fun) | 3249 VISIT_AND_RETURN(ThisFunction, fun) |
3244 } | 3250 } |
3245 | 3251 |
3246 #undef VISIT_AND_RETURN | 3252 #undef VISIT_AND_RETURN |
3247 | 3253 |
3248 private: | 3254 private: |
3249 Isolate* isolate_; | 3255 Isolate* isolate_; |
3250 Zone* zone_; | 3256 Zone* zone_; |
3251 Visitor visitor_; | 3257 Visitor visitor_; |
3252 }; | 3258 }; |
3253 | 3259 |
3254 | 3260 |
3255 } } // namespace v8::internal | 3261 } } // namespace v8::internal |
3256 | 3262 |
3257 #endif // V8_AST_H_ | 3263 #endif // V8_AST_H_ |
OLD | NEW |