| 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(CheckNonSmi) \ | 64 V(CheckNonSmi) \ |
| 67 V(CheckMaps) \ | 65 V(CheckMaps) \ |
| 68 V(CheckMapValue) \ | 66 V(CheckMapValue) \ |
| 69 V(CheckSmi) \ | 67 V(CheckSmi) \ |
| 70 V(CheckValue) \ | 68 V(CheckValue) \ |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 class IsCallBits: public BitField<bool, 0, 1> {}; | 294 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 297 | 295 |
| 298 LEnvironment* environment_; | 296 LEnvironment* environment_; |
| 299 SetOncePointer<LPointerMap> pointer_map_; | 297 SetOncePointer<LPointerMap> pointer_map_; |
| 300 HValue* hydrogen_value_; | 298 HValue* hydrogen_value_; |
| 301 int bit_field_; | 299 int bit_field_; |
| 302 }; | 300 }; |
| 303 | 301 |
| 304 | 302 |
| 305 // R = number of result operands (0 or 1). | 303 // R = number of result operands (0 or 1). |
| 306 // I = number of input operands. | 304 template<int R> |
| 307 // T = number of temporary operands. | 305 class LTemplateResultInstruction : public LInstruction { |
| 308 template<int R, int I, int T> | |
| 309 class LTemplateInstruction : public LInstruction { | |
| 310 public: | 306 public: |
| 311 // Allow 0 or 1 output operands. | 307 // Allow 0 or 1 output operands. |
| 312 STATIC_ASSERT(R == 0 || R == 1); | 308 STATIC_ASSERT(R == 0 || R == 1); |
| 313 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 309 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
| 314 return R != 0 && result() != NULL; | 310 return R != 0 && result() != NULL; |
| 315 } | 311 } |
| 316 void set_result(LOperand* operand) { results_[0] = operand; } | 312 void set_result(LOperand* operand) { results_[0] = operand; } |
| 317 LOperand* result() const { return results_[0]; } | 313 LOperand* result() const { return results_[0]; } |
| 318 | 314 |
| 319 protected: | 315 protected: |
| 320 EmbeddedContainer<LOperand*, R> results_; | 316 EmbeddedContainer<LOperand*, R> results_; |
| 317 }; |
| 318 |
| 319 |
| 320 // R = number of result operands (0 or 1). |
| 321 // I = number of input operands. |
| 322 // T = number of temporary operands. |
| 323 template<int R, int I, int T> |
| 324 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
| 325 protected: |
| 321 EmbeddedContainer<LOperand*, I> inputs_; | 326 EmbeddedContainer<LOperand*, I> inputs_; |
| 322 EmbeddedContainer<LOperand*, T> temps_; | 327 EmbeddedContainer<LOperand*, T> temps_; |
| 323 | 328 |
| 324 private: | 329 private: |
| 330 // Iterator support. |
| 325 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } | 331 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } |
| 326 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } | 332 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 327 | 333 |
| 328 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } | 334 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } |
| 329 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } | 335 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } |
| 330 }; | 336 }; |
| 331 | 337 |
| 332 | 338 |
| 333 class LGap : public LTemplateInstruction<0, 0, 0> { | 339 class LGap : public LTemplateInstruction<0, 0, 0> { |
| 334 public: | 340 public: |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 explicit LGlobalReceiver(LOperand* global_object) { | 1837 explicit LGlobalReceiver(LOperand* global_object) { |
| 1832 inputs_[0] = global_object; | 1838 inputs_[0] = global_object; |
| 1833 } | 1839 } |
| 1834 | 1840 |
| 1835 LOperand* global_object() { return inputs_[0]; } | 1841 LOperand* global_object() { return inputs_[0]; } |
| 1836 | 1842 |
| 1837 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") | 1843 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
| 1838 }; | 1844 }; |
| 1839 | 1845 |
| 1840 | 1846 |
| 1841 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 1847 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1842 public: | 1848 public: |
| 1843 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 1849 LCallJSFunction(LOperand* function, LOperand* call_kind) { |
| 1844 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 1850 inputs_[0] = function; |
| 1851 inputs_[1] = call_kind; |
| 1852 } |
| 1853 |
| 1854 LOperand* function() { return inputs_[0]; } |
| 1855 LOperand* call_kind() { return inputs_[1]; } |
| 1856 |
| 1857 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 1858 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
| 1845 | 1859 |
| 1846 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1860 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1847 | 1861 |
| 1848 Handle<JSFunction> function() { return hydrogen()->function(); } | |
| 1849 int arity() const { return hydrogen()->argument_count() - 1; } | 1862 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1850 }; | 1863 }; |
| 1851 | 1864 |
| 1852 | 1865 |
| 1866 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1867 public: |
| 1868 LCallWithDescriptor(const CodeStubInterfaceDescriptor* descriptor, |
| 1869 ZoneList<LOperand*>& operands, |
| 1870 Zone* zone) |
| 1871 : descriptor_(descriptor), |
| 1872 inputs_(descriptor->environment_length() + 1, zone) { |
| 1873 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1874 inputs_.AddAll(operands, zone); |
| 1875 } |
| 1876 |
| 1877 LOperand* target() const { return inputs_[0]; } |
| 1878 |
| 1879 |
| 1880 private: |
| 1881 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") |
| 1882 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) |
| 1883 |
| 1884 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1885 |
| 1886 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1887 |
| 1888 const CodeStubInterfaceDescriptor* descriptor_; |
| 1889 ZoneList<LOperand*> inputs_; |
| 1890 |
| 1891 virtual void InternalSetOperandAt(int index, |
| 1892 LOperand* value) V8_FINAL V8_OVERRIDE { |
| 1893 inputs_[index] = value; |
| 1894 } |
| 1895 |
| 1896 // Iterator support. |
| 1897 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1898 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1899 |
| 1900 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1901 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1902 }; |
| 1903 |
| 1904 |
| 1853 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1905 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1854 public: | 1906 public: |
| 1855 LInvokeFunction(LOperand* context, LOperand* function) { | 1907 LInvokeFunction(LOperand* context, LOperand* function) { |
| 1856 inputs_[0] = context; | 1908 inputs_[0] = context; |
| 1857 inputs_[1] = function; | 1909 inputs_[1] = function; |
| 1858 } | 1910 } |
| 1859 | 1911 |
| 1860 LOperand* context() { return inputs_[0]; } | 1912 LOperand* context() { return inputs_[0]; } |
| 1861 LOperand* function() { return inputs_[1]; } | 1913 LOperand* function() { return inputs_[1]; } |
| 1862 | 1914 |
| 1863 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | 1915 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1864 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | 1916 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1865 | 1917 |
| 1866 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1918 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1867 | 1919 |
| 1868 int arity() const { return hydrogen()->argument_count() - 1; } | 1920 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1869 }; | 1921 }; |
| 1870 | 1922 |
| 1871 | |
| 1872 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { | |
| 1873 public: | |
| 1874 LCallKeyed(LOperand* context, LOperand* key) { | |
| 1875 inputs_[0] = context; | |
| 1876 inputs_[1] = key; | |
| 1877 } | |
| 1878 | |
| 1879 LOperand* context() { return inputs_[0]; } | |
| 1880 LOperand* key() { return inputs_[1]; } | |
| 1881 | |
| 1882 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | |
| 1883 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | |
| 1884 | |
| 1885 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1886 | |
| 1887 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1888 }; | |
| 1889 | |
| 1890 | |
| 1891 | |
| 1892 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1893 public: | |
| 1894 explicit LCallNamed(LOperand* context) { | |
| 1895 inputs_[0] = context; | |
| 1896 } | |
| 1897 | |
| 1898 LOperand* context() { return inputs_[0]; } | |
| 1899 | |
| 1900 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") | |
| 1901 DECLARE_HYDROGEN_ACCESSOR(CallNamed) | |
| 1902 | |
| 1903 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1904 | |
| 1905 Handle<String> name() const { return hydrogen()->name(); } | |
| 1906 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1907 }; | |
| 1908 | |
| 1909 | 1923 |
| 1910 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1924 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1911 public: | 1925 public: |
| 1912 LCallFunction(LOperand* context, LOperand* function) { | 1926 LCallFunction(LOperand* context, LOperand* function) { |
| 1913 inputs_[0] = context; | 1927 inputs_[0] = context; |
| 1914 inputs_[1] = function; | 1928 inputs_[1] = function; |
| 1915 } | 1929 } |
| 1916 | 1930 |
| 1917 LOperand* context() { return inputs_[0]; } | 1931 LOperand* context() { return inputs_[0]; } |
| 1918 LOperand* function() { return inputs_[1]; } | 1932 LOperand* function() { return inputs_[1]; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1935 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") | 1949 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
| 1936 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) | 1950 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
| 1937 | 1951 |
| 1938 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1952 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1939 | 1953 |
| 1940 Handle<String> name() const {return hydrogen()->name(); } | 1954 Handle<String> name() const {return hydrogen()->name(); } |
| 1941 int arity() const { return hydrogen()->argument_count() - 1; } | 1955 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1942 }; | 1956 }; |
| 1943 | 1957 |
| 1944 | 1958 |
| 1945 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 1946 public: | |
| 1947 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") | |
| 1948 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) | |
| 1949 | |
| 1950 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1951 | |
| 1952 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1953 }; | |
| 1954 | |
| 1955 | |
| 1956 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1959 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1957 public: | 1960 public: |
| 1958 LCallNew(LOperand* context, LOperand* constructor) { | 1961 LCallNew(LOperand* context, LOperand* constructor) { |
| 1959 inputs_[0] = context; | 1962 inputs_[0] = context; |
| 1960 inputs_[1] = constructor; | 1963 inputs_[1] = constructor; |
| 1961 } | 1964 } |
| 1962 | 1965 |
| 1963 LOperand* context() { return inputs_[0]; } | 1966 LOperand* context() { return inputs_[0]; } |
| 1964 LOperand* constructor() { return inputs_[1]; } | 1967 LOperand* constructor() { return inputs_[1]; } |
| 1965 | 1968 |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 // Will not be moved to a register even if one is freely available. | 2809 // Will not be moved to a register even if one is freely available. |
| 2807 MUST_USE_RESULT LOperand* UseAny(HValue* value); | 2810 MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2808 | 2811 |
| 2809 // Temporary operand that must be in a register. | 2812 // Temporary operand that must be in a register. |
| 2810 MUST_USE_RESULT LUnallocated* TempRegister(); | 2813 MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2811 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | 2814 MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2812 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); | 2815 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); |
| 2813 | 2816 |
| 2814 // Methods for setting up define-use relationships. | 2817 // Methods for setting up define-use relationships. |
| 2815 // Return the same instruction that they are passed. | 2818 // Return the same instruction that they are passed. |
| 2816 template<int I, int T> | 2819 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
| 2817 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2820 LUnallocated* result); |
| 2818 LUnallocated* result); | 2821 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
| 2819 template<int I, int T> | 2822 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
| 2820 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2823 int index); |
| 2821 template<int I, int T> | 2824 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
| 2822 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2825 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
| 2823 int index); | 2826 Register reg); |
| 2824 template<int I, int T> | 2827 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
| 2825 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | 2828 DoubleRegister reg); |
| 2826 template<int I, int T> | |
| 2827 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 2828 Register reg); | |
| 2829 template<int I, int T> | |
| 2830 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
| 2831 DoubleRegister reg); | |
| 2832 LInstruction* AssignEnvironment(LInstruction* instr); | 2829 LInstruction* AssignEnvironment(LInstruction* instr); |
| 2833 LInstruction* AssignPointerMap(LInstruction* instr); | 2830 LInstruction* AssignPointerMap(LInstruction* instr); |
| 2834 | 2831 |
| 2835 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2832 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2836 | 2833 |
| 2837 // By default we assume that instruction sequences generated for calls | 2834 // By default we assume that instruction sequences generated for calls |
| 2838 // cannot deoptimize eagerly and we do not attach environment to this | 2835 // cannot deoptimize eagerly and we do not attach environment to this |
| 2839 // instruction. | 2836 // instruction. |
| 2840 LInstruction* MarkAsCall( | 2837 LInstruction* MarkAsCall( |
| 2841 LInstruction* instr, | 2838 LInstruction* instr, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2871 | 2868 |
| 2872 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2869 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2873 }; | 2870 }; |
| 2874 | 2871 |
| 2875 #undef DECLARE_HYDROGEN_ACCESSOR | 2872 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2876 #undef DECLARE_CONCRETE_INSTRUCTION | 2873 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2877 | 2874 |
| 2878 } } // namespace v8::internal | 2875 } } // namespace v8::internal |
| 2879 | 2876 |
| 2880 #endif // V8_ARM_LITHIUM_ARM_H_ | 2877 #endif // V8_ARM_LITHIUM_ARM_H_ |
| OLD | NEW |