| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 class IsCallBits: public BitField<bool, 0, 1> {}; | 291 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 294 | 292 |
| 295 LEnvironment* environment_; | 293 LEnvironment* environment_; |
| 296 SetOncePointer<LPointerMap> pointer_map_; | 294 SetOncePointer<LPointerMap> pointer_map_; |
| 297 HValue* hydrogen_value_; | 295 HValue* hydrogen_value_; |
| 298 int bit_field_; | 296 int bit_field_; |
| 299 }; | 297 }; |
| 300 | 298 |
| 301 | 299 |
| 302 // R = number of result operands (0 or 1). | 300 // R = number of result operands (0 or 1). |
| 303 // I = number of input operands. | 301 template<int R> |
| 304 // T = number of temporary operands. | 302 class LTemplateResultInstruction : public LInstruction { |
| 305 template<int R, int I, int T> | |
| 306 class LTemplateInstruction : public LInstruction { | |
| 307 public: | 303 public: |
| 308 // Allow 0 or 1 output operands. | 304 // Allow 0 or 1 output operands. |
| 309 STATIC_ASSERT(R == 0 || R == 1); | 305 STATIC_ASSERT(R == 0 || R == 1); |
| 310 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 306 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
| 311 return R != 0 && result() != NULL; | 307 return R != 0 && result() != NULL; |
| 312 } | 308 } |
| 313 void set_result(LOperand* operand) { results_[0] = operand; } | 309 void set_result(LOperand* operand) { results_[0] = operand; } |
| 314 LOperand* result() const { return results_[0]; } | 310 LOperand* result() const { return results_[0]; } |
| 315 | 311 |
| 316 protected: | 312 protected: |
| 317 EmbeddedContainer<LOperand*, R> results_; | 313 EmbeddedContainer<LOperand*, R> results_; |
| 314 }; |
| 315 |
| 316 |
| 317 // R = number of result operands (0 or 1). |
| 318 // I = number of input operands. |
| 319 // T = number of temporary operands. |
| 320 template<int R, int I, int T> |
| 321 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
| 322 protected: |
| 318 EmbeddedContainer<LOperand*, I> inputs_; | 323 EmbeddedContainer<LOperand*, I> inputs_; |
| 319 EmbeddedContainer<LOperand*, T> temps_; | 324 EmbeddedContainer<LOperand*, T> temps_; |
| 320 | 325 |
| 321 private: | 326 private: |
| 322 // Iterator support. | 327 // Iterator support. |
| 323 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } | 328 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } |
| 324 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } | 329 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 325 | 330 |
| 326 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } | 331 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } |
| 327 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } | 332 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 explicit LGlobalReceiver(LOperand* global_object) { | 1780 explicit LGlobalReceiver(LOperand* global_object) { |
| 1776 inputs_[0] = global_object; | 1781 inputs_[0] = global_object; |
| 1777 } | 1782 } |
| 1778 | 1783 |
| 1779 LOperand* global() { return inputs_[0]; } | 1784 LOperand* global() { return inputs_[0]; } |
| 1780 | 1785 |
| 1781 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") | 1786 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
| 1782 }; | 1787 }; |
| 1783 | 1788 |
| 1784 | 1789 |
| 1785 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 1790 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1786 public: | 1791 public: |
| 1787 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 1792 LCallJSFunction(LOperand* function, LOperand* call_kind) { |
| 1788 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 1793 inputs_[0] = function; |
| 1794 inputs_[1] = call_kind; |
| 1795 } |
| 1789 | 1796 |
| 1790 virtual void PrintDataTo(StringStream* stream); | 1797 LOperand* function() { return inputs_[0]; } |
| 1798 LOperand* call_kind() { return inputs_[1]; } |
| 1791 | 1799 |
| 1792 Handle<JSFunction> function() { return hydrogen()->function(); } | 1800 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 1801 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
| 1802 |
| 1803 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1804 |
| 1793 int arity() const { return hydrogen()->argument_count() - 1; } | 1805 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1794 }; | 1806 }; |
| 1795 | 1807 |
| 1796 | 1808 |
| 1809 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1810 public: |
| 1811 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, |
| 1812 ZoneList<LOperand*>& operands, |
| 1813 Zone* zone) |
| 1814 : descriptor_(descriptor), |
| 1815 inputs_(descriptor->environment_length() + 1, zone) { |
| 1816 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1817 inputs_.AddAll(operands, zone); |
| 1818 } |
| 1819 |
| 1820 LOperand* target() const { return inputs_[0]; } |
| 1821 |
| 1822 |
| 1823 private: |
| 1824 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") |
| 1825 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) |
| 1826 |
| 1827 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1828 |
| 1829 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1830 |
| 1831 const CallInterfaceDescriptor* descriptor_; |
| 1832 ZoneList<LOperand*> inputs_; |
| 1833 |
| 1834 virtual void InternalSetOperandAt(int index, |
| 1835 LOperand* value) V8_FINAL V8_OVERRIDE { |
| 1836 inputs_[index] = value; |
| 1837 } |
| 1838 |
| 1839 // Iterator support. |
| 1840 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1841 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1842 |
| 1843 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1844 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1845 }; |
| 1846 |
| 1847 |
| 1797 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1848 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1798 public: | 1849 public: |
| 1799 LInvokeFunction(LOperand* context, LOperand* function) { | 1850 LInvokeFunction(LOperand* context, LOperand* function) { |
| 1800 inputs_[0] = context; | 1851 inputs_[0] = context; |
| 1801 inputs_[1] = function; | 1852 inputs_[1] = function; |
| 1802 } | 1853 } |
| 1803 | 1854 |
| 1804 LOperand* context() { return inputs_[0]; } | 1855 LOperand* context() { return inputs_[0]; } |
| 1805 LOperand* function() { return inputs_[1]; } | 1856 LOperand* function() { return inputs_[1]; } |
| 1806 | 1857 |
| 1807 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | 1858 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1808 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | 1859 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1809 | 1860 |
| 1810 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1861 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1811 | 1862 |
| 1812 int arity() const { return hydrogen()->argument_count() - 1; } | 1863 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1813 }; | 1864 }; |
| 1814 | 1865 |
| 1815 | |
| 1816 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { | |
| 1817 public: | |
| 1818 LCallKeyed(LOperand* context, LOperand* key) { | |
| 1819 inputs_[0] = context; | |
| 1820 inputs_[1] = key; | |
| 1821 } | |
| 1822 | |
| 1823 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | |
| 1824 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | |
| 1825 | |
| 1826 LOperand* context() { return inputs_[0]; } | |
| 1827 LOperand* key() { return inputs_[1]; } | |
| 1828 | |
| 1829 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1830 | |
| 1831 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1832 }; | |
| 1833 | |
| 1834 | |
| 1835 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1836 public: | |
| 1837 explicit LCallNamed(LOperand* context) { | |
| 1838 inputs_[0] = context; | |
| 1839 } | |
| 1840 | |
| 1841 LOperand* context() { return inputs_[0]; } | |
| 1842 | |
| 1843 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") | |
| 1844 DECLARE_HYDROGEN_ACCESSOR(CallNamed) | |
| 1845 | |
| 1846 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1847 | |
| 1848 Handle<String> name() const { return hydrogen()->name(); } | |
| 1849 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1850 }; | |
| 1851 | |
| 1852 | 1866 |
| 1853 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1867 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1854 public: | 1868 public: |
| 1855 LCallFunction(LOperand* context, LOperand* function) { | 1869 LCallFunction(LOperand* context, LOperand* function) { |
| 1856 inputs_[0] = context; | 1870 inputs_[0] = context; |
| 1857 inputs_[1] = function; | 1871 inputs_[1] = function; |
| 1858 } | 1872 } |
| 1859 | 1873 |
| 1860 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") | 1874 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1861 DECLARE_HYDROGEN_ACCESSOR(CallFunction) | 1875 DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1877 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") | 1891 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
| 1878 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) | 1892 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
| 1879 | 1893 |
| 1880 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1894 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1881 | 1895 |
| 1882 Handle<String> name() const {return hydrogen()->name(); } | 1896 Handle<String> name() const {return hydrogen()->name(); } |
| 1883 int arity() const { return hydrogen()->argument_count() - 1; } | 1897 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1884 }; | 1898 }; |
| 1885 | 1899 |
| 1886 | 1900 |
| 1887 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 1888 public: | |
| 1889 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") | |
| 1890 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) | |
| 1891 | |
| 1892 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 1893 | |
| 1894 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 1895 }; | |
| 1896 | |
| 1897 | |
| 1898 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { | 1901 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { |
| 1899 public: | 1902 public: |
| 1900 LCallNew(LOperand* context, LOperand* constructor) { | 1903 LCallNew(LOperand* context, LOperand* constructor) { |
| 1901 inputs_[0] = context; | 1904 inputs_[0] = context; |
| 1902 inputs_[1] = constructor; | 1905 inputs_[1] = constructor; |
| 1903 } | 1906 } |
| 1904 | 1907 |
| 1905 LOperand* context() { return inputs_[0]; } | 1908 LOperand* context() { return inputs_[0]; } |
| 1906 LOperand* constructor() { return inputs_[1]; } | 1909 LOperand* constructor() { return inputs_[1]; } |
| 1907 | 1910 |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2732 // Will not be moved to a register even if one is freely available. | 2735 // Will not be moved to a register even if one is freely available. |
| 2733 MUST_USE_RESULT LOperand* UseAny(HValue* value); | 2736 MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2734 | 2737 |
| 2735 // Temporary operand that must be in a register. | 2738 // Temporary operand that must be in a register. |
| 2736 MUST_USE_RESULT LUnallocated* TempRegister(); | 2739 MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2737 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | 2740 MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2738 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); | 2741 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); |
| 2739 | 2742 |
| 2740 // Methods for setting up define-use relationships. | 2743 // Methods for setting up define-use relationships. |
| 2741 // Return the same instruction that they are passed. | 2744 // Return the same instruction that they are passed. |
| 2742 template<int I, int T> | 2745 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
| 2743 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2746 LUnallocated* result); |
| 2744 LUnallocated* result); | 2747 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
| 2745 template<int I, int T> | 2748 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
| 2746 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2749 int index); |
| 2747 template<int I, int T> | 2750 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
| 2748 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2751 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
| 2749 int index); | 2752 Register reg); |
| 2750 template<int I, int T> | 2753 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
| 2751 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | 2754 XMMRegister reg); |
| 2752 template<int I, int T> | |
| 2753 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 2754 Register reg); | |
| 2755 template<int I, int T> | |
| 2756 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
| 2757 XMMRegister reg); | |
| 2758 // Assigns an environment to an instruction. An instruction which can | 2755 // Assigns an environment to an instruction. An instruction which can |
| 2759 // deoptimize must have an environment. | 2756 // deoptimize must have an environment. |
| 2760 LInstruction* AssignEnvironment(LInstruction* instr); | 2757 LInstruction* AssignEnvironment(LInstruction* instr); |
| 2761 // Assigns a pointer map to an instruction. An instruction which can | 2758 // Assigns a pointer map to an instruction. An instruction which can |
| 2762 // trigger a GC or a lazy deoptimization must have a pointer map. | 2759 // trigger a GC or a lazy deoptimization must have a pointer map. |
| 2763 LInstruction* AssignPointerMap(LInstruction* instr); | 2760 LInstruction* AssignPointerMap(LInstruction* instr); |
| 2764 | 2761 |
| 2765 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2762 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2766 | 2763 |
| 2767 // Marks a call for the register allocator. Assigns a pointer map to | 2764 // Marks a call for the register allocator. Assigns a pointer map to |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2800 | 2797 |
| 2801 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2798 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2802 }; | 2799 }; |
| 2803 | 2800 |
| 2804 #undef DECLARE_HYDROGEN_ACCESSOR | 2801 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2805 #undef DECLARE_CONCRETE_INSTRUCTION | 2802 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2806 | 2803 |
| 2807 } } // namespace v8::int | 2804 } } // namespace v8::int |
| 2808 | 2805 |
| 2809 #endif // V8_X64_LITHIUM_X64_H_ | 2806 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |