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 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 explicit LGlobalReceiver(LOperand* global_object) { | 1835 explicit LGlobalReceiver(LOperand* global_object) { |
1831 inputs_[0] = global_object; | 1836 inputs_[0] = global_object; |
1832 } | 1837 } |
1833 | 1838 |
1834 LOperand* global() { return inputs_[0]; } | 1839 LOperand* global() { return inputs_[0]; } |
1835 | 1840 |
1836 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") | 1841 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
1837 }; | 1842 }; |
1838 | 1843 |
1839 | 1844 |
1840 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 1845 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
1841 public: | 1846 public: |
1842 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 1847 LCallJSFunction(LOperand* function, LOperand* call_kind) { |
1843 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 1848 inputs_[0] = function; |
| 1849 inputs_[1] = call_kind; |
| 1850 } |
| 1851 |
| 1852 LOperand* function() { return inputs_[0]; } |
| 1853 LOperand* call_kind() { return inputs_[1]; } |
| 1854 |
| 1855 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 1856 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
1844 | 1857 |
1845 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1858 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
1846 | 1859 |
1847 Handle<JSFunction> function() { return hydrogen()->function(); } | |
1848 int arity() const { return hydrogen()->argument_count() - 1; } | 1860 int arity() const { return hydrogen()->argument_count() - 1; } |
1849 }; | 1861 }; |
1850 | 1862 |
1851 | 1863 |
| 1864 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1865 public: |
| 1866 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, |
| 1867 ZoneList<LOperand*>& operands, |
| 1868 Zone* zone) |
| 1869 : descriptor_(descriptor), |
| 1870 inputs_(descriptor->environment_length() + 1, zone) { |
| 1871 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1872 inputs_.AddAll(operands, zone); |
| 1873 } |
| 1874 |
| 1875 LOperand* target() const { return inputs_[0]; } |
| 1876 |
| 1877 |
| 1878 private: |
| 1879 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") |
| 1880 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) |
| 1881 |
| 1882 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1883 |
| 1884 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1885 |
| 1886 const CallInterfaceDescriptor* descriptor_; |
| 1887 ZoneList<LOperand*> inputs_; |
| 1888 |
| 1889 virtual void InternalSetOperandAt(int index, |
| 1890 LOperand* value) V8_FINAL V8_OVERRIDE { |
| 1891 inputs_[index] = value; |
| 1892 } |
| 1893 |
| 1894 // Iterator support. |
| 1895 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1896 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1897 |
| 1898 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1899 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1900 }; |
| 1901 |
| 1902 |
1852 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1903 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
1853 public: | 1904 public: |
1854 LInvokeFunction(LOperand* context, LOperand* function) { | 1905 LInvokeFunction(LOperand* context, LOperand* function) { |
1855 inputs_[0] = context; | 1906 inputs_[0] = context; |
1856 inputs_[1] = function; | 1907 inputs_[1] = function; |
1857 } | 1908 } |
1858 | 1909 |
1859 LOperand* context() { return inputs_[0]; } | 1910 LOperand* context() { return inputs_[0]; } |
1860 LOperand* function() { return inputs_[1]; } | 1911 LOperand* function() { return inputs_[1]; } |
1861 | 1912 |
1862 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | 1913 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
1863 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | 1914 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
1864 | 1915 |
1865 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1916 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
1866 | 1917 |
1867 int arity() const { return hydrogen()->argument_count() - 1; } | 1918 int arity() const { return hydrogen()->argument_count() - 1; } |
1868 }; | 1919 }; |
1869 | 1920 |
1870 | |
1871 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { | |
1872 public: | |
1873 LCallKeyed(LOperand* context, LOperand* key) { | |
1874 inputs_[0] = context; | |
1875 inputs_[1] = key; | |
1876 } | |
1877 | |
1878 LOperand* context() { return inputs_[0]; } | |
1879 LOperand* key() { return inputs_[1]; } | |
1880 | |
1881 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | |
1882 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | |
1883 | |
1884 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
1885 | |
1886 int arity() const { return hydrogen()->argument_count() - 1; } | |
1887 }; | |
1888 | |
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 | 1921 |
1908 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1922 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
1909 public: | 1923 public: |
1910 explicit LCallFunction(LOperand* context, LOperand* function) { | 1924 explicit LCallFunction(LOperand* context, LOperand* function) { |
1911 inputs_[0] = context; | 1925 inputs_[0] = context; |
1912 inputs_[1] = function; | 1926 inputs_[1] = function; |
1913 } | 1927 } |
1914 | 1928 |
1915 LOperand* context() { return inputs_[0]; } | 1929 LOperand* context() { return inputs_[0]; } |
1916 LOperand* function() { return inputs_[1]; } | 1930 LOperand* function() { return inputs_[1]; } |
(...skipping 16 matching lines...) Expand all Loading... |
1933 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") | 1947 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
1934 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) | 1948 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
1935 | 1949 |
1936 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1950 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
1937 | 1951 |
1938 Handle<String> name() const {return hydrogen()->name(); } | 1952 Handle<String> name() const {return hydrogen()->name(); } |
1939 int arity() const { return hydrogen()->argument_count() - 1; } | 1953 int arity() const { return hydrogen()->argument_count() - 1; } |
1940 }; | 1954 }; |
1941 | 1955 |
1942 | 1956 |
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> { | 1957 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
1955 public: | 1958 public: |
1956 LCallNew(LOperand* context, LOperand* constructor) { | 1959 LCallNew(LOperand* context, LOperand* constructor) { |
1957 inputs_[0] = context; | 1960 inputs_[0] = context; |
1958 inputs_[1] = constructor; | 1961 inputs_[1] = constructor; |
1959 } | 1962 } |
1960 | 1963 |
1961 LOperand* context() { return inputs_[0]; } | 1964 LOperand* context() { return inputs_[0]; } |
1962 LOperand* constructor() { return inputs_[1]; } | 1965 LOperand* constructor() { return inputs_[1]; } |
1963 | 1966 |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 // Will not be moved to a register even if one is freely available. | 2819 // Will not be moved to a register even if one is freely available. |
2817 MUST_USE_RESULT LOperand* UseAny(HValue* value); | 2820 MUST_USE_RESULT LOperand* UseAny(HValue* value); |
2818 | 2821 |
2819 // Temporary operand that must be in a register. | 2822 // Temporary operand that must be in a register. |
2820 MUST_USE_RESULT LUnallocated* TempRegister(); | 2823 MUST_USE_RESULT LUnallocated* TempRegister(); |
2821 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | 2824 MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
2822 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); | 2825 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); |
2823 | 2826 |
2824 // Methods for setting up define-use relationships. | 2827 // Methods for setting up define-use relationships. |
2825 // Return the same instruction that they are passed. | 2828 // Return the same instruction that they are passed. |
2826 template<int I, int T> | 2829 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
2827 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2830 LUnallocated* result); |
2828 LUnallocated* result); | 2831 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
2829 template<int I, int T> | 2832 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
2830 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2833 int index); |
2831 template<int I, int T> | 2834 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
2832 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2835 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
2833 int index); | 2836 Register reg); |
2834 template<int I, int T> | 2837 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
2835 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | 2838 XMMRegister reg); |
2836 template<int I, int T> | 2839 LInstruction* DefineX87TOS(LTemplateResultInstruction<1>* instr); |
2837 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
2838 Register reg); | |
2839 template<int I, int T> | |
2840 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
2841 XMMRegister reg); | |
2842 template<int I, int T> | |
2843 LInstruction* DefineX87TOS(LTemplateInstruction<1, I, T>* instr); | |
2844 // Assigns an environment to an instruction. An instruction which can | 2840 // Assigns an environment to an instruction. An instruction which can |
2845 // deoptimize must have an environment. | 2841 // deoptimize must have an environment. |
2846 LInstruction* AssignEnvironment(LInstruction* instr); | 2842 LInstruction* AssignEnvironment(LInstruction* instr); |
2847 // Assigns a pointer map to an instruction. An instruction which can | 2843 // Assigns a pointer map to an instruction. An instruction which can |
2848 // trigger a GC or a lazy deoptimization must have a pointer map. | 2844 // trigger a GC or a lazy deoptimization must have a pointer map. |
2849 LInstruction* AssignPointerMap(LInstruction* instr); | 2845 LInstruction* AssignPointerMap(LInstruction* instr); |
2850 | 2846 |
2851 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2847 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
2852 | 2848 |
2853 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); | 2849 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 | 2886 |
2891 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2887 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2892 }; | 2888 }; |
2893 | 2889 |
2894 #undef DECLARE_HYDROGEN_ACCESSOR | 2890 #undef DECLARE_HYDROGEN_ACCESSOR |
2895 #undef DECLARE_CONCRETE_INSTRUCTION | 2891 #undef DECLARE_CONCRETE_INSTRUCTION |
2896 | 2892 |
2897 } } // namespace v8::internal | 2893 } } // namespace v8::internal |
2898 | 2894 |
2899 #endif // V8_IA32_LITHIUM_IA32_H_ | 2895 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |