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 20 matching lines...) Expand all Loading... |
31 #include "hydrogen.h" | 31 #include "hydrogen.h" |
32 #include "lithium-allocator.h" | 32 #include "lithium-allocator.h" |
33 #include "lithium.h" | 33 #include "lithium.h" |
34 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
35 | 35 |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 // Forward declarations. | 39 // Forward declarations. |
40 class LCodeGen; | 40 class LCodeGen; |
41 class LEnvironment; | |
42 class Translation; | |
43 | 41 |
44 | 42 |
45 // Type hierarchy: | 43 // Type hierarchy: |
46 // | 44 // |
47 // LInstruction | 45 // LInstruction |
48 // LAccessArgumentsAt | 46 // LAccessArgumentsAt |
49 // LArgumentsElements | 47 // LArgumentsElements |
50 // LArgumentsLength | 48 // LArgumentsLength |
51 // LBinaryOperation | 49 // LBinaryOperation |
52 // LAddI | 50 // LAddI |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; | 1806 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; |
1809 }; | 1807 }; |
1810 | 1808 |
1811 | 1809 |
1812 class LStackCheck: public LTemplateInstruction<0> { | 1810 class LStackCheck: public LTemplateInstruction<0> { |
1813 public: | 1811 public: |
1814 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | 1812 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
1815 }; | 1813 }; |
1816 | 1814 |
1817 | 1815 |
1818 class LPointerMap: public ZoneObject { | |
1819 public: | |
1820 explicit LPointerMap(int position) | |
1821 : pointer_operands_(8), position_(position), lithium_position_(-1) { } | |
1822 | |
1823 const ZoneList<LOperand*>* operands() const { return &pointer_operands_; } | |
1824 int position() const { return position_; } | |
1825 int lithium_position() const { return lithium_position_; } | |
1826 | |
1827 void set_lithium_position(int pos) { | |
1828 ASSERT(lithium_position_ == -1); | |
1829 lithium_position_ = pos; | |
1830 } | |
1831 | |
1832 void RecordPointer(LOperand* op); | |
1833 void PrintTo(StringStream* stream); | |
1834 | |
1835 private: | |
1836 ZoneList<LOperand*> pointer_operands_; | |
1837 int position_; | |
1838 int lithium_position_; | |
1839 }; | |
1840 | |
1841 | |
1842 class LEnvironment: public ZoneObject { | |
1843 public: | |
1844 LEnvironment(Handle<JSFunction> closure, | |
1845 int ast_id, | |
1846 int parameter_count, | |
1847 int argument_count, | |
1848 int value_count, | |
1849 LEnvironment* outer) | |
1850 : closure_(closure), | |
1851 arguments_stack_height_(argument_count), | |
1852 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), | |
1853 translation_index_(-1), | |
1854 ast_id_(ast_id), | |
1855 parameter_count_(parameter_count), | |
1856 values_(value_count), | |
1857 representations_(value_count), | |
1858 spilled_registers_(NULL), | |
1859 spilled_double_registers_(NULL), | |
1860 outer_(outer) { | |
1861 } | |
1862 | |
1863 Handle<JSFunction> closure() const { return closure_; } | |
1864 int arguments_stack_height() const { return arguments_stack_height_; } | |
1865 int deoptimization_index() const { return deoptimization_index_; } | |
1866 int translation_index() const { return translation_index_; } | |
1867 int ast_id() const { return ast_id_; } | |
1868 int parameter_count() const { return parameter_count_; } | |
1869 const ZoneList<LOperand*>* values() const { return &values_; } | |
1870 LEnvironment* outer() const { return outer_; } | |
1871 | |
1872 void AddValue(LOperand* operand, Representation representation) { | |
1873 values_.Add(operand); | |
1874 representations_.Add(representation); | |
1875 } | |
1876 | |
1877 bool HasTaggedValueAt(int index) const { | |
1878 return representations_[index].IsTagged(); | |
1879 } | |
1880 | |
1881 void Register(int deoptimization_index, int translation_index) { | |
1882 ASSERT(!HasBeenRegistered()); | |
1883 deoptimization_index_ = deoptimization_index; | |
1884 translation_index_ = translation_index; | |
1885 } | |
1886 bool HasBeenRegistered() const { | |
1887 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex; | |
1888 } | |
1889 | |
1890 void SetSpilledRegisters(LOperand** registers, | |
1891 LOperand** double_registers) { | |
1892 spilled_registers_ = registers; | |
1893 spilled_double_registers_ = double_registers; | |
1894 } | |
1895 | |
1896 // Emit frame translation commands for this environment. | |
1897 void WriteTranslation(LCodeGen* cgen, Translation* translation) const; | |
1898 | |
1899 void PrintTo(StringStream* stream); | |
1900 | |
1901 private: | |
1902 Handle<JSFunction> closure_; | |
1903 int arguments_stack_height_; | |
1904 int deoptimization_index_; | |
1905 int translation_index_; | |
1906 int ast_id_; | |
1907 int parameter_count_; | |
1908 ZoneList<LOperand*> values_; | |
1909 ZoneList<Representation> representations_; | |
1910 | |
1911 // Allocation index indexed arrays of spill slot operands for registers | |
1912 // that are also in spill slots at an OSR entry. NULL for environments | |
1913 // that do not correspond to an OSR entry. | |
1914 LOperand** spilled_registers_; | |
1915 LOperand** spilled_double_registers_; | |
1916 | |
1917 LEnvironment* outer_; | |
1918 }; | |
1919 | |
1920 class LChunkBuilder; | 1816 class LChunkBuilder; |
1921 class LChunk: public ZoneObject { | 1817 class LChunk: public ZoneObject { |
1922 public: | 1818 public: |
1923 explicit LChunk(HGraph* graph) | 1819 explicit LChunk(HGraph* graph) |
1924 : spill_slot_count_(0), | 1820 : spill_slot_count_(0), |
1925 graph_(graph), | 1821 graph_(graph), |
1926 instructions_(32), | 1822 instructions_(32), |
1927 pointer_maps_(8), | 1823 pointer_maps_(8), |
1928 inlined_closures_(1) { } | 1824 inlined_closures_(1) { } |
1929 | 1825 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2012 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2117 }; | 2013 }; |
2118 | 2014 |
2119 #undef DECLARE_HYDROGEN_ACCESSOR | 2015 #undef DECLARE_HYDROGEN_ACCESSOR |
2120 #undef DECLARE_INSTRUCTION | 2016 #undef DECLARE_INSTRUCTION |
2121 #undef DECLARE_CONCRETE_INSTRUCTION | 2017 #undef DECLARE_CONCRETE_INSTRUCTION |
2122 | 2018 |
2123 } } // namespace v8::internal | 2019 } } // namespace v8::internal |
2124 | 2020 |
2125 #endif // V8_IA32_LITHIUM_IA32_H_ | 2021 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |