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

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

Issue 6410120: Refactor lithium instructions for constants.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 23 matching lines...) Expand all
34 #include "safepoint-table.h" 34 #include "safepoint-table.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 // Forward declarations. 39 // Forward declarations.
40 class LCodeGen; 40 class LCodeGen;
41 41
42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ 42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
43 V(ControlInstruction) \ 43 V(ControlInstruction) \
44 V(Constant) \
45 V(Call) \ 44 V(Call) \
46 V(StoreKeyed) \ 45 V(StoreKeyed) \
47 V(StoreNamed) \ 46 V(StoreNamed) \
48 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) 47 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
49 48
50 49
51 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 50 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
52 V(AccessArgumentsAt) \ 51 V(AccessArgumentsAt) \
53 V(AddI) \ 52 V(AddI) \
54 V(ApplyArguments) \ 53 V(ApplyArguments) \
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 LSubI(LOperand* left, LOperand* right) { 905 LSubI(LOperand* left, LOperand* right) {
907 inputs_[0] = left; 906 inputs_[0] = left;
908 inputs_[1] = right; 907 inputs_[1] = right;
909 } 908 }
910 909
911 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") 910 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
912 DECLARE_HYDROGEN_ACCESSOR(Sub) 911 DECLARE_HYDROGEN_ACCESSOR(Sub)
913 }; 912 };
914 913
915 914
916 class LConstant: public LTemplateInstruction<1, 0, 0> { 915 class LConstantI: public LTemplateInstruction<1, 0, 0> {
917 DECLARE_INSTRUCTION(Constant) 916 public:
917 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
918 DECLARE_HYDROGEN_ACCESSOR(Constant)
919
920 int32_t value() const { return hydrogen()->Integer32Value(); }
918 }; 921 };
919 922
920 923
921 class LConstantI: public LConstant { 924 class LConstantD: public LTemplateInstruction<1, 0, 0> {
922 public: 925 public:
923 explicit LConstantI(int32_t value) : value_(value) { } 926 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
924 int32_t value() const { return value_; } 927 DECLARE_HYDROGEN_ACCESSOR(Constant)
925 928
926 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") 929 double value() const { return hydrogen()->DoubleValue(); }
927
928 private:
929 int32_t value_;
930 }; 930 };
931 931
932 932
933 class LConstantD: public LConstant { 933 class LConstantT: public LTemplateInstruction<1, 0, 0> {
934 public: 934 public:
935 explicit LConstantD(double value) : value_(value) { } 935 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
936 double value() const { return value_; } 936 DECLARE_HYDROGEN_ACCESSOR(Constant)
937 937
938 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") 938 Handle<Object> value() const { return hydrogen()->handle(); }
939
940 private:
941 double value_;
942 }; 939 };
943 940
944 941
945 class LConstantT: public LConstant {
946 public:
947 explicit LConstantT(Handle<Object> value) : value_(value) { }
948 Handle<Object> value() const { return value_; }
949
950 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
951
952 private:
953 Handle<Object> value_;
954 };
955
956
957 class LBranch: public LControlInstruction<1, 0> { 942 class LBranch: public LControlInstruction<1, 0> {
958 public: 943 public:
959 explicit LBranch(LOperand* value) { 944 explicit LBranch(LOperand* value) {
960 inputs_[0] = value; 945 inputs_[0] = value;
961 } 946 }
962 947
963 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 948 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
964 DECLARE_HYDROGEN_ACCESSOR(Value) 949 DECLARE_HYDROGEN_ACCESSOR(Value)
965 950
966 virtual void PrintDataTo(StringStream* stream); 951 virtual void PrintDataTo(StringStream* stream);
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 1982 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
1998 }; 1983 };
1999 1984
2000 #undef DECLARE_HYDROGEN_ACCESSOR 1985 #undef DECLARE_HYDROGEN_ACCESSOR
2001 #undef DECLARE_INSTRUCTION 1986 #undef DECLARE_INSTRUCTION
2002 #undef DECLARE_CONCRETE_INSTRUCTION 1987 #undef DECLARE_CONCRETE_INSTRUCTION
2003 1988
2004 } } // namespace v8::internal 1989 } } // namespace v8::internal
2005 1990
2006 #endif // V8_IA32_LITHIUM_IA32_H_ 1991 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | src/x64/lithium-x64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698