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