Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: src/mips/lithium-mips.h

Issue 137663005: MIPS: This is a preview of a first step towards unification of the hydrogen call machinery. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 class IsCallBits: public BitField<bool, 0, 1> {}; 290 class IsCallBits: public BitField<bool, 0, 1> {};
293 291
294 LEnvironment* environment_; 292 LEnvironment* environment_;
295 SetOncePointer<LPointerMap> pointer_map_; 293 SetOncePointer<LPointerMap> pointer_map_;
296 HValue* hydrogen_value_; 294 HValue* hydrogen_value_;
297 int bit_field_; 295 int bit_field_;
298 }; 296 };
299 297
300 298
301 // R = number of result operands (0 or 1). 299 // R = number of result operands (0 or 1).
302 // I = number of input operands. 300 template<int R>
303 // T = number of temporary operands. 301 class LTemplateResultInstruction : public LInstruction {
304 template<int R, int I, int T>
305 class LTemplateInstruction : public LInstruction {
306 public: 302 public:
307 // Allow 0 or 1 output operands. 303 // Allow 0 or 1 output operands.
308 STATIC_ASSERT(R == 0 || R == 1); 304 STATIC_ASSERT(R == 0 || R == 1);
309 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { 305 virtual bool HasResult() const V8_FINAL V8_OVERRIDE {
310 return R != 0 && result() != NULL; 306 return R != 0 && result() != NULL;
311 } 307 }
312 void set_result(LOperand* operand) { results_[0] = operand; } 308 void set_result(LOperand* operand) { results_[0] = operand; }
313 LOperand* result() const { return results_[0]; } 309 LOperand* result() const { return results_[0]; }
314 310
315 protected: 311 protected:
316 EmbeddedContainer<LOperand*, R> results_; 312 EmbeddedContainer<LOperand*, R> results_;
313 };
314
315
316 // R = number of result operands (0 or 1).
317 // I = number of input operands.
318 // T = number of temporary operands.
319 template<int R, int I, int T>
320 class LTemplateInstruction : public LTemplateResultInstruction<R> {
321 protected:
317 EmbeddedContainer<LOperand*, I> inputs_; 322 EmbeddedContainer<LOperand*, I> inputs_;
318 EmbeddedContainer<LOperand*, T> temps_; 323 EmbeddedContainer<LOperand*, T> temps_;
319 324
320 private: 325 private:
326 // Iterator support.
321 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } 327 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
322 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } 328 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
323 329
324 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } 330 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
325 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } 331 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; }
326 }; 332 };
327 333
328 334
329 class LGap : public LTemplateInstruction<0, 0, 0> { 335 class LGap : public LTemplateInstruction<0, 0, 0> {
330 public: 336 public:
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 explicit LGlobalReceiver(LOperand* global_object) { 1812 explicit LGlobalReceiver(LOperand* global_object) {
1807 inputs_[0] = global_object; 1813 inputs_[0] = global_object;
1808 } 1814 }
1809 1815
1810 LOperand* global_object() { return inputs_[0]; } 1816 LOperand* global_object() { return inputs_[0]; }
1811 1817
1812 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1818 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1813 }; 1819 };
1814 1820
1815 1821
1816 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { 1822 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1817 public: 1823 public:
1818 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1824 explicit LCallJSFunction(LOperand* function) {
1819 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1825 inputs_[0] = function;
1826 }
1827
1828 LOperand* function() { return inputs_[0]; }
1829
1830 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1831 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1820 1832
1821 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1833 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1822 1834
1823 Handle<JSFunction> function() { return hydrogen()->function(); }
1824 int arity() const { return hydrogen()->argument_count() - 1; } 1835 int arity() const { return hydrogen()->argument_count() - 1; }
1825 }; 1836 };
1826 1837
1827 1838
1839 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
1840 public:
1841 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
1842 ZoneList<LOperand*>& operands,
1843 Zone* zone)
1844 : descriptor_(descriptor),
1845 inputs_(descriptor->environment_length() + 1, zone) {
1846 ASSERT(descriptor->environment_length() + 1 == operands.length());
1847 inputs_.AddAll(operands, zone);
1848 }
1849
1850 LOperand* target() const { return inputs_[0]; }
1851
1852 const CallInterfaceDescriptor* descriptor() { return descriptor_; }
1853
1854 private:
1855 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1856 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1857
1858 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1859
1860 int arity() const { return hydrogen()->argument_count() - 1; }
1861
1862 const CallInterfaceDescriptor* descriptor_;
1863 ZoneList<LOperand*> inputs_;
1864
1865 virtual void InternalSetOperandAt(int index,
1866 LOperand* value) V8_FINAL V8_OVERRIDE {
1867 inputs_[index] = value;
1868 }
1869
1870 // Iterator support.
1871 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); }
1872 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
1873
1874 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; }
1875 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; }
1876 };
1877
1878
1828 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1879 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1829 public: 1880 public:
1830 LInvokeFunction(LOperand* context, LOperand* function) { 1881 LInvokeFunction(LOperand* context, LOperand* function) {
1831 inputs_[0] = context; 1882 inputs_[0] = context;
1832 inputs_[1] = function; 1883 inputs_[1] = function;
1833 } 1884 }
1834 1885
1835 LOperand* context() { return inputs_[0]; } 1886 LOperand* context() { return inputs_[0]; }
1836 LOperand* function() { return inputs_[1]; } 1887 LOperand* function() { return inputs_[1]; }
1837 1888
1838 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") 1889 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1839 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) 1890 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1840 1891
1841 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1892 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1842 1893
1843 int arity() const { return hydrogen()->argument_count() - 1; } 1894 int arity() const { return hydrogen()->argument_count() - 1; }
1844 }; 1895 };
1845 1896
1846
1847 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1848 public:
1849 LCallKeyed(LOperand* context, LOperand* key) {
1850 inputs_[0] = context;
1851 inputs_[1] = key;
1852 }
1853
1854 LOperand* context() { return inputs_[0]; }
1855 LOperand* key() { return inputs_[1]; }
1856
1857 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1858 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1859
1860 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1861
1862 int arity() const { return hydrogen()->argument_count() - 1; }
1863 };
1864
1865
1866
1867 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1868 public:
1869 explicit LCallNamed(LOperand* context) {
1870 inputs_[0] = context;
1871 }
1872
1873 LOperand* context() { return inputs_[0]; }
1874
1875 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1876 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1877
1878 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1879
1880 Handle<String> name() const { return hydrogen()->name(); }
1881 int arity() const { return hydrogen()->argument_count() - 1; }
1882 };
1883
1884 1897
1885 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1898 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1886 public: 1899 public:
1887 LCallFunction(LOperand* context, LOperand* function) { 1900 LCallFunction(LOperand* context, LOperand* function) {
1888 inputs_[0] = context; 1901 inputs_[0] = context;
1889 inputs_[1] = function; 1902 inputs_[1] = function;
1890 } 1903 }
1891 1904
1892 LOperand* context() { return inputs_[0]; } 1905 LOperand* context() { return inputs_[0]; }
1893 LOperand* function() { return inputs_[1]; } 1906 LOperand* function() { return inputs_[1]; }
1894 1907
1895 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") 1908 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1896 DECLARE_HYDROGEN_ACCESSOR(CallFunction) 1909 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1897 1910
1898 int arity() const { return hydrogen()->argument_count() - 1; } 1911 int arity() const { return hydrogen()->argument_count() - 1; }
1899 }; 1912 };
1900 1913
1901 1914
1902 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1903 public:
1904 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1905 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1906
1907 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1908
1909 int arity() const { return hydrogen()->argument_count() - 1; }
1910 };
1911
1912
1913 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1915 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1914 public: 1916 public:
1915 LCallNew(LOperand* context, LOperand* constructor) { 1917 LCallNew(LOperand* context, LOperand* constructor) {
1916 inputs_[0] = context; 1918 inputs_[0] = context;
1917 inputs_[1] = constructor; 1919 inputs_[1] = constructor;
1918 } 1920 }
1919 1921
1920 LOperand* context() { return inputs_[0]; } 1922 LOperand* context() { return inputs_[0]; }
1921 LOperand* constructor() { return inputs_[1]; } 1923 LOperand* constructor() { return inputs_[1]; }
1922 1924
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 // Will not be moved to a register even if one is freely available. 2757 // Will not be moved to a register even if one is freely available.
2756 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; 2758 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE;
2757 2759
2758 // Temporary operand that must be in a register. 2760 // Temporary operand that must be in a register.
2759 MUST_USE_RESULT LUnallocated* TempRegister(); 2761 MUST_USE_RESULT LUnallocated* TempRegister();
2760 MUST_USE_RESULT LOperand* FixedTemp(Register reg); 2762 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2761 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); 2763 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2762 2764
2763 // Methods for setting up define-use relationships. 2765 // Methods for setting up define-use relationships.
2764 // Return the same instruction that they are passed. 2766 // Return the same instruction that they are passed.
2765 template<int I, int T> 2767 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2766 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, 2768 LUnallocated* result);
2767 LUnallocated* result); 2769 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2768 template<int I, int T> 2770 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2769 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); 2771 int index);
2770 template<int I, int T> 2772 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2771 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, 2773 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2772 int index); 2774 Register reg);
2773 template<int I, int T> 2775 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2774 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); 2776 DoubleRegister reg);
2775 template<int I, int T>
2776 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2777 Register reg);
2778 template<int I, int T>
2779 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2780 DoubleRegister reg);
2781 LInstruction* AssignEnvironment(LInstruction* instr); 2777 LInstruction* AssignEnvironment(LInstruction* instr);
2782 LInstruction* AssignPointerMap(LInstruction* instr); 2778 LInstruction* AssignPointerMap(LInstruction* instr);
2783 2779
2784 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; 2780 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2785 2781
2786 // By default we assume that instruction sequences generated for calls 2782 // By default we assume that instruction sequences generated for calls
2787 // cannot deoptimize eagerly and we do not attach environment to this 2783 // cannot deoptimize eagerly and we do not attach environment to this
2788 // instruction. 2784 // instruction.
2789 LInstruction* MarkAsCall( 2785 LInstruction* MarkAsCall(
2790 LInstruction* instr, 2786 LInstruction* instr,
(...skipping 24 matching lines...) Expand all
2815 2811
2816 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2812 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2817 }; 2813 };
2818 2814
2819 #undef DECLARE_HYDROGEN_ACCESSOR 2815 #undef DECLARE_HYDROGEN_ACCESSOR
2820 #undef DECLARE_CONCRETE_INSTRUCTION 2816 #undef DECLARE_CONCRETE_INSTRUCTION
2821 2817
2822 } } // namespace v8::internal 2818 } } // namespace v8::internal
2823 2819
2824 #endif // V8_MIPS_LITHIUM_MIPS_H_ 2820 #endif // V8_MIPS_LITHIUM_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698