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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 6480030: Remove the uses of the arguments from all calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) { 284 void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
285 if (index < 2) { 285 if (index < 2) {
286 operands_[index] = value; 286 operands_[index] = value;
287 } else { 287 } else {
288 context_ = value; 288 context_ = value;
289 } 289 }
290 } 290 }
291 291
292 292
293 void HCallKeyed::InternalSetOperandAt(int index, HValue* value) {
294 // The key and all the arguments are stored in the base class's arguments_
295 // vector. The context is in the object itself. Ugly.
296 if (index <= argument_count()) {
297 arguments_[index] = value;
298 } else {
299 context_ = value;
300 }
301 }
302
303
304 void HCallNamed::InternalSetOperandAt(int index, HValue* value) {
305 // The arguments are in the base class's arguments_ vector. The context
306 // is in the object itself.
307 if (index < argument_count()) {
308 arguments_[index] = value;
309 } else {
310 context_ = value;
311 }
312 }
313
314
315 void HCallFunction::InternalSetOperandAt(int index, HValue* value) {
316 // The arguments are in the base class's arguments_ vector. The context
317 // is in the object itself.
318 if (index < argument_count()) {
319 arguments_[index] = value;
320 } else {
321 context_ = value;
322 }
323 }
324
325
326 void HCallGlobal::InternalSetOperandAt(int index, HValue* value) {
327 // The arguments are in the base class's arguments_ vector. The context
328 // is in the object itself.
329 if (index < argument_count()) {
330 arguments_[index] = value;
331 } else {
332 context_ = value;
333 }
334 }
335
336
337 void HCallNew::InternalSetOperandAt(int index, HValue* value) {
338 // The arguments are in the base class's arguments_ vector. The context
339 // is in the object itself.
340 if (index < argument_count()) {
341 arguments_[index] = value;
342 } else {
343 context_ = value;
344 }
345 }
346
347
348 void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) { 293 void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
349 if (index < 3) { 294 if (index < 3) {
350 operands_[index] = value; 295 operands_[index] = value;
351 } else { 296 } else {
352 context_ = value; 297 context_ = value;
353 } 298 }
354 } 299 }
355 300
356 301
357 void HStoreNamedGeneric::InternalSetOperandAt(int index, HValue* value) { 302 void HStoreNamedGeneric::InternalSetOperandAt(int index, HValue* value) {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 547 }
603 548
604 // Verify that instructions that can be eliminated by GVN have overridden 549 // Verify that instructions that can be eliminated by GVN have overridden
605 // HValue::DataEquals. The default implementation is UNREACHABLE. We 550 // HValue::DataEquals. The default implementation is UNREACHABLE. We
606 // don't actually care whether DataEquals returns true or false here. 551 // don't actually care whether DataEquals returns true or false here.
607 if (CheckFlag(kUseGVN)) DataEquals(this); 552 if (CheckFlag(kUseGVN)) DataEquals(this);
608 } 553 }
609 #endif 554 #endif
610 555
611 556
612 HCall::HCall(int count) : arguments_(Zone::NewArray<HValue*>(count), count) { 557 void HCall::PrintDataTo(StringStream* stream) const {
613 for (int i = 0; i < count; ++i) arguments_[i] = NULL; 558 stream->Add("#%d", argument_count());
614 set_representation(Representation::Tagged());
615 SetAllSideEffects();
616 } 559 }
617 560
618 561
619 void HCall::PrintDataTo(StringStream* stream) const { 562 void HUnaryCall::PrintDataTo(StringStream* stream) const {
620 stream->Add("("); 563 value()->PrintNameTo(stream);
621 for (int i = 0; i < arguments_.length(); ++i) { 564 stream->Add(" ");
622 if (i != 0) stream->Add(", "); 565 HCall::PrintDataTo(stream);
623 arguments_.at(i)->PrintNameTo(stream); 566 }
567
568
569 void HBinaryCall::PrintDataTo(StringStream* stream) const {
570 first()->PrintNameTo(stream);
571 stream->Add(" ");
572 second()->PrintNameTo(stream);
573 stream->Add(" ");
574 HCall::PrintDataTo(stream);
575 }
576
577
578 void HCallConstantFunction::PrintDataTo(StringStream* stream) const {
579 if (IsApplyFunction()) {
580 stream->Add("optimized apply ");
581 } else {
582 stream->Add("%o ", function()->shared()->DebugName());
624 } 583 }
625 stream->Add(")"); 584 HCall::PrintDataTo(stream);
585 }
586
587
588 void HCallNamed::PrintDataTo(StringStream* stream) const {
589 stream->Add("%o ", *name());
590 HUnaryCall::PrintDataTo(stream);
591 }
592
593
594 void HCallGlobal::PrintDataTo(StringStream* stream) const {
595 stream->Add("%o ", *name());
596 HUnaryCall::PrintDataTo(stream);
597 }
598
599
600 void HCallKnownGlobal::PrintDataTo(StringStream* stream) const {
601 stream->Add("o ", target()->shared()->DebugName());
602 HCall::PrintDataTo(stream);
603 }
604
605
606 void HCallRuntime::PrintDataTo(StringStream* stream) const {
607 stream->Add("%o ", *name());
608 HCall::PrintDataTo(stream);
626 } 609 }
627 610
628 611
629 void HClassOfTest::PrintDataTo(StringStream* stream) const { 612 void HClassOfTest::PrintDataTo(StringStream* stream) const {
630 stream->Add("class_of_test("); 613 stream->Add("class_of_test(");
631 value()->PrintTo(stream); 614 value()->PrintNameTo(stream);
632 stream->Add(", \"%o\")", *class_name()); 615 stream->Add(", \"%o\")", *class_name());
633 } 616 }
634 617
635 618
636 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const { 619 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const {
637 arguments()->PrintNameTo(stream); 620 arguments()->PrintNameTo(stream);
638 stream->Add("["); 621 stream->Add("[");
639 index()->PrintNameTo(stream); 622 index()->PrintNameTo(stream);
640 stream->Add("], length "); 623 stream->Add("], length ");
641 length()->PrintNameTo(stream); 624 length()->PrintNameTo(stream);
642 } 625 }
643 626
644 627
645 void HCall::SetArgumentAt(int index, HPushArgument* push_argument) {
646 push_argument->set_argument_index(index);
647 SetOperandAt(index, push_argument);
648 }
649
650
651 void HCallConstantFunction::PrintDataTo(StringStream* stream) const {
652 if (IsApplyFunction()) {
653 stream->Add("SPECIAL function: apply");
654 } else {
655 stream->Add("%s", *(function()->shared()->DebugName()->ToCString()));
656 }
657 HCall::PrintDataTo(stream);
658 }
659
660
661 void HControlInstruction::PrintDataTo(StringStream* stream) const { 628 void HControlInstruction::PrintDataTo(StringStream* stream) const {
662 if (FirstSuccessor() != NULL) { 629 if (FirstSuccessor() != NULL) {
663 int first_id = FirstSuccessor()->block_id(); 630 int first_id = FirstSuccessor()->block_id();
664 if (SecondSuccessor() == NULL) { 631 if (SecondSuccessor() == NULL) {
665 stream->Add(" B%d", first_id); 632 stream->Add(" B%d", first_id);
666 } else { 633 } else {
667 int second_id = SecondSuccessor()->block_id(); 634 int second_id = SecondSuccessor()->block_id();
668 stream->Add(" goto (B%d, B%d)", first_id, second_id); 635 stream->Add(" goto (B%d, B%d)", first_id, second_id);
669 } 636 }
670 } 637 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 705 }
739 706
740 707
741 void HTypeofIs::PrintDataTo(StringStream* stream) const { 708 void HTypeofIs::PrintDataTo(StringStream* stream) const {
742 value()->PrintNameTo(stream); 709 value()->PrintNameTo(stream);
743 stream->Add(" == "); 710 stream->Add(" == ");
744 stream->Add(type_literal_->ToAsciiVector()); 711 stream->Add(type_literal_->ToAsciiVector());
745 } 712 }
746 713
747 714
748 void HPushArgument::PrintDataTo(StringStream* stream) const {
749 HUnaryOperation::PrintDataTo(stream);
750 if (argument_index() != -1) {
751 stream->Add(" [%d]", argument_index_);
752 }
753 }
754
755
756 void HChange::PrintDataTo(StringStream* stream) const { 715 void HChange::PrintDataTo(StringStream* stream) const {
757 HUnaryOperation::PrintDataTo(stream); 716 HUnaryOperation::PrintDataTo(stream);
758 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic()); 717 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic());
759 718
760 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); 719 if (CanTruncateToInt32()) stream->Add(" truncating-int32");
761 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); 720 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
762 } 721 }
763 722
764 723
765 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction( 724 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction(
766 HValue* value) { 725 HValue* value) {
767 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE); 726 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE);
768 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE); 727 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE);
769 } 728 }
770 729
771 730
772 void HCheckMap::PrintDataTo(StringStream* stream) const { 731 void HCheckMap::PrintDataTo(StringStream* stream) const {
773 value()->PrintNameTo(stream); 732 value()->PrintNameTo(stream);
774 stream->Add(" %p", *map()); 733 stream->Add(" %p", *map());
775 } 734 }
776 735
777 736
778 void HCheckFunction::PrintDataTo(StringStream* stream) const { 737 void HCheckFunction::PrintDataTo(StringStream* stream) const {
779 value()->PrintNameTo(stream); 738 value()->PrintNameTo(stream);
780 stream->Add(" %p", *target()); 739 stream->Add(" %p", *target());
781 } 740 }
782 741
783 742
784 void HCallKeyed::PrintDataTo(StringStream* stream) const {
785 stream->Add("[");
786 key()->PrintNameTo(stream);
787 stream->Add("](");
788 for (int i = 1; i < arguments_.length(); ++i) {
789 if (i != 1) stream->Add(", ");
790 arguments_.at(i)->PrintNameTo(stream);
791 }
792 stream->Add(")");
793 }
794
795
796 void HCallNamed::PrintDataTo(StringStream* stream) const {
797 SmartPointer<char> name_string = name()->ToCString();
798 stream->Add("%s ", *name_string);
799 HCall::PrintDataTo(stream);
800 }
801
802
803 void HCallGlobal::PrintDataTo(StringStream* stream) const {
804 SmartPointer<char> name_string = name()->ToCString();
805 stream->Add("%s ", *name_string);
806 HCall::PrintDataTo(stream);
807 }
808
809
810 void HCallRuntime::PrintDataTo(StringStream* stream) const {
811 SmartPointer<char> name_string = name()->ToCString();
812 stream->Add("%s ", *name_string);
813 HCall::PrintDataTo(stream);
814 }
815
816
817 void HCallStub::PrintDataTo(StringStream* stream) const { 743 void HCallStub::PrintDataTo(StringStream* stream) const {
818 HUnaryOperation::PrintDataTo(stream); 744 stream->Add("%s ",
819 stream->Add(" %s(%d)", 745 CodeStub::MajorName(major_key_, false));
820 CodeStub::MajorName(major_key_, false), 746 HUnaryCall::PrintDataTo(stream);
821 argument_count_);
822 } 747 }
823 748
824 749
825 void HInstanceOf::PrintDataTo(StringStream* stream) const { 750 void HInstanceOf::PrintDataTo(StringStream* stream) const {
826 left()->PrintNameTo(stream); 751 left()->PrintNameTo(stream);
827 stream->Add(" "); 752 stream->Add(" ");
828 right()->PrintNameTo(stream); 753 right()->PrintNameTo(stream);
829 stream->Add(" "); 754 stream->Add(" ");
830 context()->PrintNameTo(stream); 755 context()->PrintNameTo(stream);
831 } 756 }
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1472
1548 1473
1549 void HCheckPrototypeMaps::Verify() { 1474 void HCheckPrototypeMaps::Verify() {
1550 HInstruction::Verify(); 1475 HInstruction::Verify();
1551 ASSERT(HasNoUses()); 1476 ASSERT(HasNoUses());
1552 } 1477 }
1553 1478
1554 #endif 1479 #endif
1555 1480
1556 } } // namespace v8::internal 1481 } } // namespace v8::internal
OLDNEW
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698