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

Side by Side Diff: src/hydrogen.h

Issue 16128004: Reorder switch clauses using newly-introduced execution counters in (Closed) Base URL: gh:v8/v8.git@master
Patch Set: tweak heuristic 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
« no previous file with comments | « src/ast.cc ('k') | src/hydrogen.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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 // Search the break stack for a break or continue target. 1388 // Search the break stack for a break or continue target.
1389 enum BreakType { BREAK, CONTINUE }; 1389 enum BreakType { BREAK, CONTINUE };
1390 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); 1390 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra);
1391 1391
1392 private: 1392 private:
1393 BreakAndContinueInfo* info_; 1393 BreakAndContinueInfo* info_;
1394 HOptimizedGraphBuilder* owner_; 1394 HOptimizedGraphBuilder* owner_;
1395 BreakAndContinueScope* next_; 1395 BreakAndContinueScope* next_;
1396 }; 1396 };
1397 1397
1398 class ClauseMapping : public ZoneObject {
1399 public:
1400 ClauseMapping(int index, CaseClause* clause) : index_(index),
1401 clause_(clause) {
1402 }
1403
1404 inline int index() const { return index_; }
1405 inline CaseClause* clause() const { return clause_; }
1406
1407 static int HitCountOrder(ClauseMapping* const* a, ClauseMapping* const* b);
1408
1409 private:
1410 int index_;
1411 CaseClause* clause_;
1412 };
1413
1398 explicit HOptimizedGraphBuilder(CompilationInfo* info); 1414 explicit HOptimizedGraphBuilder(CompilationInfo* info);
1399 1415
1400 virtual bool BuildGraph(); 1416 virtual bool BuildGraph();
1401 1417
1402 // Simple accessors. 1418 // Simple accessors.
1403 BreakAndContinueScope* break_scope() const { return break_scope_; } 1419 BreakAndContinueScope* break_scope() const { return break_scope_; }
1404 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 1420 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
1405 1421
1406 bool inline_bailout() { return inline_bailout_; } 1422 bool inline_bailout() { return inline_bailout_; }
1407 1423
1408 void AddSoftDeoptimize(); 1424 void AddSoftDeoptimize();
1425 HDeoptCounter* AddDeoptCounter(int initial_value, int max_value);
1409 1426
1410 void Bailout(const char* reason); 1427 void Bailout(const char* reason);
1411 1428
1412 HBasicBlock* CreateJoin(HBasicBlock* first, 1429 HBasicBlock* CreateJoin(HBasicBlock* first,
1413 HBasicBlock* second, 1430 HBasicBlock* second,
1414 BailoutId join_id); 1431 BailoutId join_id);
1415 1432
1416 FunctionState* function_state() const { return function_state_; } 1433 FunctionState* function_state() const { return function_state_; }
1417 1434
1418 void VisitDeclarations(ZoneList<Declaration*>* declarations); 1435 void VisitDeclarations(ZoneList<Declaration*>* declarations);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 FunctionState initial_function_state_; 1802 FunctionState initial_function_state_;
1786 1803
1787 // Expression context of the currently visited subexpression. NULL when 1804 // Expression context of the currently visited subexpression. NULL when
1788 // visiting statements. 1805 // visiting statements.
1789 AstContext* ast_context_; 1806 AstContext* ast_context_;
1790 1807
1791 // A stack of breakable statements entered. 1808 // A stack of breakable statements entered.
1792 BreakAndContinueScope* break_scope_; 1809 BreakAndContinueScope* break_scope_;
1793 1810
1794 int inlined_count_; 1811 int inlined_count_;
1812 int deopt_counter_count_;
1795 ZoneList<Handle<Object> > globals_; 1813 ZoneList<Handle<Object> > globals_;
1796 1814
1797 bool inline_bailout_; 1815 bool inline_bailout_;
1798 1816
1799 friend class FunctionState; // Pushes and pops the state stack. 1817 friend class FunctionState; // Pushes and pops the state stack.
1800 friend class AstContext; // Pushes and pops the AST context stack. 1818 friend class AstContext; // Pushes and pops the AST context stack.
1801 friend class KeyedLoadFastElementStub; 1819 friend class KeyedLoadFastElementStub;
1802 1820
1803 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); 1821 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);
1804 }; 1822 };
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 EmbeddedVector<char, 64> filename_; 1968 EmbeddedVector<char, 64> filename_;
1951 HeapStringAllocator string_allocator_; 1969 HeapStringAllocator string_allocator_;
1952 StringStream trace_; 1970 StringStream trace_;
1953 int indent_; 1971 int indent_;
1954 }; 1972 };
1955 1973
1956 1974
1957 } } // namespace v8::internal 1975 } } // namespace v8::internal
1958 1976
1959 #endif // V8_HYDROGEN_H_ 1977 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698