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

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

Issue 5964005: Shorten live ranges of argument subexpressions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 // Verify that instructions that may have side-effects are followed 515 // Verify that instructions that may have side-effects are followed
516 // by a simulate instruction. 516 // by a simulate instruction.
517 if (HasSideEffects() && !IsOsrEntry()) { 517 if (HasSideEffects() && !IsOsrEntry()) {
518 ASSERT(next()->IsSimulate()); 518 ASSERT(next()->IsSimulate());
519 } 519 }
520 } 520 }
521 #endif 521 #endif
522 522
523 523
524 HCall::HCall(int count) : arguments_(Zone::NewArray<HValue*>(count), count) { 524 HCall::HCall(int argument_count) : argument_count_(argument_count) {
525 for (int i = 0; i < count; ++i) arguments_[i] = NULL;
526 set_representation(Representation::Tagged()); 525 set_representation(Representation::Tagged());
527 SetFlagMask(AllSideEffects()); 526 SetFlagMask(AllSideEffects());
528 } 527 }
529 528
530 529
531 void HCall::PrintDataTo(StringStream* stream) const { 530 void HCall::PrintDataTo(StringStream* stream) const {
532 stream->Add("("); 531 stream->Add("#%d", argument_count());
533 for (int i = 0; i < arguments_.length(); ++i) {
534 if (i != 0) stream->Add(", ");
535 arguments_.at(i)->PrintNameTo(stream);
536 }
537 stream->Add(")");
538 } 532 }
539 533
540 534
541 void HClassOfTest::PrintDataTo(StringStream* stream) const { 535 void HClassOfTest::PrintDataTo(StringStream* stream) const {
542 stream->Add("class_of_test("); 536 stream->Add("class_of_test(");
543 value()->PrintTo(stream); 537 value()->PrintTo(stream);
544 stream->Add(", \"%o\")", *class_name()); 538 stream->Add(", \"%o\")", *class_name());
545 } 539 }
546 540
547 541
548 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const { 542 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const {
549 arguments()->PrintNameTo(stream); 543 arguments()->PrintNameTo(stream);
550 stream->Add("["); 544 stream->Add("[");
551 index()->PrintNameTo(stream); 545 index()->PrintNameTo(stream);
552 stream->Add("], length "); 546 stream->Add("], length ");
553 length()->PrintNameTo(stream); 547 length()->PrintNameTo(stream);
554 } 548 }
555 549
556 550
557 void HCall::SetArgumentAt(int index, HPushArgument* push_argument) {
558 push_argument->set_argument_index(index);
559 SetOperandAt(index, push_argument);
560 }
561
562
563 void HCallConstantFunction::PrintDataTo(StringStream* stream) const { 551 void HCallConstantFunction::PrintDataTo(StringStream* stream) const {
564 if (IsApplyFunction()) { 552 if (IsApplyFunction()) {
565 stream->Add("SPECIAL function: apply"); 553 stream->Add("SPECIAL function: apply");
566 } else { 554 } else {
567 stream->Add("%s", *(function()->shared()->DebugName()->ToCString())); 555 stream->Add("%s", *(function()->shared()->DebugName()->ToCString()));
568 } 556 }
569 HCall::PrintDataTo(stream); 557 HCall::PrintDataTo(stream);
570 } 558 }
571 559
572 560
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 643 }
656 644
657 645
658 void HTypeofIs::PrintDataTo(StringStream* stream) const { 646 void HTypeofIs::PrintDataTo(StringStream* stream) const {
659 value()->PrintNameTo(stream); 647 value()->PrintNameTo(stream);
660 stream->Add(" == "); 648 stream->Add(" == ");
661 stream->Add(type_literal_->ToAsciiVector()); 649 stream->Add(type_literal_->ToAsciiVector());
662 } 650 }
663 651
664 652
665 void HPushArgument::PrintDataTo(StringStream* stream) const {
666 HUnaryOperation::PrintDataTo(stream);
667 if (argument_index() != -1) {
668 stream->Add(" [%d]", argument_index_);
669 }
670 }
671
672
673 void HChange::PrintDataTo(StringStream* stream) const { 653 void HChange::PrintDataTo(StringStream* stream) const {
674 HUnaryOperation::PrintDataTo(stream); 654 HUnaryOperation::PrintDataTo(stream);
675 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic()); 655 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic());
676 656
677 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); 657 if (CanTruncateToInt32()) stream->Add(" truncating-int32");
678 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); 658 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
679 } 659 }
680 660
681 661
682 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction( 662 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction(
(...skipping 11 matching lines...) Expand all
694 674
695 void HCheckFunction::PrintDataTo(StringStream* stream) const { 675 void HCheckFunction::PrintDataTo(StringStream* stream) const {
696 value()->PrintNameTo(stream); 676 value()->PrintNameTo(stream);
697 stream->Add(" %p", *target()); 677 stream->Add(" %p", *target());
698 } 678 }
699 679
700 680
701 void HCallKeyed::PrintDataTo(StringStream* stream) const { 681 void HCallKeyed::PrintDataTo(StringStream* stream) const {
702 stream->Add("["); 682 stream->Add("[");
703 key()->PrintNameTo(stream); 683 key()->PrintNameTo(stream);
704 stream->Add("]("); 684 stream->Add("]");
705 for (int i = 1; i < arguments_.length(); ++i) {
706 if (i != 1) stream->Add(", ");
707 arguments_.at(i)->PrintNameTo(stream);
708 }
709 stream->Add(")");
710 } 685 }
711 686
712 687
713 void HCallNamed::PrintDataTo(StringStream* stream) const { 688 void HCallNamed::PrintDataTo(StringStream* stream) const {
714 SmartPointer<char> name_string = name()->ToCString(); 689 SmartPointer<char> name_string = name()->ToCString();
715 stream->Add("%s ", *name_string); 690 stream->Add("%s ", *name_string);
716 HCall::PrintDataTo(stream); 691 HCall::PrintDataTo(stream);
717 } 692 }
718 693
719 694
720 void HCallGlobal::PrintDataTo(StringStream* stream) const { 695 void HCallGlobal::PrintDataTo(StringStream* stream) const {
721 SmartPointer<char> name_string = name()->ToCString(); 696 SmartPointer<char> name_string = name()->ToCString();
722 stream->Add("%s ", *name_string); 697 stream->Add("%s ", *name_string);
723 HCall::PrintDataTo(stream); 698 HCall::PrintDataTo(stream);
724 } 699 }
725 700
726 701
702 void HCallKnownGlobal::PrintDataTo(StringStream* stream) const {
703 receiver()->PrintNameTo(stream);
704 }
705
706
707 void HCallNew::PrintDataTo(StringStream* stream) const {
708 constructor()->PrintNameTo(stream);
709 }
710
711
727 void HCallRuntime::PrintDataTo(StringStream* stream) const { 712 void HCallRuntime::PrintDataTo(StringStream* stream) const {
728 SmartPointer<char> name_string = name()->ToCString(); 713 SmartPointer<char> name_string = name()->ToCString();
729 stream->Add("%s ", *name_string); 714 stream->Add("%s ", *name_string);
730 HCall::PrintDataTo(stream); 715 HCall::PrintDataTo(stream);
731 } 716 }
732 717
718
733 void HCallStub::PrintDataTo(StringStream* stream) const { 719 void HCallStub::PrintDataTo(StringStream* stream) const {
734 stream->Add("%s(%d)", 720 stream->Add("%s(%d)",
735 CodeStub::MajorName(major_key_, false), 721 CodeStub::MajorName(major_key_, false),
736 argument_count_); 722 argument_count_);
737 } 723 }
738 724
739 725
740 Range* HValue::InferRange() { 726 Range* HValue::InferRange() {
741 if (representation().IsTagged()) { 727 if (representation().IsTagged()) {
742 // Tagged values are always in int32 range when converted to integer, 728 // Tagged values are always in int32 range when converted to integer,
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1423
1438 1424
1439 void HCheckPrototypeMaps::Verify() const { 1425 void HCheckPrototypeMaps::Verify() const {
1440 HInstruction::Verify(); 1426 HInstruction::Verify();
1441 ASSERT(HasNoUses()); 1427 ASSERT(HasNoUses());
1442 } 1428 }
1443 1429
1444 #endif 1430 #endif
1445 1431
1446 } } // namespace v8::internal 1432 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698