Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: src/ast.h

Issue 15993016: Remove the optimized construct stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 int end_position() const; 2154 int end_position() const;
2155 int SourceSize() const { return end_position() - start_position(); } 2155 int SourceSize() const { return end_position() - start_position(); }
2156 bool is_expression() const { return IsExpression::decode(bitfield_); } 2156 bool is_expression() const { return IsExpression::decode(bitfield_); }
2157 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } 2157 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); }
2158 bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; } 2158 bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
2159 LanguageMode language_mode() const; 2159 LanguageMode language_mode() const;
2160 2160
2161 int materialized_literal_count() { return materialized_literal_count_; } 2161 int materialized_literal_count() { return materialized_literal_count_; }
2162 int expected_property_count() { return expected_property_count_; } 2162 int expected_property_count() { return expected_property_count_; }
2163 int handler_count() { return handler_count_; } 2163 int handler_count() { return handler_count_; }
2164 bool has_only_simple_this_property_assignments() {
2165 return HasOnlySimpleThisPropertyAssignments::decode(bitfield_);
2166 }
2167 Handle<FixedArray> this_property_assignments() {
2168 return this_property_assignments_;
2169 }
2170 int parameter_count() { return parameter_count_; } 2164 int parameter_count() { return parameter_count_; }
2171 2165
2172 bool AllowsLazyCompilation(); 2166 bool AllowsLazyCompilation();
2173 bool AllowsLazyCompilationWithoutContext(); 2167 bool AllowsLazyCompilationWithoutContext();
2174 2168
2175 Handle<String> debug_name() const { 2169 Handle<String> debug_name() const {
2176 if (name_->length() > 0) return name_; 2170 if (name_->length() > 0) return name_;
2177 return inferred_name(); 2171 return inferred_name();
2178 } 2172 }
2179 2173
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 } 2208 }
2215 2209
2216 protected: 2210 protected:
2217 FunctionLiteral(Isolate* isolate, 2211 FunctionLiteral(Isolate* isolate,
2218 Handle<String> name, 2212 Handle<String> name,
2219 Scope* scope, 2213 Scope* scope,
2220 ZoneList<Statement*>* body, 2214 ZoneList<Statement*>* body,
2221 int materialized_literal_count, 2215 int materialized_literal_count,
2222 int expected_property_count, 2216 int expected_property_count,
2223 int handler_count, 2217 int handler_count,
2224 bool has_only_simple_this_property_assignments,
2225 Handle<FixedArray> this_property_assignments,
2226 int parameter_count, 2218 int parameter_count,
2227 Type type, 2219 Type type,
2228 ParameterFlag has_duplicate_parameters, 2220 ParameterFlag has_duplicate_parameters,
2229 IsFunctionFlag is_function, 2221 IsFunctionFlag is_function,
2230 IsParenthesizedFlag is_parenthesized, 2222 IsParenthesizedFlag is_parenthesized,
2231 IsGeneratorFlag is_generator) 2223 IsGeneratorFlag is_generator)
2232 : Expression(isolate), 2224 : Expression(isolate),
2233 name_(name), 2225 name_(name),
2234 scope_(scope), 2226 scope_(scope),
2235 body_(body), 2227 body_(body),
2236 this_property_assignments_(this_property_assignments),
2237 inferred_name_(isolate->factory()->empty_string()), 2228 inferred_name_(isolate->factory()->empty_string()),
2238 materialized_literal_count_(materialized_literal_count), 2229 materialized_literal_count_(materialized_literal_count),
2239 expected_property_count_(expected_property_count), 2230 expected_property_count_(expected_property_count),
2240 handler_count_(handler_count), 2231 handler_count_(handler_count),
2241 parameter_count_(parameter_count), 2232 parameter_count_(parameter_count),
2242 function_token_position_(RelocInfo::kNoPosition) { 2233 function_token_position_(RelocInfo::kNoPosition) {
2243 bitfield_ = 2234 bitfield_ =
2244 HasOnlySimpleThisPropertyAssignments::encode(
2245 has_only_simple_this_property_assignments) |
2246 IsExpression::encode(type != DECLARATION) | 2235 IsExpression::encode(type != DECLARATION) |
2247 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) | 2236 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) |
2248 Pretenure::encode(false) | 2237 Pretenure::encode(false) |
2249 HasDuplicateParameters::encode(has_duplicate_parameters) | 2238 HasDuplicateParameters::encode(has_duplicate_parameters) |
2250 IsFunction::encode(is_function) | 2239 IsFunction::encode(is_function) |
2251 IsParenthesized::encode(is_parenthesized) | 2240 IsParenthesized::encode(is_parenthesized) |
2252 IsGenerator::encode(is_generator); 2241 IsGenerator::encode(is_generator);
2253 } 2242 }
2254 2243
2255 private: 2244 private:
2256 Handle<String> name_; 2245 Handle<String> name_;
2257 Scope* scope_; 2246 Scope* scope_;
2258 ZoneList<Statement*>* body_; 2247 ZoneList<Statement*>* body_;
2259 Handle<FixedArray> this_property_assignments_;
2260 Handle<String> inferred_name_; 2248 Handle<String> inferred_name_;
2261 AstProperties ast_properties_; 2249 AstProperties ast_properties_;
2262 2250
2263 int materialized_literal_count_; 2251 int materialized_literal_count_;
2264 int expected_property_count_; 2252 int expected_property_count_;
2265 int handler_count_; 2253 int handler_count_;
2266 int parameter_count_; 2254 int parameter_count_;
2267 int function_token_position_; 2255 int function_token_position_;
2268 2256
2269 unsigned bitfield_; 2257 unsigned bitfield_;
2270 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {}; 2258 class IsExpression: public BitField<bool, 0, 1> {};
2271 class IsExpression: public BitField<bool, 1, 1> {}; 2259 class IsAnonymous: public BitField<bool, 1, 1> {};
2272 class IsAnonymous: public BitField<bool, 2, 1> {}; 2260 class Pretenure: public BitField<bool, 2, 1> {};
2273 class Pretenure: public BitField<bool, 3, 1> {}; 2261 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {};
2274 class HasDuplicateParameters: public BitField<ParameterFlag, 4, 1> {}; 2262 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {};
2275 class IsFunction: public BitField<IsFunctionFlag, 5, 1> {}; 2263 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
2276 class IsParenthesized: public BitField<IsParenthesizedFlag, 6, 1> {}; 2264 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {};
2277 class IsGenerator: public BitField<IsGeneratorFlag, 7, 1> {};
2278 }; 2265 };
2279 2266
2280 2267
2281 class SharedFunctionInfoLiteral: public Expression { 2268 class SharedFunctionInfoLiteral: public Expression {
2282 public: 2269 public:
2283 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) 2270 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral)
2284 2271
2285 Handle<SharedFunctionInfo> shared_function_info() const { 2272 Handle<SharedFunctionInfo> shared_function_info() const {
2286 return shared_function_info_; 2273 return shared_function_info_;
2287 } 2274 }
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 VISIT_AND_RETURN(Throw, t) 3077 VISIT_AND_RETURN(Throw, t)
3091 } 3078 }
3092 3079
3093 FunctionLiteral* NewFunctionLiteral( 3080 FunctionLiteral* NewFunctionLiteral(
3094 Handle<String> name, 3081 Handle<String> name,
3095 Scope* scope, 3082 Scope* scope,
3096 ZoneList<Statement*>* body, 3083 ZoneList<Statement*>* body,
3097 int materialized_literal_count, 3084 int materialized_literal_count,
3098 int expected_property_count, 3085 int expected_property_count,
3099 int handler_count, 3086 int handler_count,
3100 bool has_only_simple_this_property_assignments,
3101 Handle<FixedArray> this_property_assignments,
3102 int parameter_count, 3087 int parameter_count,
3103 FunctionLiteral::ParameterFlag has_duplicate_parameters, 3088 FunctionLiteral::ParameterFlag has_duplicate_parameters,
3104 FunctionLiteral::Type type, 3089 FunctionLiteral::Type type,
3105 FunctionLiteral::IsFunctionFlag is_function, 3090 FunctionLiteral::IsFunctionFlag is_function,
3106 FunctionLiteral::IsParenthesizedFlag is_parenthesized, 3091 FunctionLiteral::IsParenthesizedFlag is_parenthesized,
3107 FunctionLiteral::IsGeneratorFlag is_generator) { 3092 FunctionLiteral::IsGeneratorFlag is_generator) {
3108 FunctionLiteral* lit = new(zone_) FunctionLiteral( 3093 FunctionLiteral* lit = new(zone_) FunctionLiteral(
3109 isolate_, name, scope, body, 3094 isolate_, name, scope, body,
3110 materialized_literal_count, expected_property_count, handler_count, 3095 materialized_literal_count, expected_property_count, handler_count,
3111 has_only_simple_this_property_assignments, this_property_assignments,
3112 parameter_count, type, has_duplicate_parameters, is_function, 3096 parameter_count, type, has_duplicate_parameters, is_function,
3113 is_parenthesized, is_generator); 3097 is_parenthesized, is_generator);
3114 // Top-level literal doesn't count for the AST's properties. 3098 // Top-level literal doesn't count for the AST's properties.
3115 if (is_function == FunctionLiteral::kIsFunction) { 3099 if (is_function == FunctionLiteral::kIsFunction) {
3116 visitor_.VisitFunctionLiteral(lit); 3100 visitor_.VisitFunctionLiteral(lit);
3117 } 3101 }
3118 return lit; 3102 return lit;
3119 } 3103 }
3120 3104
3121 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral( 3105 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral(
(...skipping 13 matching lines...) Expand all
3135 private: 3119 private:
3136 Isolate* isolate_; 3120 Isolate* isolate_;
3137 Zone* zone_; 3121 Zone* zone_;
3138 Visitor visitor_; 3122 Visitor visitor_;
3139 }; 3123 };
3140 3124
3141 3125
3142 } } // namespace v8::internal 3126 } } // namespace v8::internal
3143 3127
3144 #endif // V8_AST_H_ 3128 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698