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

Side by Side Diff: src/ast.h

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/assembler.cc ('k') | src/ast.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 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void AddMapIfMissing(Handle<Map> map, Zone* zone) { 281 void AddMapIfMissing(Handle<Map> map, Zone* zone) {
283 Map* updated = map->CurrentMapForDeprecated(); 282 Map* updated = map->CurrentMapForDeprecated();
284 if (updated == NULL) return; 283 if (updated == NULL) return;
285 map = Handle<Map>(updated); 284 map = Handle<Map>(updated);
286 for (int i = 0; i < length(); ++i) { 285 for (int i = 0; i < length(); ++i) {
287 if (at(i).is_identical_to(map)) return; 286 if (at(i).is_identical_to(map)) return;
288 } 287 }
289 Add(map, zone); 288 Add(map, zone);
290 } 289 }
291 290
291 void FilterForPossibleTransitions(Map* root_map) {
292 for (int i = list_.length() - 1; i >= 0; i--) {
293 if (at(i)->FindRootMap() != root_map) {
294 list_.RemoveElement(list_.at(i));
295 }
296 }
297 }
298
292 void Add(Handle<Map> handle, Zone* zone) { 299 void Add(Handle<Map> handle, Zone* zone) {
293 list_.Add(handle.location(), zone); 300 list_.Add(handle.location(), zone);
294 } 301 }
295 302
296 Handle<Map> at(int i) const { 303 Handle<Map> at(int i) const {
297 return Handle<Map>(list_.at(i)); 304 return Handle<Map>(list_.at(i));
298 } 305 }
299 306
300 Handle<Map> first() const { return at(0); } 307 Handle<Map> first() const { return at(0); }
301 Handle<Map> last() const { return at(length() - 1); } 308 Handle<Map> last() const { return at(length() - 1); }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 367
361 // Type feedback information for assignments and properties. 368 // Type feedback information for assignments and properties.
362 virtual bool IsMonomorphic() { 369 virtual bool IsMonomorphic() {
363 UNREACHABLE(); 370 UNREACHABLE();
364 return false; 371 return false;
365 } 372 }
366 virtual SmallMapList* GetReceiverTypes() { 373 virtual SmallMapList* GetReceiverTypes() {
367 UNREACHABLE(); 374 UNREACHABLE();
368 return NULL; 375 return NULL;
369 } 376 }
370 Handle<Map> GetMonomorphicReceiverType() {
371 ASSERT(IsMonomorphic());
372 SmallMapList* types = GetReceiverTypes();
373 ASSERT(types != NULL && types->length() == 1);
374 return types->at(0);
375 }
376 virtual KeyedAccessStoreMode GetStoreMode() { 377 virtual KeyedAccessStoreMode GetStoreMode() {
377 UNREACHABLE(); 378 UNREACHABLE();
378 return STANDARD_STORE; 379 return STANDARD_STORE;
379 } 380 }
380 381
381 // TODO(rossberg): this should move to its own AST node eventually. 382 // TODO(rossberg): this should move to its own AST node eventually.
382 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 383 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
383 byte to_boolean_types() const { return to_boolean_types_; } 384 byte to_boolean_types() const { return to_boolean_types_; }
384 385
385 BailoutId id() const { return id_; } 386 BailoutId id() const { return id_; }
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 protected: 2032 protected:
2032 CompareOperation(Isolate* isolate, 2033 CompareOperation(Isolate* isolate,
2033 Token::Value op, 2034 Token::Value op,
2034 Expression* left, 2035 Expression* left,
2035 Expression* right, 2036 Expression* right,
2036 int pos) 2037 int pos)
2037 : Expression(isolate), 2038 : Expression(isolate),
2038 op_(op), 2039 op_(op),
2039 left_(left), 2040 left_(left),
2040 right_(right), 2041 right_(right),
2041 pos_(pos) { 2042 pos_(pos),
2043 combined_type_(Type::Null(), isolate) {
2042 ASSERT(Token::IsCompareOp(op)); 2044 ASSERT(Token::IsCompareOp(op));
2043 } 2045 }
2044 2046
2045 private: 2047 private:
2046 Token::Value op_; 2048 Token::Value op_;
2047 Expression* left_; 2049 Expression* left_;
2048 Expression* right_; 2050 Expression* right_;
2049 int pos_; 2051 int pos_;
2050 2052
2051 Handle<Type> combined_type_; 2053 Handle<Type> combined_type_;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 bool is_generator() { 2310 bool is_generator() {
2309 return IsGenerator::decode(bitfield_) == kIsGenerator; 2311 return IsGenerator::decode(bitfield_) == kIsGenerator;
2310 } 2312 }
2311 2313
2312 int ast_node_count() { return ast_properties_.node_count(); } 2314 int ast_node_count() { return ast_properties_.node_count(); }
2313 AstProperties::Flags* flags() { return ast_properties_.flags(); } 2315 AstProperties::Flags* flags() { return ast_properties_.flags(); }
2314 void set_ast_properties(AstProperties* ast_properties) { 2316 void set_ast_properties(AstProperties* ast_properties) {
2315 ast_properties_ = *ast_properties; 2317 ast_properties_ = *ast_properties;
2316 } 2318 }
2317 2319
2320 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; }
2321 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2322 void set_dont_optimize_reason(BailoutReason reason) {
2323 dont_optimize_reason_ = reason;
2324 }
2325
2318 protected: 2326 protected:
2319 FunctionLiteral(Isolate* isolate, 2327 FunctionLiteral(Isolate* isolate,
2320 Handle<String> name, 2328 Handle<String> name,
2321 Scope* scope, 2329 Scope* scope,
2322 ZoneList<Statement*>* body, 2330 ZoneList<Statement*>* body,
2323 int materialized_literal_count, 2331 int materialized_literal_count,
2324 int expected_property_count, 2332 int expected_property_count,
2325 int handler_count, 2333 int handler_count,
2326 int parameter_count, 2334 int parameter_count,
2327 FunctionType function_type, 2335 FunctionType function_type,
2328 ParameterFlag has_duplicate_parameters, 2336 ParameterFlag has_duplicate_parameters,
2329 IsFunctionFlag is_function, 2337 IsFunctionFlag is_function,
2330 IsParenthesizedFlag is_parenthesized, 2338 IsParenthesizedFlag is_parenthesized,
2331 IsGeneratorFlag is_generator) 2339 IsGeneratorFlag is_generator)
2332 : Expression(isolate), 2340 : Expression(isolate),
2333 name_(name), 2341 name_(name),
2334 scope_(scope), 2342 scope_(scope),
2335 body_(body), 2343 body_(body),
2336 inferred_name_(isolate->factory()->empty_string()), 2344 inferred_name_(isolate->factory()->empty_string()),
2345 dont_optimize_reason_(kNoReason),
2337 materialized_literal_count_(materialized_literal_count), 2346 materialized_literal_count_(materialized_literal_count),
2338 expected_property_count_(expected_property_count), 2347 expected_property_count_(expected_property_count),
2339 handler_count_(handler_count), 2348 handler_count_(handler_count),
2340 parameter_count_(parameter_count), 2349 parameter_count_(parameter_count),
2341 function_token_position_(RelocInfo::kNoPosition) { 2350 function_token_position_(RelocInfo::kNoPosition) {
2342 bitfield_ = 2351 bitfield_ =
2343 IsExpression::encode(function_type != DECLARATION) | 2352 IsExpression::encode(function_type != DECLARATION) |
2344 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | 2353 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) |
2345 Pretenure::encode(false) | 2354 Pretenure::encode(false) |
2346 HasDuplicateParameters::encode(has_duplicate_parameters) | 2355 HasDuplicateParameters::encode(has_duplicate_parameters) |
2347 IsFunction::encode(is_function) | 2356 IsFunction::encode(is_function) |
2348 IsParenthesized::encode(is_parenthesized) | 2357 IsParenthesized::encode(is_parenthesized) |
2349 IsGenerator::encode(is_generator); 2358 IsGenerator::encode(is_generator);
2350 } 2359 }
2351 2360
2352 private: 2361 private:
2353 Handle<String> name_; 2362 Handle<String> name_;
2354 Scope* scope_; 2363 Scope* scope_;
2355 ZoneList<Statement*>* body_; 2364 ZoneList<Statement*>* body_;
2356 Handle<String> inferred_name_; 2365 Handle<String> inferred_name_;
2357 AstProperties ast_properties_; 2366 AstProperties ast_properties_;
2367 BailoutReason dont_optimize_reason_;
2358 2368
2359 int materialized_literal_count_; 2369 int materialized_literal_count_;
2360 int expected_property_count_; 2370 int expected_property_count_;
2361 int handler_count_; 2371 int handler_count_;
2362 int parameter_count_; 2372 int parameter_count_;
2363 int function_token_position_; 2373 int function_token_position_;
2364 2374
2365 unsigned bitfield_; 2375 unsigned bitfield_;
2366 class IsExpression: public BitField<bool, 0, 1> {}; 2376 class IsExpression: public BitField<bool, 0, 1> {};
2367 class IsAnonymous: public BitField<bool, 1, 1> {}; 2377 class IsAnonymous: public BitField<bool, 1, 1> {};
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 \ 2832 \
2823 Isolate* isolate_; \ 2833 Isolate* isolate_; \
2824 bool stack_overflow_ 2834 bool stack_overflow_
2825 2835
2826 2836
2827 // ---------------------------------------------------------------------------- 2837 // ----------------------------------------------------------------------------
2828 // Construction time visitor. 2838 // Construction time visitor.
2829 2839
2830 class AstConstructionVisitor BASE_EMBEDDED { 2840 class AstConstructionVisitor BASE_EMBEDDED {
2831 public: 2841 public:
2832 AstConstructionVisitor() { } 2842 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
2833 2843
2834 AstProperties* ast_properties() { return &properties_; } 2844 AstProperties* ast_properties() { return &properties_; }
2845 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2835 2846
2836 private: 2847 private:
2837 template<class> friend class AstNodeFactory; 2848 template<class> friend class AstNodeFactory;
2838 2849
2839 // Node visitors. 2850 // Node visitors.
2840 #define DEF_VISIT(type) \ 2851 #define DEF_VISIT(type) \
2841 void Visit##type(type* node); 2852 void Visit##type(type* node);
2842 AST_NODE_LIST(DEF_VISIT) 2853 AST_NODE_LIST(DEF_VISIT)
2843 #undef DEF_VISIT 2854 #undef DEF_VISIT
2844 2855
2845 void increase_node_count() { properties_.add_node_count(1); } 2856 void increase_node_count() { properties_.add_node_count(1); }
2846 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } 2857 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
2858 void set_dont_optimize_reason(BailoutReason reason) {
2859 dont_optimize_reason_ = reason;
2860 }
2847 2861
2848 AstProperties properties_; 2862 AstProperties properties_;
2863 BailoutReason dont_optimize_reason_;
2849 }; 2864 };
2850 2865
2851 2866
2852 class AstNullVisitor BASE_EMBEDDED { 2867 class AstNullVisitor BASE_EMBEDDED {
2853 public: 2868 public:
2854 // Node visitors. 2869 // Node visitors.
2855 #define DEF_VISIT(type) \ 2870 #define DEF_VISIT(type) \
2856 void Visit##type(type* node) {} 2871 void Visit##type(type* node) {}
2857 AST_NODE_LIST(DEF_VISIT) 2872 AST_NODE_LIST(DEF_VISIT)
2858 #undef DEF_VISIT 2873 #undef DEF_VISIT
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 private: 3257 private:
3243 Isolate* isolate_; 3258 Isolate* isolate_;
3244 Zone* zone_; 3259 Zone* zone_;
3245 Visitor visitor_; 3260 Visitor visitor_;
3246 }; 3261 };
3247 3262
3248 3263
3249 } } // namespace v8::internal 3264 } } // namespace v8::internal
3250 3265
3251 #endif // V8_AST_H_ 3266 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698