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

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

Issue 104663004: Preview of a first step towards unification of hydrogen calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed code review comments 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
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(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(CheckNonSmi) \ 64 V(CheckNonSmi) \
67 V(CheckMaps) \ 65 V(CheckMaps) \
68 V(CheckMapValue) \ 66 V(CheckMapValue) \
69 V(CheckSmi) \ 67 V(CheckSmi) \
70 V(CheckValue) \ 68 V(CheckValue) \
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 class IsCallBits: public BitField<bool, 0, 1> {}; 294 class IsCallBits: public BitField<bool, 0, 1> {};
297 295
298 LEnvironment* environment_; 296 LEnvironment* environment_;
299 SetOncePointer<LPointerMap> pointer_map_; 297 SetOncePointer<LPointerMap> pointer_map_;
300 HValue* hydrogen_value_; 298 HValue* hydrogen_value_;
301 int bit_field_; 299 int bit_field_;
302 }; 300 };
303 301
304 302
305 // R = number of result operands (0 or 1). 303 // R = number of result operands (0 or 1).
306 // I = number of input operands. 304 template<int R>
307 // T = number of temporary operands. 305 class LTemplateResultInstruction : public LInstruction {
308 template<int R, int I, int T>
309 class LTemplateInstruction : public LInstruction {
310 public: 306 public:
311 // Allow 0 or 1 output operands. 307 // Allow 0 or 1 output operands.
312 STATIC_ASSERT(R == 0 || R == 1); 308 STATIC_ASSERT(R == 0 || R == 1);
313 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { 309 virtual bool HasResult() const V8_FINAL V8_OVERRIDE {
314 return R != 0 && result() != NULL; 310 return R != 0 && result() != NULL;
315 } 311 }
316 void set_result(LOperand* operand) { results_[0] = operand; } 312 void set_result(LOperand* operand) { results_[0] = operand; }
317 LOperand* result() const { return results_[0]; } 313 LOperand* result() const { return results_[0]; }
318 314
319 protected: 315 protected:
320 EmbeddedContainer<LOperand*, R> results_; 316 EmbeddedContainer<LOperand*, R> results_;
317 };
318
319
320 // R = number of result operands (0 or 1).
321 // I = number of input operands.
322 // T = number of temporary operands.
323 template<int R, int I, int T>
324 class LTemplateInstruction : public LTemplateResultInstruction<R> {
325 protected:
321 EmbeddedContainer<LOperand*, I> inputs_; 326 EmbeddedContainer<LOperand*, I> inputs_;
322 EmbeddedContainer<LOperand*, T> temps_; 327 EmbeddedContainer<LOperand*, T> temps_;
323 328
324 private: 329 private:
330 // Iterator support.
325 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } 331 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
326 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } 332 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
327 333
328 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } 334 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
329 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } 335 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; }
330 }; 336 };
331 337
332 338
333 class LGap : public LTemplateInstruction<0, 0, 0> { 339 class LGap : public LTemplateInstruction<0, 0, 0> {
334 public: 340 public:
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 explicit LGlobalReceiver(LOperand* global_object) { 1833 explicit LGlobalReceiver(LOperand* global_object) {
1828 inputs_[0] = global_object; 1834 inputs_[0] = global_object;
1829 } 1835 }
1830 1836
1831 LOperand* global_object() { return inputs_[0]; } 1837 LOperand* global_object() { return inputs_[0]; }
1832 1838
1833 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1839 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1834 }; 1840 };
1835 1841
1836 1842
1837 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { 1843 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1838 public: 1844 public:
1839 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1845 LCallJSFunction(LOperand* function, LOperand* call_kind) {
1840 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1846 inputs_[0] = function;
1847 inputs_[1] = call_kind;
1848 }
1849
1850 LOperand* function() { return inputs_[0]; }
1851 LOperand* call_kind() { return inputs_[1]; }
1852
1853 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1854 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1841 1855
1842 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1856 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1843 1857
1844 Handle<JSFunction> function() { return hydrogen()->function(); }
1845 int arity() const { return hydrogen()->argument_count() - 1; } 1858 int arity() const { return hydrogen()->argument_count() - 1; }
1846 }; 1859 };
1847 1860
1848 1861
1862 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
1863 public:
1864 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
1865 ZoneList<LOperand*>& operands,
1866 Zone* zone)
1867 : descriptor_(descriptor),
1868 inputs_(descriptor->environment_length() + 1, zone) {
1869 ASSERT(descriptor->environment_length() + 1 == operands.length());
1870 inputs_.AddAll(operands, zone);
1871 }
1872
1873 LOperand* target() const { return inputs_[0]; }
1874
1875 const CallInterfaceDescriptor* descriptor() { return descriptor_; }
1876
1877 private:
1878 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1879 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1880
1881 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1882
1883 int arity() const { return hydrogen()->argument_count() - 1; }
1884
1885 const CallInterfaceDescriptor* descriptor_;
1886 ZoneList<LOperand*> inputs_;
1887
1888 virtual void InternalSetOperandAt(int index,
1889 LOperand* value) V8_FINAL V8_OVERRIDE {
1890 inputs_[index] = value;
1891 }
1892
1893 // Iterator support.
1894 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); }
1895 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
1896
1897 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; }
1898 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; }
1899 };
1900
1901
1849 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1902 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1850 public: 1903 public:
1851 LInvokeFunction(LOperand* context, LOperand* function) { 1904 LInvokeFunction(LOperand* context, LOperand* function) {
1852 inputs_[0] = context; 1905 inputs_[0] = context;
1853 inputs_[1] = function; 1906 inputs_[1] = function;
1854 } 1907 }
1855 1908
1856 LOperand* context() { return inputs_[0]; } 1909 LOperand* context() { return inputs_[0]; }
1857 LOperand* function() { return inputs_[1]; } 1910 LOperand* function() { return inputs_[1]; }
1858 1911
1859 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") 1912 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1860 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) 1913 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1861 1914
1862 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1915 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1863 1916
1864 int arity() const { return hydrogen()->argument_count() - 1; } 1917 int arity() const { return hydrogen()->argument_count() - 1; }
1865 }; 1918 };
1866 1919
1867
1868 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1869 public:
1870 LCallKeyed(LOperand* context, LOperand* key) {
1871 inputs_[0] = context;
1872 inputs_[1] = key;
1873 }
1874
1875 LOperand* context() { return inputs_[0]; }
1876 LOperand* key() { return inputs_[1]; }
1877
1878 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1879 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1880
1881 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1882
1883 int arity() const { return hydrogen()->argument_count() - 1; }
1884 };
1885
1886
1887
1888 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1889 public:
1890 explicit LCallNamed(LOperand* context) {
1891 inputs_[0] = context;
1892 }
1893
1894 LOperand* context() { return inputs_[0]; }
1895
1896 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1897 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1898
1899 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1900
1901 Handle<String> name() const { return hydrogen()->name(); }
1902 int arity() const { return hydrogen()->argument_count() - 1; }
1903 };
1904
1905 1920
1906 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1921 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1907 public: 1922 public:
1908 LCallFunction(LOperand* context, LOperand* function) { 1923 LCallFunction(LOperand* context, LOperand* function) {
1909 inputs_[0] = context; 1924 inputs_[0] = context;
1910 inputs_[1] = function; 1925 inputs_[1] = function;
1911 } 1926 }
1912 1927
1913 LOperand* context() { return inputs_[0]; } 1928 LOperand* context() { return inputs_[0]; }
1914 LOperand* function() { return inputs_[1]; } 1929 LOperand* function() { return inputs_[1]; }
(...skipping 16 matching lines...) Expand all
1931 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") 1946 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1932 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) 1947 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1933 1948
1934 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1949 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1935 1950
1936 Handle<String> name() const {return hydrogen()->name(); } 1951 Handle<String> name() const {return hydrogen()->name(); }
1937 int arity() const { return hydrogen()->argument_count() - 1; } 1952 int arity() const { return hydrogen()->argument_count() - 1; }
1938 }; 1953 };
1939 1954
1940 1955
1941 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1942 public:
1943 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1944 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1945
1946 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1947
1948 int arity() const { return hydrogen()->argument_count() - 1; }
1949 };
1950
1951
1952 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1956 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1953 public: 1957 public:
1954 LCallNew(LOperand* context, LOperand* constructor) { 1958 LCallNew(LOperand* context, LOperand* constructor) {
1955 inputs_[0] = context; 1959 inputs_[0] = context;
1956 inputs_[1] = constructor; 1960 inputs_[1] = constructor;
1957 } 1961 }
1958 1962
1959 LOperand* context() { return inputs_[0]; } 1963 LOperand* context() { return inputs_[0]; }
1960 LOperand* constructor() { return inputs_[1]; } 1964 LOperand* constructor() { return inputs_[1]; }
1961 1965
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 // Will not be moved to a register even if one is freely available. 2806 // Will not be moved to a register even if one is freely available.
2803 MUST_USE_RESULT LOperand* UseAny(HValue* value); 2807 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2804 2808
2805 // Temporary operand that must be in a register. 2809 // Temporary operand that must be in a register.
2806 MUST_USE_RESULT LUnallocated* TempRegister(); 2810 MUST_USE_RESULT LUnallocated* TempRegister();
2807 MUST_USE_RESULT LOperand* FixedTemp(Register reg); 2811 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2808 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); 2812 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2809 2813
2810 // Methods for setting up define-use relationships. 2814 // Methods for setting up define-use relationships.
2811 // Return the same instruction that they are passed. 2815 // Return the same instruction that they are passed.
2812 template<int I, int T> 2816 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2813 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, 2817 LUnallocated* result);
2814 LUnallocated* result); 2818 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2815 template<int I, int T> 2819 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2816 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); 2820 int index);
2817 template<int I, int T> 2821 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2818 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, 2822 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2819 int index); 2823 Register reg);
2820 template<int I, int T> 2824 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2821 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); 2825 DoubleRegister reg);
2822 template<int I, int T>
2823 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2824 Register reg);
2825 template<int I, int T>
2826 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2827 DoubleRegister reg);
2828 LInstruction* AssignEnvironment(LInstruction* instr); 2826 LInstruction* AssignEnvironment(LInstruction* instr);
2829 LInstruction* AssignPointerMap(LInstruction* instr); 2827 LInstruction* AssignPointerMap(LInstruction* instr);
2830 2828
2831 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; 2829 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2832 2830
2833 // By default we assume that instruction sequences generated for calls 2831 // By default we assume that instruction sequences generated for calls
2834 // cannot deoptimize eagerly and we do not attach environment to this 2832 // cannot deoptimize eagerly and we do not attach environment to this
2835 // instruction. 2833 // instruction.
2836 LInstruction* MarkAsCall( 2834 LInstruction* MarkAsCall(
2837 LInstruction* instr, 2835 LInstruction* instr,
(...skipping 29 matching lines...) Expand all
2867 2865
2868 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2866 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2869 }; 2867 };
2870 2868
2871 #undef DECLARE_HYDROGEN_ACCESSOR 2869 #undef DECLARE_HYDROGEN_ACCESSOR
2872 #undef DECLARE_CONCRETE_INSTRUCTION 2870 #undef DECLARE_CONCRETE_INSTRUCTION
2873 2871
2874 } } // namespace v8::internal 2872 } } // namespace v8::internal
2875 2873
2876 #endif // V8_ARM_LITHIUM_ARM_H_ 2874 #endif // V8_ARM_LITHIUM_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/lithium-arm.cc » ('j') | src/arm/lithium-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698