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 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 | 2084 |
2085 bool pretenure() { return Pretenure::decode(bitfield_); } | 2085 bool pretenure() { return Pretenure::decode(bitfield_); } |
2086 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2086 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
2087 | 2087 |
2088 bool has_duplicate_parameters() { | 2088 bool has_duplicate_parameters() { |
2089 return HasDuplicateParameters::decode(bitfield_); | 2089 return HasDuplicateParameters::decode(bitfield_); |
2090 } | 2090 } |
2091 | 2091 |
2092 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } | 2092 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } |
2093 | 2093 |
| 2094 // This is used as a heuristic on when to eagerly compile a function |
| 2095 // literal. We consider the following constructs as hints that the |
| 2096 // function will be called immediately: |
| 2097 // - (function() { ... })(); |
| 2098 // - var x = function() { ... }(); |
2094 bool is_parenthesized() { | 2099 bool is_parenthesized() { |
2095 return IsParenthesized::decode(bitfield_) == kIsParenthesized; | 2100 return IsParenthesized::decode(bitfield_) == kIsParenthesized; |
2096 } | 2101 } |
| 2102 void set_parenthesized() { |
| 2103 bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); |
| 2104 } |
2097 | 2105 |
2098 int ast_node_count() { return ast_properties_.node_count(); } | 2106 int ast_node_count() { return ast_properties_.node_count(); } |
2099 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2107 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
2100 void set_ast_properties(AstProperties* ast_properties) { | 2108 void set_ast_properties(AstProperties* ast_properties) { |
2101 ast_properties_ = *ast_properties; | 2109 ast_properties_ = *ast_properties; |
2102 } | 2110 } |
2103 | 2111 |
2104 protected: | 2112 protected: |
2105 template<class> friend class AstNodeFactory; | 2113 template<class> friend class AstNodeFactory; |
2106 | 2114 |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 private: | 3005 private: |
2998 Isolate* isolate_; | 3006 Isolate* isolate_; |
2999 Zone* zone_; | 3007 Zone* zone_; |
3000 Visitor visitor_; | 3008 Visitor visitor_; |
3001 }; | 3009 }; |
3002 | 3010 |
3003 | 3011 |
3004 } } // namespace v8::internal | 3012 } } // namespace v8::internal |
3005 | 3013 |
3006 #endif // V8_AST_H_ | 3014 #endif // V8_AST_H_ |
OLD | NEW |