| OLD | NEW |
| 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") | 1251 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
| 1252 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) | 1252 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
| 1253 | 1253 |
| 1254 LOperand* context() { return InputAt(0); } | 1254 LOperand* context() { return InputAt(0); } |
| 1255 int slot_index() { return hydrogen()->slot_index(); } | 1255 int slot_index() { return hydrogen()->slot_index(); } |
| 1256 | 1256 |
| 1257 virtual void PrintDataTo(StringStream* stream); | 1257 virtual void PrintDataTo(StringStream* stream); |
| 1258 }; | 1258 }; |
| 1259 | 1259 |
| 1260 | 1260 |
| 1261 class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> { | 1261 class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> { |
| 1262 public: | 1262 public: |
| 1263 LStoreContextSlot(LOperand* context, LOperand* value) { | 1263 LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) { |
| 1264 inputs_[0] = context; | 1264 inputs_[0] = context; |
| 1265 inputs_[1] = value; | 1265 inputs_[1] = value; |
| 1266 temps_[0] = temp; |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") | 1269 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") |
| 1269 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) | 1270 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) |
| 1270 | 1271 |
| 1271 LOperand* context() { return InputAt(0); } | 1272 LOperand* context() { return InputAt(0); } |
| 1272 LOperand* value() { return InputAt(1); } | 1273 LOperand* value() { return InputAt(1); } |
| 1273 int slot_index() { return hydrogen()->slot_index(); } | 1274 int slot_index() { return hydrogen()->slot_index(); } |
| 1274 int needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } | 1275 int needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } |
| 1275 | 1276 |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 | 1836 |
| 1836 class LStackCheck: public LTemplateInstruction<0, 0, 0> { | 1837 class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
| 1837 public: | 1838 public: |
| 1838 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | 1839 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
| 1839 }; | 1840 }; |
| 1840 | 1841 |
| 1841 | 1842 |
| 1842 class LChunkBuilder; | 1843 class LChunkBuilder; |
| 1843 class LChunk: public ZoneObject { | 1844 class LChunk: public ZoneObject { |
| 1844 public: | 1845 public: |
| 1845 explicit LChunk(HGraph* graph) | 1846 explicit LChunk(CompilationInfo* info, HGraph* graph) |
| 1846 : spill_slot_count_(0), | 1847 : spill_slot_count_(0), |
| 1848 info_(info), |
| 1847 graph_(graph), | 1849 graph_(graph), |
| 1848 instructions_(32), | 1850 instructions_(32), |
| 1849 pointer_maps_(8), | 1851 pointer_maps_(8), |
| 1850 inlined_closures_(1) { } | 1852 inlined_closures_(1) { } |
| 1851 | 1853 |
| 1852 void AddInstruction(LInstruction* instruction, HBasicBlock* block); | 1854 void AddInstruction(LInstruction* instruction, HBasicBlock* block); |
| 1853 LConstantOperand* DefineConstantOperand(HConstant* constant); | 1855 LConstantOperand* DefineConstantOperand(HConstant* constant); |
| 1854 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | 1856 Handle<Object> LookupLiteral(LConstantOperand* operand) const; |
| 1855 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | 1857 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; |
| 1856 | 1858 |
| 1857 int GetNextSpillIndex(bool is_double); | 1859 int GetNextSpillIndex(bool is_double); |
| 1858 LOperand* GetNextSpillSlot(bool is_double); | 1860 LOperand* GetNextSpillSlot(bool is_double); |
| 1859 | 1861 |
| 1860 int ParameterAt(int index); | 1862 int ParameterAt(int index); |
| 1861 int GetParameterStackSlot(int index) const; | 1863 int GetParameterStackSlot(int index) const; |
| 1862 int spill_slot_count() const { return spill_slot_count_; } | 1864 int spill_slot_count() const { return spill_slot_count_; } |
| 1865 CompilationInfo* info() const { return info_; } |
| 1863 HGraph* graph() const { return graph_; } | 1866 HGraph* graph() const { return graph_; } |
| 1864 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } | 1867 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } |
| 1865 void AddGapMove(int index, LOperand* from, LOperand* to); | 1868 void AddGapMove(int index, LOperand* from, LOperand* to); |
| 1866 LGap* GetGapAt(int index) const; | 1869 LGap* GetGapAt(int index) const; |
| 1867 bool IsGapAt(int index) const; | 1870 bool IsGapAt(int index) const; |
| 1868 int NearestGapPos(int index) const; | 1871 int NearestGapPos(int index) const; |
| 1869 void MarkEmptyBlocks(); | 1872 void MarkEmptyBlocks(); |
| 1870 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } | 1873 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } |
| 1871 LLabel* GetLabel(int block_id) const { | 1874 LLabel* GetLabel(int block_id) const { |
| 1872 HBasicBlock* block = graph_->blocks()->at(block_id); | 1875 HBasicBlock* block = graph_->blocks()->at(block_id); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1889 const ZoneList<Handle<JSFunction> >* inlined_closures() const { | 1892 const ZoneList<Handle<JSFunction> >* inlined_closures() const { |
| 1890 return &inlined_closures_; | 1893 return &inlined_closures_; |
| 1891 } | 1894 } |
| 1892 | 1895 |
| 1893 void AddInlinedClosure(Handle<JSFunction> closure) { | 1896 void AddInlinedClosure(Handle<JSFunction> closure) { |
| 1894 inlined_closures_.Add(closure); | 1897 inlined_closures_.Add(closure); |
| 1895 } | 1898 } |
| 1896 | 1899 |
| 1897 private: | 1900 private: |
| 1898 int spill_slot_count_; | 1901 int spill_slot_count_; |
| 1902 CompilationInfo* info_; |
| 1899 HGraph* const graph_; | 1903 HGraph* const graph_; |
| 1900 ZoneList<LInstruction*> instructions_; | 1904 ZoneList<LInstruction*> instructions_; |
| 1901 ZoneList<LPointerMap*> pointer_maps_; | 1905 ZoneList<LPointerMap*> pointer_maps_; |
| 1902 ZoneList<Handle<JSFunction> > inlined_closures_; | 1906 ZoneList<Handle<JSFunction> > inlined_closures_; |
| 1903 }; | 1907 }; |
| 1904 | 1908 |
| 1905 | 1909 |
| 1906 class LChunkBuilder BASE_EMBEDDED { | 1910 class LChunkBuilder BASE_EMBEDDED { |
| 1907 public: | 1911 public: |
| 1908 LChunkBuilder(HGraph* graph, LAllocator* allocator) | 1912 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
| 1909 : chunk_(NULL), | 1913 : chunk_(NULL), |
| 1914 info_(info), |
| 1910 graph_(graph), | 1915 graph_(graph), |
| 1911 status_(UNUSED), | 1916 status_(UNUSED), |
| 1912 current_instruction_(NULL), | 1917 current_instruction_(NULL), |
| 1913 current_block_(NULL), | 1918 current_block_(NULL), |
| 1914 next_block_(NULL), | 1919 next_block_(NULL), |
| 1915 argument_count_(0), | 1920 argument_count_(0), |
| 1916 allocator_(allocator), | 1921 allocator_(allocator), |
| 1917 position_(RelocInfo::kNoPosition), | 1922 position_(RelocInfo::kNoPosition), |
| 1918 instruction_pending_deoptimization_environment_(NULL), | 1923 instruction_pending_deoptimization_environment_(NULL), |
| 1919 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } | 1924 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } |
| 1920 | 1925 |
| 1921 // Build the sequence for the graph. | 1926 // Build the sequence for the graph. |
| 1922 LChunk* Build(); | 1927 LChunk* Build(); |
| 1923 | 1928 |
| 1924 // Declare methods that deal with the individual node types. | 1929 // Declare methods that deal with the individual node types. |
| 1925 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 1930 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| 1926 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 1931 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 1927 #undef DECLARE_DO | 1932 #undef DECLARE_DO |
| 1928 | 1933 |
| 1929 private: | 1934 private: |
| 1930 enum Status { | 1935 enum Status { |
| 1931 UNUSED, | 1936 UNUSED, |
| 1932 BUILDING, | 1937 BUILDING, |
| 1933 DONE, | 1938 DONE, |
| 1934 ABORTED | 1939 ABORTED |
| 1935 }; | 1940 }; |
| 1936 | 1941 |
| 1937 LChunk* chunk() const { return chunk_; } | 1942 LChunk* chunk() const { return chunk_; } |
| 1943 CompilationInfo* info() const { return info_; } |
| 1938 HGraph* graph() const { return graph_; } | 1944 HGraph* graph() const { return graph_; } |
| 1939 | 1945 |
| 1940 bool is_unused() const { return status_ == UNUSED; } | 1946 bool is_unused() const { return status_ == UNUSED; } |
| 1941 bool is_building() const { return status_ == BUILDING; } | 1947 bool is_building() const { return status_ == BUILDING; } |
| 1942 bool is_done() const { return status_ == DONE; } | 1948 bool is_done() const { return status_ == DONE; } |
| 1943 bool is_aborted() const { return status_ == ABORTED; } | 1949 bool is_aborted() const { return status_ == ABORTED; } |
| 1944 | 1950 |
| 1945 void Abort(const char* format, ...); | 1951 void Abort(const char* format, ...); |
| 1946 | 1952 |
| 1947 // Methods for getting operands for Use / Define / Temp. | 1953 // Methods for getting operands for Use / Define / Temp. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 | 2040 |
| 2035 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2041 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
| 2036 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); | 2042 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2037 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2043 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2038 LInstruction* DoArithmeticD(Token::Value op, | 2044 LInstruction* DoArithmeticD(Token::Value op, |
| 2039 HArithmeticBinaryOperation* instr); | 2045 HArithmeticBinaryOperation* instr); |
| 2040 LInstruction* DoArithmeticT(Token::Value op, | 2046 LInstruction* DoArithmeticT(Token::Value op, |
| 2041 HArithmeticBinaryOperation* instr); | 2047 HArithmeticBinaryOperation* instr); |
| 2042 | 2048 |
| 2043 LChunk* chunk_; | 2049 LChunk* chunk_; |
| 2050 CompilationInfo* info_; |
| 2044 HGraph* const graph_; | 2051 HGraph* const graph_; |
| 2045 Status status_; | 2052 Status status_; |
| 2046 HInstruction* current_instruction_; | 2053 HInstruction* current_instruction_; |
| 2047 HBasicBlock* current_block_; | 2054 HBasicBlock* current_block_; |
| 2048 HBasicBlock* next_block_; | 2055 HBasicBlock* next_block_; |
| 2049 int argument_count_; | 2056 int argument_count_; |
| 2050 LAllocator* allocator_; | 2057 LAllocator* allocator_; |
| 2051 int position_; | 2058 int position_; |
| 2052 LInstruction* instruction_pending_deoptimization_environment_; | 2059 LInstruction* instruction_pending_deoptimization_environment_; |
| 2053 int pending_deoptimization_ast_id_; | 2060 int pending_deoptimization_ast_id_; |
| 2054 | 2061 |
| 2055 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2062 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2056 }; | 2063 }; |
| 2057 | 2064 |
| 2058 #undef DECLARE_HYDROGEN_ACCESSOR | 2065 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2059 #undef DECLARE_INSTRUCTION | 2066 #undef DECLARE_INSTRUCTION |
| 2060 #undef DECLARE_CONCRETE_INSTRUCTION | 2067 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2061 | 2068 |
| 2062 } } // namespace v8::int | 2069 } } // namespace v8::int |
| 2063 | 2070 |
| 2064 #endif // V8_X64_LITHIUM_X64_H_ | 2071 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |