| OLD | NEW |
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 V(AddI) \ | 45 V(AddI) \ |
| 46 V(Allocate) \ | 46 V(Allocate) \ |
| 47 V(ApplyArguments) \ | 47 V(ApplyArguments) \ |
| 48 V(ArgumentsElements) \ | 48 V(ArgumentsElements) \ |
| 49 V(ArgumentsLength) \ | 49 V(ArgumentsLength) \ |
| 50 V(ArithmeticD) \ | 50 V(ArithmeticD) \ |
| 51 V(ArithmeticT) \ | 51 V(ArithmeticT) \ |
| 52 V(BitI) \ | 52 V(BitI) \ |
| 53 V(BoundsCheck) \ | 53 V(BoundsCheck) \ |
| 54 V(Branch) \ | 54 V(Branch) \ |
| 55 V(CallConstantFunction) \ | 55 V(CallJSFunction) \ |
| 56 V(CallWithDescriptor) \ |
| 56 V(CallFunction) \ | 57 V(CallFunction) \ |
| 57 V(CallGlobal) \ | |
| 58 V(CallKeyed) \ | |
| 59 V(CallKnownGlobal) \ | |
| 60 V(CallNamed) \ | |
| 61 V(CallNew) \ | 58 V(CallNew) \ |
| 62 V(CallNewArray) \ | 59 V(CallNewArray) \ |
| 63 V(CallRuntime) \ | 60 V(CallRuntime) \ |
| 64 V(CallStub) \ | 61 V(CallStub) \ |
| 65 V(CheckInstanceType) \ | 62 V(CheckInstanceType) \ |
| 66 V(CheckMaps) \ | 63 V(CheckMaps) \ |
| 67 V(CheckMapValue) \ | 64 V(CheckMapValue) \ |
| 68 V(CheckNonSmi) \ | 65 V(CheckNonSmi) \ |
| 69 V(CheckSmi) \ | 66 V(CheckSmi) \ |
| 70 V(CheckValue) \ | 67 V(CheckValue) \ |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 class IsCallBits: public BitField<bool, 0, 1> {}; | 298 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 302 | 299 |
| 303 LEnvironment* environment_; | 300 LEnvironment* environment_; |
| 304 SetOncePointer<LPointerMap> pointer_map_; | 301 SetOncePointer<LPointerMap> pointer_map_; |
| 305 HValue* hydrogen_value_; | 302 HValue* hydrogen_value_; |
| 306 int bit_field_; | 303 int bit_field_; |
| 307 }; | 304 }; |
| 308 | 305 |
| 309 | 306 |
| 310 // R = number of result operands (0 or 1). | 307 // R = number of result operands (0 or 1). |
| 311 // I = number of input operands. | 308 template<int R> |
| 312 // T = number of temporary operands. | 309 class LTemplateResultInstruction : public LInstruction { |
| 313 template<int R, int I, int T> | |
| 314 class LTemplateInstruction : public LInstruction { | |
| 315 public: | 310 public: |
| 316 // Allow 0 or 1 output operands. | 311 // Allow 0 or 1 output operands. |
| 317 STATIC_ASSERT(R == 0 || R == 1); | 312 STATIC_ASSERT(R == 0 || R == 1); |
| 318 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 313 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
| 319 return R != 0 && result() != NULL; | 314 return R != 0 && result() != NULL; |
| 320 } | 315 } |
| 321 void set_result(LOperand* operand) { results_[0] = operand; } | 316 void set_result(LOperand* operand) { results_[0] = operand; } |
| 322 LOperand* result() const { return results_[0]; } | 317 LOperand* result() const { return results_[0]; } |
| 323 | 318 |
| 324 protected: | 319 protected: |
| 325 EmbeddedContainer<LOperand*, R> results_; | 320 EmbeddedContainer<LOperand*, R> results_; |
| 321 }; |
| 322 |
| 323 |
| 324 // R = number of result operands (0 or 1). |
| 325 // I = number of input operands. |
| 326 // T = number of temporary operands. |
| 327 template<int R, int I, int T> |
| 328 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
| 329 protected: |
| 326 EmbeddedContainer<LOperand*, I> inputs_; | 330 EmbeddedContainer<LOperand*, I> inputs_; |
| 327 EmbeddedContainer<LOperand*, T> temps_; | 331 EmbeddedContainer<LOperand*, T> temps_; |
| 328 | 332 |
| 329 private: | 333 private: |
| 330 // Iterator support. | 334 // Iterator support. |
| 331 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } | 335 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } |
| 332 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } | 336 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 333 | 337 |
| 334 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } | 338 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } |
| 335 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } | 339 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 explicit LGlobalReceiver(LOperand* global_object) { | 1834 explicit LGlobalReceiver(LOperand* global_object) { |
| 1831 inputs_[0] = global_object; | 1835 inputs_[0] = global_object; |
| 1832 } | 1836 } |
| 1833 | 1837 |
| 1834 LOperand* global() { return inputs_[0]; } | 1838 LOperand* global() { return inputs_[0]; } |
| 1835 | 1839 |
| 1836 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") | 1840 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
| 1837 }; | 1841 }; |
| 1838 | 1842 |
| 1839 | 1843 |
| 1840 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 1844 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 1841 public: | 1845 public: |
| 1842 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 1846 explicit LCallJSFunction(LOperand* function) { |
| 1843 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 1847 inputs_[0] = function; |
| 1848 } |
| 1849 |
| 1850 LOperand* function() { return inputs_[0]; } |
| 1851 |
| 1852 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 1853 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
| 1844 | 1854 |
| 1845 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1855 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1846 | 1856 |
| 1847 Handle<JSFunction> function() { return hydrogen()->function(); } | |
| 1848 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1849 }; | |
| 1850 | |
| 1851 | |
| 1852 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | |
| 1853 public: | |
| 1854 LInvokeFunction(LOperand* context, LOperand* function) { | |
| 1855 inputs_[0] = context; | |
| 1856 inputs_[1] = function; | |
| 1857 } | |
| 1858 | |
| 1859 LOperand* context() { return inputs_[0]; } | |
| 1860 LOperand* function() { return inputs_[1]; } | |
| 1861 | |
| 1862 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | |
| 1863 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | |
| 1864 | |
| 1865 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1866 | |
| 1867 int arity() const { return hydrogen()->argument_count() - 1; } | 1857 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1868 }; | 1858 }; |
| 1869 | 1859 |
| 1870 | 1860 |
| 1871 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1861 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1872 public: | 1862 public: |
| 1873 LCallKeyed(LOperand* context, LOperand* key) { | 1863 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, |
| 1864 ZoneList<LOperand*>& operands, |
| 1865 Zone* zone) |
| 1866 : descriptor_(descriptor), |
| 1867 inputs_(descriptor->environment_length() + 1, zone) { |
| 1868 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1869 inputs_.AddAll(operands, zone); |
| 1870 } |
| 1871 |
| 1872 LOperand* target() const { return inputs_[0]; } |
| 1873 |
| 1874 private: |
| 1875 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") |
| 1876 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) |
| 1877 |
| 1878 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1879 |
| 1880 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1881 |
| 1882 const CallInterfaceDescriptor* descriptor_; |
| 1883 ZoneList<LOperand*> inputs_; |
| 1884 |
| 1885 // Iterator support. |
| 1886 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1887 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1888 |
| 1889 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1890 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1891 }; |
| 1892 |
| 1893 |
| 1894 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1895 public: |
| 1896 LInvokeFunction(LOperand* context, LOperand* function) { |
| 1874 inputs_[0] = context; | 1897 inputs_[0] = context; |
| 1875 inputs_[1] = key; | 1898 inputs_[1] = function; |
| 1876 } | 1899 } |
| 1877 | 1900 |
| 1878 LOperand* context() { return inputs_[0]; } | 1901 LOperand* context() { return inputs_[0]; } |
| 1879 LOperand* key() { return inputs_[1]; } | 1902 LOperand* function() { return inputs_[1]; } |
| 1880 | 1903 |
| 1881 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | 1904 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1882 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | 1905 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1883 | 1906 |
| 1884 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1907 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1885 | 1908 |
| 1886 int arity() const { return hydrogen()->argument_count() - 1; } | 1909 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1887 }; | 1910 }; |
| 1888 | 1911 |
| 1889 | |
| 1890 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1891 public: | |
| 1892 explicit LCallNamed(LOperand* context) { | |
| 1893 inputs_[0] = context; | |
| 1894 } | |
| 1895 | |
| 1896 LOperand* context() { return inputs_[0]; } | |
| 1897 | |
| 1898 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") | |
| 1899 DECLARE_HYDROGEN_ACCESSOR(CallNamed) | |
| 1900 | |
| 1901 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1902 | |
| 1903 Handle<String> name() const { return hydrogen()->name(); } | |
| 1904 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1905 }; | |
| 1906 | |
| 1907 | 1912 |
| 1908 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1913 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1909 public: | 1914 public: |
| 1910 explicit LCallFunction(LOperand* context, LOperand* function) { | 1915 explicit LCallFunction(LOperand* context, LOperand* function) { |
| 1911 inputs_[0] = context; | 1916 inputs_[0] = context; |
| 1912 inputs_[1] = function; | 1917 inputs_[1] = function; |
| 1913 } | 1918 } |
| 1914 | 1919 |
| 1915 LOperand* context() { return inputs_[0]; } | 1920 LOperand* context() { return inputs_[0]; } |
| 1916 LOperand* function() { return inputs_[1]; } | 1921 LOperand* function() { return inputs_[1]; } |
| 1917 | 1922 |
| 1918 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") | 1923 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1919 DECLARE_HYDROGEN_ACCESSOR(CallFunction) | 1924 DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 1920 | 1925 |
| 1921 int arity() const { return hydrogen()->argument_count() - 1; } | 1926 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1922 }; | 1927 }; |
| 1923 | 1928 |
| 1924 | 1929 |
| 1925 class LCallGlobal V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1926 public: | |
| 1927 explicit LCallGlobal(LOperand* context) { | |
| 1928 inputs_[0] = context; | |
| 1929 } | |
| 1930 | |
| 1931 LOperand* context() { return inputs_[0]; } | |
| 1932 | |
| 1933 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") | |
| 1934 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) | |
| 1935 | |
| 1936 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1937 | |
| 1938 Handle<String> name() const {return hydrogen()->name(); } | |
| 1939 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1940 }; | |
| 1941 | |
| 1942 | |
| 1943 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 1944 public: | |
| 1945 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") | |
| 1946 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) | |
| 1947 | |
| 1948 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1949 | |
| 1950 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1951 }; | |
| 1952 | |
| 1953 | |
| 1954 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1930 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1955 public: | 1931 public: |
| 1956 LCallNew(LOperand* context, LOperand* constructor) { | 1932 LCallNew(LOperand* context, LOperand* constructor) { |
| 1957 inputs_[0] = context; | 1933 inputs_[0] = context; |
| 1958 inputs_[1] = constructor; | 1934 inputs_[1] = constructor; |
| 1959 } | 1935 } |
| 1960 | 1936 |
| 1961 LOperand* context() { return inputs_[0]; } | 1937 LOperand* context() { return inputs_[0]; } |
| 1962 LOperand* constructor() { return inputs_[1]; } | 1938 LOperand* constructor() { return inputs_[1]; } |
| 1963 | 1939 |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2814 // Will not be moved to a register even if one is freely available. | 2790 // Will not be moved to a register even if one is freely available. |
| 2815 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; | 2791 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; |
| 2816 | 2792 |
| 2817 // Temporary operand that must be in a register. | 2793 // Temporary operand that must be in a register. |
| 2818 MUST_USE_RESULT LUnallocated* TempRegister(); | 2794 MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2819 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | 2795 MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2820 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); | 2796 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); |
| 2821 | 2797 |
| 2822 // Methods for setting up define-use relationships. | 2798 // Methods for setting up define-use relationships. |
| 2823 // Return the same instruction that they are passed. | 2799 // Return the same instruction that they are passed. |
| 2824 template<int I, int T> | 2800 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
| 2825 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2801 LUnallocated* result); |
| 2826 LUnallocated* result); | 2802 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
| 2827 template<int I, int T> | 2803 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
| 2828 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2804 int index); |
| 2829 template<int I, int T> | 2805 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
| 2830 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2806 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
| 2831 int index); | 2807 Register reg); |
| 2832 template<int I, int T> | 2808 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
| 2833 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | 2809 XMMRegister reg); |
| 2834 template<int I, int T> | 2810 LInstruction* DefineX87TOS(LTemplateResultInstruction<1>* instr); |
| 2835 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 2836 Register reg); | |
| 2837 template<int I, int T> | |
| 2838 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
| 2839 XMMRegister reg); | |
| 2840 template<int I, int T> | |
| 2841 LInstruction* DefineX87TOS(LTemplateInstruction<1, I, T>* instr); | |
| 2842 // Assigns an environment to an instruction. An instruction which can | 2811 // Assigns an environment to an instruction. An instruction which can |
| 2843 // deoptimize must have an environment. | 2812 // deoptimize must have an environment. |
| 2844 LInstruction* AssignEnvironment(LInstruction* instr); | 2813 LInstruction* AssignEnvironment(LInstruction* instr); |
| 2845 // Assigns a pointer map to an instruction. An instruction which can | 2814 // Assigns a pointer map to an instruction. An instruction which can |
| 2846 // trigger a GC or a lazy deoptimization must have a pointer map. | 2815 // trigger a GC or a lazy deoptimization must have a pointer map. |
| 2847 LInstruction* AssignPointerMap(LInstruction* instr); | 2816 LInstruction* AssignPointerMap(LInstruction* instr); |
| 2848 | 2817 |
| 2849 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2818 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2850 | 2819 |
| 2851 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); | 2820 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2882 | 2851 |
| 2883 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2852 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2884 }; | 2853 }; |
| 2885 | 2854 |
| 2886 #undef DECLARE_HYDROGEN_ACCESSOR | 2855 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2887 #undef DECLARE_CONCRETE_INSTRUCTION | 2856 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2888 | 2857 |
| 2889 } } // namespace v8::internal | 2858 } } // namespace v8::internal |
| 2890 | 2859 |
| 2891 #endif // V8_IA32_LITHIUM_IA32_H_ | 2860 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |