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

Side by Side Diff: src/x64/lithium-x64.h

Issue 6628012: Refactor polymorphic load and inline function graph construction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1835
1836 class LStackCheck: public LTemplateInstruction<0, 0, 0> { 1836 class LStackCheck: public LTemplateInstruction<0, 0, 0> {
1837 public: 1837 public:
1838 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") 1838 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1839 }; 1839 };
1840 1840
1841 1841
1842 class LChunkBuilder; 1842 class LChunkBuilder;
1843 class LChunk: public ZoneObject { 1843 class LChunk: public ZoneObject {
1844 public: 1844 public:
1845 explicit LChunk(HGraph* graph) 1845 explicit LChunk(CompilationInfo* info, HGraph* graph)
1846 : spill_slot_count_(0), 1846 : spill_slot_count_(0),
1847 info_(info),
1847 graph_(graph), 1848 graph_(graph),
1848 instructions_(32), 1849 instructions_(32),
1849 pointer_maps_(8), 1850 pointer_maps_(8),
1850 inlined_closures_(1) { } 1851 inlined_closures_(1) { }
1851 1852
1852 void AddInstruction(LInstruction* instruction, HBasicBlock* block); 1853 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
1853 LConstantOperand* DefineConstantOperand(HConstant* constant); 1854 LConstantOperand* DefineConstantOperand(HConstant* constant);
1854 Handle<Object> LookupLiteral(LConstantOperand* operand) const; 1855 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
1855 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; 1856 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
1856 1857
1857 int GetNextSpillIndex(bool is_double); 1858 int GetNextSpillIndex(bool is_double);
1858 LOperand* GetNextSpillSlot(bool is_double); 1859 LOperand* GetNextSpillSlot(bool is_double);
1859 1860
1860 int ParameterAt(int index); 1861 int ParameterAt(int index);
1861 int GetParameterStackSlot(int index) const; 1862 int GetParameterStackSlot(int index) const;
1862 int spill_slot_count() const { return spill_slot_count_; } 1863 int spill_slot_count() const { return spill_slot_count_; }
1864 CompilationInfo* info() const { return info_; }
1863 HGraph* graph() const { return graph_; } 1865 HGraph* graph() const { return graph_; }
1864 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } 1866 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
1865 void AddGapMove(int index, LOperand* from, LOperand* to); 1867 void AddGapMove(int index, LOperand* from, LOperand* to);
1866 LGap* GetGapAt(int index) const; 1868 LGap* GetGapAt(int index) const;
1867 bool IsGapAt(int index) const; 1869 bool IsGapAt(int index) const;
1868 int NearestGapPos(int index) const; 1870 int NearestGapPos(int index) const;
1869 void MarkEmptyBlocks(); 1871 void MarkEmptyBlocks();
1870 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } 1872 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
1871 LLabel* GetLabel(int block_id) const { 1873 LLabel* GetLabel(int block_id) const {
1872 HBasicBlock* block = graph_->blocks()->at(block_id); 1874 HBasicBlock* block = graph_->blocks()->at(block_id);
(...skipping 16 matching lines...) Expand all
1889 const ZoneList<Handle<JSFunction> >* inlined_closures() const { 1891 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
1890 return &inlined_closures_; 1892 return &inlined_closures_;
1891 } 1893 }
1892 1894
1893 void AddInlinedClosure(Handle<JSFunction> closure) { 1895 void AddInlinedClosure(Handle<JSFunction> closure) {
1894 inlined_closures_.Add(closure); 1896 inlined_closures_.Add(closure);
1895 } 1897 }
1896 1898
1897 private: 1899 private:
1898 int spill_slot_count_; 1900 int spill_slot_count_;
1901 CompilationInfo* info_;
1899 HGraph* const graph_; 1902 HGraph* const graph_;
1900 ZoneList<LInstruction*> instructions_; 1903 ZoneList<LInstruction*> instructions_;
1901 ZoneList<LPointerMap*> pointer_maps_; 1904 ZoneList<LPointerMap*> pointer_maps_;
1902 ZoneList<Handle<JSFunction> > inlined_closures_; 1905 ZoneList<Handle<JSFunction> > inlined_closures_;
1903 }; 1906 };
1904 1907
1905 1908
1906 class LChunkBuilder BASE_EMBEDDED { 1909 class LChunkBuilder BASE_EMBEDDED {
1907 public: 1910 public:
1908 LChunkBuilder(HGraph* graph, LAllocator* allocator) 1911 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
1909 : chunk_(NULL), 1912 : chunk_(NULL),
1913 info_(info),
1910 graph_(graph), 1914 graph_(graph),
1911 status_(UNUSED), 1915 status_(UNUSED),
1912 current_instruction_(NULL), 1916 current_instruction_(NULL),
1913 current_block_(NULL), 1917 current_block_(NULL),
1914 next_block_(NULL), 1918 next_block_(NULL),
1915 argument_count_(0), 1919 argument_count_(0),
1916 allocator_(allocator), 1920 allocator_(allocator),
1917 position_(RelocInfo::kNoPosition), 1921 position_(RelocInfo::kNoPosition),
1918 instruction_pending_deoptimization_environment_(NULL), 1922 instruction_pending_deoptimization_environment_(NULL),
1919 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } 1923 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
1920 1924
1921 // Build the sequence for the graph. 1925 // Build the sequence for the graph.
1922 LChunk* Build(); 1926 LChunk* Build();
1923 1927
1924 // Declare methods that deal with the individual node types. 1928 // Declare methods that deal with the individual node types.
1925 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 1929 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
1926 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 1930 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
1927 #undef DECLARE_DO 1931 #undef DECLARE_DO
1928 1932
1929 private: 1933 private:
1930 enum Status { 1934 enum Status {
1931 UNUSED, 1935 UNUSED,
1932 BUILDING, 1936 BUILDING,
1933 DONE, 1937 DONE,
1934 ABORTED 1938 ABORTED
1935 }; 1939 };
1936 1940
1937 LChunk* chunk() const { return chunk_; } 1941 LChunk* chunk() const { return chunk_; }
1942 CompilationInfo* info() const { return info_; }
1938 HGraph* graph() const { return graph_; } 1943 HGraph* graph() const { return graph_; }
1939 1944
1940 bool is_unused() const { return status_ == UNUSED; } 1945 bool is_unused() const { return status_ == UNUSED; }
1941 bool is_building() const { return status_ == BUILDING; } 1946 bool is_building() const { return status_ == BUILDING; }
1942 bool is_done() const { return status_ == DONE; } 1947 bool is_done() const { return status_ == DONE; }
1943 bool is_aborted() const { return status_ == ABORTED; } 1948 bool is_aborted() const { return status_ == ABORTED; }
1944 1949
1945 void Abort(const char* format, ...); 1950 void Abort(const char* format, ...);
1946 1951
1947 // Methods for getting operands for Use / Define / Temp. 1952 // Methods for getting operands for Use / Define / Temp.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 2039
2035 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); 2040 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2036 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); 2041 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2037 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); 2042 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2038 LInstruction* DoArithmeticD(Token::Value op, 2043 LInstruction* DoArithmeticD(Token::Value op,
2039 HArithmeticBinaryOperation* instr); 2044 HArithmeticBinaryOperation* instr);
2040 LInstruction* DoArithmeticT(Token::Value op, 2045 LInstruction* DoArithmeticT(Token::Value op,
2041 HArithmeticBinaryOperation* instr); 2046 HArithmeticBinaryOperation* instr);
2042 2047
2043 LChunk* chunk_; 2048 LChunk* chunk_;
2049 CompilationInfo* info_;
2044 HGraph* const graph_; 2050 HGraph* const graph_;
2045 Status status_; 2051 Status status_;
2046 HInstruction* current_instruction_; 2052 HInstruction* current_instruction_;
2047 HBasicBlock* current_block_; 2053 HBasicBlock* current_block_;
2048 HBasicBlock* next_block_; 2054 HBasicBlock* next_block_;
2049 int argument_count_; 2055 int argument_count_;
2050 LAllocator* allocator_; 2056 LAllocator* allocator_;
2051 int position_; 2057 int position_;
2052 LInstruction* instruction_pending_deoptimization_environment_; 2058 LInstruction* instruction_pending_deoptimization_environment_;
2053 int pending_deoptimization_ast_id_; 2059 int pending_deoptimization_ast_id_;
2054 2060
2055 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2061 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2056 }; 2062 };
2057 2063
2058 #undef DECLARE_HYDROGEN_ACCESSOR 2064 #undef DECLARE_HYDROGEN_ACCESSOR
2059 #undef DECLARE_INSTRUCTION 2065 #undef DECLARE_INSTRUCTION
2060 #undef DECLARE_CONCRETE_INSTRUCTION 2066 #undef DECLARE_CONCRETE_INSTRUCTION
2061 2067
2062 } } // namespace v8::int 2068 } } // namespace v8::int
2063 2069
2064 #endif // V8_X64_LITHIUM_X64_H_ 2070 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698