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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 559 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
563 if (value->EmitAtUses()) { | 560 if (value->EmitAtUses()) { |
564 HInstruction* instr = HInstruction::cast(value); | 561 HInstruction* instr = HInstruction::cast(value); |
565 VisitInstruction(instr); | 562 VisitInstruction(instr); |
566 } | 563 } |
567 operand->set_virtual_register(value->id()); | 564 operand->set_virtual_register(value->id()); |
568 return operand; | 565 return operand; |
569 } | 566 } |
570 | 567 |
571 | 568 |
572 template<int I, int T> | 569 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
573 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
574 LUnallocated* result) { | 570 LUnallocated* result) { |
575 result->set_virtual_register(current_instruction_->id()); | 571 result->set_virtual_register(current_instruction_->id()); |
576 instr->set_result(result); | 572 instr->set_result(result); |
577 return instr; | 573 return instr; |
578 } | 574 } |
579 | 575 |
580 | 576 |
581 template<int I, int T> | |
582 LInstruction* LChunkBuilder::DefineAsRegister( | 577 LInstruction* LChunkBuilder::DefineAsRegister( |
583 LTemplateInstruction<1, I, T>* instr) { | 578 LTemplateResultInstruction<1>* instr) { |
584 return Define(instr, | 579 return Define(instr, |
585 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 580 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
586 } | 581 } |
587 | 582 |
588 | 583 |
589 template<int I, int T> | |
590 LInstruction* LChunkBuilder::DefineAsSpilled( | 584 LInstruction* LChunkBuilder::DefineAsSpilled( |
591 LTemplateInstruction<1, I, T>* instr, | 585 LTemplateResultInstruction<1>* instr, |
592 int index) { | 586 int index) { |
593 return Define(instr, | 587 return Define(instr, |
594 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 588 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
595 } | 589 } |
596 | 590 |
597 | 591 |
598 template<int I, int T> | |
599 LInstruction* LChunkBuilder::DefineSameAsFirst( | 592 LInstruction* LChunkBuilder::DefineSameAsFirst( |
600 LTemplateInstruction<1, I, T>* instr) { | 593 LTemplateResultInstruction<1>* instr) { |
601 return Define(instr, | 594 return Define(instr, |
602 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 595 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
603 } | 596 } |
604 | 597 |
605 | 598 |
606 template<int I, int T> | 599 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr, |
607 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
608 Register reg) { | 600 Register reg) { |
609 return Define(instr, ToUnallocated(reg)); | 601 return Define(instr, ToUnallocated(reg)); |
610 } | 602 } |
611 | 603 |
612 | 604 |
613 template<int I, int T> | |
614 LInstruction* LChunkBuilder::DefineFixedDouble( | 605 LInstruction* LChunkBuilder::DefineFixedDouble( |
615 LTemplateInstruction<1, I, T>* instr, | 606 LTemplateResultInstruction<1>* instr, |
616 XMMRegister reg) { | 607 XMMRegister reg) { |
617 return Define(instr, ToUnallocated(reg)); | 608 return Define(instr, ToUnallocated(reg)); |
618 } | 609 } |
619 | 610 |
620 | 611 |
621 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 612 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
622 HEnvironment* hydrogen_env = current_block_->last_environment(); | 613 HEnvironment* hydrogen_env = current_block_->last_environment(); |
623 int argument_index_accumulator = 0; | 614 int argument_index_accumulator = 0; |
624 ZoneList<HValue*> objects_to_materialize(0, zone()); | 615 ZoneList<HValue*> objects_to_materialize(0, zone()); |
625 instr->set_environment(CreateEnvironment(hydrogen_env, | 616 instr->set_environment(CreateEnvironment(hydrogen_env, |
(...skipping 534 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, rax), instr); | 1163 LOperand* function = UseFixed(instr->function(), rdi); |
1164 LOperand* call_kind = UseFixed(instr->call_kind(), rcx); | |
1165 | |
1166 LCallJSFunction* result = new(zone()) LCallJSFunction(function, call_kind); | |
1167 | |
1168 return MarkAsCall(DefineFixed(result, rax), instr); | |
1173 } | 1169 } |
1174 | 1170 |
1175 | 1171 |
1172 LInstruction* LChunkBuilder::DoCallWithDescriptor( | |
1173 HCallWithDescriptor* instr) { | |
1174 const CodeStubInterfaceDescriptor* 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
2013/12/18 16:11:41
4-space indent
Jarin
2013/12/30 15:15:47
Done.
| |
1182 ops.Add(op, zone()); | |
1183 } | |
1184 | |
1185 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | |
1186 descriptor, ops, zone()); | |
1187 return MarkAsCall(DefineFixed(result, rax), instr); | |
1188 } | |
1189 | |
1190 | |
1176 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1191 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1177 LOperand* context = UseFixed(instr->context(), rsi); | 1192 LOperand* context = UseFixed(instr->context(), rsi); |
1178 LOperand* function = UseFixed(instr->function(), rdi); | 1193 LOperand* function = UseFixed(instr->function(), rdi); |
1179 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1194 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1180 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1195 return MarkAsCall(DefineFixed(result, rax), 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 } | 1261 } |
1247 | 1262 |
1248 | 1263 |
1249 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1264 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
1250 LOperand* input = UseRegisterAtStart(instr->value()); | 1265 LOperand* input = UseRegisterAtStart(instr->value()); |
1251 LMathPowHalf* result = new(zone()) LMathPowHalf(input); | 1266 LMathPowHalf* result = new(zone()) LMathPowHalf(input); |
1252 return DefineSameAsFirst(result); | 1267 return DefineSameAsFirst(result); |
1253 } | 1268 } |
1254 | 1269 |
1255 | 1270 |
1256 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
1257 ASSERT(instr->key()->representation().IsTagged()); | |
1258 LOperand* context = UseFixed(instr->context(), rsi); | |
1259 LOperand* key = UseFixed(instr->key(), rcx); | |
1260 LCallKeyed* result = new(zone()) LCallKeyed(context, key); | |
1261 return MarkAsCall(DefineFixed(result, rax), instr); | |
1262 } | |
1263 | |
1264 | |
1265 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
1266 LOperand* context = UseFixed(instr->context(), rsi); | |
1267 LCallNamed* result = new(zone()) LCallNamed(context); | |
1268 return MarkAsCall(DefineFixed(result, rax), instr); | |
1269 } | |
1270 | |
1271 | |
1272 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1271 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
1273 LOperand* context = UseFixed(instr->context(), rsi); | 1272 LOperand* context = UseFixed(instr->context(), rsi); |
1274 LCallGlobal* result = new(zone()) LCallGlobal(context); | 1273 LCallGlobal* result = new(zone()) LCallGlobal(context); |
1275 return MarkAsCall(DefineFixed(result, rax), instr); | 1274 return MarkAsCall(DefineFixed(result, rax), instr); |
1276 } | 1275 } |
1277 | 1276 |
1278 | 1277 |
1279 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
1280 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); | |
1281 } | |
1282 | |
1283 | |
1284 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1278 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
1285 LOperand* context = UseFixed(instr->context(), rsi); | 1279 LOperand* context = UseFixed(instr->context(), rsi); |
1286 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1280 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
1287 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1281 LCallNew* result = new(zone()) LCallNew(context, constructor); |
1288 return MarkAsCall(DefineFixed(result, rax), instr); | 1282 return MarkAsCall(DefineFixed(result, rax), instr); |
1289 } | 1283 } |
1290 | 1284 |
1291 | 1285 |
1292 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1286 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
1293 LOperand* context = UseFixed(instr->context(), rsi); | 1287 LOperand* context = UseFixed(instr->context(), rsi); |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2600 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2594 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2601 LOperand* object = UseRegister(instr->object()); | 2595 LOperand* object = UseRegister(instr->object()); |
2602 LOperand* index = UseTempRegister(instr->index()); | 2596 LOperand* index = UseTempRegister(instr->index()); |
2603 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2597 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2604 } | 2598 } |
2605 | 2599 |
2606 | 2600 |
2607 } } // namespace v8::internal | 2601 } } // namespace v8::internal |
2608 | 2602 |
2609 #endif // V8_TARGET_ARCH_X64 | 2603 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |