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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 | 270 |
271 | 271 |
272 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 272 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
273 stream->Add(" = "); | 273 stream->Add(" = "); |
274 base_object()->PrintTo(stream); | 274 base_object()->PrintTo(stream); |
275 stream->Add(" + "); | 275 stream->Add(" + "); |
276 offset()->PrintTo(stream); | 276 offset()->PrintTo(stream); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 280 void LCallJSFunction::PrintDataTo(StringStream* stream) { |
281 stream->Add("= "); | |
282 function()->PrintTo(stream); | |
283 stream->Add(" "); | |
284 call_kind()->PrintTo(stream); | |
281 stream->Add("#%d / ", arity()); | 285 stream->Add("#%d / ", arity()); |
282 } | 286 } |
283 | 287 |
288 | |
289 void LCallWithDescriptor::PrintDataTo(StringStream* stream) { | |
290 for (int i = 0; i < InputCount(); i++) { | |
291 InputAt(i)->PrintTo(stream); | |
292 stream->Add(" "); | |
293 } | |
294 stream->Add("#%d / ", arity()); | |
295 } | |
296 | |
284 | 297 |
285 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 298 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
286 context()->PrintTo(stream); | 299 context()->PrintTo(stream); |
287 stream->Add("[%d]", slot_index()); | 300 stream->Add("[%d]", slot_index()); |
288 } | 301 } |
289 | 302 |
290 | 303 |
291 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 304 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
292 context()->PrintTo(stream); | 305 context()->PrintTo(stream); |
293 stream->Add("[%d] <- ", slot_index()); | 306 stream->Add("[%d] <- ", slot_index()); |
294 value()->PrintTo(stream); | 307 value()->PrintTo(stream); |
295 } | 308 } |
296 | 309 |
297 | 310 |
298 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 311 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
299 stream->Add("= "); | 312 stream->Add("= "); |
300 function()->PrintTo(stream); | 313 function()->PrintTo(stream); |
301 stream->Add(" #%d / ", arity()); | 314 stream->Add(" #%d / ", arity()); |
302 } | 315 } |
303 | 316 |
304 | 317 |
305 void LCallKeyed::PrintDataTo(StringStream* stream) { | |
306 stream->Add("[r2] #%d / ", arity()); | |
307 } | |
308 | |
309 | |
310 void LCallNamed::PrintDataTo(StringStream* stream) { | |
311 SmartArrayPointer<char> name_string = name()->ToCString(); | |
312 stream->Add("%s #%d / ", name_string.get(), arity()); | |
313 } | |
314 | |
315 | |
316 void LCallGlobal::PrintDataTo(StringStream* stream) { | 318 void LCallGlobal::PrintDataTo(StringStream* stream) { |
317 SmartArrayPointer<char> name_string = name()->ToCString(); | 319 SmartArrayPointer<char> name_string = name()->ToCString(); |
318 stream->Add("%s #%d / ", name_string.get(), arity()); | 320 stream->Add("%s #%d / ", name_string.get(), arity()); |
319 } | 321 } |
320 | 322 |
321 | 323 |
322 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | |
323 stream->Add("#%d / ", arity()); | |
324 } | |
325 | |
326 | |
327 void LCallNew::PrintDataTo(StringStream* stream) { | 324 void LCallNew::PrintDataTo(StringStream* stream) { |
328 stream->Add("= "); | 325 stream->Add("= "); |
329 constructor()->PrintTo(stream); | 326 constructor()->PrintTo(stream); |
330 stream->Add(" #%d / ", arity()); | 327 stream->Add(" #%d / ", arity()); |
331 } | 328 } |
332 | 329 |
333 | 330 |
334 void LCallNewArray::PrintDataTo(StringStream* stream) { | 331 void LCallNewArray::PrintDataTo(StringStream* stream) { |
335 stream->Add("= "); | 332 stream->Add("= "); |
336 constructor()->PrintTo(stream); | 333 constructor()->PrintTo(stream); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 553 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
557 if (value->EmitAtUses()) { | 554 if (value->EmitAtUses()) { |
558 HInstruction* instr = HInstruction::cast(value); | 555 HInstruction* instr = HInstruction::cast(value); |
559 VisitInstruction(instr); | 556 VisitInstruction(instr); |
560 } | 557 } |
561 operand->set_virtual_register(value->id()); | 558 operand->set_virtual_register(value->id()); |
562 return operand; | 559 return operand; |
563 } | 560 } |
564 | 561 |
565 | 562 |
566 template<int I, int T> | 563 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
567 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
568 LUnallocated* result) { | 564 LUnallocated* result) { |
569 result->set_virtual_register(current_instruction_->id()); | 565 result->set_virtual_register(current_instruction_->id()); |
570 instr->set_result(result); | 566 instr->set_result(result); |
571 return instr; | 567 return instr; |
572 } | 568 } |
573 | 569 |
574 | 570 |
575 template<int I, int T> | |
576 LInstruction* LChunkBuilder::DefineAsRegister( | 571 LInstruction* LChunkBuilder::DefineAsRegister( |
577 LTemplateInstruction<1, I, T>* instr) { | 572 LTemplateResultInstruction<1>* instr) { |
578 return Define(instr, | 573 return Define(instr, |
579 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 574 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
580 } | 575 } |
581 | 576 |
582 | 577 |
583 template<int I, int T> | |
584 LInstruction* LChunkBuilder::DefineAsSpilled( | 578 LInstruction* LChunkBuilder::DefineAsSpilled( |
585 LTemplateInstruction<1, I, T>* instr, int index) { | 579 LTemplateResultInstruction<1>* instr, int index) { |
586 return Define(instr, | 580 return Define(instr, |
587 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 581 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
588 } | 582 } |
589 | 583 |
590 | 584 |
591 template<int I, int T> | |
592 LInstruction* LChunkBuilder::DefineSameAsFirst( | 585 LInstruction* LChunkBuilder::DefineSameAsFirst( |
593 LTemplateInstruction<1, I, T>* instr) { | 586 LTemplateResultInstruction<1>* instr) { |
594 return Define(instr, | 587 return Define(instr, |
595 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 588 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
596 } | 589 } |
597 | 590 |
598 | 591 |
599 template<int I, int T> | |
600 LInstruction* LChunkBuilder::DefineFixed( | 592 LInstruction* LChunkBuilder::DefineFixed( |
601 LTemplateInstruction<1, I, T>* instr, Register reg) { | 593 LTemplateResultInstruction<1>* instr, Register reg) { |
602 return Define(instr, ToUnallocated(reg)); | 594 return Define(instr, ToUnallocated(reg)); |
603 } | 595 } |
604 | 596 |
605 | 597 |
606 template<int I, int T> | |
607 LInstruction* LChunkBuilder::DefineFixedDouble( | 598 LInstruction* LChunkBuilder::DefineFixedDouble( |
608 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { | 599 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { |
609 return Define(instr, ToUnallocated(reg)); | 600 return Define(instr, ToUnallocated(reg)); |
610 } | 601 } |
611 | 602 |
612 | 603 |
613 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 604 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
614 HEnvironment* hydrogen_env = current_block_->last_environment(); | 605 HEnvironment* hydrogen_env = current_block_->last_environment(); |
615 int argument_index_accumulator = 0; | 606 int argument_index_accumulator = 0; |
616 ZoneList<HValue*> objects_to_materialize(0, zone()); | 607 ZoneList<HValue*> objects_to_materialize(0, zone()); |
617 instr->set_environment(CreateEnvironment(hydrogen_env, | 608 instr->set_environment(CreateEnvironment(hydrogen_env, |
618 &argument_index_accumulator, | 609 &argument_index_accumulator, |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1160 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1151 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
1161 } | 1152 } |
1162 | 1153 |
1163 | 1154 |
1164 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1155 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
1165 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1156 LOperand* global_object = UseRegisterAtStart(instr->value()); |
1166 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1157 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
1167 } | 1158 } |
1168 | 1159 |
1169 | 1160 |
1170 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1161 LInstruction* LChunkBuilder::DoCallJSFunction( |
1171 HCallConstantFunction* instr) { | 1162 HCallJSFunction* instr) { |
1172 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr); | 1163 LOperand* function = UseFixed(instr->function(), r1); |
1164 LOperand* call_kind = UseFixed(instr->call_kind(), r5); | |
1165 | |
1166 LCallJSFunction* result = new(zone()) LCallJSFunction(function, call_kind); | |
1167 | |
1168 return MarkAsCall(DefineFixed(result, r0), instr); | |
1173 } | 1169 } |
1174 | 1170 |
1175 | 1171 |
1172 LInstruction* LChunkBuilder::DoCallWithDescriptor( | |
1173 HCallWithDescriptor* instr) { | |
1174 const CallInterfaceDescriptor* descriptor = instr->descriptor(); | |
1175 | |
1176 LOperand* target = UseRegisterOrConstantAtStart(instr->target()); | |
1177 ZoneList<LOperand*> ops(instr->OperandCount(), zone()); | |
1178 ops.Add(target, zone()); | |
1179 for (int i = 1; i < instr->OperandCount(); i++) { | |
1180 LOperand* op = UseFixed(instr->OperandAt(i), | |
1181 descriptor->GetParameterRegister(i - 1)); | |
Toon Verwaest
2014/01/14 15:33:50
4-space indent
Jarin
2014/01/14 19:08:08
Done.
| |
1182 ops.Add(op, zone()); | |
1183 } | |
1184 | |
1185 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | |
1186 descriptor, ops, zone()); | |
1187 return MarkAsCall(DefineFixed(result, r0), instr); | |
1188 } | |
1189 | |
1190 | |
1176 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1191 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1177 LOperand* context = UseFixed(instr->context(), cp); | 1192 LOperand* context = UseFixed(instr->context(), cp); |
1178 LOperand* function = UseFixed(instr->function(), r1); | 1193 LOperand* function = UseFixed(instr->function(), r1); |
1179 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1194 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1180 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1195 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1181 } | 1196 } |
1182 | 1197 |
1183 | 1198 |
1184 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1199 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1185 switch (instr->op()) { | 1200 switch (instr->op()) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1250 } | 1265 } |
1251 | 1266 |
1252 | 1267 |
1253 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1268 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
1254 LOperand* input = UseRegisterAtStart(instr->value()); | 1269 LOperand* input = UseRegisterAtStart(instr->value()); |
1255 LMathPowHalf* result = new(zone()) LMathPowHalf(input); | 1270 LMathPowHalf* result = new(zone()) LMathPowHalf(input); |
1256 return DefineAsRegister(result); | 1271 return DefineAsRegister(result); |
1257 } | 1272 } |
1258 | 1273 |
1259 | 1274 |
1260 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
1261 ASSERT(instr->key()->representation().IsTagged()); | |
1262 LOperand* context = UseFixed(instr->context(), cp); | |
1263 LOperand* key = UseFixed(instr->key(), r2); | |
1264 return MarkAsCall( | |
1265 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); | |
1266 } | |
1267 | |
1268 | |
1269 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
1270 LOperand* context = UseFixed(instr->context(), cp); | |
1271 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr); | |
1272 } | |
1273 | |
1274 | |
1275 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1275 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
1276 LOperand* context = UseFixed(instr->context(), cp); | 1276 LOperand* context = UseFixed(instr->context(), cp); |
1277 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr); | 1277 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr); |
1278 } | 1278 } |
1279 | 1279 |
1280 | 1280 |
1281 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
1282 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr); | |
1283 } | |
1284 | |
1285 | |
1286 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1281 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
1287 LOperand* context = UseFixed(instr->context(), cp); | 1282 LOperand* context = UseFixed(instr->context(), cp); |
1288 LOperand* constructor = UseFixed(instr->constructor(), r1); | 1283 LOperand* constructor = UseFixed(instr->constructor(), r1); |
1289 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1284 LCallNew* result = new(zone()) LCallNew(context, constructor); |
1290 return MarkAsCall(DefineFixed(result, r0), instr); | 1285 return MarkAsCall(DefineFixed(result, r0), instr); |
1291 } | 1286 } |
1292 | 1287 |
1293 | 1288 |
1294 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1289 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
1295 LOperand* context = UseFixed(instr->context(), cp); | 1290 LOperand* context = UseFixed(instr->context(), cp); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2648 } | 2643 } |
2649 | 2644 |
2650 | 2645 |
2651 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2646 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2652 LOperand* object = UseRegister(instr->object()); | 2647 LOperand* object = UseRegister(instr->object()); |
2653 LOperand* index = UseRegister(instr->index()); | 2648 LOperand* index = UseRegister(instr->index()); |
2654 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2649 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2655 } | 2650 } |
2656 | 2651 |
2657 } } // namespace v8::internal | 2652 } } // namespace v8::internal |
OLD | NEW |