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 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 | 1822 |
1823 class LStackCheck: public LTemplateInstruction<0, 0, 0> { | 1823 class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
1824 public: | 1824 public: |
1825 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | 1825 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
1826 }; | 1826 }; |
1827 | 1827 |
1828 | 1828 |
1829 class LChunkBuilder; | 1829 class LChunkBuilder; |
1830 class LChunk: public ZoneObject { | 1830 class LChunk: public ZoneObject { |
1831 public: | 1831 public: |
1832 explicit LChunk(HGraph* graph); | 1832 explicit LChunk(CompilationInfo* info, HGraph* graph); |
1833 | 1833 |
1834 void AddInstruction(LInstruction* instruction, HBasicBlock* block); | 1834 void AddInstruction(LInstruction* instruction, HBasicBlock* block); |
1835 LConstantOperand* DefineConstantOperand(HConstant* constant); | 1835 LConstantOperand* DefineConstantOperand(HConstant* constant); |
1836 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | 1836 Handle<Object> LookupLiteral(LConstantOperand* operand) const; |
1837 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | 1837 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; |
1838 | 1838 |
1839 int GetNextSpillIndex(bool is_double); | 1839 int GetNextSpillIndex(bool is_double); |
1840 LOperand* GetNextSpillSlot(bool is_double); | 1840 LOperand* GetNextSpillSlot(bool is_double); |
1841 | 1841 |
1842 int ParameterAt(int index); | 1842 int ParameterAt(int index); |
1843 int GetParameterStackSlot(int index) const; | 1843 int GetParameterStackSlot(int index) const; |
1844 int spill_slot_count() const { return spill_slot_count_; } | 1844 int spill_slot_count() const { return spill_slot_count_; } |
| 1845 CompilationInfo* info() const { return info_; } |
1845 HGraph* graph() const { return graph_; } | 1846 HGraph* graph() const { return graph_; } |
1846 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } | 1847 const ZoneList<LInstruction*>* instructions() const { return &instructions_; } |
1847 void AddGapMove(int index, LOperand* from, LOperand* to); | 1848 void AddGapMove(int index, LOperand* from, LOperand* to); |
1848 LGap* GetGapAt(int index) const; | 1849 LGap* GetGapAt(int index) const; |
1849 bool IsGapAt(int index) const; | 1850 bool IsGapAt(int index) const; |
1850 int NearestGapPos(int index) const; | 1851 int NearestGapPos(int index) const; |
1851 void MarkEmptyBlocks(); | 1852 void MarkEmptyBlocks(); |
1852 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } | 1853 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } |
1853 LLabel* GetLabel(int block_id) const { | 1854 LLabel* GetLabel(int block_id) const { |
1854 HBasicBlock* block = graph_->blocks()->at(block_id); | 1855 HBasicBlock* block = graph_->blocks()->at(block_id); |
(...skipping 16 matching lines...) Expand all Loading... |
1871 const ZoneList<Handle<JSFunction> >* inlined_closures() const { | 1872 const ZoneList<Handle<JSFunction> >* inlined_closures() const { |
1872 return &inlined_closures_; | 1873 return &inlined_closures_; |
1873 } | 1874 } |
1874 | 1875 |
1875 void AddInlinedClosure(Handle<JSFunction> closure) { | 1876 void AddInlinedClosure(Handle<JSFunction> closure) { |
1876 inlined_closures_.Add(closure); | 1877 inlined_closures_.Add(closure); |
1877 } | 1878 } |
1878 | 1879 |
1879 private: | 1880 private: |
1880 int spill_slot_count_; | 1881 int spill_slot_count_; |
| 1882 CompilationInfo* info_; |
1881 HGraph* const graph_; | 1883 HGraph* const graph_; |
1882 ZoneList<LInstruction*> instructions_; | 1884 ZoneList<LInstruction*> instructions_; |
1883 ZoneList<LPointerMap*> pointer_maps_; | 1885 ZoneList<LPointerMap*> pointer_maps_; |
1884 ZoneList<Handle<JSFunction> > inlined_closures_; | 1886 ZoneList<Handle<JSFunction> > inlined_closures_; |
1885 }; | 1887 }; |
1886 | 1888 |
1887 | 1889 |
1888 class LChunkBuilder BASE_EMBEDDED { | 1890 class LChunkBuilder BASE_EMBEDDED { |
1889 public: | 1891 public: |
1890 LChunkBuilder(HGraph* graph, LAllocator* allocator) | 1892 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
1891 : chunk_(NULL), | 1893 : chunk_(NULL), |
| 1894 info_(info), |
1892 graph_(graph), | 1895 graph_(graph), |
1893 status_(UNUSED), | 1896 status_(UNUSED), |
1894 current_instruction_(NULL), | 1897 current_instruction_(NULL), |
1895 current_block_(NULL), | 1898 current_block_(NULL), |
1896 next_block_(NULL), | 1899 next_block_(NULL), |
1897 argument_count_(0), | 1900 argument_count_(0), |
1898 allocator_(allocator), | 1901 allocator_(allocator), |
1899 position_(RelocInfo::kNoPosition), | 1902 position_(RelocInfo::kNoPosition), |
1900 instruction_pending_deoptimization_environment_(NULL), | 1903 instruction_pending_deoptimization_environment_(NULL), |
1901 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } | 1904 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } |
1902 | 1905 |
1903 // Build the sequence for the graph. | 1906 // Build the sequence for the graph. |
1904 LChunk* Build(); | 1907 LChunk* Build(); |
1905 | 1908 |
1906 // Declare methods that deal with the individual node types. | 1909 // Declare methods that deal with the individual node types. |
1907 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 1910 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
1908 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 1911 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
1909 #undef DECLARE_DO | 1912 #undef DECLARE_DO |
1910 | 1913 |
1911 private: | 1914 private: |
1912 enum Status { | 1915 enum Status { |
1913 UNUSED, | 1916 UNUSED, |
1914 BUILDING, | 1917 BUILDING, |
1915 DONE, | 1918 DONE, |
1916 ABORTED | 1919 ABORTED |
1917 }; | 1920 }; |
1918 | 1921 |
1919 LChunk* chunk() const { return chunk_; } | 1922 LChunk* chunk() const { return chunk_; } |
| 1923 CompilationInfo* info() const { return info_; } |
1920 HGraph* graph() const { return graph_; } | 1924 HGraph* graph() const { return graph_; } |
1921 | 1925 |
1922 bool is_unused() const { return status_ == UNUSED; } | 1926 bool is_unused() const { return status_ == UNUSED; } |
1923 bool is_building() const { return status_ == BUILDING; } | 1927 bool is_building() const { return status_ == BUILDING; } |
1924 bool is_done() const { return status_ == DONE; } | 1928 bool is_done() const { return status_ == DONE; } |
1925 bool is_aborted() const { return status_ == ABORTED; } | 1929 bool is_aborted() const { return status_ == ABORTED; } |
1926 | 1930 |
1927 void Abort(const char* format, ...); | 1931 void Abort(const char* format, ...); |
1928 | 1932 |
1929 // Methods for getting operands for Use / Define / Temp. | 1933 // Methods for getting operands for Use / Define / Temp. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 | 2020 |
2017 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2021 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
2018 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); | 2022 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); |
2019 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2023 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
2020 LInstruction* DoArithmeticD(Token::Value op, | 2024 LInstruction* DoArithmeticD(Token::Value op, |
2021 HArithmeticBinaryOperation* instr); | 2025 HArithmeticBinaryOperation* instr); |
2022 LInstruction* DoArithmeticT(Token::Value op, | 2026 LInstruction* DoArithmeticT(Token::Value op, |
2023 HArithmeticBinaryOperation* instr); | 2027 HArithmeticBinaryOperation* instr); |
2024 | 2028 |
2025 LChunk* chunk_; | 2029 LChunk* chunk_; |
| 2030 CompilationInfo* info_; |
2026 HGraph* const graph_; | 2031 HGraph* const graph_; |
2027 Status status_; | 2032 Status status_; |
2028 HInstruction* current_instruction_; | 2033 HInstruction* current_instruction_; |
2029 HBasicBlock* current_block_; | 2034 HBasicBlock* current_block_; |
2030 HBasicBlock* next_block_; | 2035 HBasicBlock* next_block_; |
2031 int argument_count_; | 2036 int argument_count_; |
2032 LAllocator* allocator_; | 2037 LAllocator* allocator_; |
2033 int position_; | 2038 int position_; |
2034 LInstruction* instruction_pending_deoptimization_environment_; | 2039 LInstruction* instruction_pending_deoptimization_environment_; |
2035 int pending_deoptimization_ast_id_; | 2040 int pending_deoptimization_ast_id_; |
2036 | 2041 |
2037 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2042 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2038 }; | 2043 }; |
2039 | 2044 |
2040 #undef DECLARE_HYDROGEN_ACCESSOR | 2045 #undef DECLARE_HYDROGEN_ACCESSOR |
2041 #undef DECLARE_INSTRUCTION | 2046 #undef DECLARE_INSTRUCTION |
2042 #undef DECLARE_CONCRETE_INSTRUCTION | 2047 #undef DECLARE_CONCRETE_INSTRUCTION |
2043 | 2048 |
2044 } } // namespace v8::internal | 2049 } } // namespace v8::internal |
2045 | 2050 |
2046 #endif // V8_ARM_LITHIUM_ARM_H_ | 2051 #endif // V8_ARM_LITHIUM_ARM_H_ |
OLD | NEW |