OLD | NEW |
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void HValue::SetOperandAt(int index, HValue* value) { | 280 void HValue::SetOperandAt(int index, HValue* value) { |
281 ASSERT(value == NULL || !value->representation().IsNone()); | 281 ASSERT(value == NULL || !value->representation().IsNone()); |
282 RegisterUse(index, value); | 282 RegisterUse(index, value); |
283 InternalSetOperandAt(index, value); | 283 InternalSetOperandAt(index, value); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) { | |
288 if (index < 2) { | |
289 operands_[index] = value; | |
290 } else { | |
291 context_ = value; | |
292 } | |
293 } | |
294 | |
295 | |
296 void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) { | |
297 if (index < 3) { | |
298 operands_[index] = value; | |
299 } else { | |
300 context_ = value; | |
301 } | |
302 } | |
303 | |
304 | |
305 void HStoreNamedGeneric::InternalSetOperandAt(int index, HValue* value) { | |
306 if (index < 2) { | |
307 operands_[index] = value; | |
308 } else { | |
309 context_ = value; | |
310 } | |
311 } | |
312 | |
313 | |
314 void HValue::ReplaceAndDelete(HValue* other) { | 287 void HValue::ReplaceAndDelete(HValue* other) { |
315 ReplaceValue(other); | 288 ReplaceValue(other); |
316 Delete(); | 289 Delete(); |
317 } | 290 } |
318 | 291 |
319 | 292 |
320 void HValue::ReplaceValue(HValue* other) { | 293 void HValue::ReplaceValue(HValue* other) { |
321 ZoneList<HValue*> start_uses(2); | 294 ZoneList<HValue*> start_uses(2); |
322 for (int i = 0; i < uses_.length(); ++i) { | 295 for (int i = 0; i < uses_.length(); ++i) { |
323 HValue* use = uses_.at(i); | 296 HValue* use = uses_.at(i); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 530 } |
558 | 531 |
559 // Verify that instructions that can be eliminated by GVN have overridden | 532 // Verify that instructions that can be eliminated by GVN have overridden |
560 // HValue::DataEquals. The default implementation is UNREACHABLE. We | 533 // HValue::DataEquals. The default implementation is UNREACHABLE. We |
561 // don't actually care whether DataEquals returns true or false here. | 534 // don't actually care whether DataEquals returns true or false here. |
562 if (CheckFlag(kUseGVN)) DataEquals(this); | 535 if (CheckFlag(kUseGVN)) DataEquals(this); |
563 } | 536 } |
564 #endif | 537 #endif |
565 | 538 |
566 | 539 |
567 void HCall::PrintDataTo(StringStream* stream) { | |
568 stream->Add("#%d", argument_count()); | |
569 } | |
570 | |
571 | |
572 void HUnaryCall::PrintDataTo(StringStream* stream) { | 540 void HUnaryCall::PrintDataTo(StringStream* stream) { |
573 value()->PrintNameTo(stream); | 541 value()->PrintNameTo(stream); |
574 stream->Add(" "); | 542 stream->Add(" "); |
575 HCall::PrintDataTo(stream); | 543 stream->Add("#%d", argument_count()); |
576 } | 544 } |
577 | 545 |
578 | 546 |
579 void HBinaryCall::PrintDataTo(StringStream* stream) { | 547 void HBinaryCall::PrintDataTo(StringStream* stream) { |
580 first()->PrintNameTo(stream); | 548 first()->PrintNameTo(stream); |
581 stream->Add(" "); | 549 stream->Add(" "); |
582 second()->PrintNameTo(stream); | 550 second()->PrintNameTo(stream); |
583 stream->Add(" "); | 551 stream->Add(" "); |
584 HCall::PrintDataTo(stream); | 552 stream->Add("#%d", argument_count()); |
585 } | 553 } |
586 | 554 |
587 | 555 |
588 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 556 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
589 if (IsApplyFunction()) { | 557 if (IsApplyFunction()) { |
590 stream->Add("optimized apply "); | 558 stream->Add("optimized apply "); |
591 } else { | 559 } else { |
592 stream->Add("%o ", function()->shared()->DebugName()); | 560 stream->Add("%o ", function()->shared()->DebugName()); |
593 } | 561 } |
594 HCall::PrintDataTo(stream); | 562 stream->Add("#%d", argument_count()); |
595 } | 563 } |
596 | 564 |
597 | 565 |
598 void HCallNamed::PrintDataTo(StringStream* stream) { | 566 void HCallNamed::PrintDataTo(StringStream* stream) { |
599 stream->Add("%o ", *name()); | 567 stream->Add("%o ", *name()); |
600 HUnaryCall::PrintDataTo(stream); | 568 HUnaryCall::PrintDataTo(stream); |
601 } | 569 } |
602 | 570 |
603 | 571 |
604 void HCallGlobal::PrintDataTo(StringStream* stream) { | 572 void HCallGlobal::PrintDataTo(StringStream* stream) { |
605 stream->Add("%o ", *name()); | 573 stream->Add("%o ", *name()); |
606 HUnaryCall::PrintDataTo(stream); | 574 HUnaryCall::PrintDataTo(stream); |
607 } | 575 } |
608 | 576 |
609 | 577 |
610 void HCallKnownGlobal::PrintDataTo(StringStream* stream) { | 578 void HCallKnownGlobal::PrintDataTo(StringStream* stream) { |
611 stream->Add("o ", target()->shared()->DebugName()); | 579 stream->Add("o ", target()->shared()->DebugName()); |
612 HCall::PrintDataTo(stream); | 580 stream->Add("#%d", argument_count()); |
613 } | 581 } |
614 | 582 |
615 | 583 |
616 void HCallRuntime::PrintDataTo(StringStream* stream) { | 584 void HCallRuntime::PrintDataTo(StringStream* stream) { |
617 stream->Add("%o ", *name()); | 585 stream->Add("%o ", *name()); |
618 HCall::PrintDataTo(stream); | 586 stream->Add("#%d", argument_count()); |
619 } | 587 } |
620 | 588 |
621 | 589 |
622 void HClassOfTest::PrintDataTo(StringStream* stream) { | 590 void HClassOfTest::PrintDataTo(StringStream* stream) { |
623 stream->Add("class_of_test("); | 591 stream->Add("class_of_test("); |
624 value()->PrintNameTo(stream); | 592 value()->PrintNameTo(stream); |
625 stream->Add(", \"%o\")", *class_name()); | 593 stream->Add(", \"%o\")", *class_name()); |
626 } | 594 } |
627 | 595 |
628 | 596 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 stream->Add("%u", index()); | 1123 stream->Add("%u", index()); |
1156 } | 1124 } |
1157 | 1125 |
1158 | 1126 |
1159 void HLoadNamedField::PrintDataTo(StringStream* stream) { | 1127 void HLoadNamedField::PrintDataTo(StringStream* stream) { |
1160 object()->PrintNameTo(stream); | 1128 object()->PrintNameTo(stream); |
1161 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); | 1129 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); |
1162 } | 1130 } |
1163 | 1131 |
1164 | 1132 |
1165 void HLoadKeyed::PrintDataTo(StringStream* stream) { | 1133 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
1166 object()->PrintNameTo(stream); | 1134 object()->PrintNameTo(stream); |
1167 stream->Add("["); | 1135 stream->Add("["); |
1168 key()->PrintNameTo(stream); | 1136 key()->PrintNameTo(stream); |
1169 stream->Add("]"); | 1137 stream->Add("]"); |
1170 } | 1138 } |
1171 | 1139 |
1172 | 1140 |
| 1141 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1142 object()->PrintNameTo(stream); |
| 1143 stream->Add("["); |
| 1144 key()->PrintNameTo(stream); |
| 1145 stream->Add("]"); |
| 1146 } |
| 1147 |
| 1148 |
1173 void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) { | 1149 void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) { |
1174 external_pointer()->PrintNameTo(stream); | 1150 external_pointer()->PrintNameTo(stream); |
1175 stream->Add("["); | 1151 stream->Add("["); |
1176 key()->PrintNameTo(stream); | 1152 key()->PrintNameTo(stream); |
1177 stream->Add("]"); | 1153 stream->Add("]"); |
1178 } | 1154 } |
1179 | 1155 |
1180 | 1156 |
1181 void HStoreNamed::PrintDataTo(StringStream* stream) { | 1157 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
1182 object()->PrintNameTo(stream); | 1158 object()->PrintNameTo(stream); |
1183 stream->Add("."); | 1159 stream->Add("."); |
1184 ASSERT(name()->IsString()); | 1160 ASSERT(name()->IsString()); |
1185 stream->Add(*String::cast(*name())->ToCString()); | 1161 stream->Add(*String::cast(*name())->ToCString()); |
1186 stream->Add(" = "); | 1162 stream->Add(" = "); |
1187 value()->PrintNameTo(stream); | 1163 value()->PrintNameTo(stream); |
1188 } | 1164 } |
1189 | 1165 |
1190 | 1166 |
1191 void HStoreNamedField::PrintDataTo(StringStream* stream) { | 1167 void HStoreNamedField::PrintDataTo(StringStream* stream) { |
1192 HStoreNamed::PrintDataTo(stream); | 1168 object()->PrintNameTo(stream); |
| 1169 stream->Add("."); |
| 1170 ASSERT(name()->IsString()); |
| 1171 stream->Add(*String::cast(*name())->ToCString()); |
| 1172 stream->Add(" = "); |
| 1173 value()->PrintNameTo(stream); |
1193 if (!transition().is_null()) { | 1174 if (!transition().is_null()) { |
1194 stream->Add(" (transition map %p)", *transition()); | 1175 stream->Add(" (transition map %p)", *transition()); |
1195 } | 1176 } |
1196 } | 1177 } |
1197 | 1178 |
1198 | 1179 |
1199 void HStoreKeyed::PrintDataTo(StringStream* stream) { | 1180 void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
1200 object()->PrintNameTo(stream); | 1181 object()->PrintNameTo(stream); |
1201 stream->Add("["); | 1182 stream->Add("["); |
1202 key()->PrintNameTo(stream); | 1183 key()->PrintNameTo(stream); |
1203 stream->Add("] = "); | 1184 stream->Add("] = "); |
1204 value()->PrintNameTo(stream); | 1185 value()->PrintNameTo(stream); |
1205 } | 1186 } |
1206 | 1187 |
1207 | 1188 |
| 1189 void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1190 object()->PrintNameTo(stream); |
| 1191 stream->Add("["); |
| 1192 key()->PrintNameTo(stream); |
| 1193 stream->Add("] = "); |
| 1194 value()->PrintNameTo(stream); |
| 1195 } |
| 1196 |
| 1197 |
1208 void HStorePixelArrayElement::PrintDataTo(StringStream* stream) { | 1198 void HStorePixelArrayElement::PrintDataTo(StringStream* stream) { |
1209 external_pointer()->PrintNameTo(stream); | 1199 external_pointer()->PrintNameTo(stream); |
1210 stream->Add("["); | 1200 stream->Add("["); |
1211 key()->PrintNameTo(stream); | 1201 key()->PrintNameTo(stream); |
1212 stream->Add("] = "); | 1202 stream->Add("] = "); |
1213 value()->PrintNameTo(stream); | 1203 value()->PrintNameTo(stream); |
1214 } | 1204 } |
1215 | 1205 |
1216 | 1206 |
1217 void HLoadGlobal::PrintDataTo(StringStream* stream) { | 1207 void HLoadGlobal::PrintDataTo(StringStream* stream) { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 | 1481 |
1492 | 1482 |
1493 void HCheckPrototypeMaps::Verify() { | 1483 void HCheckPrototypeMaps::Verify() { |
1494 HInstruction::Verify(); | 1484 HInstruction::Verify(); |
1495 ASSERT(HasNoUses()); | 1485 ASSERT(HasNoUses()); |
1496 } | 1486 } |
1497 | 1487 |
1498 #endif | 1488 #endif |
1499 | 1489 |
1500 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
OLD | NEW |