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

Side by Side Diff: src/x64/lithium-x64.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: Merge fix 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/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.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:
321 // Iterator support. 326 // Iterator support.
322 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } 327 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
323 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]; }
324 329
325 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } 330 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
326 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]; }
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 explicit LGlobalReceiver(LOperand* global_object) { 1779 explicit LGlobalReceiver(LOperand* global_object) {
1775 inputs_[0] = global_object; 1780 inputs_[0] = global_object;
1776 } 1781 }
1777 1782
1778 LOperand* global() { return inputs_[0]; } 1783 LOperand* global() { return inputs_[0]; }
1779 1784
1780 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1785 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1781 }; 1786 };
1782 1787
1783 1788
1784 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { 1789 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1785 public: 1790 public:
1786 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1791 explicit LCallJSFunction(LOperand* function) {
1787 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1792 inputs_[0] = function;
1793 }
1788 1794
1789 virtual void PrintDataTo(StringStream* stream); 1795 LOperand* function() { return inputs_[0]; }
1790 1796
1791 Handle<JSFunction> function() { return hydrogen()->function(); } 1797 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1798 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1799
1800 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1801
1792 int arity() const { return hydrogen()->argument_count() - 1; } 1802 int arity() const { return hydrogen()->argument_count() - 1; }
1793 }; 1803 };
1794 1804
1795 1805
1806 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
1807 public:
1808 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
1809 ZoneList<LOperand*>& operands,
1810 Zone* zone)
1811 : descriptor_(descriptor),
1812 inputs_(descriptor->environment_length() + 1, zone) {
1813 ASSERT(descriptor->environment_length() + 1 == operands.length());
1814 inputs_.AddAll(operands, zone);
1815 }
1816
1817 LOperand* target() const { return inputs_[0]; }
1818
1819
1820 private:
1821 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1822 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1823
1824 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1825
1826 int arity() const { return hydrogen()->argument_count() - 1; }
1827
1828 const CallInterfaceDescriptor* descriptor_;
1829 ZoneList<LOperand*> inputs_;
1830
1831 virtual void InternalSetOperandAt(int index,
1832 LOperand* value) V8_FINAL V8_OVERRIDE {
1833 inputs_[index] = value;
1834 }
1835
1836 // Iterator support.
1837 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); }
1838 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
1839
1840 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; }
1841 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; }
1842 };
1843
1844
1796 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1845 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1797 public: 1846 public:
1798 LInvokeFunction(LOperand* context, LOperand* function) { 1847 LInvokeFunction(LOperand* context, LOperand* function) {
1799 inputs_[0] = context; 1848 inputs_[0] = context;
1800 inputs_[1] = function; 1849 inputs_[1] = function;
1801 } 1850 }
1802 1851
1803 LOperand* context() { return inputs_[0]; } 1852 LOperand* context() { return inputs_[0]; }
1804 LOperand* function() { return inputs_[1]; } 1853 LOperand* function() { return inputs_[1]; }
1805 1854
1806 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") 1855 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1807 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) 1856 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1808 1857
1809 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1858 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1810 1859
1811 int arity() const { return hydrogen()->argument_count() - 1; } 1860 int arity() const { return hydrogen()->argument_count() - 1; }
1812 }; 1861 };
1813 1862
1814
1815 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1816 public:
1817 LCallKeyed(LOperand* context, LOperand* key) {
1818 inputs_[0] = context;
1819 inputs_[1] = key;
1820 }
1821
1822 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1823 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1824
1825 LOperand* context() { return inputs_[0]; }
1826 LOperand* key() { return inputs_[1]; }
1827
1828 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1829
1830 int arity() const { return hydrogen()->argument_count() - 1; }
1831 };
1832
1833
1834 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1835 public:
1836 explicit LCallNamed(LOperand* context) {
1837 inputs_[0] = context;
1838 }
1839
1840 LOperand* context() { return inputs_[0]; }
1841
1842 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1843 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1844
1845 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1846
1847 Handle<String> name() const { return hydrogen()->name(); }
1848 int arity() const { return hydrogen()->argument_count() - 1; }
1849 };
1850
1851 1863
1852 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1864 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1853 public: 1865 public:
1854 LCallFunction(LOperand* context, LOperand* function) { 1866 LCallFunction(LOperand* context, LOperand* function) {
1855 inputs_[0] = context; 1867 inputs_[0] = context;
1856 inputs_[1] = function; 1868 inputs_[1] = function;
1857 } 1869 }
1858 1870
1859 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") 1871 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1860 DECLARE_HYDROGEN_ACCESSOR(CallFunction) 1872 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1861 1873
1862 LOperand* context() { return inputs_[0]; } 1874 LOperand* context() { return inputs_[0]; }
1863 LOperand* function() { return inputs_[1]; } 1875 LOperand* function() { return inputs_[1]; }
1864 int arity() const { return hydrogen()->argument_count() - 1; } 1876 int arity() const { return hydrogen()->argument_count() - 1; }
1865 }; 1877 };
1866 1878
1867 1879
1868 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1869 public:
1870 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1871 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1872
1873 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1874
1875 int arity() const { return hydrogen()->argument_count() - 1; }
1876 };
1877
1878
1879 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> { 1880 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1880 public: 1881 public:
1881 LCallNew(LOperand* context, LOperand* constructor) { 1882 LCallNew(LOperand* context, LOperand* constructor) {
1882 inputs_[0] = context; 1883 inputs_[0] = context;
1883 inputs_[1] = constructor; 1884 inputs_[1] = constructor;
1884 } 1885 }
1885 1886
1886 LOperand* context() { return inputs_[0]; } 1887 LOperand* context() { return inputs_[0]; }
1887 LOperand* constructor() { return inputs_[1]; } 1888 LOperand* constructor() { return inputs_[1]; }
1888 1889
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 // Will not be moved to a register even if one is freely available. 2712 // Will not be moved to a register even if one is freely available.
2712 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE; 2713 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE;
2713 2714
2714 // Temporary operand that must be in a register. 2715 // Temporary operand that must be in a register.
2715 MUST_USE_RESULT LUnallocated* TempRegister(); 2716 MUST_USE_RESULT LUnallocated* TempRegister();
2716 MUST_USE_RESULT LOperand* FixedTemp(Register reg); 2717 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2717 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg); 2718 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
2718 2719
2719 // Methods for setting up define-use relationships. 2720 // Methods for setting up define-use relationships.
2720 // Return the same instruction that they are passed. 2721 // Return the same instruction that they are passed.
2721 template<int I, int T> 2722 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2722 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, 2723 LUnallocated* result);
2723 LUnallocated* result); 2724 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2724 template<int I, int T> 2725 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2725 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); 2726 int index);
2726 template<int I, int T> 2727 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2727 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, 2728 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2728 int index); 2729 Register reg);
2729 template<int I, int T> 2730 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2730 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); 2731 XMMRegister reg);
2731 template<int I, int T>
2732 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2733 Register reg);
2734 template<int I, int T>
2735 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2736 XMMRegister reg);
2737 // Assigns an environment to an instruction. An instruction which can 2732 // Assigns an environment to an instruction. An instruction which can
2738 // deoptimize must have an environment. 2733 // deoptimize must have an environment.
2739 LInstruction* AssignEnvironment(LInstruction* instr); 2734 LInstruction* AssignEnvironment(LInstruction* instr);
2740 // Assigns a pointer map to an instruction. An instruction which can 2735 // Assigns a pointer map to an instruction. An instruction which can
2741 // trigger a GC or a lazy deoptimization must have a pointer map. 2736 // trigger a GC or a lazy deoptimization must have a pointer map.
2742 LInstruction* AssignPointerMap(LInstruction* instr); 2737 LInstruction* AssignPointerMap(LInstruction* instr);
2743 2738
2744 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; 2739 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2745 2740
2746 // Marks a call for the register allocator. Assigns a pointer map to 2741 // Marks a call for the register allocator. Assigns a pointer map to
(...skipping 26 matching lines...) Expand all
2773 2768
2774 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2769 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2775 }; 2770 };
2776 2771
2777 #undef DECLARE_HYDROGEN_ACCESSOR 2772 #undef DECLARE_HYDROGEN_ACCESSOR
2778 #undef DECLARE_CONCRETE_INSTRUCTION 2773 #undef DECLARE_CONCRETE_INSTRUCTION
2779 2774
2780 } } // namespace v8::int 2775 } } // namespace v8::int
2781 2776
2782 #endif // V8_X64_LITHIUM_X64_H_ 2777 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698