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

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

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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 274
275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { 275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) {
276 stream->Add(" = "); 276 stream->Add(" = ");
277 base_object()->PrintTo(stream); 277 base_object()->PrintTo(stream);
278 stream->Add(" + "); 278 stream->Add(" + ");
279 offset()->PrintTo(stream); 279 offset()->PrintTo(stream);
280 } 280 }
281 281
282 282
283 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 283 void LCallJSFunction::PrintDataTo(StringStream* stream) {
284 stream->Add("= ");
285 function()->PrintTo(stream);
286 stream->Add(" ");
287 call_kind()->PrintTo(stream);
284 stream->Add("#%d / ", arity()); 288 stream->Add("#%d / ", arity());
285 } 289 }
286 290
291
292 void LCallWithDescriptor::PrintDataTo(StringStream* stream) {
293 for (int i = 0; i < InputCount(); i++) {
294 InputAt(i)->PrintTo(stream);
295 stream->Add(" ");
296 }
297 stream->Add("#%d / ", arity());
298 }
299
287 300
288 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 301 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
289 context()->PrintTo(stream); 302 context()->PrintTo(stream);
290 stream->Add("[%d]", slot_index()); 303 stream->Add("[%d]", slot_index());
291 } 304 }
292 305
293 306
294 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 307 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
295 context()->PrintTo(stream); 308 context()->PrintTo(stream);
296 stream->Add("[%d] <- ", slot_index()); 309 stream->Add("[%d] <- ", slot_index());
297 value()->PrintTo(stream); 310 value()->PrintTo(stream);
298 } 311 }
299 312
300 313
301 void LInvokeFunction::PrintDataTo(StringStream* stream) { 314 void LInvokeFunction::PrintDataTo(StringStream* stream) {
302 stream->Add("= "); 315 stream->Add("= ");
303 function()->PrintTo(stream); 316 function()->PrintTo(stream);
304 stream->Add(" #%d / ", arity()); 317 stream->Add(" #%d / ", arity());
305 } 318 }
306 319
307 320
308 void LCallKeyed::PrintDataTo(StringStream* stream) {
309 stream->Add("[rcx] #%d / ", arity());
310 }
311
312
313 void LCallNamed::PrintDataTo(StringStream* stream) {
314 SmartArrayPointer<char> name_string = name()->ToCString();
315 stream->Add("%s #%d / ", name_string.get(), arity());
316 }
317
318
319 void LCallGlobal::PrintDataTo(StringStream* stream) { 321 void LCallGlobal::PrintDataTo(StringStream* stream) {
320 SmartArrayPointer<char> name_string = name()->ToCString(); 322 SmartArrayPointer<char> name_string = name()->ToCString();
321 stream->Add("%s #%d / ", name_string.get(), arity()); 323 stream->Add("%s #%d / ", name_string.get(), arity());
322 } 324 }
323 325
324 326
325 void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
326 stream->Add("#%d / ", arity());
327 }
328
329
330 void LCallNew::PrintDataTo(StringStream* stream) { 327 void LCallNew::PrintDataTo(StringStream* stream) {
331 stream->Add("= "); 328 stream->Add("= ");
332 constructor()->PrintTo(stream); 329 constructor()->PrintTo(stream);
333 stream->Add(" #%d / ", arity()); 330 stream->Add(" #%d / ", arity());
334 } 331 }
335 332
336 333
337 void LCallNewArray::PrintDataTo(StringStream* stream) { 334 void LCallNewArray::PrintDataTo(StringStream* stream) {
338 stream->Add("= "); 335 stream->Add("= ");
339 constructor()->PrintTo(stream); 336 constructor()->PrintTo(stream);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { 566 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
570 if (value->EmitAtUses()) { 567 if (value->EmitAtUses()) {
571 HInstruction* instr = HInstruction::cast(value); 568 HInstruction* instr = HInstruction::cast(value);
572 VisitInstruction(instr); 569 VisitInstruction(instr);
573 } 570 }
574 operand->set_virtual_register(value->id()); 571 operand->set_virtual_register(value->id());
575 return operand; 572 return operand;
576 } 573 }
577 574
578 575
579 template<int I, int T> 576 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
580 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
581 LUnallocated* result) { 577 LUnallocated* result) {
582 result->set_virtual_register(current_instruction_->id()); 578 result->set_virtual_register(current_instruction_->id());
583 instr->set_result(result); 579 instr->set_result(result);
584 return instr; 580 return instr;
585 } 581 }
586 582
587 583
588 template<int I, int T>
589 LInstruction* LChunkBuilder::DefineAsRegister( 584 LInstruction* LChunkBuilder::DefineAsRegister(
590 LTemplateInstruction<1, I, T>* instr) { 585 LTemplateResultInstruction<1>* instr) {
591 return Define(instr, 586 return Define(instr,
592 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 587 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
593 } 588 }
594 589
595 590
596 template<int I, int T>
597 LInstruction* LChunkBuilder::DefineAsSpilled( 591 LInstruction* LChunkBuilder::DefineAsSpilled(
598 LTemplateInstruction<1, I, T>* instr, 592 LTemplateResultInstruction<1>* instr,
599 int index) { 593 int index) {
600 return Define(instr, 594 return Define(instr,
601 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); 595 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index));
602 } 596 }
603 597
604 598
605 template<int I, int T>
606 LInstruction* LChunkBuilder::DefineSameAsFirst( 599 LInstruction* LChunkBuilder::DefineSameAsFirst(
607 LTemplateInstruction<1, I, T>* instr) { 600 LTemplateResultInstruction<1>* instr) {
608 return Define(instr, 601 return Define(instr,
609 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); 602 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
610 } 603 }
611 604
612 605
613 template<int I, int T> 606 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr,
614 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
615 Register reg) { 607 Register reg) {
616 return Define(instr, ToUnallocated(reg)); 608 return Define(instr, ToUnallocated(reg));
617 } 609 }
618 610
619 611
620 template<int I, int T>
621 LInstruction* LChunkBuilder::DefineFixedDouble( 612 LInstruction* LChunkBuilder::DefineFixedDouble(
622 LTemplateInstruction<1, I, T>* instr, 613 LTemplateResultInstruction<1>* instr,
623 XMMRegister reg) { 614 XMMRegister reg) {
624 return Define(instr, ToUnallocated(reg)); 615 return Define(instr, ToUnallocated(reg));
625 } 616 }
626 617
627 618
628 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 619 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
629 HEnvironment* hydrogen_env = current_block_->last_environment(); 620 HEnvironment* hydrogen_env = current_block_->last_environment();
630 int argument_index_accumulator = 0; 621 int argument_index_accumulator = 0;
631 ZoneList<HValue*> objects_to_materialize(0, zone()); 622 ZoneList<HValue*> objects_to_materialize(0, zone());
632 instr->set_environment(CreateEnvironment(hydrogen_env, 623 instr->set_environment(CreateEnvironment(hydrogen_env,
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 return DefineAsRegister(new(zone()) LGlobalObject(context)); 1158 return DefineAsRegister(new(zone()) LGlobalObject(context));
1168 } 1159 }
1169 1160
1170 1161
1171 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1162 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1172 LOperand* global_object = UseRegisterAtStart(instr->value()); 1163 LOperand* global_object = UseRegisterAtStart(instr->value());
1173 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); 1164 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1174 } 1165 }
1175 1166
1176 1167
1177 LInstruction* LChunkBuilder::DoCallConstantFunction( 1168 LInstruction* LChunkBuilder::DoCallJSFunction(
1178 HCallConstantFunction* instr) { 1169 HCallJSFunction* instr) {
1179 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); 1170 LOperand* function = UseFixed(instr->function(), rdi);
1171 LOperand* call_kind = UseFixed(instr->call_kind(), rcx);
1172
1173 LCallJSFunction* result = new(zone()) LCallJSFunction(function, call_kind);
1174
1175 return MarkAsCall(DefineFixed(result, rax), instr);
1180 } 1176 }
1181 1177
1182 1178
1179 LInstruction* LChunkBuilder::DoCallWithDescriptor(
1180 HCallWithDescriptor* instr) {
1181 const CallInterfaceDescriptor* descriptor = instr->descriptor();
1182
1183 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1184 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1185 ops.Add(target, zone());
1186 for (int i = 1; i < instr->OperandCount(); i++) {
1187 LOperand* op = UseFixed(instr->OperandAt(i),
1188 descriptor->GetParameterRegister(i - 1));
1189 ops.Add(op, zone());
1190 }
1191
1192 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(
1193 descriptor, ops, zone());
1194 return MarkAsCall(DefineFixed(result, rax), instr);
1195 }
1196
1197
1183 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1198 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1184 LOperand* context = UseFixed(instr->context(), rsi); 1199 LOperand* context = UseFixed(instr->context(), rsi);
1185 LOperand* function = UseFixed(instr->function(), rdi); 1200 LOperand* function = UseFixed(instr->function(), rdi);
1186 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); 1201 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1187 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1202 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1188 } 1203 }
1189 1204
1190 1205
1191 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1206 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1192 switch (instr->op()) { 1207 switch (instr->op()) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 } 1267 }
1253 1268
1254 1269
1255 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1270 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1256 LOperand* input = UseRegisterAtStart(instr->value()); 1271 LOperand* input = UseRegisterAtStart(instr->value());
1257 LMathPowHalf* result = new(zone()) LMathPowHalf(input); 1272 LMathPowHalf* result = new(zone()) LMathPowHalf(input);
1258 return DefineSameAsFirst(result); 1273 return DefineSameAsFirst(result);
1259 } 1274 }
1260 1275
1261 1276
1262 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1263 ASSERT(instr->key()->representation().IsTagged());
1264 LOperand* context = UseFixed(instr->context(), rsi);
1265 LOperand* key = UseFixed(instr->key(), rcx);
1266 LCallKeyed* result = new(zone()) LCallKeyed(context, key);
1267 return MarkAsCall(DefineFixed(result, rax), instr);
1268 }
1269
1270
1271 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1272 LOperand* context = UseFixed(instr->context(), rsi);
1273 LCallNamed* result = new(zone()) LCallNamed(context);
1274 return MarkAsCall(DefineFixed(result, rax), instr);
1275 }
1276
1277
1278 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { 1277 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1279 LOperand* context = UseFixed(instr->context(), rsi); 1278 LOperand* context = UseFixed(instr->context(), rsi);
1280 LCallGlobal* result = new(zone()) LCallGlobal(context); 1279 LCallGlobal* result = new(zone()) LCallGlobal(context);
1281 return MarkAsCall(DefineFixed(result, rax), instr); 1280 return MarkAsCall(DefineFixed(result, rax), instr);
1282 } 1281 }
1283 1282
1284 1283
1285 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1286 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr);
1287 }
1288
1289
1290 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1284 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1291 LOperand* context = UseFixed(instr->context(), rsi); 1285 LOperand* context = UseFixed(instr->context(), rsi);
1292 LOperand* constructor = UseFixed(instr->constructor(), rdi); 1286 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1293 LCallNew* result = new(zone()) LCallNew(context, constructor); 1287 LCallNew* result = new(zone()) LCallNew(context, constructor);
1294 return MarkAsCall(DefineFixed(result, rax), instr); 1288 return MarkAsCall(DefineFixed(result, rax), instr);
1295 } 1289 }
1296 1290
1297 1291
1298 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { 1292 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1299 LOperand* context = UseFixed(instr->context(), rsi); 1293 LOperand* context = UseFixed(instr->context(), rsi);
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2603 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2610 LOperand* object = UseRegister(instr->object()); 2604 LOperand* object = UseRegister(instr->object());
2611 LOperand* index = UseTempRegister(instr->index()); 2605 LOperand* index = UseTempRegister(instr->index());
2612 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2606 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2613 } 2607 }
2614 2608
2615 2609
2616 } } // namespace v8::internal 2610 } } // namespace v8::internal
2617 2611
2618 #endif // V8_TARGET_ARCH_X64 2612 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698