| OLD | NEW |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 | 301 |
| 302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 303 stream->Add(" = "); | 303 stream->Add(" = "); |
| 304 base_object()->PrintTo(stream); | 304 base_object()->PrintTo(stream); |
| 305 stream->Add(" + "); | 305 stream->Add(" + "); |
| 306 offset()->PrintTo(stream); | 306 offset()->PrintTo(stream); |
| 307 } | 307 } |
| 308 | 308 |
| 309 | 309 |
| 310 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 310 void LCallJSFunction::PrintDataTo(StringStream* stream) { |
| 311 stream->Add("= "); |
| 312 function()->PrintTo(stream); |
| 311 stream->Add("#%d / ", arity()); | 313 stream->Add("#%d / ", arity()); |
| 312 } | 314 } |
| 313 | 315 |
| 316 |
| 317 void LCallWithDescriptor::PrintDataTo(StringStream* stream) { |
| 318 for (int i = 0; i < InputCount(); i++) { |
| 319 InputAt(i)->PrintTo(stream); |
| 320 stream->Add(" "); |
| 321 } |
| 322 stream->Add("#%d / ", arity()); |
| 323 } |
| 324 |
| 314 | 325 |
| 315 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 326 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 316 context()->PrintTo(stream); | 327 context()->PrintTo(stream); |
| 317 stream->Add("[%d]", slot_index()); | 328 stream->Add("[%d]", slot_index()); |
| 318 } | 329 } |
| 319 | 330 |
| 320 | 331 |
| 321 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 332 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 322 context()->PrintTo(stream); | 333 context()->PrintTo(stream); |
| 323 stream->Add("[%d] <- ", slot_index()); | 334 stream->Add("[%d] <- ", slot_index()); |
| 324 value()->PrintTo(stream); | 335 value()->PrintTo(stream); |
| 325 } | 336 } |
| 326 | 337 |
| 327 | 338 |
| 328 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 339 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
| 329 stream->Add("= "); | 340 stream->Add("= "); |
| 330 context()->PrintTo(stream); | 341 context()->PrintTo(stream); |
| 331 stream->Add(" "); | 342 stream->Add(" "); |
| 332 function()->PrintTo(stream); | 343 function()->PrintTo(stream); |
| 333 stream->Add(" #%d / ", arity()); | 344 stream->Add(" #%d / ", arity()); |
| 334 } | 345 } |
| 335 | 346 |
| 336 | 347 |
| 337 void LCallKeyed::PrintDataTo(StringStream* stream) { | |
| 338 stream->Add("[ecx] #%d / ", arity()); | |
| 339 } | |
| 340 | |
| 341 | |
| 342 void LCallNamed::PrintDataTo(StringStream* stream) { | |
| 343 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 344 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 345 } | |
| 346 | |
| 347 | |
| 348 void LCallGlobal::PrintDataTo(StringStream* stream) { | |
| 349 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 350 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 351 } | |
| 352 | |
| 353 | |
| 354 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | |
| 355 stream->Add("#%d / ", arity()); | |
| 356 } | |
| 357 | |
| 358 | |
| 359 void LCallNew::PrintDataTo(StringStream* stream) { | 348 void LCallNew::PrintDataTo(StringStream* stream) { |
| 360 stream->Add("= "); | 349 stream->Add("= "); |
| 361 context()->PrintTo(stream); | 350 context()->PrintTo(stream); |
| 362 stream->Add(" "); | 351 stream->Add(" "); |
| 363 constructor()->PrintTo(stream); | 352 constructor()->PrintTo(stream); |
| 364 stream->Add(" #%d / ", arity()); | 353 stream->Add(" #%d / ", arity()); |
| 365 } | 354 } |
| 366 | 355 |
| 367 | 356 |
| 368 void LCallNewArray::PrintDataTo(StringStream* stream) { | 357 void LCallNewArray::PrintDataTo(StringStream* stream) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 607 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 619 if (value->EmitAtUses()) { | 608 if (value->EmitAtUses()) { |
| 620 HInstruction* instr = HInstruction::cast(value); | 609 HInstruction* instr = HInstruction::cast(value); |
| 621 VisitInstruction(instr); | 610 VisitInstruction(instr); |
| 622 } | 611 } |
| 623 operand->set_virtual_register(value->id()); | 612 operand->set_virtual_register(value->id()); |
| 624 return operand; | 613 return operand; |
| 625 } | 614 } |
| 626 | 615 |
| 627 | 616 |
| 628 template<int I, int T> | 617 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
| 629 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
| 630 LUnallocated* result) { | 618 LUnallocated* result) { |
| 631 result->set_virtual_register(current_instruction_->id()); | 619 result->set_virtual_register(current_instruction_->id()); |
| 632 instr->set_result(result); | 620 instr->set_result(result); |
| 633 return instr; | 621 return instr; |
| 634 } | 622 } |
| 635 | 623 |
| 636 | 624 |
| 637 template<int I, int T> | |
| 638 LInstruction* LChunkBuilder::DefineAsRegister( | 625 LInstruction* LChunkBuilder::DefineAsRegister( |
| 639 LTemplateInstruction<1, I, T>* instr) { | 626 LTemplateResultInstruction<1>* instr) { |
| 640 return Define(instr, | 627 return Define(instr, |
| 641 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 628 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| 642 } | 629 } |
| 643 | 630 |
| 644 | 631 |
| 645 template<int I, int T> | |
| 646 LInstruction* LChunkBuilder::DefineAsSpilled( | 632 LInstruction* LChunkBuilder::DefineAsSpilled( |
| 647 LTemplateInstruction<1, I, T>* instr, | 633 LTemplateResultInstruction<1>* instr, |
| 648 int index) { | 634 int index) { |
| 649 return Define(instr, | 635 return Define(instr, |
| 650 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 636 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
| 651 } | 637 } |
| 652 | 638 |
| 653 | 639 |
| 654 template<int I, int T> | |
| 655 LInstruction* LChunkBuilder::DefineSameAsFirst( | 640 LInstruction* LChunkBuilder::DefineSameAsFirst( |
| 656 LTemplateInstruction<1, I, T>* instr) { | 641 LTemplateResultInstruction<1>* instr) { |
| 657 return Define(instr, | 642 return Define(instr, |
| 658 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 643 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
| 659 } | 644 } |
| 660 | 645 |
| 661 | 646 |
| 662 template<int I, int T> | 647 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr, |
| 663 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 664 Register reg) { | 648 Register reg) { |
| 665 return Define(instr, ToUnallocated(reg)); | 649 return Define(instr, ToUnallocated(reg)); |
| 666 } | 650 } |
| 667 | 651 |
| 668 | 652 |
| 669 template<int I, int T> | |
| 670 LInstruction* LChunkBuilder::DefineFixedDouble( | 653 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 671 LTemplateInstruction<1, I, T>* instr, | 654 LTemplateResultInstruction<1>* instr, |
| 672 XMMRegister reg) { | 655 XMMRegister reg) { |
| 673 return Define(instr, ToUnallocated(reg)); | 656 return Define(instr, ToUnallocated(reg)); |
| 674 } | 657 } |
| 675 | 658 |
| 676 | 659 |
| 677 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 660 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 678 HEnvironment* hydrogen_env = current_block_->last_environment(); | 661 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 679 int argument_index_accumulator = 0; | 662 int argument_index_accumulator = 0; |
| 680 ZoneList<HValue*> objects_to_materialize(0, zone()); | 663 ZoneList<HValue*> objects_to_materialize(0, zone()); |
| 681 instr->set_environment(CreateEnvironment(hydrogen_env, | 664 instr->set_environment(CreateEnvironment(hydrogen_env, |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1144 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
| 1162 } | 1145 } |
| 1163 | 1146 |
| 1164 | 1147 |
| 1165 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1148 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1166 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1149 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1167 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1150 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
| 1168 } | 1151 } |
| 1169 | 1152 |
| 1170 | 1153 |
| 1171 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1154 LInstruction* LChunkBuilder::DoCallJSFunction( |
| 1172 HCallConstantFunction* instr) { | 1155 HCallJSFunction* instr) { |
| 1173 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr); | 1156 LOperand* function = UseFixed(instr->function(), edi); |
| 1157 |
| 1158 LCallJSFunction* result = new(zone()) LCallJSFunction(function); |
| 1159 |
| 1160 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1174 } | 1161 } |
| 1175 | 1162 |
| 1176 | 1163 |
| 1164 LInstruction* LChunkBuilder::DoCallWithDescriptor( |
| 1165 HCallWithDescriptor* instr) { |
| 1166 const CallInterfaceDescriptor* descriptor = instr->descriptor(); |
| 1167 |
| 1168 LOperand* target = UseRegisterOrConstantAtStart(instr->target()); |
| 1169 ZoneList<LOperand*> ops(instr->OperandCount(), zone()); |
| 1170 ops.Add(target, zone()); |
| 1171 for (int i = 1; i < instr->OperandCount(); i++) { |
| 1172 LOperand* op = UseFixed(instr->OperandAt(i), |
| 1173 descriptor->GetParameterRegister(i - 1)); |
| 1174 ops.Add(op, zone()); |
| 1175 } |
| 1176 |
| 1177 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
| 1178 descriptor, ops, zone()); |
| 1179 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1180 } |
| 1181 |
| 1182 |
| 1177 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1183 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1178 LOperand* context = UseFixed(instr->context(), esi); | 1184 LOperand* context = UseFixed(instr->context(), esi); |
| 1179 LOperand* function = UseFixed(instr->function(), edi); | 1185 LOperand* function = UseFixed(instr->function(), edi); |
| 1180 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1186 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1181 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1187 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1182 } | 1188 } |
| 1183 | 1189 |
| 1184 | 1190 |
| 1185 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1191 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1186 switch (instr->op()) { | 1192 switch (instr->op()) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1254 |
| 1249 | 1255 |
| 1250 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1256 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
| 1251 LOperand* input = UseRegisterAtStart(instr->value()); | 1257 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1252 LOperand* temp = TempRegister(); | 1258 LOperand* temp = TempRegister(); |
| 1253 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); | 1259 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); |
| 1254 return DefineSameAsFirst(result); | 1260 return DefineSameAsFirst(result); |
| 1255 } | 1261 } |
| 1256 | 1262 |
| 1257 | 1263 |
| 1258 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
| 1259 ASSERT(instr->key()->representation().IsTagged()); | |
| 1260 LOperand* context = UseFixed(instr->context(), esi); | |
| 1261 LOperand* key = UseFixed(instr->key(), ecx); | |
| 1262 LCallKeyed* result = new(zone()) LCallKeyed(context, key); | |
| 1263 return MarkAsCall(DefineFixed(result, eax), instr); | |
| 1264 } | |
| 1265 | |
| 1266 | |
| 1267 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
| 1268 LOperand* context = UseFixed(instr->context(), esi); | |
| 1269 LCallNamed* result = new(zone()) LCallNamed(context); | |
| 1270 return MarkAsCall(DefineFixed(result, eax), instr); | |
| 1271 } | |
| 1272 | |
| 1273 | |
| 1274 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | |
| 1275 LOperand* context = UseFixed(instr->context(), esi); | |
| 1276 LCallGlobal* result = new(zone()) LCallGlobal(context); | |
| 1277 return MarkAsCall(DefineFixed(result, eax), instr); | |
| 1278 } | |
| 1279 | |
| 1280 | |
| 1281 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
| 1282 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr); | |
| 1283 } | |
| 1284 | |
| 1285 | |
| 1286 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1264 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1287 LOperand* context = UseFixed(instr->context(), esi); | 1265 LOperand* context = UseFixed(instr->context(), esi); |
| 1288 LOperand* constructor = UseFixed(instr->constructor(), edi); | 1266 LOperand* constructor = UseFixed(instr->constructor(), edi); |
| 1289 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1267 LCallNew* result = new(zone()) LCallNew(context, constructor); |
| 1290 return MarkAsCall(DefineFixed(result, eax), instr); | 1268 return MarkAsCall(DefineFixed(result, eax), instr); |
| 1291 } | 1269 } |
| 1292 | 1270 |
| 1293 | 1271 |
| 1294 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1272 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1295 LOperand* context = UseFixed(instr->context(), esi); | 1273 LOperand* context = UseFixed(instr->context(), esi); |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2657 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2680 LOperand* object = UseRegister(instr->object()); | 2658 LOperand* object = UseRegister(instr->object()); |
| 2681 LOperand* index = UseTempRegister(instr->index()); | 2659 LOperand* index = UseTempRegister(instr->index()); |
| 2682 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2660 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2683 } | 2661 } |
| 2684 | 2662 |
| 2685 | 2663 |
| 2686 } } // namespace v8::internal | 2664 } } // namespace v8::internal |
| 2687 | 2665 |
| 2688 #endif // V8_TARGET_ARCH_IA32 | 2666 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |