| 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(CheckNonSmi) \ | 63 V(CheckNonSmi) \ |
| 66 V(CheckMaps) \ | 64 V(CheckMaps) \ |
| 67 V(CheckMapValue) \ | 65 V(CheckMapValue) \ |
| 68 V(CheckSmi) \ | 66 V(CheckSmi) \ |
| 69 V(CheckValue) \ | 67 V(CheckValue) \ |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 class IsCallBits: public BitField<bool, 0, 1> {}; | 293 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 296 | 294 |
| 297 LEnvironment* environment_; | 295 LEnvironment* environment_; |
| 298 SetOncePointer<LPointerMap> pointer_map_; | 296 SetOncePointer<LPointerMap> pointer_map_; |
| 299 HValue* hydrogen_value_; | 297 HValue* hydrogen_value_; |
| 300 int bit_field_; | 298 int bit_field_; |
| 301 }; | 299 }; |
| 302 | 300 |
| 303 | 301 |
| 304 // R = number of result operands (0 or 1). | 302 // R = number of result operands (0 or 1). |
| 305 // I = number of input operands. | 303 template<int R> |
| 306 // T = number of temporary operands. | 304 class LTemplateResultInstruction : public LInstruction { |
| 307 template<int R, int I, int T> | |
| 308 class LTemplateInstruction : public LInstruction { | |
| 309 public: | 305 public: |
| 310 // Allow 0 or 1 output operands. | 306 // Allow 0 or 1 output operands. |
| 311 STATIC_ASSERT(R == 0 || R == 1); | 307 STATIC_ASSERT(R == 0 || R == 1); |
| 312 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 308 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
| 313 return R != 0 && result() != NULL; | 309 return R != 0 && result() != NULL; |
| 314 } | 310 } |
| 315 void set_result(LOperand* operand) { results_[0] = operand; } | 311 void set_result(LOperand* operand) { results_[0] = operand; } |
| 316 LOperand* result() const { return results_[0]; } | 312 LOperand* result() const { return results_[0]; } |
| 317 | 313 |
| 318 protected: | 314 protected: |
| 319 EmbeddedContainer<LOperand*, R> results_; | 315 EmbeddedContainer<LOperand*, R> results_; |
| 316 }; |
| 317 |
| 318 |
| 319 // R = number of result operands (0 or 1). |
| 320 // I = number of input operands. |
| 321 // T = number of temporary operands. |
| 322 template<int R, int I, int T> |
| 323 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
| 324 protected: |
| 320 EmbeddedContainer<LOperand*, I> inputs_; | 325 EmbeddedContainer<LOperand*, I> inputs_; |
| 321 EmbeddedContainer<LOperand*, T> temps_; | 326 EmbeddedContainer<LOperand*, T> temps_; |
| 322 | 327 |
| 323 private: | 328 private: |
| 329 // Iterator support. |
| 324 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } | 330 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } |
| 325 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } | 331 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 326 | 332 |
| 327 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } | 333 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } |
| 328 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } | 334 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } |
| 329 }; | 335 }; |
| 330 | 336 |
| 331 | 337 |
| 332 class LGap : public LTemplateInstruction<0, 0, 0> { | 338 class LGap : public LTemplateInstruction<0, 0, 0> { |
| 333 public: | 339 public: |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 explicit LGlobalReceiver(LOperand* global_object) { | 1832 explicit LGlobalReceiver(LOperand* global_object) { |
| 1827 inputs_[0] = global_object; | 1833 inputs_[0] = global_object; |
| 1828 } | 1834 } |
| 1829 | 1835 |
| 1830 LOperand* global_object() { return inputs_[0]; } | 1836 LOperand* global_object() { return inputs_[0]; } |
| 1831 | 1837 |
| 1832 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") | 1838 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
| 1833 }; | 1839 }; |
| 1834 | 1840 |
| 1835 | 1841 |
| 1836 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 1842 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 1837 public: | 1843 public: |
| 1838 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 1844 explicit LCallJSFunction(LOperand* function) { |
| 1839 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 1845 inputs_[0] = function; |
| 1846 } |
| 1847 |
| 1848 LOperand* function() { return inputs_[0]; } |
| 1849 |
| 1850 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 1851 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
| 1840 | 1852 |
| 1841 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1853 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1842 | 1854 |
| 1843 Handle<JSFunction> function() { return hydrogen()->function(); } | |
| 1844 int arity() const { return hydrogen()->argument_count() - 1; } | 1855 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1845 }; | 1856 }; |
| 1846 | 1857 |
| 1847 | 1858 |
| 1859 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1860 public: |
| 1861 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, |
| 1862 ZoneList<LOperand*>& operands, |
| 1863 Zone* zone) |
| 1864 : descriptor_(descriptor), |
| 1865 inputs_(descriptor->environment_length() + 1, zone) { |
| 1866 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1867 inputs_.AddAll(operands, zone); |
| 1868 } |
| 1869 |
| 1870 LOperand* target() const { return inputs_[0]; } |
| 1871 |
| 1872 const CallInterfaceDescriptor* descriptor() { return descriptor_; } |
| 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 virtual void InternalSetOperandAt(int index, |
| 1886 LOperand* value) V8_FINAL V8_OVERRIDE { |
| 1887 inputs_[index] = value; |
| 1888 } |
| 1889 |
| 1890 // Iterator support. |
| 1891 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1892 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1893 |
| 1894 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1895 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1896 }; |
| 1897 |
| 1898 |
| 1848 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1899 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1849 public: | 1900 public: |
| 1850 LInvokeFunction(LOperand* context, LOperand* function) { | 1901 LInvokeFunction(LOperand* context, LOperand* function) { |
| 1851 inputs_[0] = context; | 1902 inputs_[0] = context; |
| 1852 inputs_[1] = function; | 1903 inputs_[1] = function; |
| 1853 } | 1904 } |
| 1854 | 1905 |
| 1855 LOperand* context() { return inputs_[0]; } | 1906 LOperand* context() { return inputs_[0]; } |
| 1856 LOperand* function() { return inputs_[1]; } | 1907 LOperand* function() { return inputs_[1]; } |
| 1857 | 1908 |
| 1858 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | 1909 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1859 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | 1910 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1860 | 1911 |
| 1861 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1912 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1862 | 1913 |
| 1863 int arity() const { return hydrogen()->argument_count() - 1; } | 1914 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1864 }; | 1915 }; |
| 1865 | 1916 |
| 1866 | |
| 1867 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { | |
| 1868 public: | |
| 1869 LCallKeyed(LOperand* context, LOperand* key) { | |
| 1870 inputs_[0] = context; | |
| 1871 inputs_[1] = key; | |
| 1872 } | |
| 1873 | |
| 1874 LOperand* context() { return inputs_[0]; } | |
| 1875 LOperand* key() { return inputs_[1]; } | |
| 1876 | |
| 1877 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | |
| 1878 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | |
| 1879 | |
| 1880 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1881 | |
| 1882 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1883 }; | |
| 1884 | |
| 1885 | |
| 1886 | |
| 1887 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1888 public: | |
| 1889 explicit LCallNamed(LOperand* context) { | |
| 1890 inputs_[0] = context; | |
| 1891 } | |
| 1892 | |
| 1893 LOperand* context() { return inputs_[0]; } | |
| 1894 | |
| 1895 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") | |
| 1896 DECLARE_HYDROGEN_ACCESSOR(CallNamed) | |
| 1897 | |
| 1898 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1899 | |
| 1900 Handle<String> name() const { return hydrogen()->name(); } | |
| 1901 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1902 }; | |
| 1903 | |
| 1904 | 1917 |
| 1905 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1918 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1906 public: | 1919 public: |
| 1907 LCallFunction(LOperand* context, LOperand* function) { | 1920 LCallFunction(LOperand* context, LOperand* function) { |
| 1908 inputs_[0] = context; | 1921 inputs_[0] = context; |
| 1909 inputs_[1] = function; | 1922 inputs_[1] = function; |
| 1910 } | 1923 } |
| 1911 | 1924 |
| 1912 LOperand* context() { return inputs_[0]; } | 1925 LOperand* context() { return inputs_[0]; } |
| 1913 LOperand* function() { return inputs_[1]; } | 1926 LOperand* function() { return inputs_[1]; } |
| 1914 | 1927 |
| 1915 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") | 1928 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1916 DECLARE_HYDROGEN_ACCESSOR(CallFunction) | 1929 DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 1917 | 1930 |
| 1918 int arity() const { return hydrogen()->argument_count() - 1; } | 1931 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1919 }; | 1932 }; |
| 1920 | 1933 |
| 1921 | 1934 |
| 1922 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 1923 public: | |
| 1924 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") | |
| 1925 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) | |
| 1926 | |
| 1927 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1928 | |
| 1929 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1930 }; | |
| 1931 | |
| 1932 | |
| 1933 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1935 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1934 public: | 1936 public: |
| 1935 LCallNew(LOperand* context, LOperand* constructor) { | 1937 LCallNew(LOperand* context, LOperand* constructor) { |
| 1936 inputs_[0] = context; | 1938 inputs_[0] = context; |
| 1937 inputs_[1] = constructor; | 1939 inputs_[1] = constructor; |
| 1938 } | 1940 } |
| 1939 | 1941 |
| 1940 LOperand* context() { return inputs_[0]; } | 1942 LOperand* context() { return inputs_[0]; } |
| 1941 LOperand* constructor() { return inputs_[1]; } | 1943 LOperand* constructor() { return inputs_[1]; } |
| 1942 | 1944 |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 // Will not be moved to a register even if one is freely available. | 2783 // Will not be moved to a register even if one is freely available. |
| 2782 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; | 2784 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; |
| 2783 | 2785 |
| 2784 // Temporary operand that must be in a register. | 2786 // Temporary operand that must be in a register. |
| 2785 MUST_USE_RESULT LUnallocated* TempRegister(); | 2787 MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2786 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | 2788 MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2787 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); | 2789 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); |
| 2788 | 2790 |
| 2789 // Methods for setting up define-use relationships. | 2791 // Methods for setting up define-use relationships. |
| 2790 // Return the same instruction that they are passed. | 2792 // Return the same instruction that they are passed. |
| 2791 template<int I, int T> | 2793 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
| 2792 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2794 LUnallocated* result); |
| 2793 LUnallocated* result); | 2795 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
| 2794 template<int I, int T> | 2796 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
| 2795 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2797 int index); |
| 2796 template<int I, int T> | 2798 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
| 2797 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2799 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
| 2798 int index); | 2800 Register reg); |
| 2799 template<int I, int T> | 2801 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
| 2800 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | 2802 DoubleRegister reg); |
| 2801 template<int I, int T> | |
| 2802 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 2803 Register reg); | |
| 2804 template<int I, int T> | |
| 2805 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
| 2806 DoubleRegister reg); | |
| 2807 LInstruction* AssignEnvironment(LInstruction* instr); | 2803 LInstruction* AssignEnvironment(LInstruction* instr); |
| 2808 LInstruction* AssignPointerMap(LInstruction* instr); | 2804 LInstruction* AssignPointerMap(LInstruction* instr); |
| 2809 | 2805 |
| 2810 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2806 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2811 | 2807 |
| 2812 // By default we assume that instruction sequences generated for calls | 2808 // By default we assume that instruction sequences generated for calls |
| 2813 // cannot deoptimize eagerly and we do not attach environment to this | 2809 // cannot deoptimize eagerly and we do not attach environment to this |
| 2814 // instruction. | 2810 // instruction. |
| 2815 LInstruction* MarkAsCall( | 2811 LInstruction* MarkAsCall( |
| 2816 LInstruction* instr, | 2812 LInstruction* instr, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2840 | 2836 |
| 2841 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2837 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2842 }; | 2838 }; |
| 2843 | 2839 |
| 2844 #undef DECLARE_HYDROGEN_ACCESSOR | 2840 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2845 #undef DECLARE_CONCRETE_INSTRUCTION | 2841 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2846 | 2842 |
| 2847 } } // namespace v8::internal | 2843 } } // namespace v8::internal |
| 2848 | 2844 |
| 2849 #endif // V8_ARM_LITHIUM_ARM_H_ | 2845 #endif // V8_ARM_LITHIUM_ARM_H_ |
| OLD | NEW |