| 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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 virtual int position() const V8_OVERRIDE { return pos_; } | 1961 virtual int position() const V8_OVERRIDE { return pos_; } |
| 1962 | 1962 |
| 1963 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1963 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
| 1964 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1964 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1965 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1965 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 1966 return &receiver_types_; | 1966 return &receiver_types_; |
| 1967 } | 1967 } |
| 1968 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 1968 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 1969 return store_mode_; | 1969 return store_mode_; |
| 1970 } | 1970 } |
| 1971 TypeInfo type() const { return type_; } | 1971 Handle<Type> type() const { return type_; } |
| 1972 | 1972 |
| 1973 BailoutId AssignmentId() const { return assignment_id_; } | 1973 BailoutId AssignmentId() const { return assignment_id_; } |
| 1974 | 1974 |
| 1975 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 1975 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 1976 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 1976 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| 1977 | 1977 |
| 1978 protected: | 1978 protected: |
| 1979 CountOperation(Isolate* isolate, | 1979 CountOperation(Isolate* isolate, |
| 1980 Token::Value op, | 1980 Token::Value op, |
| 1981 bool is_prefix, | 1981 bool is_prefix, |
| 1982 Expression* expr, | 1982 Expression* expr, |
| 1983 int pos) | 1983 int pos) |
| 1984 : Expression(isolate), | 1984 : Expression(isolate), |
| 1985 op_(op), | 1985 op_(op), |
| 1986 is_prefix_(is_prefix), | 1986 is_prefix_(is_prefix), |
| 1987 is_monomorphic_(false), | 1987 is_monomorphic_(false), |
| 1988 store_mode_(STANDARD_STORE), | 1988 store_mode_(STANDARD_STORE), |
| 1989 expression_(expr), | 1989 expression_(expr), |
| 1990 pos_(pos), | 1990 pos_(pos), |
| 1991 assignment_id_(GetNextId(isolate)), | 1991 assignment_id_(GetNextId(isolate)), |
| 1992 count_id_(GetNextId(isolate)) {} | 1992 count_id_(GetNextId(isolate)) {} |
| 1993 | 1993 |
| 1994 private: | 1994 private: |
| 1995 Token::Value op_; | 1995 Token::Value op_; |
| 1996 bool is_prefix_ : 1; | 1996 bool is_prefix_ : 1; |
| 1997 bool is_monomorphic_ : 1; | 1997 bool is_monomorphic_ : 1; |
| 1998 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 1998 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
| 1999 // must have extra bit. | 1999 // must have extra bit. |
| 2000 TypeInfo type_; | 2000 Handle<Type> type_; |
| 2001 | 2001 |
| 2002 Expression* expression_; | 2002 Expression* expression_; |
| 2003 int pos_; | 2003 int pos_; |
| 2004 const BailoutId assignment_id_; | 2004 const BailoutId assignment_id_; |
| 2005 const TypeFeedbackId count_id_; | 2005 const TypeFeedbackId count_id_; |
| 2006 SmallMapList receiver_types_; | 2006 SmallMapList receiver_types_; |
| 2007 }; | 2007 }; |
| 2008 | 2008 |
| 2009 | 2009 |
| 2010 class CompareOperation V8_FINAL : public Expression { | 2010 class CompareOperation V8_FINAL : public Expression { |
| (...skipping 362 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_; | 2388 v8::Extension* extension() const { return extension_; } |
| 2389 } | |
| 2390 | 2389 |
| 2391 protected: | 2390 protected: |
| 2392 SharedFunctionInfoLiteral( | 2391 NativeFunctionLiteral( |
| 2393 Isolate* isolate, | 2392 Isolate* isolate, Handle<String> name, v8::Extension* extension) |
| 2394 Handle<SharedFunctionInfo> shared_function_info) | 2393 : Expression(isolate), name_(name), extension_(extension) { } |
| 2395 : Expression(isolate), | |
| 2396 shared_function_info_(shared_function_info) { } | |
| 2397 | 2394 |
| 2398 private: | 2395 private: |
| 2399 Handle<SharedFunctionInfo> shared_function_info_; | 2396 Handle<String> name_; |
| 2397 v8::Extension* extension_; |
| 2400 }; | 2398 }; |
| 2401 | 2399 |
| 2402 | 2400 |
| 2403 class ThisFunction V8_FINAL : public Expression { | 2401 class ThisFunction V8_FINAL : public Expression { |
| 2404 public: | 2402 public: |
| 2405 DECLARE_NODE_TYPE(ThisFunction) | 2403 DECLARE_NODE_TYPE(ThisFunction) |
| 2406 | 2404 |
| 2407 protected: | 2405 protected: |
| 2408 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2406 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
| 2409 }; | 2407 }; |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3230 materialized_literal_count, expected_property_count, handler_count, | 3228 materialized_literal_count, expected_property_count, handler_count, |
| 3231 parameter_count, function_type, has_duplicate_parameters, is_function, | 3229 parameter_count, function_type, has_duplicate_parameters, is_function, |
| 3232 is_parenthesized, is_generator); | 3230 is_parenthesized, is_generator); |
| 3233 // Top-level literal doesn't count for the AST's properties. | 3231 // Top-level literal doesn't count for the AST's properties. |
| 3234 if (is_function == FunctionLiteral::kIsFunction) { | 3232 if (is_function == FunctionLiteral::kIsFunction) { |
| 3235 visitor_.VisitFunctionLiteral(lit); | 3233 visitor_.VisitFunctionLiteral(lit); |
| 3236 } | 3234 } |
| 3237 return lit; | 3235 return lit; |
| 3238 } | 3236 } |
| 3239 | 3237 |
| 3240 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral( | 3238 NativeFunctionLiteral* NewNativeFunctionLiteral(Handle<String> name, |
| 3241 Handle<SharedFunctionInfo> shared_function_info) { | 3239 v8::Extension* extension) { |
| 3242 SharedFunctionInfoLiteral* lit = | 3240 NativeFunctionLiteral* lit = |
| 3243 new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info); | 3241 new(zone_) NativeFunctionLiteral(isolate_, name, extension); |
| 3244 VISIT_AND_RETURN(SharedFunctionInfoLiteral, lit) | 3242 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
| 3245 } | 3243 } |
| 3246 | 3244 |
| 3247 ThisFunction* NewThisFunction() { | 3245 ThisFunction* NewThisFunction() { |
| 3248 ThisFunction* fun = new(zone_) ThisFunction(isolate_); | 3246 ThisFunction* fun = new(zone_) ThisFunction(isolate_); |
| 3249 VISIT_AND_RETURN(ThisFunction, fun) | 3247 VISIT_AND_RETURN(ThisFunction, fun) |
| 3250 } | 3248 } |
| 3251 | 3249 |
| 3252 #undef VISIT_AND_RETURN | 3250 #undef VISIT_AND_RETURN |
| 3253 | 3251 |
| 3254 private: | 3252 private: |
| 3255 Isolate* isolate_; | 3253 Isolate* isolate_; |
| 3256 Zone* zone_; | 3254 Zone* zone_; |
| 3257 Visitor visitor_; | 3255 Visitor visitor_; |
| 3258 }; | 3256 }; |
| 3259 | 3257 |
| 3260 | 3258 |
| 3261 } } // namespace v8::internal | 3259 } } // namespace v8::internal |
| 3262 | 3260 |
| 3263 #endif // V8_AST_H_ | 3261 #endif // V8_AST_H_ |
| OLD | NEW |