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

Side by Side Diff: src/x64/lithium-x64.cc

Issue 6262005: Merge changes to LTemplateInstruction to X64 (Issue 1048). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
Patch Set: Created 9 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-x64.h ('k') | no next file » | 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 if (HasPointerMap()) { 84 if (HasPointerMap()) {
85 stream->Add(" "); 85 stream->Add(" ");
86 pointer_map()->PrintTo(stream); 86 pointer_map()->PrintTo(stream);
87 } 87 }
88 } 88 }
89 89
90 90
91 template<int R, int I, int T> 91 template<int R, int I, int T>
92 void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) { 92 void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) {
93 for (int i = 0; i < I; i++) { 93 stream->Add("= ");
94 stream->Add(i == 0 ? "= " : " "); 94 inputs_.PrintOperandsTo(stream);
95 inputs_.at(i)->PrintTo(stream);
96 }
97 } 95 }
98 96
99 97
100 template<int R, int I, int T> 98 template<int R, int I, int T>
101 void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) { 99 void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) {
102 if (this->HasResult()) { 100 results_.PrintOperandsTo(stream);
103 this->result()->PrintTo(stream); 101 }
104 stream->Add(" "); 102
103
104 template<typename T, int N>
105 void OperandContainer<T, N>::PrintOperandsTo(StringStream* stream) {
106 for (int i = 0; i < N; i++) {
107 if (i > 0) stream->Add(" ");
108 elems_[i]->PrintTo(stream);
105 } 109 }
106 } 110 }
107 111
108 112
109 void LLabel::PrintDataTo(StringStream* stream) { 113 void LLabel::PrintDataTo(StringStream* stream) {
110 LGap::PrintDataTo(stream); 114 LGap::PrintDataTo(stream);
111 LLabel* rep = replacement(); 115 LLabel* rep = replacement();
112 if (rep != NULL) { 116 if (rep != NULL) {
113 stream->Add(" Dead block replaced with B%d", rep->block_id()); 117 stream->Add(" Dead block replaced with B%d", rep->block_id());
114 } 118 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 169 }
166 170
167 171
168 void LGoto::PrintDataTo(StringStream* stream) { 172 void LGoto::PrintDataTo(StringStream* stream) {
169 stream->Add("B%d", block_id()); 173 stream->Add("B%d", block_id());
170 } 174 }
171 175
172 176
173 void LBranch::PrintDataTo(StringStream* stream) { 177 void LBranch::PrintDataTo(StringStream* stream) {
174 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); 178 stream->Add("B%d | B%d on ", true_block_id(), false_block_id());
175 input()->PrintTo(stream); 179 InputAt(0)->PrintTo(stream);
176 } 180 }
177 181
178 182
179 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { 183 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) {
180 stream->Add("if "); 184 stream->Add("if ");
181 left()->PrintTo(stream); 185 InputAt(0)->PrintTo(stream);
182 stream->Add(" %s ", Token::String(op())); 186 stream->Add(" %s ", Token::String(op()));
183 right()->PrintTo(stream); 187 InputAt(1)->PrintTo(stream);
184 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 188 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
185 } 189 }
186 190
187 191
188 void LIsNullAndBranch::PrintDataTo(StringStream* stream) { 192 void LIsNullAndBranch::PrintDataTo(StringStream* stream) {
189 stream->Add("if "); 193 stream->Add("if ");
190 input()->PrintTo(stream); 194 InputAt(0)->PrintTo(stream);
191 stream->Add(is_strict() ? " === null" : " == null"); 195 stream->Add(is_strict() ? " === null" : " == null");
192 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 196 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
193 } 197 }
194 198
195 199
196 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { 200 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
197 stream->Add("if is_object("); 201 stream->Add("if is_object(");
198 input()->PrintTo(stream); 202 InputAt(0)->PrintTo(stream);
199 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 203 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
200 } 204 }
201 205
202 206
203 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { 207 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
204 stream->Add("if is_smi("); 208 stream->Add("if is_smi(");
205 input()->PrintTo(stream); 209 InputAt(0)->PrintTo(stream);
206 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 210 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
207 } 211 }
208 212
209 213
210 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { 214 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
211 stream->Add("if has_instance_type("); 215 stream->Add("if has_instance_type(");
212 input()->PrintTo(stream); 216 InputAt(0)->PrintTo(stream);
213 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 217 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
214 } 218 }
215 219
216 220
217 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { 221 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
218 stream->Add("if has_cached_array_index("); 222 stream->Add("if has_cached_array_index(");
219 input()->PrintTo(stream); 223 InputAt(0)->PrintTo(stream);
220 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
221 } 225 }
222 226
223 227
224 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { 228 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
225 stream->Add("if class_of_test("); 229 stream->Add("if class_of_test(");
226 input()->PrintTo(stream); 230 InputAt(0)->PrintTo(stream);
227 stream->Add(", \"%o\") then B%d else B%d", 231 stream->Add(", \"%o\") then B%d else B%d",
228 *hydrogen()->class_name(), 232 *hydrogen()->class_name(),
229 true_block_id(), 233 true_block_id(),
230 false_block_id()); 234 false_block_id());
231 } 235 }
232 236
233 237
234 void LTypeofIs::PrintDataTo(StringStream* stream) { 238 void LTypeofIs::PrintDataTo(StringStream* stream) {
235 input()->PrintTo(stream); 239 InputAt(0)->PrintTo(stream);
236 stream->Add(" == \"%s\"", *hydrogen()->type_literal()->ToCString()); 240 stream->Add(" == \"%s\"", *hydrogen()->type_literal()->ToCString());
237 } 241 }
238 242
239 243
240 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { 244 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
241 stream->Add("if typeof "); 245 stream->Add("if typeof ");
242 input()->PrintTo(stream); 246 InputAt(0)->PrintTo(stream);
243 stream->Add(" == \"%s\" then B%d else B%d", 247 stream->Add(" == \"%s\" then B%d else B%d",
244 *hydrogen()->type_literal()->ToCString(), 248 *hydrogen()->type_literal()->ToCString(),
245 true_block_id(), false_block_id()); 249 true_block_id(), false_block_id());
246 } 250 }
247 251
248 252
249 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 253 void LCallConstantFunction::PrintDataTo(StringStream* stream) {
250 stream->Add("#%d / ", arity()); 254 stream->Add("#%d / ", arity());
251 } 255 }
252 256
253 257
254 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { 258 void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
255 stream->Add("/%s ", hydrogen()->OpName()); 259 stream->Add("/%s ", hydrogen()->OpName());
256 input()->PrintTo(stream); 260 InputAt(0)->PrintTo(stream);
257 } 261 }
258 262
259 263
260 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 264 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
261 stream->Add("(%d, %d)", context_chain_length(), slot_index()); 265 stream->Add("(%d, %d)", context_chain_length(), slot_index());
262 } 266 }
263 267
264 268
265 void LCallKeyed::PrintDataTo(StringStream* stream) { 269 void LCallKeyed::PrintDataTo(StringStream* stream) {
266 stream->Add("[rcx] #%d / ", arity()); 270 stream->Add("[ecx] #%d / ", arity());
267 } 271 }
268 272
269 273
270 void LCallNamed::PrintDataTo(StringStream* stream) { 274 void LCallNamed::PrintDataTo(StringStream* stream) {
271 SmartPointer<char> name_string = name()->ToCString(); 275 SmartPointer<char> name_string = name()->ToCString();
272 stream->Add("%s #%d / ", *name_string, arity()); 276 stream->Add("%s #%d / ", *name_string, arity());
273 } 277 }
274 278
275 279
276 void LCallGlobal::PrintDataTo(StringStream* stream) { 280 void LCallGlobal::PrintDataTo(StringStream* stream) {
277 SmartPointer<char> name_string = name()->ToCString(); 281 SmartPointer<char> name_string = name()->ToCString();
278 stream->Add("%s #%d / ", *name_string, arity()); 282 stream->Add("%s #%d / ", *name_string, arity());
279 } 283 }
280 284
281 285
282 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { 286 void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
283 stream->Add("#%d / ", arity()); 287 stream->Add("#%d / ", arity());
284 } 288 }
285 289
286 290
287 void LCallNew::PrintDataTo(StringStream* stream) { 291 void LCallNew::PrintDataTo(StringStream* stream) {
288 stream->Add("= "); 292 stream->Add("= ");
289 input()->PrintTo(stream); 293 InputAt(0)->PrintTo(stream);
290 stream->Add(" #%d / ", arity()); 294 stream->Add(" #%d / ", arity());
291 } 295 }
292 296
293 297
294 void LClassOfTest::PrintDataTo(StringStream* stream) { 298 void LClassOfTest::PrintDataTo(StringStream* stream) {
295 stream->Add("= class_of_test("); 299 stream->Add("= class_of_test(");
296 input()->PrintTo(stream); 300 InputAt(0)->PrintTo(stream);
297 stream->Add(", \"%o\")", *hydrogen()->class_name()); 301 stream->Add(", \"%o\")", *hydrogen()->class_name());
298 } 302 }
299 303
300 304
301 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { 305 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
302 arguments()->PrintTo(stream); 306 arguments()->PrintTo(stream);
303 307
304 stream->Add(" length "); 308 stream->Add(" length ");
305 length()->PrintTo(stream); 309 length()->PrintTo(stream);
306 310
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (current->has_position()) position_ = current->position(); 822 if (current->has_position()) position_ = current->position();
819 LInstruction* instr = current->CompileToLithium(this); 823 LInstruction* instr = current->CompileToLithium(this);
820 824
821 if (instr != NULL) { 825 if (instr != NULL) {
822 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 826 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
823 instr = AssignPointerMap(instr); 827 instr = AssignPointerMap(instr);
824 } 828 }
825 if (FLAG_stress_environments && !instr->HasEnvironment()) { 829 if (FLAG_stress_environments && !instr->HasEnvironment()) {
826 instr = AssignEnvironment(instr); 830 instr = AssignEnvironment(instr);
827 } 831 }
828 if (current->IsBranch()) { 832 if (current->IsBranch() && !instr->IsGoto()) {
829 instr->set_hydrogen_value(HBranch::cast(current)->value()); 833 // TODO(fschneider): Handle branch instructions uniformly like
834 // other instructions. This requires us to generate the right
835 // branch instruction already at the HIR level.
836 ASSERT(instr->IsControl());
837 HBranch* branch = HBranch::cast(current);
838 instr->set_hydrogen_value(branch->value());
839 HBasicBlock* first = branch->FirstSuccessor();
840 HBasicBlock* second = branch->SecondSuccessor();
841 ASSERT(first != NULL && second != NULL);
842 instr->SetBranchTargets(first->block_id(), second->block_id());
830 } else { 843 } else {
831 instr->set_hydrogen_value(current); 844 instr->set_hydrogen_value(current);
832 } 845 }
833 846
834 int index = chunk_->AddInstruction(instr, current_block_); 847 int index = chunk_->AddInstruction(instr, current_block_);
835 allocator_->SummarizeInstruction(index); 848 allocator_->SummarizeInstruction(index);
836 } else { 849 } else {
837 // This instruction should be omitted. 850 // This instruction should be omitted.
838 allocator_->OmitInstruction(); 851 allocator_->OmitInstruction();
839 } 852 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1220 }
1208 1221
1209 1222
1210 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1223 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1211 Representation r = instr->representation(); 1224 Representation r = instr->representation();
1212 if (r.IsInteger32()) { 1225 if (r.IsInteger32()) {
1213 int32_t value = instr->Integer32Value(); 1226 int32_t value = instr->Integer32Value();
1214 return DefineAsRegister(new LConstantI(value)); 1227 return DefineAsRegister(new LConstantI(value));
1215 } else if (r.IsDouble()) { 1228 } else if (r.IsDouble()) {
1216 double value = instr->DoubleValue(); 1229 double value = instr->DoubleValue();
1217 return DefineAsRegister(new LConstantD(value)); 1230 LOperand* temp = TempRegister();
1231 return DefineAsRegister(new LConstantD(value, temp));
1218 } else if (r.IsTagged()) { 1232 } else if (r.IsTagged()) {
1219 return DefineAsRegister(new LConstantT(instr->handle())); 1233 return DefineAsRegister(new LConstantT(instr->handle()));
1220 } else { 1234 } else {
1221 UNREACHABLE(); 1235 UNREACHABLE();
1222 return NULL; 1236 return NULL;
1223 } 1237 }
1224 } 1238 }
1225 1239
1226 1240
1227 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { 1241 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1440
1427 1441
1428 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 1442 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
1429 Abort("Unimplemented: %s", "DoLeaveInlined"); 1443 Abort("Unimplemented: %s", "DoLeaveInlined");
1430 return NULL; 1444 return NULL;
1431 } 1445 }
1432 1446
1433 } } // namespace v8::internal 1447 } } // namespace v8::internal
1434 1448
1435 #endif // V8_TARGET_ARCH_X64 1449 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698