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

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

Issue 6878042: Revert r7662. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 8 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/arm/lithium-arm.h ('k') | src/x64/lithium-x64.h » ('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 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 21 matching lines...) Expand all
32 #include "lithium-allocator.h" 32 #include "lithium-allocator.h"
33 #include "lithium.h" 33 #include "lithium.h"
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
43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
42 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 49 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
43 V(AccessArgumentsAt) \ 50 V(AccessArgumentsAt) \
44 V(AddI) \ 51 V(AddI) \
45 V(ApplyArguments) \ 52 V(ApplyArguments) \
46 V(ArgumentsElements) \ 53 V(ArgumentsElements) \
47 V(ArgumentsLength) \ 54 V(ArgumentsLength) \
48 V(ArithmeticD) \ 55 V(ArithmeticD) \
49 V(ArithmeticT) \ 56 V(ArithmeticT) \
50 V(ArrayLiteral) \ 57 V(ArrayLiteral) \
51 V(BitI) \ 58 V(BitI) \
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 V(Throw) \ 165 V(Throw) \
159 V(ToFastProperties) \ 166 V(ToFastProperties) \
160 V(Typeof) \ 167 V(Typeof) \
161 V(TypeofIs) \ 168 V(TypeofIs) \
162 V(TypeofIsAndBranch) \ 169 V(TypeofIsAndBranch) \
163 V(UnaryMathOperation) \ 170 V(UnaryMathOperation) \
164 V(UnknownOSRValue) \ 171 V(UnknownOSRValue) \
165 V(ValueOf) 172 V(ValueOf)
166 173
167 174
168 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ 175 #define DECLARE_INSTRUCTION(type) \
169 virtual Opcode opcode() const { return LInstruction::k##type; } \ 176 virtual bool Is##type() const { return true; } \
170 virtual void CompileToNative(LCodeGen* generator); \ 177 static L##type* cast(LInstruction* instr) { \
171 virtual const char* Mnemonic() const { return mnemonic; } \ 178 ASSERT(instr->Is##type()); \
172 static L##type* cast(LInstruction* instr) { \ 179 return reinterpret_cast<L##type*>(instr); \
173 ASSERT(instr->Is##type()); \
174 return reinterpret_cast<L##type*>(instr); \
175 } 180 }
176 181
177 182
183 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
184 virtual void CompileToNative(LCodeGen* generator); \
185 virtual const char* Mnemonic() const { return mnemonic; } \
186 DECLARE_INSTRUCTION(type)
187
188
178 #define DECLARE_HYDROGEN_ACCESSOR(type) \ 189 #define DECLARE_HYDROGEN_ACCESSOR(type) \
179 H##type* hydrogen() const { \ 190 H##type* hydrogen() const { \
180 return H##type::cast(hydrogen_value()); \ 191 return H##type::cast(hydrogen_value()); \
181 } 192 }
182 193
183 194
184 class LInstruction: public ZoneObject { 195 class LInstruction: public ZoneObject {
185 public: 196 public:
186 LInstruction() 197 LInstruction()
187 : environment_(NULL), 198 : environment_(NULL),
188 hydrogen_value_(NULL), 199 hydrogen_value_(NULL),
189 is_call_(false), 200 is_call_(false),
190 is_save_doubles_(false) { } 201 is_save_doubles_(false) { }
191 virtual ~LInstruction() { } 202 virtual ~LInstruction() { }
192 203
193 virtual void CompileToNative(LCodeGen* generator) = 0; 204 virtual void CompileToNative(LCodeGen* generator) = 0;
194 virtual const char* Mnemonic() const = 0; 205 virtual const char* Mnemonic() const = 0;
195 virtual void PrintTo(StringStream* stream); 206 virtual void PrintTo(StringStream* stream);
196 virtual void PrintDataTo(StringStream* stream) = 0; 207 virtual void PrintDataTo(StringStream* stream) = 0;
197 virtual void PrintOutputOperandTo(StringStream* stream) = 0; 208 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
198 209
199 enum Opcode {
200 // Declare a unique enum value for each instruction.
201 #define DECLARE_OPCODE(type) k##type,
202 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
203 kNumberOfInstructions
204 #undef DECLARE_OPCODE
205 };
206
207 virtual Opcode opcode() const = 0;
208
209 // Declare virtual type testers. 210 // Declare virtual type testers.
210 #define DECLARE_PREDICATE(type) \ 211 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
211 bool Is##type() const { return opcode() == k##type; } 212 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
212 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) 213 #undef DECLARE_DO
213 #undef DECLARE_PREDICATE
214 214
215 virtual bool IsControl() const { return false; } 215 virtual bool IsControl() const { return false; }
216 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } 216 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
217 217
218 void set_environment(LEnvironment* env) { environment_ = env; } 218 void set_environment(LEnvironment* env) { environment_ = env; }
219 LEnvironment* environment() const { return environment_; } 219 LEnvironment* environment() const { return environment_; }
220 bool HasEnvironment() const { return environment_ != NULL; } 220 bool HasEnvironment() const { return environment_ != NULL; }
221 221
222 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 222 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
223 LPointerMap* pointer_map() const { return pointer_map_.get(); } 223 LPointerMap* pointer_map() const { return pointer_map_.get(); }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { 457 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
458 public: 458 public:
459 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") 459 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
460 }; 460 };
461 461
462 462
463 template<int I, int T> 463 template<int I, int T>
464 class LControlInstruction: public LTemplateInstruction<0, I, T> { 464 class LControlInstruction: public LTemplateInstruction<0, I, T> {
465 public: 465 public:
466 DECLARE_INSTRUCTION(ControlInstruction)
466 virtual bool IsControl() const { return true; } 467 virtual bool IsControl() const { return true; }
467 468
468 int true_block_id() const { return true_block_id_; } 469 int true_block_id() const { return true_block_id_; }
469 int false_block_id() const { return false_block_id_; } 470 int false_block_id() const { return false_block_id_; }
470 void SetBranchTargets(int true_block_id, int false_block_id) { 471 void SetBranchTargets(int true_block_id, int false_block_id) {
471 true_block_id_ = true_block_id; 472 true_block_id_ = true_block_id;
472 false_block_id_ = false_block_id; 473 false_block_id_ = false_block_id;
473 } 474 }
474 475
475 private: 476 private:
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 class LArithmeticD: public LTemplateInstruction<1, 2, 0> { 1126 class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1126 public: 1127 public:
1127 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) 1128 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1128 : op_(op) { 1129 : op_(op) {
1129 inputs_[0] = left; 1130 inputs_[0] = left;
1130 inputs_[1] = right; 1131 inputs_[1] = right;
1131 } 1132 }
1132 1133
1133 Token::Value op() const { return op_; } 1134 Token::Value op() const { return op_; }
1134 1135
1135 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1136 virtual void CompileToNative(LCodeGen* generator); 1136 virtual void CompileToNative(LCodeGen* generator);
1137 virtual const char* Mnemonic() const; 1137 virtual const char* Mnemonic() const;
1138 1138
1139 private: 1139 private:
1140 Token::Value op_; 1140 Token::Value op_;
1141 }; 1141 };
1142 1142
1143 1143
1144 class LArithmeticT: public LTemplateInstruction<1, 2, 0> { 1144 class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1145 public: 1145 public:
1146 LArithmeticT(Token::Value op, LOperand* left, LOperand* right) 1146 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1147 : op_(op) { 1147 : op_(op) {
1148 inputs_[0] = left; 1148 inputs_[0] = left;
1149 inputs_[1] = right; 1149 inputs_[1] = right;
1150 } 1150 }
1151 1151
1152 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1153 virtual void CompileToNative(LCodeGen* generator); 1152 virtual void CompileToNative(LCodeGen* generator);
1154 virtual const char* Mnemonic() const; 1153 virtual const char* Mnemonic() const;
1155 1154
1156 Token::Value op() const { return op_; } 1155 Token::Value op() const { return op_; }
1157 1156
1158 private: 1157 private:
1159 Token::Value op_; 1158 Token::Value op_;
1160 }; 1159 };
1161 1160
1162 1161
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 int argument_count_; 2261 int argument_count_;
2263 LAllocator* allocator_; 2262 LAllocator* allocator_;
2264 int position_; 2263 int position_;
2265 LInstruction* instruction_pending_deoptimization_environment_; 2264 LInstruction* instruction_pending_deoptimization_environment_;
2266 int pending_deoptimization_ast_id_; 2265 int pending_deoptimization_ast_id_;
2267 2266
2268 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2267 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2269 }; 2268 };
2270 2269
2271 #undef DECLARE_HYDROGEN_ACCESSOR 2270 #undef DECLARE_HYDROGEN_ACCESSOR
2271 #undef DECLARE_INSTRUCTION
2272 #undef DECLARE_CONCRETE_INSTRUCTION 2272 #undef DECLARE_CONCRETE_INSTRUCTION
2273 2273
2274 } } // namespace v8::internal 2274 } } // namespace v8::internal
2275 2275
2276 #endif // V8_IA32_LITHIUM_IA32_H_ 2276 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698