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