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

Side by Side Diff: src/mips/lithium-mips.cc

Issue 9511003: MIPS: Pass zone explicitly to zone-allocation on x64 and ARM. (Closed)
Patch Set: Created 8 years, 9 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
« no previous file with comments | « src/mips/lithium-mips.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 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 if (can_eliminate) { 469 if (can_eliminate) {
470 label->set_replacement(GetLabel(goto_instr->block_id())); 470 label->set_replacement(GetLabel(goto_instr->block_id()));
471 } 471 }
472 } 472 }
473 } 473 }
474 } 474 }
475 } 475 }
476 476
477 477
478 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { 478 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) {
479 LInstructionGap* gap = new LInstructionGap(block); 479 LInstructionGap* gap = new(graph_->zone()) LInstructionGap(block);
480 int index = -1; 480 int index = -1;
481 if (instr->IsControl()) { 481 if (instr->IsControl()) {
482 instructions_.Add(gap); 482 instructions_.Add(gap);
483 index = instructions_.length(); 483 index = instructions_.length();
484 instructions_.Add(instr); 484 instructions_.Add(instr);
485 } else { 485 } else {
486 index = instructions_.length(); 486 index = instructions_.length();
487 instructions_.Add(instr); 487 instructions_.Add(instr);
488 instructions_.Add(gap); 488 instructions_.Add(gap);
489 } 489 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 545
546 Representation LChunk::LookupLiteralRepresentation( 546 Representation LChunk::LookupLiteralRepresentation(
547 LConstantOperand* operand) const { 547 LConstantOperand* operand) const {
548 return graph_->LookupValue(operand->index())->representation(); 548 return graph_->LookupValue(operand->index())->representation();
549 } 549 }
550 550
551 551
552 LChunk* LChunkBuilder::Build() { 552 LChunk* LChunkBuilder::Build() {
553 ASSERT(is_unused()); 553 ASSERT(is_unused());
554 chunk_ = new LChunk(info(), graph()); 554 chunk_ = new(zone()) LChunk(info(), graph());
555 HPhase phase("Building chunk", chunk_); 555 HPhase phase("Building chunk", chunk_);
556 status_ = BUILDING; 556 status_ = BUILDING;
557 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 557 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
558 for (int i = 0; i < blocks->length(); i++) { 558 for (int i = 0; i < blocks->length(); i++) {
559 HBasicBlock* next = NULL; 559 HBasicBlock* next = NULL;
560 if (i < blocks->length() - 1) next = blocks->at(i + 1); 560 if (i < blocks->length() - 1) next = blocks->at(i + 1);
561 DoBasicBlock(blocks->at(i), next); 561 DoBasicBlock(blocks->at(i), next);
562 if (is_aborted()) return NULL; 562 if (is_aborted()) return NULL;
563 } 563 }
564 status_ = DONE; 564 status_ = DONE;
(...skipping 10 matching lines...) Expand all
575 va_start(arguments, format); 575 va_start(arguments, format);
576 OS::VPrint(format, arguments); 576 OS::VPrint(format, arguments);
577 va_end(arguments); 577 va_end(arguments);
578 PrintF("\n"); 578 PrintF("\n");
579 } 579 }
580 status_ = ABORTED; 580 status_ = ABORTED;
581 } 581 }
582 582
583 583
584 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { 584 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
585 return new LUnallocated(LUnallocated::FIXED_REGISTER, 585 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER,
586 Register::ToAllocationIndex(reg)); 586 Register::ToAllocationIndex(reg));
fschneider 2012/02/29 09:48:16 Indentation.
587 } 587 }
588 588
589 589
590 LUnallocated* LChunkBuilder::ToUnallocated(DoubleRegister reg) { 590 LUnallocated* LChunkBuilder::ToUnallocated(DoubleRegister reg) {
591 return new LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, 591 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER,
592 DoubleRegister::ToAllocationIndex(reg)); 592 DoubleRegister::ToAllocationIndex(reg));
fschneider 2012/02/29 09:48:16 Indentation.
593 } 593 }
594 594
595 595
596 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { 596 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) {
597 return Use(value, ToUnallocated(fixed_register)); 597 return Use(value, ToUnallocated(fixed_register));
598 } 598 }
599 599
600 600
601 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, DoubleRegister reg) { 601 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, DoubleRegister reg) {
602 return Use(value, ToUnallocated(reg)); 602 return Use(value, ToUnallocated(reg));
603 } 603 }
604 604
605 605
606 LOperand* LChunkBuilder::UseRegister(HValue* value) { 606 LOperand* LChunkBuilder::UseRegister(HValue* value) {
607 return Use(value, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 607 return Use(value, new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
608 } 608 }
609 609
610 610
611 LOperand* LChunkBuilder::UseRegisterAtStart(HValue* value) { 611 LOperand* LChunkBuilder::UseRegisterAtStart(HValue* value) {
612 return Use(value, 612 return Use(value,
613 new LUnallocated(LUnallocated::MUST_HAVE_REGISTER, 613 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER,
614 LUnallocated::USED_AT_START)); 614 LUnallocated::USED_AT_START));
fschneider 2012/02/29 09:48:16 Indentation.
615 } 615 }
616 616
617 617
618 LOperand* LChunkBuilder::UseTempRegister(HValue* value) { 618 LOperand* LChunkBuilder::UseTempRegister(HValue* value) {
619 return Use(value, new LUnallocated(LUnallocated::WRITABLE_REGISTER)); 619 return Use(value, new(zone()) LUnallocated(LUnallocated::WRITABLE_REGISTER));
620 } 620 }
621 621
622 622
623 LOperand* LChunkBuilder::Use(HValue* value) { 623 LOperand* LChunkBuilder::Use(HValue* value) {
624 return Use(value, new LUnallocated(LUnallocated::NONE)); 624 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE));
625 } 625 }
626 626
627 627
628 LOperand* LChunkBuilder::UseAtStart(HValue* value) { 628 LOperand* LChunkBuilder::UseAtStart(HValue* value) {
629 return Use(value, new LUnallocated(LUnallocated::NONE, 629 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE,
630 LUnallocated::USED_AT_START)); 630 LUnallocated::USED_AT_START));
631 } 631 }
632 632
633 633
634 LOperand* LChunkBuilder::UseOrConstant(HValue* value) { 634 LOperand* LChunkBuilder::UseOrConstant(HValue* value) {
635 return value->IsConstant() 635 return value->IsConstant()
636 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 636 ? chunk_->DefineConstantOperand(HConstant::cast(value))
637 : Use(value); 637 : Use(value);
638 } 638 }
639 639
(...skipping 15 matching lines...) Expand all
655 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { 655 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
656 return value->IsConstant() 656 return value->IsConstant()
657 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 657 ? chunk_->DefineConstantOperand(HConstant::cast(value))
658 : UseRegisterAtStart(value); 658 : UseRegisterAtStart(value);
659 } 659 }
660 660
661 661
662 LOperand* LChunkBuilder::UseAny(HValue* value) { 662 LOperand* LChunkBuilder::UseAny(HValue* value) {
663 return value->IsConstant() 663 return value->IsConstant()
664 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 664 ? chunk_->DefineConstantOperand(HConstant::cast(value))
665 : Use(value, new LUnallocated(LUnallocated::ANY)); 665 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY));
666 } 666 }
667 667
668 668
669 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { 669 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
670 if (value->EmitAtUses()) { 670 if (value->EmitAtUses()) {
671 HInstruction* instr = HInstruction::cast(value); 671 HInstruction* instr = HInstruction::cast(value);
672 VisitInstruction(instr); 672 VisitInstruction(instr);
673 } 673 }
674 operand->set_virtual_register(value->id()); 674 operand->set_virtual_register(value->id());
675 return operand; 675 return operand;
676 } 676 }
677 677
678 678
679 template<int I, int T> 679 template<int I, int T>
680 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, 680 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
681 LUnallocated* result) { 681 LUnallocated* result) {
682 result->set_virtual_register(current_instruction_->id()); 682 result->set_virtual_register(current_instruction_->id());
683 instr->set_result(result); 683 instr->set_result(result);
684 return instr; 684 return instr;
685 } 685 }
686 686
687 687
688 template<int I, int T> 688 template<int I, int T>
689 LInstruction* LChunkBuilder::DefineAsRegister( 689 LInstruction* LChunkBuilder::DefineAsRegister(
690 LTemplateInstruction<1, I, T>* instr) { 690 LTemplateInstruction<1, I, T>* instr) {
691 return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 691 return Define(instr,
692 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
692 } 693 }
693 694
694 695
695 template<int I, int T> 696 template<int I, int T>
696 LInstruction* LChunkBuilder::DefineAsSpilled( 697 LInstruction* LChunkBuilder::DefineAsSpilled(
697 LTemplateInstruction<1, I, T>* instr, int index) { 698 LTemplateInstruction<1, I, T>* instr, int index) {
698 return Define(instr, new LUnallocated(LUnallocated::FIXED_SLOT, index)); 699 return Define(instr,
700 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index));
699 } 701 }
700 702
701 703
702 template<int I, int T> 704 template<int I, int T>
703 LInstruction* LChunkBuilder::DefineSameAsFirst( 705 LInstruction* LChunkBuilder::DefineSameAsFirst(
704 LTemplateInstruction<1, I, T>* instr) { 706 LTemplateInstruction<1, I, T>* instr) {
705 return Define(instr, new LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); 707 return Define(instr,
708 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
706 } 709 }
707 710
708 711
709 template<int I, int T> 712 template<int I, int T>
710 LInstruction* LChunkBuilder::DefineFixed( 713 LInstruction* LChunkBuilder::DefineFixed(
711 LTemplateInstruction<1, I, T>* instr, Register reg) { 714 LTemplateInstruction<1, I, T>* instr, Register reg) {
712 return Define(instr, ToUnallocated(reg)); 715 return Define(instr, ToUnallocated(reg));
713 } 716 }
714 717
715 718
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 780
778 781
779 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) { 782 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
780 instr->MarkAsSaveDoubles(); 783 instr->MarkAsSaveDoubles();
781 return instr; 784 return instr;
782 } 785 }
783 786
784 787
785 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { 788 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
786 ASSERT(!instr->HasPointerMap()); 789 ASSERT(!instr->HasPointerMap());
787 instr->set_pointer_map(new LPointerMap(position_)); 790 instr->set_pointer_map(new(zone()) LPointerMap(position_));
788 return instr; 791 return instr;
789 } 792 }
790 793
791 794
792 LUnallocated* LChunkBuilder::TempRegister() { 795 LUnallocated* LChunkBuilder::TempRegister() {
793 LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); 796 LUnallocated* operand =
797 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER);
794 operand->set_virtual_register(allocator_->GetVirtualRegister()); 798 operand->set_virtual_register(allocator_->GetVirtualRegister());
795 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers."); 799 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers.");
796 return operand; 800 return operand;
797 } 801 }
798 802
799 803
800 LOperand* LChunkBuilder::FixedTemp(Register reg) { 804 LOperand* LChunkBuilder::FixedTemp(Register reg) {
801 LUnallocated* operand = ToUnallocated(reg); 805 LUnallocated* operand = ToUnallocated(reg);
802 ASSERT(operand->HasFixedPolicy()); 806 ASSERT(operand->HasFixedPolicy());
803 return operand; 807 return operand;
804 } 808 }
805 809
806 810
807 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { 811 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) {
808 LUnallocated* operand = ToUnallocated(reg); 812 LUnallocated* operand = ToUnallocated(reg);
809 ASSERT(operand->HasFixedPolicy()); 813 ASSERT(operand->HasFixedPolicy());
810 return operand; 814 return operand;
811 } 815 }
812 816
813 817
814 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { 818 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
815 return new LLabel(instr->block()); 819 return new(zone()) LLabel(instr->block());
816 } 820 }
817 821
818 822
819 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { 823 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) {
820 return AssignEnvironment(new LDeoptimize); 824 return AssignEnvironment(new(zone()) LDeoptimize);
821 } 825 }
822 826
823 827
824 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { 828 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
825 return AssignEnvironment(new LDeoptimize); 829 return AssignEnvironment(new(zone()) LDeoptimize);
826 } 830 }
827 831
828 832
829 LInstruction* LChunkBuilder::DoShift(Token::Value op, 833 LInstruction* LChunkBuilder::DoShift(Token::Value op,
830 HBitwiseBinaryOperation* instr) { 834 HBitwiseBinaryOperation* instr) {
831 if (instr->representation().IsTagged()) { 835 if (instr->representation().IsTagged()) {
832 ASSERT(instr->left()->representation().IsTagged()); 836 ASSERT(instr->left()->representation().IsTagged());
833 ASSERT(instr->right()->representation().IsTagged()); 837 ASSERT(instr->right()->representation().IsTagged());
834 838
835 LOperand* left = UseFixed(instr->left(), a1); 839 LOperand* left = UseFixed(instr->left(), a1);
836 LOperand* right = UseFixed(instr->right(), a0); 840 LOperand* right = UseFixed(instr->right(), a0);
837 LArithmeticT* result = new LArithmeticT(op, left, right); 841 LArithmeticT* result = new(zone()) LArithmeticT(op, left, right);
838 return MarkAsCall(DefineFixed(result, v0), instr); 842 return MarkAsCall(DefineFixed(result, v0), instr);
839 } 843 }
840 844
841 ASSERT(instr->representation().IsInteger32()); 845 ASSERT(instr->representation().IsInteger32());
842 ASSERT(instr->left()->representation().IsInteger32()); 846 ASSERT(instr->left()->representation().IsInteger32());
843 ASSERT(instr->right()->representation().IsInteger32()); 847 ASSERT(instr->right()->representation().IsInteger32());
844 LOperand* left = UseRegisterAtStart(instr->left()); 848 LOperand* left = UseRegisterAtStart(instr->left());
845 849
846 HValue* right_value = instr->right(); 850 HValue* right_value = instr->right();
847 LOperand* right = NULL; 851 LOperand* right = NULL;
(...skipping 13 matching lines...) Expand all
861 if (may_deopt) { 865 if (may_deopt) {
862 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 866 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
863 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { 867 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
864 does_deopt = true; 868 does_deopt = true;
865 break; 869 break;
866 } 870 }
867 } 871 }
868 } 872 }
869 873
870 LInstruction* result = 874 LInstruction* result =
871 DefineAsRegister(new LShiftI(op, left, right, does_deopt)); 875 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt));
872 return does_deopt ? AssignEnvironment(result) : result; 876 return does_deopt ? AssignEnvironment(result) : result;
873 } 877 }
874 878
875 879
876 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, 880 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
877 HArithmeticBinaryOperation* instr) { 881 HArithmeticBinaryOperation* instr) {
878 ASSERT(instr->representation().IsDouble()); 882 ASSERT(instr->representation().IsDouble());
879 ASSERT(instr->left()->representation().IsDouble()); 883 ASSERT(instr->left()->representation().IsDouble());
880 ASSERT(instr->right()->representation().IsDouble()); 884 ASSERT(instr->right()->representation().IsDouble());
881 ASSERT(op != Token::MOD); 885 ASSERT(op != Token::MOD);
882 LOperand* left = UseRegisterAtStart(instr->left()); 886 LOperand* left = UseRegisterAtStart(instr->left());
883 LOperand* right = UseRegisterAtStart(instr->right()); 887 LOperand* right = UseRegisterAtStart(instr->right());
884 LArithmeticD* result = new LArithmeticD(op, left, right); 888 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
885 return DefineAsRegister(result); 889 return DefineAsRegister(result);
886 } 890 }
887 891
888 892
889 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, 893 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op,
890 HArithmeticBinaryOperation* instr) { 894 HArithmeticBinaryOperation* instr) {
891 ASSERT(op == Token::ADD || 895 ASSERT(op == Token::ADD ||
892 op == Token::DIV || 896 op == Token::DIV ||
893 op == Token::MOD || 897 op == Token::MOD ||
894 op == Token::MUL || 898 op == Token::MUL ||
895 op == Token::SUB); 899 op == Token::SUB);
896 HValue* left = instr->left(); 900 HValue* left = instr->left();
897 HValue* right = instr->right(); 901 HValue* right = instr->right();
898 ASSERT(left->representation().IsTagged()); 902 ASSERT(left->representation().IsTagged());
899 ASSERT(right->representation().IsTagged()); 903 ASSERT(right->representation().IsTagged());
900 LOperand* left_operand = UseFixed(left, a1); 904 LOperand* left_operand = UseFixed(left, a1);
901 LOperand* right_operand = UseFixed(right, a0); 905 LOperand* right_operand = UseFixed(right, a0);
902 LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand); 906 LArithmeticT* result =
907 new(zone()) LArithmeticT(op, left_operand, right_operand);
903 return MarkAsCall(DefineFixed(result, v0), instr); 908 return MarkAsCall(DefineFixed(result, v0), instr);
904 } 909 }
905 910
906 911
907 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { 912 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) {
908 ASSERT(is_building()); 913 ASSERT(is_building());
909 current_block_ = block; 914 current_block_ = block;
910 next_block_ = next_block; 915 next_block_ = next_block;
911 if (block->IsStartBlock()) { 916 if (block->IsStartBlock()) {
912 block->UpdateEnvironment(graph_->start_environment()); 917 block->UpdateEnvironment(graph_->start_environment());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 HEnvironment* hydrogen_env, 996 HEnvironment* hydrogen_env,
992 int* argument_index_accumulator) { 997 int* argument_index_accumulator) {
993 if (hydrogen_env == NULL) return NULL; 998 if (hydrogen_env == NULL) return NULL;
994 999
995 LEnvironment* outer = 1000 LEnvironment* outer =
996 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); 1001 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator);
997 int ast_id = hydrogen_env->ast_id(); 1002 int ast_id = hydrogen_env->ast_id();
998 ASSERT(ast_id != AstNode::kNoNumber || 1003 ASSERT(ast_id != AstNode::kNoNumber ||
999 hydrogen_env->frame_type() != JS_FUNCTION); 1004 hydrogen_env->frame_type() != JS_FUNCTION);
1000 int value_count = hydrogen_env->length(); 1005 int value_count = hydrogen_env->length();
1001 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), 1006 LEnvironment* result = new(zone()) LEnvironment(
1002 hydrogen_env->frame_type(), 1007 hydrogen_env->closure(),
1003 ast_id, 1008 hydrogen_env->frame_type(),
1004 hydrogen_env->parameter_count(), 1009 ast_id,
1005 argument_count_, 1010 hydrogen_env->parameter_count(),
1006 value_count, 1011 argument_count_,
1007 outer); 1012 value_count,
1013 outer);
1008 int argument_index = *argument_index_accumulator; 1014 int argument_index = *argument_index_accumulator;
1009 for (int i = 0; i < value_count; ++i) { 1015 for (int i = 0; i < value_count; ++i) {
1010 if (hydrogen_env->is_special_index(i)) continue; 1016 if (hydrogen_env->is_special_index(i)) continue;
1011 1017
1012 HValue* value = hydrogen_env->values()->at(i); 1018 HValue* value = hydrogen_env->values()->at(i);
1013 LOperand* op = NULL; 1019 LOperand* op = NULL;
1014 if (value->IsArgumentsObject()) { 1020 if (value->IsArgumentsObject()) {
1015 op = NULL; 1021 op = NULL;
1016 } else if (value->IsPushArgument()) { 1022 } else if (value->IsPushArgument()) {
1017 op = new LArgument(argument_index++); 1023 op = new(zone()) LArgument(argument_index++);
1018 } else { 1024 } else {
1019 op = UseAny(value); 1025 op = UseAny(value);
1020 } 1026 }
1021 result->AddValue(op, value->representation()); 1027 result->AddValue(op, value->representation());
1022 } 1028 }
1023 1029
1024 if (hydrogen_env->frame_type() == JS_FUNCTION) { 1030 if (hydrogen_env->frame_type() == JS_FUNCTION) {
1025 *argument_index_accumulator = argument_index; 1031 *argument_index_accumulator = argument_index;
1026 } 1032 }
1027 1033
1028 return result; 1034 return result;
1029 } 1035 }
1030 1036
1031 1037
1032 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1038 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1033 return new LGoto(instr->FirstSuccessor()->block_id()); 1039 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
1034 } 1040 }
1035 1041
1036 1042
1037 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 1043 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1038 HValue* value = instr->value(); 1044 HValue* value = instr->value();
1039 if (value->EmitAtUses()) { 1045 if (value->EmitAtUses()) {
1040 HBasicBlock* successor = HConstant::cast(value)->ToBoolean() 1046 HBasicBlock* successor = HConstant::cast(value)->ToBoolean()
1041 ? instr->FirstSuccessor() 1047 ? instr->FirstSuccessor()
1042 : instr->SecondSuccessor(); 1048 : instr->SecondSuccessor();
1043 return new LGoto(successor->block_id()); 1049 return new(zone()) LGoto(successor->block_id());
1044 } 1050 }
1045 1051
1046 LBranch* result = new LBranch(UseRegister(value)); 1052 LBranch* result = new(zone()) LBranch(UseRegister(value));
1047 // Tagged values that are not known smis or booleans require a 1053 // Tagged values that are not known smis or booleans require a
1048 // deoptimization environment. 1054 // deoptimization environment.
1049 Representation rep = value->representation(); 1055 Representation rep = value->representation();
1050 HType type = value->type(); 1056 HType type = value->type();
1051 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) { 1057 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) {
1052 return AssignEnvironment(result); 1058 return AssignEnvironment(result);
1053 } 1059 }
1054 return result; 1060 return result;
1055 } 1061 }
1056 1062
1057 1063
1058 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { 1064 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1059 ASSERT(instr->value()->representation().IsTagged()); 1065 ASSERT(instr->value()->representation().IsTagged());
1060 LOperand* value = UseRegisterAtStart(instr->value()); 1066 LOperand* value = UseRegisterAtStart(instr->value());
1061 LOperand* temp = TempRegister(); 1067 LOperand* temp = TempRegister();
1062 return new LCmpMapAndBranch(value, temp); 1068 return new(zone()) LCmpMapAndBranch(value, temp);
1063 } 1069 }
1064 1070
1065 1071
1066 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { 1072 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) {
1067 return DefineAsRegister(new LArgumentsLength(UseRegister(length->value()))); 1073 return DefineAsRegister(
1074 new(zone()) LArgumentsLength(UseRegister(length->value())));
1068 } 1075 }
1069 1076
1070 1077
1071 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1078 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1072 return DefineAsRegister(new LArgumentsElements); 1079 return DefineAsRegister(new(zone()) LArgumentsElements);
1073 } 1080 }
1074 1081
1075 1082
1076 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1083 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1077 LInstanceOf* result = 1084 LInstanceOf* result =
1078 new LInstanceOf(UseFixed(instr->left(), a0), 1085 new(zone()) LInstanceOf(UseFixed(instr->left(), a0),
1079 UseFixed(instr->right(), a1)); 1086 UseFixed(instr->right(), a1));
1080 return MarkAsCall(DefineFixed(result, v0), instr); 1087 return MarkAsCall(DefineFixed(result, v0), instr);
1081 } 1088 }
1082 1089
1083 1090
1084 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 1091 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
1085 HInstanceOfKnownGlobal* instr) { 1092 HInstanceOfKnownGlobal* instr) {
1086 LInstanceOfKnownGlobal* result = 1093 LInstanceOfKnownGlobal* result =
1087 new LInstanceOfKnownGlobal(UseFixed(instr->left(), a0), FixedTemp(t0)); 1094 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), a0),
1095 FixedTemp(t0));
1088 return MarkAsCall(DefineFixed(result, v0), instr); 1096 return MarkAsCall(DefineFixed(result, v0), instr);
1089 } 1097 }
1090 1098
1091 1099
1092 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1100 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1093 LOperand* function = UseFixed(instr->function(), a1); 1101 LOperand* function = UseFixed(instr->function(), a1);
1094 LOperand* receiver = UseFixed(instr->receiver(), a0); 1102 LOperand* receiver = UseFixed(instr->receiver(), a0);
1095 LOperand* length = UseFixed(instr->length(), a2); 1103 LOperand* length = UseFixed(instr->length(), a2);
1096 LOperand* elements = UseFixed(instr->elements(), a3); 1104 LOperand* elements = UseFixed(instr->elements(), a3);
1097 LApplyArguments* result = new LApplyArguments(function, 1105 LApplyArguments* result = new(zone()) LApplyArguments(function,
1098 receiver, 1106 receiver,
1099 length, 1107 length,
1100 elements); 1108 elements);
1101 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); 1109 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY);
1102 } 1110 }
1103 1111
1104 1112
1105 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { 1113 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1106 ++argument_count_; 1114 ++argument_count_;
1107 LOperand* argument = Use(instr->argument()); 1115 LOperand* argument = Use(instr->argument());
1108 return new LPushArgument(argument); 1116 return new(zone()) LPushArgument(argument);
1109 } 1117 }
1110 1118
1111 1119
1112 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { 1120 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1113 return instr->HasNoUses() ? NULL : DefineAsRegister(new LThisFunction); 1121 return instr->HasNoUses()
1122 ? NULL
1123 : DefineAsRegister(new(zone()) LThisFunction);
1114 } 1124 }
1115 1125
1116 1126
1117 LInstruction* LChunkBuilder::DoContext(HContext* instr) { 1127 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1118 return instr->HasNoUses() ? NULL : DefineAsRegister(new LContext); 1128 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
1119 } 1129 }
1120 1130
1121 1131
1122 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { 1132 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1123 LOperand* context = UseRegisterAtStart(instr->value()); 1133 LOperand* context = UseRegisterAtStart(instr->value());
1124 return DefineAsRegister(new LOuterContext(context)); 1134 return DefineAsRegister(new(zone()) LOuterContext(context));
1125 } 1135 }
1126 1136
1127 1137
1128 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { 1138 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1129 return MarkAsCall(new LDeclareGlobals, instr); 1139 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1130 } 1140 }
1131 1141
1132 1142
1133 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { 1143 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1134 LOperand* context = UseRegisterAtStart(instr->value()); 1144 LOperand* context = UseRegisterAtStart(instr->value());
1135 return DefineAsRegister(new LGlobalObject(context)); 1145 return DefineAsRegister(new(zone()) LGlobalObject(context));
1136 } 1146 }
1137 1147
1138 1148
1139 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1149 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1140 LOperand* global_object = UseRegisterAtStart(instr->value()); 1150 LOperand* global_object = UseRegisterAtStart(instr->value());
1141 return DefineAsRegister(new LGlobalReceiver(global_object)); 1151 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1142 } 1152 }
1143 1153
1144 1154
1145 LInstruction* LChunkBuilder::DoCallConstantFunction( 1155 LInstruction* LChunkBuilder::DoCallConstantFunction(
1146 HCallConstantFunction* instr) { 1156 HCallConstantFunction* instr) {
1147 argument_count_ -= instr->argument_count(); 1157 argument_count_ -= instr->argument_count();
1148 return MarkAsCall(DefineFixed(new LCallConstantFunction, v0), instr); 1158 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr);
1149 } 1159 }
1150 1160
1151 1161
1152 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1162 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1153 LOperand* function = UseFixed(instr->function(), a1); 1163 LOperand* function = UseFixed(instr->function(), a1);
1154 argument_count_ -= instr->argument_count(); 1164 argument_count_ -= instr->argument_count();
1155 LInvokeFunction* result = new LInvokeFunction(function); 1165 LInvokeFunction* result = new(zone()) LInvokeFunction(function);
1156 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1166 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1157 } 1167 }
1158 1168
1159 1169
1160 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1170 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1161 BuiltinFunctionId op = instr->op(); 1171 BuiltinFunctionId op = instr->op();
1162 if (op == kMathLog || op == kMathSin || op == kMathCos) { 1172 if (op == kMathLog || op == kMathSin || op == kMathCos) {
1163 LOperand* input = UseFixedDouble(instr->value(), f4); 1173 LOperand* input = UseFixedDouble(instr->value(), f4);
1164 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); 1174 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, NULL);
1165 return MarkAsCall(DefineFixedDouble(result, f4), instr); 1175 return MarkAsCall(DefineFixedDouble(result, f4), instr);
1166 } else if (op == kMathPowHalf) { 1176 } else if (op == kMathPowHalf) {
1167 // Input cannot be the same as the result. 1177 // Input cannot be the same as the result.
1168 // See lithium-codegen-mips.cc::DoMathPowHalf. 1178 // See lithium-codegen-mips.cc::DoMathPowHalf.
1169 LOperand* input = UseFixedDouble(instr->value(), f8); 1179 LOperand* input = UseFixedDouble(instr->value(), f8);
1170 LOperand* temp = FixedTemp(f6); 1180 LOperand* temp = FixedTemp(f6);
1171 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); 1181 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1172 return DefineFixedDouble(result, f4); 1182 return DefineFixedDouble(result, f4);
1173 } else { 1183 } else {
1174 LOperand* input = UseRegisterAtStart(instr->value()); 1184 LOperand* input = UseRegisterAtStart(instr->value());
1175 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; 1185 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL;
1176 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); 1186 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1177 switch (op) { 1187 switch (op) {
1178 case kMathAbs: 1188 case kMathAbs:
1179 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1189 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1180 case kMathFloor: 1190 case kMathFloor:
1181 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1191 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1182 case kMathSqrt: 1192 case kMathSqrt:
1183 return DefineAsRegister(result); 1193 return DefineAsRegister(result);
1184 case kMathRound: 1194 case kMathRound:
1185 return AssignEnvironment(DefineAsRegister(result)); 1195 return AssignEnvironment(DefineAsRegister(result));
1186 default: 1196 default:
1187 UNREACHABLE(); 1197 UNREACHABLE();
1188 return NULL; 1198 return NULL;
1189 } 1199 }
1190 } 1200 }
1191 } 1201 }
1192 1202
1193 1203
1194 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1204 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1195 ASSERT(instr->key()->representation().IsTagged()); 1205 ASSERT(instr->key()->representation().IsTagged());
1196 argument_count_ -= instr->argument_count(); 1206 argument_count_ -= instr->argument_count();
1197 LOperand* key = UseFixed(instr->key(), a2); 1207 LOperand* key = UseFixed(instr->key(), a2);
1198 return MarkAsCall(DefineFixed(new LCallKeyed(key), v0), instr); 1208 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr);
1199 } 1209 }
1200 1210
1201 1211
1202 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { 1212 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1203 argument_count_ -= instr->argument_count(); 1213 argument_count_ -= instr->argument_count();
1204 return MarkAsCall(DefineFixed(new LCallNamed, v0), instr); 1214 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, v0), instr);
1205 } 1215 }
1206 1216
1207 1217
1208 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { 1218 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1209 argument_count_ -= instr->argument_count(); 1219 argument_count_ -= instr->argument_count();
1210 return MarkAsCall(DefineFixed(new LCallGlobal, v0), instr); 1220 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, v0), instr);
1211 } 1221 }
1212 1222
1213 1223
1214 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { 1224 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1215 argument_count_ -= instr->argument_count(); 1225 argument_count_ -= instr->argument_count();
1216 return MarkAsCall(DefineFixed(new LCallKnownGlobal, v0), instr); 1226 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr);
1217 } 1227 }
1218 1228
1219 1229
1220 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1230 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1221 LOperand* constructor = UseFixed(instr->constructor(), a1); 1231 LOperand* constructor = UseFixed(instr->constructor(), a1);
1222 argument_count_ -= instr->argument_count(); 1232 argument_count_ -= instr->argument_count();
1223 LCallNew* result = new LCallNew(constructor); 1233 LCallNew* result = new(zone()) LCallNew(constructor);
1224 return MarkAsCall(DefineFixed(result, v0), instr); 1234 return MarkAsCall(DefineFixed(result, v0), instr);
1225 } 1235 }
1226 1236
1227 1237
1228 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { 1238 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1229 LOperand* function = UseFixed(instr->function(), a1); 1239 LOperand* function = UseFixed(instr->function(), a1);
1230 argument_count_ -= instr->argument_count(); 1240 argument_count_ -= instr->argument_count();
1231 return MarkAsCall(DefineFixed(new LCallFunction(function), v0), instr); 1241 return MarkAsCall(DefineFixed(new(zone()) LCallFunction(function), v0),
1242 instr);
1232 } 1243 }
1233 1244
1234 1245
1235 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { 1246 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1236 argument_count_ -= instr->argument_count(); 1247 argument_count_ -= instr->argument_count();
1237 return MarkAsCall(DefineFixed(new LCallRuntime, v0), instr); 1248 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, v0), instr);
1238 } 1249 }
1239 1250
1240 1251
1241 LInstruction* LChunkBuilder::DoShr(HShr* instr) { 1252 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1242 return DoShift(Token::SHR, instr); 1253 return DoShift(Token::SHR, instr);
1243 } 1254 }
1244 1255
1245 1256
1246 LInstruction* LChunkBuilder::DoSar(HSar* instr) { 1257 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1247 return DoShift(Token::SAR, instr); 1258 return DoShift(Token::SAR, instr);
1248 } 1259 }
1249 1260
1250 1261
1251 LInstruction* LChunkBuilder::DoShl(HShl* instr) { 1262 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1252 return DoShift(Token::SHL, instr); 1263 return DoShift(Token::SHL, instr);
1253 } 1264 }
1254 1265
1255 1266
1256 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { 1267 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1257 if (instr->representation().IsInteger32()) { 1268 if (instr->representation().IsInteger32()) {
1258 ASSERT(instr->left()->representation().IsInteger32()); 1269 ASSERT(instr->left()->representation().IsInteger32());
1259 ASSERT(instr->right()->representation().IsInteger32()); 1270 ASSERT(instr->right()->representation().IsInteger32());
1260 1271
1261 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1272 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1262 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 1273 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1263 return DefineAsRegister(new LBitI(left, right)); 1274 return DefineAsRegister(new(zone()) LBitI(left, right));
1264 } else { 1275 } else {
1265 ASSERT(instr->representation().IsTagged()); 1276 ASSERT(instr->representation().IsTagged());
1266 ASSERT(instr->left()->representation().IsTagged()); 1277 ASSERT(instr->left()->representation().IsTagged());
1267 ASSERT(instr->right()->representation().IsTagged()); 1278 ASSERT(instr->right()->representation().IsTagged());
1268 1279
1269 LOperand* left = UseFixed(instr->left(), a1); 1280 LOperand* left = UseFixed(instr->left(), a1);
1270 LOperand* right = UseFixed(instr->right(), a0); 1281 LOperand* right = UseFixed(instr->right(), a0);
1271 LArithmeticT* result = new LArithmeticT(instr->op(), left, right); 1282 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1272 return MarkAsCall(DefineFixed(result, v0), instr); 1283 return MarkAsCall(DefineFixed(result, v0), instr);
1273 } 1284 }
1274 } 1285 }
1275 1286
1276 1287
1277 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { 1288 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1278 ASSERT(instr->value()->representation().IsInteger32()); 1289 ASSERT(instr->value()->representation().IsInteger32());
1279 ASSERT(instr->representation().IsInteger32()); 1290 ASSERT(instr->representation().IsInteger32());
1280 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); 1291 LOperand* value = UseRegisterAtStart(instr->value());
1292 return DefineAsRegister(new(zone()) LBitNotI(value));
1281 } 1293 }
1282 1294
1283 1295
1284 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1296 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1285 if (instr->representation().IsDouble()) { 1297 if (instr->representation().IsDouble()) {
1286 return DoArithmeticD(Token::DIV, instr); 1298 return DoArithmeticD(Token::DIV, instr);
1287 } else if (instr->representation().IsInteger32()) { 1299 } else if (instr->representation().IsInteger32()) {
1288 // TODO(1042) The fixed register allocation 1300 // TODO(1042) The fixed register allocation
1289 // is needed because we call TypeRecordingBinaryOpStub from 1301 // is needed because we call TypeRecordingBinaryOpStub from
1290 // the generated code, which requires registers a0 1302 // the generated code, which requires registers a0
1291 // and a1 to be used. We should remove that 1303 // and a1 to be used. We should remove that
1292 // when we provide a native implementation. 1304 // when we provide a native implementation.
1293 LOperand* dividend = UseFixed(instr->left(), a0); 1305 LOperand* dividend = UseFixed(instr->left(), a0);
1294 LOperand* divisor = UseFixed(instr->right(), a1); 1306 LOperand* divisor = UseFixed(instr->right(), a1);
1295 return AssignEnvironment(AssignPointerMap( 1307 return AssignEnvironment(AssignPointerMap(
1296 DefineFixed(new LDivI(dividend, divisor), v0))); 1308 DefineFixed(new(zone()) LDivI(dividend, divisor), v0)));
1297 } else { 1309 } else {
1298 return DoArithmeticT(Token::DIV, instr); 1310 return DoArithmeticT(Token::DIV, instr);
1299 } 1311 }
1300 } 1312 }
1301 1313
1302 1314
1303 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1315 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1304 if (instr->representation().IsInteger32()) { 1316 if (instr->representation().IsInteger32()) {
1305 ASSERT(instr->left()->representation().IsInteger32()); 1317 ASSERT(instr->left()->representation().IsInteger32());
1306 ASSERT(instr->right()->representation().IsInteger32()); 1318 ASSERT(instr->right()->representation().IsInteger32());
1307 1319
1308 LModI* mod; 1320 LModI* mod;
1309 if (instr->HasPowerOf2Divisor()) { 1321 if (instr->HasPowerOf2Divisor()) {
1310 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1322 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1311 LOperand* value = UseRegisterAtStart(instr->left()); 1323 LOperand* value = UseRegisterAtStart(instr->left());
1312 mod = new LModI(value, UseOrConstant(instr->right())); 1324 mod = new(zone()) LModI(value, UseOrConstant(instr->right()));
1313 } else { 1325 } else {
1314 LOperand* dividend = UseRegister(instr->left()); 1326 LOperand* dividend = UseRegister(instr->left());
1315 LOperand* divisor = UseRegister(instr->right()); 1327 LOperand* divisor = UseRegister(instr->right());
1316 mod = new LModI(dividend, 1328 mod = new(zone()) LModI(dividend,
1317 divisor, 1329 divisor,
1318 TempRegister(), 1330 TempRegister(),
1319 FixedTemp(f20), 1331 FixedTemp(f20),
1320 FixedTemp(f22)); 1332 FixedTemp(f22));
1321 } 1333 }
1322 1334
1323 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) || 1335 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1324 instr->CheckFlag(HValue::kCanBeDivByZero)) { 1336 instr->CheckFlag(HValue::kCanBeDivByZero)) {
1325 return AssignEnvironment(DefineAsRegister(mod)); 1337 return AssignEnvironment(DefineAsRegister(mod));
1326 } else { 1338 } else {
1327 return DefineAsRegister(mod); 1339 return DefineAsRegister(mod);
1328 } 1340 }
1329 } else if (instr->representation().IsTagged()) { 1341 } else if (instr->representation().IsTagged()) {
1330 return DoArithmeticT(Token::MOD, instr); 1342 return DoArithmeticT(Token::MOD, instr);
1331 } else { 1343 } else {
1332 ASSERT(instr->representation().IsDouble()); 1344 ASSERT(instr->representation().IsDouble());
1333 // We call a C function for double modulo. It can't trigger a GC. 1345 // We call a C function for double modulo. It can't trigger a GC.
1334 // We need to use fixed result register for the call. 1346 // We need to use fixed result register for the call.
1335 // TODO(fschneider): Allow any register as input registers. 1347 // TODO(fschneider): Allow any register as input registers.
1336 LOperand* left = UseFixedDouble(instr->left(), f2); 1348 LOperand* left = UseFixedDouble(instr->left(), f2);
1337 LOperand* right = UseFixedDouble(instr->right(), f4); 1349 LOperand* right = UseFixedDouble(instr->right(), f4);
1338 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); 1350 LArithmeticD* result = new(zone()) LArithmeticD(Token::MOD, left, right);
1339 return MarkAsCall(DefineFixedDouble(result, f2), instr); 1351 return MarkAsCall(DefineFixedDouble(result, f2), instr);
1340 } 1352 }
1341 } 1353 }
1342 1354
1343 1355
1344 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1356 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1345 if (instr->representation().IsInteger32()) { 1357 if (instr->representation().IsInteger32()) {
1346 ASSERT(instr->left()->representation().IsInteger32()); 1358 ASSERT(instr->left()->representation().IsInteger32());
1347 ASSERT(instr->right()->representation().IsInteger32()); 1359 ASSERT(instr->right()->representation().IsInteger32());
1348 LOperand* left; 1360 LOperand* left;
1349 LOperand* right = UseOrConstant(instr->MostConstantOperand()); 1361 LOperand* right = UseOrConstant(instr->MostConstantOperand());
1350 LOperand* temp = NULL; 1362 LOperand* temp = NULL;
1351 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && 1363 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
1352 (instr->CheckFlag(HValue::kCanOverflow) || 1364 (instr->CheckFlag(HValue::kCanOverflow) ||
1353 !right->IsConstantOperand())) { 1365 !right->IsConstantOperand())) {
1354 left = UseRegister(instr->LeastConstantOperand()); 1366 left = UseRegister(instr->LeastConstantOperand());
1355 temp = TempRegister(); 1367 temp = TempRegister();
1356 } else { 1368 } else {
1357 left = UseRegisterAtStart(instr->LeastConstantOperand()); 1369 left = UseRegisterAtStart(instr->LeastConstantOperand());
1358 } 1370 }
1359 LMulI* mul = new LMulI(left, right, temp); 1371 LMulI* mul = new(zone()) LMulI(left, right, temp);
1360 if (instr->CheckFlag(HValue::kCanOverflow) || 1372 if (instr->CheckFlag(HValue::kCanOverflow) ||
1361 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { 1373 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1362 AssignEnvironment(mul); 1374 AssignEnvironment(mul);
1363 } 1375 }
1364 return DefineAsRegister(mul); 1376 return DefineAsRegister(mul);
1365 1377
1366 } else if (instr->representation().IsDouble()) { 1378 } else if (instr->representation().IsDouble()) {
1367 return DoArithmeticD(Token::MUL, instr); 1379 return DoArithmeticD(Token::MUL, instr);
1368 1380
1369 } else { 1381 } else {
1370 return DoArithmeticT(Token::MUL, instr); 1382 return DoArithmeticT(Token::MUL, instr);
1371 } 1383 }
1372 } 1384 }
1373 1385
1374 1386
1375 LInstruction* LChunkBuilder::DoSub(HSub* instr) { 1387 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1376 if (instr->representation().IsInteger32()) { 1388 if (instr->representation().IsInteger32()) {
1377 ASSERT(instr->left()->representation().IsInteger32()); 1389 ASSERT(instr->left()->representation().IsInteger32());
1378 ASSERT(instr->right()->representation().IsInteger32()); 1390 ASSERT(instr->right()->representation().IsInteger32());
1379 LOperand* left = UseRegisterAtStart(instr->left()); 1391 LOperand* left = UseRegisterAtStart(instr->left());
1380 LOperand* right = UseOrConstantAtStart(instr->right()); 1392 LOperand* right = UseOrConstantAtStart(instr->right());
1381 LSubI* sub = new LSubI(left, right); 1393 LSubI* sub = new(zone()) LSubI(left, right);
1382 LInstruction* result = DefineAsRegister(sub); 1394 LInstruction* result = DefineAsRegister(sub);
1383 if (instr->CheckFlag(HValue::kCanOverflow)) { 1395 if (instr->CheckFlag(HValue::kCanOverflow)) {
1384 result = AssignEnvironment(result); 1396 result = AssignEnvironment(result);
1385 } 1397 }
1386 return result; 1398 return result;
1387 } else if (instr->representation().IsDouble()) { 1399 } else if (instr->representation().IsDouble()) {
1388 return DoArithmeticD(Token::SUB, instr); 1400 return DoArithmeticD(Token::SUB, instr);
1389 } else { 1401 } else {
1390 return DoArithmeticT(Token::SUB, instr); 1402 return DoArithmeticT(Token::SUB, instr);
1391 } 1403 }
1392 } 1404 }
1393 1405
1394 1406
1395 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { 1407 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1396 if (instr->representation().IsInteger32()) { 1408 if (instr->representation().IsInteger32()) {
1397 ASSERT(instr->left()->representation().IsInteger32()); 1409 ASSERT(instr->left()->representation().IsInteger32());
1398 ASSERT(instr->right()->representation().IsInteger32()); 1410 ASSERT(instr->right()->representation().IsInteger32());
1399 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1411 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1400 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 1412 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1401 LAddI* add = new LAddI(left, right); 1413 LAddI* add = new(zone()) LAddI(left, right);
1402 LInstruction* result = DefineAsRegister(add); 1414 LInstruction* result = DefineAsRegister(add);
1403 if (instr->CheckFlag(HValue::kCanOverflow)) { 1415 if (instr->CheckFlag(HValue::kCanOverflow)) {
1404 result = AssignEnvironment(result); 1416 result = AssignEnvironment(result);
1405 } 1417 }
1406 return result; 1418 return result;
1407 } else if (instr->representation().IsDouble()) { 1419 } else if (instr->representation().IsDouble()) {
1408 return DoArithmeticD(Token::ADD, instr); 1420 return DoArithmeticD(Token::ADD, instr);
1409 } else { 1421 } else {
1410 ASSERT(instr->representation().IsTagged()); 1422 ASSERT(instr->representation().IsTagged());
1411 return DoArithmeticT(Token::ADD, instr); 1423 return DoArithmeticT(Token::ADD, instr);
1412 } 1424 }
1413 } 1425 }
1414 1426
1415 1427
1416 LInstruction* LChunkBuilder::DoPower(HPower* instr) { 1428 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1417 ASSERT(instr->representation().IsDouble()); 1429 ASSERT(instr->representation().IsDouble());
1418 // We call a C function for double power. It can't trigger a GC. 1430 // We call a C function for double power. It can't trigger a GC.
1419 // We need to use fixed result register for the call. 1431 // We need to use fixed result register for the call.
1420 Representation exponent_type = instr->right()->representation(); 1432 Representation exponent_type = instr->right()->representation();
1421 ASSERT(instr->left()->representation().IsDouble()); 1433 ASSERT(instr->left()->representation().IsDouble());
1422 LOperand* left = UseFixedDouble(instr->left(), f2); 1434 LOperand* left = UseFixedDouble(instr->left(), f2);
1423 LOperand* right = exponent_type.IsDouble() ? 1435 LOperand* right = exponent_type.IsDouble() ?
1424 UseFixedDouble(instr->right(), f4) : 1436 UseFixedDouble(instr->right(), f4) :
1425 UseFixed(instr->right(), a2); 1437 UseFixed(instr->right(), a2);
1426 LPower* result = new LPower(left, right); 1438 LPower* result = new(zone()) LPower(left, right);
1427 return MarkAsCall(DefineFixedDouble(result, f0), 1439 return MarkAsCall(DefineFixedDouble(result, f0),
1428 instr, 1440 instr,
1429 CAN_DEOPTIMIZE_EAGERLY); 1441 CAN_DEOPTIMIZE_EAGERLY);
1430 } 1442 }
1431 1443
1432 1444
1433 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { 1445 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1434 ASSERT(instr->representation().IsDouble()); 1446 ASSERT(instr->representation().IsDouble());
1435 ASSERT(instr->global_object()->representation().IsTagged()); 1447 ASSERT(instr->global_object()->representation().IsTagged());
1436 LOperand* global_object = UseFixed(instr->global_object(), a0); 1448 LOperand* global_object = UseFixed(instr->global_object(), a0);
1437 LRandom* result = new LRandom(global_object); 1449 LRandom* result = new(zone()) LRandom(global_object);
1438 return MarkAsCall(DefineFixedDouble(result, f0), instr); 1450 return MarkAsCall(DefineFixedDouble(result, f0), instr);
1439 } 1451 }
1440 1452
1441 1453
1442 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1454 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1443 Representation r = instr->GetInputRepresentation(); 1455 Representation r = instr->GetInputRepresentation();
1444 ASSERT(instr->left()->representation().IsTagged()); 1456 ASSERT(instr->left()->representation().IsTagged());
1445 ASSERT(instr->right()->representation().IsTagged()); 1457 ASSERT(instr->right()->representation().IsTagged());
1446 LOperand* left = UseFixed(instr->left(), a1); 1458 LOperand* left = UseFixed(instr->left(), a1);
1447 LOperand* right = UseFixed(instr->right(), a0); 1459 LOperand* right = UseFixed(instr->right(), a0);
1448 LCmpT* result = new LCmpT(left, right); 1460 LCmpT* result = new(zone()) LCmpT(left, right);
1449 return MarkAsCall(DefineFixed(result, v0), instr); 1461 return MarkAsCall(DefineFixed(result, v0), instr);
1450 } 1462 }
1451 1463
1452 1464
1453 LInstruction* LChunkBuilder::DoCompareIDAndBranch( 1465 LInstruction* LChunkBuilder::DoCompareIDAndBranch(
1454 HCompareIDAndBranch* instr) { 1466 HCompareIDAndBranch* instr) {
1455 Representation r = instr->GetInputRepresentation(); 1467 Representation r = instr->GetInputRepresentation();
1456 if (r.IsInteger32()) { 1468 if (r.IsInteger32()) {
1457 ASSERT(instr->left()->representation().IsInteger32()); 1469 ASSERT(instr->left()->representation().IsInteger32());
1458 ASSERT(instr->right()->representation().IsInteger32()); 1470 ASSERT(instr->right()->representation().IsInteger32());
1459 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1471 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1460 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); 1472 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1461 return new LCmpIDAndBranch(left, right); 1473 return new(zone()) LCmpIDAndBranch(left, right);
1462 } else { 1474 } else {
1463 ASSERT(r.IsDouble()); 1475 ASSERT(r.IsDouble());
1464 ASSERT(instr->left()->representation().IsDouble()); 1476 ASSERT(instr->left()->representation().IsDouble());
1465 ASSERT(instr->right()->representation().IsDouble()); 1477 ASSERT(instr->right()->representation().IsDouble());
1466 LOperand* left = UseRegisterAtStart(instr->left()); 1478 LOperand* left = UseRegisterAtStart(instr->left());
1467 LOperand* right = UseRegisterAtStart(instr->right()); 1479 LOperand* right = UseRegisterAtStart(instr->right());
1468 return new LCmpIDAndBranch(left, right); 1480 return new(zone()) LCmpIDAndBranch(left, right);
1469 } 1481 }
1470 } 1482 }
1471 1483
1472 1484
1473 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1485 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1474 HCompareObjectEqAndBranch* instr) { 1486 HCompareObjectEqAndBranch* instr) {
1475 LOperand* left = UseRegisterAtStart(instr->left()); 1487 LOperand* left = UseRegisterAtStart(instr->left());
1476 LOperand* right = UseRegisterAtStart(instr->right()); 1488 LOperand* right = UseRegisterAtStart(instr->right());
1477 return new LCmpObjectEqAndBranch(left, right); 1489 return new(zone()) LCmpObjectEqAndBranch(left, right);
1478 } 1490 }
1479 1491
1480 1492
1481 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch( 1493 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch(
1482 HCompareConstantEqAndBranch* instr) { 1494 HCompareConstantEqAndBranch* instr) {
1483 return new LCmpConstantEqAndBranch(UseRegisterAtStart(instr->value())); 1495 return new(zone()) LCmpConstantEqAndBranch(
1496 UseRegisterAtStart(instr->value()));
1484 } 1497 }
1485 1498
1486 1499
1487 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) { 1500 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1488 ASSERT(instr->value()->representation().IsTagged()); 1501 ASSERT(instr->value()->representation().IsTagged());
1489 return new LIsNilAndBranch(UseRegisterAtStart(instr->value())); 1502 return new(zone()) LIsNilAndBranch(UseRegisterAtStart(instr->value()));
1490 } 1503 }
1491 1504
1492 1505
1493 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1506 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1494 ASSERT(instr->value()->representation().IsTagged()); 1507 ASSERT(instr->value()->representation().IsTagged());
1495 LOperand* temp = TempRegister(); 1508 LOperand* temp = TempRegister();
1496 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()), temp); 1509 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()),
1510 temp);
1497 } 1511 }
1498 1512
1499 1513
1500 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { 1514 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1501 ASSERT(instr->value()->representation().IsTagged()); 1515 ASSERT(instr->value()->representation().IsTagged());
1502 LOperand* temp = TempRegister(); 1516 LOperand* temp = TempRegister();
1503 return new LIsStringAndBranch(UseRegisterAtStart(instr->value()), temp); 1517 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()),
1518 temp);
1504 } 1519 }
1505 1520
1506 1521
1507 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1522 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1508 ASSERT(instr->value()->representation().IsTagged()); 1523 ASSERT(instr->value()->representation().IsTagged());
1509 return new LIsSmiAndBranch(Use(instr->value())); 1524 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1510 } 1525 }
1511 1526
1512 1527
1513 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1528 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1514 HIsUndetectableAndBranch* instr) { 1529 HIsUndetectableAndBranch* instr) {
1515 ASSERT(instr->value()->representation().IsTagged()); 1530 ASSERT(instr->value()->representation().IsTagged());
1516 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()), 1531 return new(zone()) LIsUndetectableAndBranch(
1517 TempRegister()); 1532 UseRegisterAtStart(instr->value()), TempRegister());
1518 } 1533 }
1519 1534
1520 1535
1521 LInstruction* LChunkBuilder::DoStringCompareAndBranch( 1536 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1522 HStringCompareAndBranch* instr) { 1537 HStringCompareAndBranch* instr) {
1523 ASSERT(instr->left()->representation().IsTagged()); 1538 ASSERT(instr->left()->representation().IsTagged());
1524 ASSERT(instr->right()->representation().IsTagged()); 1539 ASSERT(instr->right()->representation().IsTagged());
1525 LOperand* left = UseFixed(instr->left(), a1); 1540 LOperand* left = UseFixed(instr->left(), a1);
1526 LOperand* right = UseFixed(instr->right(), a0); 1541 LOperand* right = UseFixed(instr->right(), a0);
1527 LStringCompareAndBranch* result = new LStringCompareAndBranch(left, right); 1542 LStringCompareAndBranch* result =
1543 new(zone()) LStringCompareAndBranch(left, right);
1528 return MarkAsCall(result, instr); 1544 return MarkAsCall(result, instr);
1529 } 1545 }
1530 1546
1531 1547
1532 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1548 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1533 HHasInstanceTypeAndBranch* instr) { 1549 HHasInstanceTypeAndBranch* instr) {
1534 ASSERT(instr->value()->representation().IsTagged()); 1550 ASSERT(instr->value()->representation().IsTagged());
1535 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value())); 1551 LOperand* value = UseRegisterAtStart(instr->value());
1552 return new(zone()) LHasInstanceTypeAndBranch(value);
1536 } 1553 }
1537 1554
1538 1555
1539 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1556 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
1540 HGetCachedArrayIndex* instr) { 1557 HGetCachedArrayIndex* instr) {
1541 ASSERT(instr->value()->representation().IsTagged()); 1558 ASSERT(instr->value()->representation().IsTagged());
1542 LOperand* value = UseRegisterAtStart(instr->value()); 1559 LOperand* value = UseRegisterAtStart(instr->value());
1543 1560
1544 return DefineAsRegister(new LGetCachedArrayIndex(value)); 1561 return DefineAsRegister(new(zone()) LGetCachedArrayIndex(value));
1545 } 1562 }
1546 1563
1547 1564
1548 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch( 1565 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch(
1549 HHasCachedArrayIndexAndBranch* instr) { 1566 HHasCachedArrayIndexAndBranch* instr) {
1550 ASSERT(instr->value()->representation().IsTagged()); 1567 ASSERT(instr->value()->representation().IsTagged());
1551 return new LHasCachedArrayIndexAndBranch( 1568 return new(zone()) LHasCachedArrayIndexAndBranch(
1552 UseRegisterAtStart(instr->value())); 1569 UseRegisterAtStart(instr->value()));
1553 } 1570 }
1554 1571
1555 1572
1556 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( 1573 LInstruction* LChunkBuilder::DoClassOfTestAndBranch(
1557 HClassOfTestAndBranch* instr) { 1574 HClassOfTestAndBranch* instr) {
1558 ASSERT(instr->value()->representation().IsTagged()); 1575 ASSERT(instr->value()->representation().IsTagged());
1559 return new LClassOfTestAndBranch(UseRegister(instr->value()), 1576 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()),
1560 TempRegister()); 1577 TempRegister());
1561 } 1578 }
1562 1579
1563 1580
1564 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) { 1581 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1565 LOperand* array = UseRegisterAtStart(instr->value()); 1582 LOperand* array = UseRegisterAtStart(instr->value());
1566 return DefineAsRegister(new LJSArrayLength(array)); 1583 return DefineAsRegister(new(zone()) LJSArrayLength(array));
1567 } 1584 }
1568 1585
1569 1586
1570 LInstruction* LChunkBuilder::DoFixedArrayBaseLength( 1587 LInstruction* LChunkBuilder::DoFixedArrayBaseLength(
1571 HFixedArrayBaseLength* instr) { 1588 HFixedArrayBaseLength* instr) {
1572 LOperand* array = UseRegisterAtStart(instr->value()); 1589 LOperand* array = UseRegisterAtStart(instr->value());
1573 return DefineAsRegister(new LFixedArrayBaseLength(array)); 1590 return DefineAsRegister(new(zone()) LFixedArrayBaseLength(array));
1574 } 1591 }
1575 1592
1576 1593
1577 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { 1594 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1578 LOperand* object = UseRegisterAtStart(instr->value()); 1595 LOperand* object = UseRegisterAtStart(instr->value());
1579 return DefineAsRegister(new LElementsKind(object)); 1596 return DefineAsRegister(new(zone()) LElementsKind(object));
1580 } 1597 }
1581 1598
1582 1599
1583 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { 1600 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1584 LOperand* object = UseRegister(instr->value()); 1601 LOperand* object = UseRegister(instr->value());
1585 LValueOf* result = new LValueOf(object, TempRegister()); 1602 LValueOf* result = new(zone()) LValueOf(object, TempRegister());
1586 return DefineAsRegister(result); 1603 return DefineAsRegister(result);
1587 } 1604 }
1588 1605
1589 1606
1590 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { 1607 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1591 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), 1608 LOperand* value = UseRegisterAtStart(instr->index());
1592 UseRegister(instr->length()))); 1609 LOperand* length = UseRegister(instr->length());
1610 return AssignEnvironment(new(zone()) LBoundsCheck(value, length));
1593 } 1611 }
1594 1612
1595 1613
1596 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { 1614 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1597 // The control instruction marking the end of a block that completed 1615 // The control instruction marking the end of a block that completed
1598 // abruptly (e.g., threw an exception). There is nothing specific to do. 1616 // abruptly (e.g., threw an exception). There is nothing specific to do.
1599 return NULL; 1617 return NULL;
1600 } 1618 }
1601 1619
1602 1620
1603 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { 1621 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1604 LOperand* value = UseFixed(instr->value(), a0); 1622 LOperand* value = UseFixed(instr->value(), a0);
1605 return MarkAsCall(new LThrow(value), instr); 1623 return MarkAsCall(new(zone()) LThrow(value), instr);
1606 } 1624 }
1607 1625
1608 1626
1609 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { 1627 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1610 return NULL; 1628 return NULL;
1611 } 1629 }
1612 1630
1613 1631
1614 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { 1632 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) {
1615 // All HForceRepresentation instructions should be eliminated in the 1633 // All HForceRepresentation instructions should be eliminated in the
1616 // representation change phase of Hydrogen. 1634 // representation change phase of Hydrogen.
1617 UNREACHABLE(); 1635 UNREACHABLE();
1618 return NULL; 1636 return NULL;
1619 } 1637 }
1620 1638
1621 1639
1622 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1640 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1623 Representation from = instr->from(); 1641 Representation from = instr->from();
1624 Representation to = instr->to(); 1642 Representation to = instr->to();
1625 if (from.IsTagged()) { 1643 if (from.IsTagged()) {
1626 if (to.IsDouble()) { 1644 if (to.IsDouble()) {
1627 LOperand* value = UseRegister(instr->value()); 1645 LOperand* value = UseRegister(instr->value());
1628 LNumberUntagD* res = new LNumberUntagD(value); 1646 LNumberUntagD* res = new(zone()) LNumberUntagD(value);
1629 return AssignEnvironment(DefineAsRegister(res)); 1647 return AssignEnvironment(DefineAsRegister(res));
1630 } else { 1648 } else {
1631 ASSERT(to.IsInteger32()); 1649 ASSERT(to.IsInteger32());
1632 LOperand* value = UseRegisterAtStart(instr->value()); 1650 LOperand* value = UseRegisterAtStart(instr->value());
1633 bool needs_check = !instr->value()->type().IsSmi(); 1651 bool needs_check = !instr->value()->type().IsSmi();
1634 LInstruction* res = NULL; 1652 LInstruction* res = NULL;
1635 if (!needs_check) { 1653 if (!needs_check) {
1636 res = DefineAsRegister(new LSmiUntag(value, needs_check)); 1654 res = DefineAsRegister(new(zone()) LSmiUntag(value, needs_check));
1637 } else { 1655 } else {
1638 LOperand* temp1 = TempRegister(); 1656 LOperand* temp1 = TempRegister();
1639 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() 1657 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1640 : NULL; 1658 : NULL;
1641 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(f22) 1659 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(f22)
1642 : NULL; 1660 : NULL;
1643 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); 1661 res = DefineSameAsFirst(new(zone()) LTaggedToI(value,
1662 temp1,
1663 temp2,
1664 temp3));
1644 res = AssignEnvironment(res); 1665 res = AssignEnvironment(res);
1645 } 1666 }
1646 return res; 1667 return res;
1647 } 1668 }
1648 } else if (from.IsDouble()) { 1669 } else if (from.IsDouble()) {
1649 if (to.IsTagged()) { 1670 if (to.IsTagged()) {
1650 LOperand* value = UseRegister(instr->value()); 1671 LOperand* value = UseRegister(instr->value());
1651 LOperand* temp1 = TempRegister(); 1672 LOperand* temp1 = TempRegister();
1652 LOperand* temp2 = TempRegister(); 1673 LOperand* temp2 = TempRegister();
1653 1674
1654 // Make sure that the temp and result_temp registers are 1675 // Make sure that the temp and result_temp registers are
1655 // different. 1676 // different.
1656 LUnallocated* result_temp = TempRegister(); 1677 LUnallocated* result_temp = TempRegister();
1657 LNumberTagD* result = new LNumberTagD(value, temp1, temp2); 1678 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2);
1658 Define(result, result_temp); 1679 Define(result, result_temp);
1659 return AssignPointerMap(result); 1680 return AssignPointerMap(result);
1660 } else { 1681 } else {
1661 ASSERT(to.IsInteger32()); 1682 ASSERT(to.IsInteger32());
1662 LOperand* value = UseRegister(instr->value()); 1683 LOperand* value = UseRegister(instr->value());
1663 LDoubleToI* res = 1684 LOperand* temp1 = TempRegister();
1664 new LDoubleToI(value, 1685 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1665 TempRegister(), 1686 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2);
1666 instr->CanTruncateToInt32() ? TempRegister() : NULL);
1667 return AssignEnvironment(DefineAsRegister(res)); 1687 return AssignEnvironment(DefineAsRegister(res));
1668 } 1688 }
1669 } else if (from.IsInteger32()) { 1689 } else if (from.IsInteger32()) {
1670 if (to.IsTagged()) { 1690 if (to.IsTagged()) {
1671 HValue* val = instr->value(); 1691 HValue* val = instr->value();
1672 LOperand* value = UseRegisterAtStart(val); 1692 LOperand* value = UseRegisterAtStart(val);
1673 if (val->HasRange() && val->range()->IsInSmiRange()) { 1693 if (val->HasRange() && val->range()->IsInSmiRange()) {
1674 return DefineAsRegister(new LSmiTag(value)); 1694 return DefineAsRegister(new(zone()) LSmiTag(value));
1675 } else { 1695 } else {
1676 LNumberTagI* result = new LNumberTagI(value); 1696 LNumberTagI* result = new(zone()) LNumberTagI(value);
1677 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1697 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1678 } 1698 }
1679 } else { 1699 } else {
1680 ASSERT(to.IsDouble()); 1700 ASSERT(to.IsDouble());
1681 LOperand* value = Use(instr->value()); 1701 LOperand* value = Use(instr->value());
1682 return DefineAsRegister(new LInteger32ToDouble(value)); 1702 return DefineAsRegister(new(zone()) LInteger32ToDouble(value));
1683 } 1703 }
1684 } 1704 }
1685 UNREACHABLE(); 1705 UNREACHABLE();
1686 return NULL; 1706 return NULL;
1687 } 1707 }
1688 1708
1689 1709
1690 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1710 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1691 LOperand* value = UseRegisterAtStart(instr->value()); 1711 LOperand* value = UseRegisterAtStart(instr->value());
1692 return AssignEnvironment(new LCheckNonSmi(value)); 1712 return AssignEnvironment(new(zone()) LCheckNonSmi(value));
1693 } 1713 }
1694 1714
1695 1715
1696 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { 1716 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1697 LOperand* value = UseRegisterAtStart(instr->value()); 1717 LOperand* value = UseRegisterAtStart(instr->value());
1698 LInstruction* result = new LCheckInstanceType(value); 1718 LInstruction* result = new(zone()) LCheckInstanceType(value);
1699 return AssignEnvironment(result); 1719 return AssignEnvironment(result);
1700 } 1720 }
1701 1721
1702 1722
1703 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { 1723 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1704 LOperand* temp1 = TempRegister(); 1724 LOperand* temp1 = TempRegister();
1705 LOperand* temp2 = TempRegister(); 1725 LOperand* temp2 = TempRegister();
1706 LInstruction* result = new LCheckPrototypeMaps(temp1, temp2); 1726 LInstruction* result = new(zone()) LCheckPrototypeMaps(temp1, temp2);
1707 return AssignEnvironment(result); 1727 return AssignEnvironment(result);
1708 } 1728 }
1709 1729
1710 1730
1711 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { 1731 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1712 LOperand* value = UseRegisterAtStart(instr->value()); 1732 LOperand* value = UseRegisterAtStart(instr->value());
1713 return AssignEnvironment(new LCheckSmi(value)); 1733 return AssignEnvironment(new(zone()) LCheckSmi(value));
1714 } 1734 }
1715 1735
1716 1736
1717 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { 1737 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1718 LOperand* value = UseRegisterAtStart(instr->value()); 1738 LOperand* value = UseRegisterAtStart(instr->value());
1719 return AssignEnvironment(new LCheckFunction(value)); 1739 return AssignEnvironment(new(zone()) LCheckFunction(value));
1720 } 1740 }
1721 1741
1722 1742
1723 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { 1743 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1724 LOperand* value = UseRegisterAtStart(instr->value()); 1744 LOperand* value = UseRegisterAtStart(instr->value());
1725 LInstruction* result = new LCheckMap(value); 1745 LInstruction* result = new(zone()) LCheckMap(value);
1726 return AssignEnvironment(result); 1746 return AssignEnvironment(result);
1727 } 1747 }
1728 1748
1729 1749
1730 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { 1750 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1731 HValue* value = instr->value(); 1751 HValue* value = instr->value();
1732 Representation input_rep = value->representation(); 1752 Representation input_rep = value->representation();
1733 LOperand* reg = UseRegister(value); 1753 LOperand* reg = UseRegister(value);
1734 if (input_rep.IsDouble()) { 1754 if (input_rep.IsDouble()) {
1735 // Revisit this decision, here and 8 lines below. 1755 // Revisit this decision, here and 8 lines below.
1736 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(f22))); 1756 return DefineAsRegister(new(zone()) LClampDToUint8(reg, FixedTemp(f22)));
1737 } else if (input_rep.IsInteger32()) { 1757 } else if (input_rep.IsInteger32()) {
1738 return DefineAsRegister(new LClampIToUint8(reg)); 1758 return DefineAsRegister(new(zone()) LClampIToUint8(reg));
1739 } else { 1759 } else {
1740 ASSERT(input_rep.IsTagged()); 1760 ASSERT(input_rep.IsTagged());
1741 // Register allocator doesn't (yet) support allocation of double 1761 // Register allocator doesn't (yet) support allocation of double
1742 // temps. Reserve f22 explicitly. 1762 // temps. Reserve f22 explicitly.
1743 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(f22)); 1763 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(f22));
1744 return AssignEnvironment(DefineAsRegister(result)); 1764 return AssignEnvironment(DefineAsRegister(result));
1745 } 1765 }
1746 } 1766 }
1747 1767
1748 1768
1749 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { 1769 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) {
1750 HValue* value = instr->value(); 1770 HValue* value = instr->value();
1751 Representation input_rep = value->representation(); 1771 Representation input_rep = value->representation();
1752 LOperand* reg = UseRegister(value); 1772 LOperand* reg = UseRegister(value);
1753 if (input_rep.IsDouble()) { 1773 if (input_rep.IsDouble()) {
1754 LOperand* temp1 = TempRegister(); 1774 LOperand* temp1 = TempRegister();
1755 LOperand* temp2 = TempRegister(); 1775 LOperand* temp2 = TempRegister();
1756 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); 1776 LDoubleToI* res = new(zone()) LDoubleToI(reg, temp1, temp2);
1757 return AssignEnvironment(DefineAsRegister(res)); 1777 return AssignEnvironment(DefineAsRegister(res));
1758 } else if (input_rep.IsInteger32()) { 1778 } else if (input_rep.IsInteger32()) {
1759 // Canonicalization should already have removed the hydrogen instruction in 1779 // Canonicalization should already have removed the hydrogen instruction in
1760 // this case, since it is a noop. 1780 // this case, since it is a noop.
1761 UNREACHABLE(); 1781 UNREACHABLE();
1762 return NULL; 1782 return NULL;
1763 } else { 1783 } else {
1764 ASSERT(input_rep.IsTagged()); 1784 ASSERT(input_rep.IsTagged());
1765 LOperand* temp1 = TempRegister(); 1785 LOperand* temp1 = TempRegister();
1766 LOperand* temp2 = TempRegister(); 1786 LOperand* temp2 = TempRegister();
1767 LOperand* temp3 = FixedTemp(f22); 1787 LOperand* temp3 = FixedTemp(f22);
1768 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); 1788 LTaggedToI* res = new(zone()) LTaggedToI(reg, temp1, temp2, temp3);
1769 return AssignEnvironment(DefineSameAsFirst(res)); 1789 return AssignEnvironment(DefineSameAsFirst(res));
1770 } 1790 }
1771 } 1791 }
1772 1792
1773 1793
1774 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 1794 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1775 return new LReturn(UseFixed(instr->value(), v0)); 1795 return new(zone()) LReturn(UseFixed(instr->value(), v0));
1776 } 1796 }
1777 1797
1778 1798
1779 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1799 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1780 Representation r = instr->representation(); 1800 Representation r = instr->representation();
1781 if (r.IsInteger32()) { 1801 if (r.IsInteger32()) {
1782 return DefineAsRegister(new LConstantI); 1802 return DefineAsRegister(new(zone()) LConstantI);
1783 } else if (r.IsDouble()) { 1803 } else if (r.IsDouble()) {
1784 return DefineAsRegister(new LConstantD); 1804 return DefineAsRegister(new(zone()) LConstantD);
1785 } else if (r.IsTagged()) { 1805 } else if (r.IsTagged()) {
1786 return DefineAsRegister(new LConstantT); 1806 return DefineAsRegister(new(zone()) LConstantT);
1787 } else { 1807 } else {
1788 UNREACHABLE(); 1808 UNREACHABLE();
1789 return NULL; 1809 return NULL;
1790 } 1810 }
1791 } 1811 }
1792 1812
1793 1813
1794 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { 1814 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1795 LLoadGlobalCell* result = new LLoadGlobalCell; 1815 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell;
1796 return instr->RequiresHoleCheck() 1816 return instr->RequiresHoleCheck()
1797 ? AssignEnvironment(DefineAsRegister(result)) 1817 ? AssignEnvironment(DefineAsRegister(result))
1798 : DefineAsRegister(result); 1818 : DefineAsRegister(result);
1799 } 1819 }
1800 1820
1801 1821
1802 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { 1822 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1803 LOperand* global_object = UseFixed(instr->global_object(), a0); 1823 LOperand* global_object = UseFixed(instr->global_object(), a0);
1804 LLoadGlobalGeneric* result = new LLoadGlobalGeneric(global_object); 1824 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object);
1805 return MarkAsCall(DefineFixed(result, v0), instr); 1825 return MarkAsCall(DefineFixed(result, v0), instr);
1806 } 1826 }
1807 1827
1808 1828
1809 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { 1829 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1810 LOperand* value = UseRegister(instr->value()); 1830 LOperand* value = UseRegister(instr->value());
1811 // Use a temp to check the value in the cell in the case where we perform 1831 // Use a temp to check the value in the cell in the case where we perform
1812 // a hole check. 1832 // a hole check.
1813 return instr->RequiresHoleCheck() 1833 return instr->RequiresHoleCheck()
1814 ? AssignEnvironment(new LStoreGlobalCell(value, TempRegister())) 1834 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister()))
1815 : new LStoreGlobalCell(value, NULL); 1835 : new(zone()) LStoreGlobalCell(value, NULL);
1816 } 1836 }
1817 1837
1818 1838
1819 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { 1839 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1820 LOperand* global_object = UseFixed(instr->global_object(), a1); 1840 LOperand* global_object = UseFixed(instr->global_object(), a1);
1821 LOperand* value = UseFixed(instr->value(), a0); 1841 LOperand* value = UseFixed(instr->value(), a0);
1822 LStoreGlobalGeneric* result = 1842 LStoreGlobalGeneric* result =
1823 new LStoreGlobalGeneric(global_object, value); 1843 new(zone()) LStoreGlobalGeneric(global_object, value);
1824 return MarkAsCall(result, instr); 1844 return MarkAsCall(result, instr);
1825 } 1845 }
1826 1846
1827 1847
1828 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 1848 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1829 LOperand* context = UseRegisterAtStart(instr->value()); 1849 LOperand* context = UseRegisterAtStart(instr->value());
1830 LInstruction* result = DefineAsRegister(new LLoadContextSlot(context)); 1850 LInstruction* result =
1851 DefineAsRegister(new(zone()) LLoadContextSlot(context));
1831 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 1852 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1832 } 1853 }
1833 1854
1834 1855
1835 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { 1856 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1836 LOperand* context; 1857 LOperand* context;
1837 LOperand* value; 1858 LOperand* value;
1838 if (instr->NeedsWriteBarrier()) { 1859 if (instr->NeedsWriteBarrier()) {
1839 context = UseTempRegister(instr->context()); 1860 context = UseTempRegister(instr->context());
1840 value = UseTempRegister(instr->value()); 1861 value = UseTempRegister(instr->value());
1841 } else { 1862 } else {
1842 context = UseRegister(instr->context()); 1863 context = UseRegister(instr->context());
1843 value = UseRegister(instr->value()); 1864 value = UseRegister(instr->value());
1844 } 1865 }
1845 LInstruction* result = new LStoreContextSlot(context, value); 1866 LInstruction* result = new(zone()) LStoreContextSlot(context, value);
1846 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 1867 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1847 } 1868 }
1848 1869
1849 1870
1850 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 1871 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1851 return DefineAsRegister( 1872 return DefineAsRegister(
1852 new LLoadNamedField(UseRegisterAtStart(instr->object()))); 1873 new(zone()) LLoadNamedField(UseRegisterAtStart(instr->object())));
1853 } 1874 }
1854 1875
1855 1876
1856 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( 1877 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic(
1857 HLoadNamedFieldPolymorphic* instr) { 1878 HLoadNamedFieldPolymorphic* instr) {
1858 ASSERT(instr->representation().IsTagged()); 1879 ASSERT(instr->representation().IsTagged());
1859 if (instr->need_generic()) { 1880 if (instr->need_generic()) {
1860 LOperand* obj = UseFixed(instr->object(), a0); 1881 LOperand* obj = UseFixed(instr->object(), a0);
1861 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); 1882 LLoadNamedFieldPolymorphic* result =
1883 new(zone()) LLoadNamedFieldPolymorphic(obj);
1862 return MarkAsCall(DefineFixed(result, v0), instr); 1884 return MarkAsCall(DefineFixed(result, v0), instr);
1863 } else { 1885 } else {
1864 LOperand* obj = UseRegisterAtStart(instr->object()); 1886 LOperand* obj = UseRegisterAtStart(instr->object());
1865 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); 1887 LLoadNamedFieldPolymorphic* result =
1888 new(zone()) LLoadNamedFieldPolymorphic(obj);
1866 return AssignEnvironment(DefineAsRegister(result)); 1889 return AssignEnvironment(DefineAsRegister(result));
1867 } 1890 }
1868 } 1891 }
1869 1892
1870 1893
1871 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { 1894 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1872 LOperand* object = UseFixed(instr->object(), a0); 1895 LOperand* object = UseFixed(instr->object(), a0);
1873 LInstruction* result = DefineFixed(new LLoadNamedGeneric(object), v0); 1896 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), v0);
1874 return MarkAsCall(result, instr); 1897 return MarkAsCall(result, instr);
1875 } 1898 }
1876 1899
1877 1900
1878 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( 1901 LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
1879 HLoadFunctionPrototype* instr) { 1902 HLoadFunctionPrototype* instr) {
1880 return AssignEnvironment(DefineAsRegister( 1903 return AssignEnvironment(DefineAsRegister(
1881 new LLoadFunctionPrototype(UseRegister(instr->function())))); 1904 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
1882 } 1905 }
1883 1906
1884 1907
1885 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) { 1908 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1886 LOperand* input = UseRegisterAtStart(instr->value()); 1909 LOperand* input = UseRegisterAtStart(instr->value());
1887 return DefineAsRegister(new LLoadElements(input)); 1910 return DefineAsRegister(new(zone()) LLoadElements(input));
1888 } 1911 }
1889 1912
1890 1913
1891 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( 1914 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
1892 HLoadExternalArrayPointer* instr) { 1915 HLoadExternalArrayPointer* instr) {
1893 LOperand* input = UseRegisterAtStart(instr->value()); 1916 LOperand* input = UseRegisterAtStart(instr->value());
1894 return DefineAsRegister(new LLoadExternalArrayPointer(input)); 1917 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1895 } 1918 }
1896 1919
1897 1920
1898 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( 1921 LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
1899 HLoadKeyedFastElement* instr) { 1922 HLoadKeyedFastElement* instr) {
1900 ASSERT(instr->representation().IsTagged()); 1923 ASSERT(instr->representation().IsTagged());
1901 ASSERT(instr->key()->representation().IsInteger32()); 1924 ASSERT(instr->key()->representation().IsInteger32());
1902 LOperand* obj = UseRegisterAtStart(instr->object()); 1925 LOperand* obj = UseRegisterAtStart(instr->object());
1903 LOperand* key = UseRegisterAtStart(instr->key()); 1926 LOperand* key = UseRegisterAtStart(instr->key());
1904 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); 1927 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key);
1905 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1928 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1906 return DefineAsRegister(result); 1929 return DefineAsRegister(result);
1907 } 1930 }
1908 1931
1909 1932
1910 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( 1933 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement(
1911 HLoadKeyedFastDoubleElement* instr) { 1934 HLoadKeyedFastDoubleElement* instr) {
1912 ASSERT(instr->representation().IsDouble()); 1935 ASSERT(instr->representation().IsDouble());
1913 ASSERT(instr->key()->representation().IsInteger32()); 1936 ASSERT(instr->key()->representation().IsInteger32());
1914 LOperand* elements = UseTempRegister(instr->elements()); 1937 LOperand* elements = UseTempRegister(instr->elements());
1915 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1938 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1916 LLoadKeyedFastDoubleElement* result = 1939 LLoadKeyedFastDoubleElement* result =
1917 new LLoadKeyedFastDoubleElement(elements, key); 1940 new(zone()) LLoadKeyedFastDoubleElement(elements, key);
1918 return AssignEnvironment(DefineAsRegister(result)); 1941 return AssignEnvironment(DefineAsRegister(result));
1919 } 1942 }
1920 1943
1921 1944
1922 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( 1945 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1923 HLoadKeyedSpecializedArrayElement* instr) { 1946 HLoadKeyedSpecializedArrayElement* instr) {
1924 ElementsKind elements_kind = instr->elements_kind(); 1947 ElementsKind elements_kind = instr->elements_kind();
1925 Representation representation(instr->representation()); 1948 Representation representation(instr->representation());
1926 ASSERT( 1949 ASSERT(
1927 (representation.IsInteger32() && 1950 (representation.IsInteger32() &&
1928 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1951 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1929 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1952 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1930 (representation.IsDouble() && 1953 (representation.IsDouble() &&
1931 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1954 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1932 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1955 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1933 ASSERT(instr->key()->representation().IsInteger32()); 1956 ASSERT(instr->key()->representation().IsInteger32());
1934 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1957 LOperand* external_pointer = UseRegister(instr->external_pointer());
1935 LOperand* key = UseRegisterOrConstant(instr->key()); 1958 LOperand* key = UseRegisterOrConstant(instr->key());
1936 LLoadKeyedSpecializedArrayElement* result = 1959 LLoadKeyedSpecializedArrayElement* result =
1937 new LLoadKeyedSpecializedArrayElement(external_pointer, key); 1960 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key);
1938 LInstruction* load_instr = DefineAsRegister(result); 1961 LInstruction* load_instr = DefineAsRegister(result);
1939 // An unsigned int array load might overflow and cause a deopt, make sure it 1962 // An unsigned int array load might overflow and cause a deopt, make sure it
1940 // has an environment. 1963 // has an environment.
1941 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? 1964 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ?
1942 AssignEnvironment(load_instr) : load_instr; 1965 AssignEnvironment(load_instr) : load_instr;
1943 } 1966 }
1944 1967
1945 1968
1946 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1969 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1947 LOperand* object = UseFixed(instr->object(), a1); 1970 LOperand* object = UseFixed(instr->object(), a1);
1948 LOperand* key = UseFixed(instr->key(), a0); 1971 LOperand* key = UseFixed(instr->key(), a0);
1949 1972
1950 LInstruction* result = 1973 LInstruction* result =
1951 DefineFixed(new LLoadKeyedGeneric(object, key), v0); 1974 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0);
1952 return MarkAsCall(result, instr); 1975 return MarkAsCall(result, instr);
1953 } 1976 }
1954 1977
1955 1978
1956 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1979 LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
1957 HStoreKeyedFastElement* instr) { 1980 HStoreKeyedFastElement* instr) {
1958 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1981 bool needs_write_barrier = instr->NeedsWriteBarrier();
1959 ASSERT(instr->value()->representation().IsTagged()); 1982 ASSERT(instr->value()->representation().IsTagged());
1960 ASSERT(instr->object()->representation().IsTagged()); 1983 ASSERT(instr->object()->representation().IsTagged());
1961 ASSERT(instr->key()->representation().IsInteger32()); 1984 ASSERT(instr->key()->representation().IsInteger32());
1962 1985
1963 LOperand* obj = UseTempRegister(instr->object()); 1986 LOperand* obj = UseTempRegister(instr->object());
1964 LOperand* val = needs_write_barrier 1987 LOperand* val = needs_write_barrier
1965 ? UseTempRegister(instr->value()) 1988 ? UseTempRegister(instr->value())
1966 : UseRegisterAtStart(instr->value()); 1989 : UseRegisterAtStart(instr->value());
1967 LOperand* key = needs_write_barrier 1990 LOperand* key = needs_write_barrier
1968 ? UseTempRegister(instr->key()) 1991 ? UseTempRegister(instr->key())
1969 : UseRegisterOrConstantAtStart(instr->key()); 1992 : UseRegisterOrConstantAtStart(instr->key());
1970 return new LStoreKeyedFastElement(obj, key, val); 1993 return new(zone()) LStoreKeyedFastElement(obj, key, val);
1971 } 1994 }
1972 1995
1973 1996
1974 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( 1997 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement(
1975 HStoreKeyedFastDoubleElement* instr) { 1998 HStoreKeyedFastDoubleElement* instr) {
1976 ASSERT(instr->value()->representation().IsDouble()); 1999 ASSERT(instr->value()->representation().IsDouble());
1977 ASSERT(instr->elements()->representation().IsTagged()); 2000 ASSERT(instr->elements()->representation().IsTagged());
1978 ASSERT(instr->key()->representation().IsInteger32()); 2001 ASSERT(instr->key()->representation().IsInteger32());
1979 2002
1980 LOperand* elements = UseRegisterAtStart(instr->elements()); 2003 LOperand* elements = UseRegisterAtStart(instr->elements());
1981 LOperand* val = UseTempRegister(instr->value()); 2004 LOperand* val = UseTempRegister(instr->value());
1982 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2005 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1983 2006
1984 return new LStoreKeyedFastDoubleElement(elements, key, val); 2007 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val);
1985 } 2008 }
1986 2009
1987 2010
1988 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( 2011 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
1989 HStoreKeyedSpecializedArrayElement* instr) { 2012 HStoreKeyedSpecializedArrayElement* instr) {
1990 Representation representation(instr->value()->representation()); 2013 Representation representation(instr->value()->representation());
1991 ElementsKind elements_kind = instr->elements_kind(); 2014 ElementsKind elements_kind = instr->elements_kind();
1992 ASSERT( 2015 ASSERT(
1993 (representation.IsInteger32() && 2016 (representation.IsInteger32() &&
1994 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2017 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1995 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2018 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1996 (representation.IsDouble() && 2019 (representation.IsDouble() &&
1997 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 2020 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1998 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 2021 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1999 ASSERT(instr->external_pointer()->representation().IsExternal()); 2022 ASSERT(instr->external_pointer()->representation().IsExternal());
2000 ASSERT(instr->key()->representation().IsInteger32()); 2023 ASSERT(instr->key()->representation().IsInteger32());
2001 2024
2002 LOperand* external_pointer = UseRegister(instr->external_pointer()); 2025 LOperand* external_pointer = UseRegister(instr->external_pointer());
2003 bool val_is_temp_register = 2026 bool val_is_temp_register =
2004 elements_kind == EXTERNAL_PIXEL_ELEMENTS || 2027 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
2005 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 2028 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
2006 LOperand* val = val_is_temp_register 2029 LOperand* val = val_is_temp_register
2007 ? UseTempRegister(instr->value()) 2030 ? UseTempRegister(instr->value())
2008 : UseRegister(instr->value()); 2031 : UseRegister(instr->value());
2009 LOperand* key = UseRegisterOrConstant(instr->key()); 2032 LOperand* key = UseRegisterOrConstant(instr->key());
2010 2033
2011 return new LStoreKeyedSpecializedArrayElement(external_pointer, 2034 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer,
2012 key, 2035 key,
2013 val); 2036 val);
2014 } 2037 }
2015 2038
2016 2039
2017 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2040 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2018 LOperand* obj = UseFixed(instr->object(), a2); 2041 LOperand* obj = UseFixed(instr->object(), a2);
2019 LOperand* key = UseFixed(instr->key(), a1); 2042 LOperand* key = UseFixed(instr->key(), a1);
2020 LOperand* val = UseFixed(instr->value(), a0); 2043 LOperand* val = UseFixed(instr->value(), a0);
2021 2044
2022 ASSERT(instr->object()->representation().IsTagged()); 2045 ASSERT(instr->object()->representation().IsTagged());
2023 ASSERT(instr->key()->representation().IsTagged()); 2046 ASSERT(instr->key()->representation().IsTagged());
2024 ASSERT(instr->value()->representation().IsTagged()); 2047 ASSERT(instr->value()->representation().IsTagged());
2025 2048
2026 return MarkAsCall(new LStoreKeyedGeneric(obj, key, val), instr); 2049 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
2027 } 2050 }
2028 2051
2029 2052
2030 LInstruction* LChunkBuilder::DoTransitionElementsKind( 2053 LInstruction* LChunkBuilder::DoTransitionElementsKind(
2031 HTransitionElementsKind* instr) { 2054 HTransitionElementsKind* instr) {
2032 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS && 2055 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS &&
2033 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) { 2056 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) {
2034 LOperand* object = UseRegister(instr->object()); 2057 LOperand* object = UseRegister(instr->object());
2035 LOperand* new_map_reg = TempRegister(); 2058 LOperand* new_map_reg = TempRegister();
2036 LTransitionElementsKind* result = 2059 LTransitionElementsKind* result =
2037 new LTransitionElementsKind(object, new_map_reg, NULL); 2060 new(zone()) LTransitionElementsKind(object, new_map_reg, NULL);
2038 return DefineSameAsFirst(result); 2061 return DefineSameAsFirst(result);
2039 } else { 2062 } else {
2040 LOperand* object = UseFixed(instr->object(), a0); 2063 LOperand* object = UseFixed(instr->object(), a0);
2041 LOperand* fixed_object_reg = FixedTemp(a2); 2064 LOperand* fixed_object_reg = FixedTemp(a2);
2042 LOperand* new_map_reg = FixedTemp(a3); 2065 LOperand* new_map_reg = FixedTemp(a3);
2043 LTransitionElementsKind* result = 2066 LTransitionElementsKind* result =
2044 new LTransitionElementsKind(object, new_map_reg, fixed_object_reg); 2067 new(zone()) LTransitionElementsKind(object,
2068 new_map_reg,
2069 fixed_object_reg);
2045 return MarkAsCall(DefineFixed(result, v0), instr); 2070 return MarkAsCall(DefineFixed(result, v0), instr);
2046 } 2071 }
2047 } 2072 }
2048 2073
2049 2074
2050 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2075 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2051 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2076 bool needs_write_barrier = instr->NeedsWriteBarrier();
2052 2077
2053 LOperand* obj = needs_write_barrier 2078 LOperand* obj = needs_write_barrier
2054 ? UseTempRegister(instr->object()) 2079 ? UseTempRegister(instr->object())
2055 : UseRegisterAtStart(instr->object()); 2080 : UseRegisterAtStart(instr->object());
2056 2081
2057 LOperand* val = needs_write_barrier 2082 LOperand* val = needs_write_barrier
2058 ? UseTempRegister(instr->value()) 2083 ? UseTempRegister(instr->value())
2059 : UseRegister(instr->value()); 2084 : UseRegister(instr->value());
2060 2085
2061 return new LStoreNamedField(obj, val); 2086 return new(zone()) LStoreNamedField(obj, val);
2062 } 2087 }
2063 2088
2064 2089
2065 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2090 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2066 LOperand* obj = UseFixed(instr->object(), a1); 2091 LOperand* obj = UseFixed(instr->object(), a1);
2067 LOperand* val = UseFixed(instr->value(), a0); 2092 LOperand* val = UseFixed(instr->value(), a0);
2068 2093
2069 LInstruction* result = new LStoreNamedGeneric(obj, val); 2094 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val);
2070 return MarkAsCall(result, instr); 2095 return MarkAsCall(result, instr);
2071 } 2096 }
2072 2097
2073 2098
2074 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { 2099 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2075 LOperand* left = UseRegisterAtStart(instr->left()); 2100 LOperand* left = UseRegisterAtStart(instr->left());
2076 LOperand* right = UseRegisterAtStart(instr->right()); 2101 LOperand* right = UseRegisterAtStart(instr->right());
2077 return MarkAsCall(DefineFixed(new LStringAdd(left, right), v0), instr); 2102 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), v0),
2103 instr);
2078 } 2104 }
2079 2105
2080 2106
2081 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { 2107 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2082 LOperand* string = UseTempRegister(instr->string()); 2108 LOperand* string = UseTempRegister(instr->string());
2083 LOperand* index = UseTempRegister(instr->index()); 2109 LOperand* index = UseTempRegister(instr->index());
2084 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); 2110 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index);
2085 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 2111 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2086 } 2112 }
2087 2113
2088 2114
2089 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { 2115 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2090 LOperand* char_code = UseRegister(instr->value()); 2116 LOperand* char_code = UseRegister(instr->value());
2091 LStringCharFromCode* result = new LStringCharFromCode(char_code); 2117 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code);
2092 return AssignPointerMap(DefineAsRegister(result)); 2118 return AssignPointerMap(DefineAsRegister(result));
2093 } 2119 }
2094 2120
2095 2121
2096 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { 2122 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2097 LOperand* string = UseRegisterAtStart(instr->value()); 2123 LOperand* string = UseRegisterAtStart(instr->value());
2098 return DefineAsRegister(new LStringLength(string)); 2124 return DefineAsRegister(new(zone()) LStringLength(string));
2099 } 2125 }
2100 2126
2101 2127
2102 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { 2128 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2103 LAllocateObject* result = new LAllocateObject(); 2129 LAllocateObject* result = new(zone()) LAllocateObject();
2104 return AssignPointerMap(DefineAsRegister(result)); 2130 return AssignPointerMap(DefineAsRegister(result));
2105 } 2131 }
2106 2132
2107 2133
2108 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) { 2134 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) {
2109 return MarkAsCall(DefineFixed(new LFastLiteral, v0), instr); 2135 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, v0), instr);
2110 } 2136 }
2111 2137
2112 2138
2113 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { 2139 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2114 return MarkAsCall(DefineFixed(new LArrayLiteral, v0), instr); 2140 return MarkAsCall(DefineFixed(new(zone()) LArrayLiteral, v0), instr);
2115 } 2141 }
2116 2142
2117 2143
2118 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { 2144 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2119 return MarkAsCall(DefineFixed(new LObjectLiteral, v0), instr); 2145 return MarkAsCall(DefineFixed(new(zone()) LObjectLiteral, v0), instr);
2120 } 2146 }
2121 2147
2122 2148
2123 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { 2149 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2124 return MarkAsCall(DefineFixed(new LRegExpLiteral, v0), instr); 2150 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, v0), instr);
2125 } 2151 }
2126 2152
2127 2153
2128 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { 2154 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2129 return MarkAsCall(DefineFixed(new LFunctionLiteral, v0), instr); 2155 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, v0), instr);
2130 } 2156 }
2131 2157
2132 2158
2133 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { 2159 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2134 LOperand* object = UseFixed(instr->object(), a0); 2160 LOperand* object = UseFixed(instr->object(), a0);
2135 LOperand* key = UseFixed(instr->key(), a1); 2161 LOperand* key = UseFixed(instr->key(), a1);
2136 LDeleteProperty* result = new LDeleteProperty(object, key); 2162 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key);
2137 return MarkAsCall(DefineFixed(result, v0), instr); 2163 return MarkAsCall(DefineFixed(result, v0), instr);
2138 } 2164 }
2139 2165
2140 2166
2141 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { 2167 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2142 allocator_->MarkAsOsrEntry(); 2168 allocator_->MarkAsOsrEntry();
2143 current_block_->last_environment()->set_ast_id(instr->ast_id()); 2169 current_block_->last_environment()->set_ast_id(instr->ast_id());
2144 return AssignEnvironment(new LOsrEntry); 2170 return AssignEnvironment(new(zone()) LOsrEntry);
2145 } 2171 }
2146 2172
2147 2173
2148 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { 2174 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2149 int spill_index = chunk()->GetParameterStackSlot(instr->index()); 2175 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2150 return DefineAsSpilled(new LParameter, spill_index); 2176 return DefineAsSpilled(new(zone()) LParameter, spill_index);
2151 } 2177 }
2152 2178
2153 2179
2154 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2180 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2155 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2181 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2156 if (spill_index > LUnallocated::kMaxFixedIndex) { 2182 if (spill_index > LUnallocated::kMaxFixedIndex) {
2157 Abort("Too many spill slots needed for OSR"); 2183 Abort("Too many spill slots needed for OSR");
2158 spill_index = 0; 2184 spill_index = 0;
2159 } 2185 }
2160 return DefineAsSpilled(new LUnknownOSRValue, spill_index); 2186 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
2161 } 2187 }
2162 2188
2163 2189
2164 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { 2190 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2165 argument_count_ -= instr->argument_count(); 2191 argument_count_ -= instr->argument_count();
2166 return MarkAsCall(DefineFixed(new LCallStub, v0), instr); 2192 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr);
2167 } 2193 }
2168 2194
2169 2195
2170 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { 2196 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2171 // There are no real uses of the arguments object. 2197 // There are no real uses of the arguments object.
2172 // arguments.length and element access are supported directly on 2198 // arguments.length and element access are supported directly on
2173 // stack arguments, and any real arguments object use causes a bailout. 2199 // stack arguments, and any real arguments object use causes a bailout.
2174 // So this value is never used. 2200 // So this value is never used.
2175 return NULL; 2201 return NULL;
2176 } 2202 }
2177 2203
2178 2204
2179 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { 2205 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2180 LOperand* arguments = UseRegister(instr->arguments()); 2206 LOperand* arguments = UseRegister(instr->arguments());
2181 LOperand* length = UseTempRegister(instr->length()); 2207 LOperand* length = UseTempRegister(instr->length());
2182 LOperand* index = UseRegister(instr->index()); 2208 LOperand* index = UseRegister(instr->index());
2183 LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index); 2209 LAccessArgumentsAt* result =
2210 new(zone()) LAccessArgumentsAt(arguments, length, index);
2184 return AssignEnvironment(DefineAsRegister(result)); 2211 return AssignEnvironment(DefineAsRegister(result));
2185 } 2212 }
2186 2213
2187 2214
2188 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { 2215 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2189 LOperand* object = UseFixed(instr->value(), a0); 2216 LOperand* object = UseFixed(instr->value(), a0);
2190 LToFastProperties* result = new LToFastProperties(object); 2217 LToFastProperties* result = new(zone()) LToFastProperties(object);
2191 return MarkAsCall(DefineFixed(result, v0), instr); 2218 return MarkAsCall(DefineFixed(result, v0), instr);
2192 } 2219 }
2193 2220
2194 2221
2195 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { 2222 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2196 LTypeof* result = new LTypeof(UseFixed(instr->value(), a0)); 2223 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), a0));
2197 return MarkAsCall(DefineFixed(result, v0), instr); 2224 return MarkAsCall(DefineFixed(result, v0), instr);
2198 } 2225 }
2199 2226
2200 2227
2201 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { 2228 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2202 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); 2229 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2203 } 2230 }
2204 2231
2205 2232
2206 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2233 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
2207 HIsConstructCallAndBranch* instr) { 2234 HIsConstructCallAndBranch* instr) {
2208 return new LIsConstructCallAndBranch(TempRegister()); 2235 return new(zone()) LIsConstructCallAndBranch(TempRegister());
2209 } 2236 }
2210 2237
2211 2238
2212 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { 2239 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2213 HEnvironment* env = current_block_->last_environment(); 2240 HEnvironment* env = current_block_->last_environment();
2214 ASSERT(env != NULL); 2241 ASSERT(env != NULL);
2215 2242
2216 env->set_ast_id(instr->ast_id()); 2243 env->set_ast_id(instr->ast_id());
2217 2244
2218 env->Drop(instr->pop_count()); 2245 env->Drop(instr->pop_count());
2219 for (int i = 0; i < instr->values()->length(); ++i) { 2246 for (int i = 0; i < instr->values()->length(); ++i) {
2220 HValue* value = instr->values()->at(i); 2247 HValue* value = instr->values()->at(i);
2221 if (instr->HasAssignedIndexAt(i)) { 2248 if (instr->HasAssignedIndexAt(i)) {
2222 env->Bind(instr->GetAssignedIndexAt(i), value); 2249 env->Bind(instr->GetAssignedIndexAt(i), value);
2223 } else { 2250 } else {
2224 env->Push(value); 2251 env->Push(value);
2225 } 2252 }
2226 } 2253 }
2227 2254
2228 // If there is an instruction pending deoptimization environment create a 2255 // If there is an instruction pending deoptimization environment create a
2229 // lazy bailout instruction to capture the environment. 2256 // lazy bailout instruction to capture the environment.
2230 if (pending_deoptimization_ast_id_ == instr->ast_id()) { 2257 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2231 LInstruction* result = new LLazyBailout; 2258 LInstruction* result = new(zone()) LLazyBailout;
2232 result = AssignEnvironment(result); 2259 result = AssignEnvironment(result);
2233 instruction_pending_deoptimization_environment_-> 2260 instruction_pending_deoptimization_environment_->
2234 set_deoptimization_environment(result->environment()); 2261 set_deoptimization_environment(result->environment());
2235 ClearInstructionPendingDeoptimizationEnvironment(); 2262 ClearInstructionPendingDeoptimizationEnvironment();
2236 return result; 2263 return result;
2237 } 2264 }
2238 2265
2239 return NULL; 2266 return NULL;
2240 } 2267 }
2241 2268
2242 2269
2243 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2270 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2244 if (instr->is_function_entry()) { 2271 if (instr->is_function_entry()) {
2245 return MarkAsCall(new LStackCheck, instr); 2272 return MarkAsCall(new(zone()) LStackCheck, instr);
2246 } else { 2273 } else {
2247 ASSERT(instr->is_backwards_branch()); 2274 ASSERT(instr->is_backwards_branch());
2248 return AssignEnvironment(AssignPointerMap(new LStackCheck)); 2275 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck));
2249 } 2276 }
2250 } 2277 }
2251 2278
2252 2279
2253 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2280 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2254 HEnvironment* outer = current_block_->last_environment(); 2281 HEnvironment* outer = current_block_->last_environment();
2255 HConstant* undefined = graph()->GetConstantUndefined(); 2282 HConstant* undefined = graph()->GetConstantUndefined();
2256 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2283 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2257 instr->arguments_count(), 2284 instr->arguments_count(),
2258 instr->function(), 2285 instr->function(),
(...skipping 10 matching lines...) Expand all
2269 HEnvironment* outer = current_block_->last_environment()-> 2296 HEnvironment* outer = current_block_->last_environment()->
2270 DiscardInlined(false); 2297 DiscardInlined(false);
2271 current_block_->UpdateEnvironment(outer); 2298 current_block_->UpdateEnvironment(outer);
2272 return NULL; 2299 return NULL;
2273 } 2300 }
2274 2301
2275 2302
2276 LInstruction* LChunkBuilder::DoIn(HIn* instr) { 2303 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2277 LOperand* key = UseRegisterAtStart(instr->key()); 2304 LOperand* key = UseRegisterAtStart(instr->key());
2278 LOperand* object = UseRegisterAtStart(instr->object()); 2305 LOperand* object = UseRegisterAtStart(instr->object());
2279 LIn* result = new LIn(key, object); 2306 LIn* result = new(zone()) LIn(key, object);
2280 return MarkAsCall(DefineFixed(result, v0), instr); 2307 return MarkAsCall(DefineFixed(result, v0), instr);
2281 } 2308 }
2282 2309
2283 2310
2284 } } // namespace v8::internal 2311 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698