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

Side by Side Diff: src/ast.h

Issue 23817003: Propagate bailout and dont_optimize reasons to cpu-profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 3 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/api.cc ('k') | src/ast.cc » ('j') | src/objects.h » ('J')
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 #define DECLARE_NODE_TYPE(type) \ 164 #define DECLARE_NODE_TYPE(type) \
165 virtual void Accept(AstVisitor* v) V8_OVERRIDE; \ 165 virtual void Accept(AstVisitor* v) V8_OVERRIDE; \
166 virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \ 166 virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \
167 return AstNode::k##type; \ 167 return AstNode::k##type; \
168 } \ 168 } \
169 template<class> friend class AstNodeFactory; 169 template<class> friend class AstNodeFactory;
170 170
171 171
172 enum AstPropertiesFlag { 172 enum AstPropertiesFlag {
173 kDontInline, 173 kDontInline,
174 kDontOptimize,
175 kDontSelfOptimize, 174 kDontSelfOptimize,
176 kDontSoftInline, 175 kDontSoftInline,
177 kDontCache 176 kDontCache
178 }; 177 };
179 178
180 179
181 class AstProperties V8_FINAL BASE_EMBEDDED { 180 class AstProperties V8_FINAL BASE_EMBEDDED {
182 public: 181 public:
183 class Flags : public EnumSet<AstPropertiesFlag, int> {}; 182 class Flags : public EnumSet<AstPropertiesFlag, int> {};
184 183
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 bool is_generator() { 2308 bool is_generator() {
2310 return IsGenerator::decode(bitfield_) == kIsGenerator; 2309 return IsGenerator::decode(bitfield_) == kIsGenerator;
2311 } 2310 }
2312 2311
2313 int ast_node_count() { return ast_properties_.node_count(); } 2312 int ast_node_count() { return ast_properties_.node_count(); }
2314 AstProperties::Flags* flags() { return ast_properties_.flags(); } 2313 AstProperties::Flags* flags() { return ast_properties_.flags(); }
2315 void set_ast_properties(AstProperties* ast_properties) { 2314 void set_ast_properties(AstProperties* ast_properties) {
2316 ast_properties_ = *ast_properties; 2315 ast_properties_ = *ast_properties;
2317 } 2316 }
2318 2317
2318 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; }
2319 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2320 void set_dont_optimize_reason(BailoutReason reason) {
2321 dont_optimize_reason_ = reason;
2322 }
2323
2319 protected: 2324 protected:
2320 FunctionLiteral(Isolate* isolate, 2325 FunctionLiteral(Isolate* isolate,
2321 Handle<String> name, 2326 Handle<String> name,
2322 Scope* scope, 2327 Scope* scope,
2323 ZoneList<Statement*>* body, 2328 ZoneList<Statement*>* body,
2324 int materialized_literal_count, 2329 int materialized_literal_count,
2325 int expected_property_count, 2330 int expected_property_count,
2326 int handler_count, 2331 int handler_count,
2327 int parameter_count, 2332 int parameter_count,
2328 FunctionType function_type, 2333 FunctionType function_type,
2329 ParameterFlag has_duplicate_parameters, 2334 ParameterFlag has_duplicate_parameters,
2330 IsFunctionFlag is_function, 2335 IsFunctionFlag is_function,
2331 IsParenthesizedFlag is_parenthesized, 2336 IsParenthesizedFlag is_parenthesized,
2332 IsGeneratorFlag is_generator) 2337 IsGeneratorFlag is_generator)
2333 : Expression(isolate), 2338 : Expression(isolate),
2334 name_(name), 2339 name_(name),
2335 scope_(scope), 2340 scope_(scope),
2336 body_(body), 2341 body_(body),
2337 inferred_name_(isolate->factory()->empty_string()), 2342 inferred_name_(isolate->factory()->empty_string()),
2343 dont_optimize_reason_(kNoReason),
2338 materialized_literal_count_(materialized_literal_count), 2344 materialized_literal_count_(materialized_literal_count),
2339 expected_property_count_(expected_property_count), 2345 expected_property_count_(expected_property_count),
2340 handler_count_(handler_count), 2346 handler_count_(handler_count),
2341 parameter_count_(parameter_count), 2347 parameter_count_(parameter_count),
2342 function_token_position_(RelocInfo::kNoPosition) { 2348 function_token_position_(RelocInfo::kNoPosition) {
2343 bitfield_ = 2349 bitfield_ =
2344 IsExpression::encode(function_type != DECLARATION) | 2350 IsExpression::encode(function_type != DECLARATION) |
2345 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | 2351 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) |
2346 Pretenure::encode(false) | 2352 Pretenure::encode(false) |
2347 HasDuplicateParameters::encode(has_duplicate_parameters) | 2353 HasDuplicateParameters::encode(has_duplicate_parameters) |
2348 IsFunction::encode(is_function) | 2354 IsFunction::encode(is_function) |
2349 IsParenthesized::encode(is_parenthesized) | 2355 IsParenthesized::encode(is_parenthesized) |
2350 IsGenerator::encode(is_generator); 2356 IsGenerator::encode(is_generator);
2351 } 2357 }
2352 2358
2353 private: 2359 private:
2354 Handle<String> name_; 2360 Handle<String> name_;
2355 Scope* scope_; 2361 Scope* scope_;
2356 ZoneList<Statement*>* body_; 2362 ZoneList<Statement*>* body_;
2357 Handle<String> inferred_name_; 2363 Handle<String> inferred_name_;
2358 AstProperties ast_properties_; 2364 AstProperties ast_properties_;
2365 BailoutReason dont_optimize_reason_;
2359 2366
2360 int materialized_literal_count_; 2367 int materialized_literal_count_;
2361 int expected_property_count_; 2368 int expected_property_count_;
2362 int handler_count_; 2369 int handler_count_;
2363 int parameter_count_; 2370 int parameter_count_;
2364 int function_token_position_; 2371 int function_token_position_;
2365 2372
2366 unsigned bitfield_; 2373 unsigned bitfield_;
2367 class IsExpression: public BitField<bool, 0, 1> {}; 2374 class IsExpression: public BitField<bool, 0, 1> {};
2368 class IsAnonymous: public BitField<bool, 1, 1> {}; 2375 class IsAnonymous: public BitField<bool, 1, 1> {};
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 \ 2830 \
2824 Isolate* isolate_; \ 2831 Isolate* isolate_; \
2825 bool stack_overflow_ 2832 bool stack_overflow_
2826 2833
2827 2834
2828 // ---------------------------------------------------------------------------- 2835 // ----------------------------------------------------------------------------
2829 // Construction time visitor. 2836 // Construction time visitor.
2830 2837
2831 class AstConstructionVisitor BASE_EMBEDDED { 2838 class AstConstructionVisitor BASE_EMBEDDED {
2832 public: 2839 public:
2833 AstConstructionVisitor() { } 2840 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
2834 2841
2835 AstProperties* ast_properties() { return &properties_; } 2842 AstProperties* ast_properties() { return &properties_; }
2843 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2836 2844
2837 private: 2845 private:
2838 template<class> friend class AstNodeFactory; 2846 template<class> friend class AstNodeFactory;
2839 2847
2840 // Node visitors. 2848 // Node visitors.
2841 #define DEF_VISIT(type) \ 2849 #define DEF_VISIT(type) \
2842 void Visit##type(type* node); 2850 void Visit##type(type* node);
2843 AST_NODE_LIST(DEF_VISIT) 2851 AST_NODE_LIST(DEF_VISIT)
2844 #undef DEF_VISIT 2852 #undef DEF_VISIT
2845 2853
2846 void increase_node_count() { properties_.add_node_count(1); } 2854 void increase_node_count() { properties_.add_node_count(1); }
2847 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } 2855 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
2856 void set_dont_optimize_reason(BailoutReason reason) {
2857 dont_optimize_reason_ = reason;
2858 }
2848 2859
2849 AstProperties properties_; 2860 AstProperties properties_;
2861 BailoutReason dont_optimize_reason_;
2850 }; 2862 };
2851 2863
2852 2864
2853 class AstNullVisitor BASE_EMBEDDED { 2865 class AstNullVisitor BASE_EMBEDDED {
2854 public: 2866 public:
2855 // Node visitors. 2867 // Node visitors.
2856 #define DEF_VISIT(type) \ 2868 #define DEF_VISIT(type) \
2857 void Visit##type(type* node) {} 2869 void Visit##type(type* node) {}
2858 AST_NODE_LIST(DEF_VISIT) 2870 AST_NODE_LIST(DEF_VISIT)
2859 #undef DEF_VISIT 2871 #undef DEF_VISIT
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 private: 3255 private:
3244 Isolate* isolate_; 3256 Isolate* isolate_;
3245 Zone* zone_; 3257 Zone* zone_;
3246 Visitor visitor_; 3258 Visitor visitor_;
3247 }; 3259 };
3248 3260
3249 3261
3250 } } // namespace v8::internal 3262 } } // namespace v8::internal
3251 3263
3252 #endif // V8_AST_H_ 3264 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/ast.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698