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

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

Issue 9491004: Pass zone explicitly to zone-allocation on x64 and ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/ia32/lithium-ia32.h » ('j') | 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));
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));
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));
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
640 640
(...skipping 14 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(), r1); 839 LOperand* left = UseFixed(instr->left(), r1);
836 LOperand* right = UseFixed(instr->right(), r0); 840 LOperand* right = UseFixed(instr->right(), r0);
837 LArithmeticT* result = new LArithmeticT(op, left, right); 841 LArithmeticT* result = new(zone()) LArithmeticT(op, left, right);
838 return MarkAsCall(DefineFixed(result, r0), instr); 842 return MarkAsCall(DefineFixed(result, r0), 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, r1); 904 LOperand* left_operand = UseFixed(left, r1);
901 LOperand* right_operand = UseFixed(right, r0); 905 LOperand* right_operand = UseFixed(right, r0);
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, r0), instr); 908 return MarkAsCall(DefineFixed(result, r0), 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 1064
1059 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { 1065 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1060 ASSERT(instr->value()->representation().IsTagged()); 1066 ASSERT(instr->value()->representation().IsTagged());
1061 LOperand* value = UseRegisterAtStart(instr->value()); 1067 LOperand* value = UseRegisterAtStart(instr->value());
1062 LOperand* temp = TempRegister(); 1068 LOperand* temp = TempRegister();
1063 return new LCmpMapAndBranch(value, temp); 1069 return new(zone()) LCmpMapAndBranch(value, temp);
1064 } 1070 }
1065 1071
1066 1072
1067 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { 1073 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* instr) {
1068 return DefineAsRegister(new LArgumentsLength(UseRegister(length->value()))); 1074 LOperand* value = UseRegister(instr->value());
1075 return DefineAsRegister(new(zone()) LArgumentsLength(value));
1069 } 1076 }
1070 1077
1071 1078
1072 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1079 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1073 return DefineAsRegister(new LArgumentsElements); 1080 return DefineAsRegister(new(zone()) LArgumentsElements);
1074 } 1081 }
1075 1082
1076 1083
1077 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1084 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1078 LInstanceOf* result = 1085 LInstanceOf* result =
1079 new LInstanceOf(UseFixed(instr->left(), r0), 1086 new(zone()) LInstanceOf(UseFixed(instr->left(), r0),
1080 UseFixed(instr->right(), r1)); 1087 UseFixed(instr->right(), r1));
1081 return MarkAsCall(DefineFixed(result, r0), instr); 1088 return MarkAsCall(DefineFixed(result, r0), instr);
1082 } 1089 }
1083 1090
1084 1091
1085 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 1092 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
1086 HInstanceOfKnownGlobal* instr) { 1093 HInstanceOfKnownGlobal* instr) {
1087 LInstanceOfKnownGlobal* result = 1094 LInstanceOfKnownGlobal* result =
1088 new LInstanceOfKnownGlobal(UseFixed(instr->left(), r0), FixedTemp(r4)); 1095 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), r0),
1096 FixedTemp(r4));
1089 return MarkAsCall(DefineFixed(result, r0), instr); 1097 return MarkAsCall(DefineFixed(result, r0), instr);
1090 } 1098 }
1091 1099
1092 1100
1093 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1101 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1094 LOperand* function = UseFixed(instr->function(), r1); 1102 LOperand* function = UseFixed(instr->function(), r1);
1095 LOperand* receiver = UseFixed(instr->receiver(), r0); 1103 LOperand* receiver = UseFixed(instr->receiver(), r0);
1096 LOperand* length = UseFixed(instr->length(), r2); 1104 LOperand* length = UseFixed(instr->length(), r2);
1097 LOperand* elements = UseFixed(instr->elements(), r3); 1105 LOperand* elements = UseFixed(instr->elements(), r3);
1098 LApplyArguments* result = new LApplyArguments(function, 1106 LApplyArguments* result = new(zone()) LApplyArguments(function,
1099 receiver, 1107 receiver,
1100 length, 1108 length,
1101 elements); 1109 elements);
1102 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY); 1110 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
1103 } 1111 }
1104 1112
1105 1113
1106 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { 1114 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1107 ++argument_count_; 1115 ++argument_count_;
1108 LOperand* argument = Use(instr->argument()); 1116 LOperand* argument = Use(instr->argument());
1109 return new LPushArgument(argument); 1117 return new(zone()) LPushArgument(argument);
1110 } 1118 }
1111 1119
1112 1120
1113 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { 1121 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1114 return instr->HasNoUses() ? NULL : DefineAsRegister(new LThisFunction); 1122 return instr->HasNoUses()
1123 ? NULL
1124 : DefineAsRegister(new(zone()) LThisFunction);
1115 } 1125 }
1116 1126
1117 1127
1118 LInstruction* LChunkBuilder::DoContext(HContext* instr) { 1128 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1119 return instr->HasNoUses() ? NULL : DefineAsRegister(new LContext); 1129 return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
1120 } 1130 }
1121 1131
1122 1132
1123 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { 1133 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1124 LOperand* context = UseRegisterAtStart(instr->value()); 1134 LOperand* context = UseRegisterAtStart(instr->value());
1125 return DefineAsRegister(new LOuterContext(context)); 1135 return DefineAsRegister(new(zone()) LOuterContext(context));
1126 } 1136 }
1127 1137
1128 1138
1129 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { 1139 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1130 return MarkAsCall(new LDeclareGlobals, instr); 1140 return MarkAsCall(new(zone()) LDeclareGlobals, instr);
1131 } 1141 }
1132 1142
1133 1143
1134 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { 1144 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1135 LOperand* context = UseRegisterAtStart(instr->value()); 1145 LOperand* context = UseRegisterAtStart(instr->value());
1136 return DefineAsRegister(new LGlobalObject(context)); 1146 return DefineAsRegister(new(zone()) LGlobalObject(context));
1137 } 1147 }
1138 1148
1139 1149
1140 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1150 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1141 LOperand* global_object = UseRegisterAtStart(instr->value()); 1151 LOperand* global_object = UseRegisterAtStart(instr->value());
1142 return DefineAsRegister(new LGlobalReceiver(global_object)); 1152 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1143 } 1153 }
1144 1154
1145 1155
1146 LInstruction* LChunkBuilder::DoCallConstantFunction( 1156 LInstruction* LChunkBuilder::DoCallConstantFunction(
1147 HCallConstantFunction* instr) { 1157 HCallConstantFunction* instr) {
1148 argument_count_ -= instr->argument_count(); 1158 argument_count_ -= instr->argument_count();
1149 return MarkAsCall(DefineFixed(new LCallConstantFunction, r0), instr); 1159 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr);
1150 } 1160 }
1151 1161
1152 1162
1153 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1163 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1154 LOperand* function = UseFixed(instr->function(), r1); 1164 LOperand* function = UseFixed(instr->function(), r1);
1155 argument_count_ -= instr->argument_count(); 1165 argument_count_ -= instr->argument_count();
1156 LInvokeFunction* result = new LInvokeFunction(function); 1166 LInvokeFunction* result = new(zone()) LInvokeFunction(function);
1157 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1167 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1158 } 1168 }
1159 1169
1160 1170
1161 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1171 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1162 BuiltinFunctionId op = instr->op(); 1172 BuiltinFunctionId op = instr->op();
1163 if (op == kMathLog || op == kMathSin || op == kMathCos) { 1173 if (op == kMathLog || op == kMathSin || op == kMathCos) {
1164 LOperand* input = UseFixedDouble(instr->value(), d2); 1174 LOperand* input = UseFixedDouble(instr->value(), d2);
1165 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); 1175 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, NULL);
1166 return MarkAsCall(DefineFixedDouble(result, d2), instr); 1176 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1167 } else if (op == kMathPowHalf) { 1177 } else if (op == kMathPowHalf) {
1168 LOperand* input = UseFixedDouble(instr->value(), d2); 1178 LOperand* input = UseFixedDouble(instr->value(), d2);
1169 LOperand* temp = FixedTemp(d3); 1179 LOperand* temp = FixedTemp(d3);
1170 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); 1180 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1171 return DefineFixedDouble(result, d2); 1181 return DefineFixedDouble(result, d2);
1172 } else { 1182 } else {
1173 LOperand* input = UseRegisterAtStart(instr->value()); 1183 LOperand* input = UseRegisterAtStart(instr->value());
1174 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; 1184 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL;
1175 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); 1185 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1176 switch (op) { 1186 switch (op) {
1177 case kMathAbs: 1187 case kMathAbs:
1178 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1188 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1179 case kMathFloor: 1189 case kMathFloor:
1180 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1190 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1181 case kMathSqrt: 1191 case kMathSqrt:
1182 return DefineAsRegister(result); 1192 return DefineAsRegister(result);
1183 case kMathRound: 1193 case kMathRound:
1184 return AssignEnvironment(DefineAsRegister(result)); 1194 return AssignEnvironment(DefineAsRegister(result));
1185 default: 1195 default:
1186 UNREACHABLE(); 1196 UNREACHABLE();
1187 return NULL; 1197 return NULL;
1188 } 1198 }
1189 } 1199 }
1190 } 1200 }
1191 1201
1192 1202
1193 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1203 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1194 ASSERT(instr->key()->representation().IsTagged()); 1204 ASSERT(instr->key()->representation().IsTagged());
1195 argument_count_ -= instr->argument_count(); 1205 argument_count_ -= instr->argument_count();
1196 LOperand* key = UseFixed(instr->key(), r2); 1206 LOperand* key = UseFixed(instr->key(), r2);
1197 return MarkAsCall(DefineFixed(new LCallKeyed(key), r0), instr); 1207 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr);
1198 } 1208 }
1199 1209
1200 1210
1201 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { 1211 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1202 argument_count_ -= instr->argument_count(); 1212 argument_count_ -= instr->argument_count();
1203 return MarkAsCall(DefineFixed(new LCallNamed, r0), instr); 1213 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, r0), instr);
1204 } 1214 }
1205 1215
1206 1216
1207 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { 1217 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1208 argument_count_ -= instr->argument_count(); 1218 argument_count_ -= instr->argument_count();
1209 return MarkAsCall(DefineFixed(new LCallGlobal, r0), instr); 1219 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, r0), instr);
1210 } 1220 }
1211 1221
1212 1222
1213 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { 1223 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1214 argument_count_ -= instr->argument_count(); 1224 argument_count_ -= instr->argument_count();
1215 return MarkAsCall(DefineFixed(new LCallKnownGlobal, r0), instr); 1225 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr);
1216 } 1226 }
1217 1227
1218 1228
1219 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1229 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1220 LOperand* constructor = UseFixed(instr->constructor(), r1); 1230 LOperand* constructor = UseFixed(instr->constructor(), r1);
1221 argument_count_ -= instr->argument_count(); 1231 argument_count_ -= instr->argument_count();
1222 LCallNew* result = new LCallNew(constructor); 1232 LCallNew* result = new(zone()) LCallNew(constructor);
1223 return MarkAsCall(DefineFixed(result, r0), instr); 1233 return MarkAsCall(DefineFixed(result, r0), instr);
1224 } 1234 }
1225 1235
1226 1236
1227 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { 1237 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1228 LOperand* function = UseFixed(instr->function(), r1); 1238 LOperand* function = UseFixed(instr->function(), r1);
1229 argument_count_ -= instr->argument_count(); 1239 argument_count_ -= instr->argument_count();
1230 return MarkAsCall(DefineFixed(new LCallFunction(function), r0), instr); 1240 return MarkAsCall(DefineFixed(new(zone()) LCallFunction(function), r0),
1241 instr);
1231 } 1242 }
1232 1243
1233 1244
1234 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { 1245 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1235 argument_count_ -= instr->argument_count(); 1246 argument_count_ -= instr->argument_count();
1236 return MarkAsCall(DefineFixed(new LCallRuntime, r0), instr); 1247 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, r0), instr);
1237 } 1248 }
1238 1249
1239 1250
1240 LInstruction* LChunkBuilder::DoShr(HShr* instr) { 1251 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1241 return DoShift(Token::SHR, instr); 1252 return DoShift(Token::SHR, instr);
1242 } 1253 }
1243 1254
1244 1255
1245 LInstruction* LChunkBuilder::DoSar(HSar* instr) { 1256 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1246 return DoShift(Token::SAR, instr); 1257 return DoShift(Token::SAR, instr);
1247 } 1258 }
1248 1259
1249 1260
1250 LInstruction* LChunkBuilder::DoShl(HShl* instr) { 1261 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1251 return DoShift(Token::SHL, instr); 1262 return DoShift(Token::SHL, instr);
1252 } 1263 }
1253 1264
1254 1265
1255 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { 1266 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1256 if (instr->representation().IsInteger32()) { 1267 if (instr->representation().IsInteger32()) {
1257 ASSERT(instr->left()->representation().IsInteger32()); 1268 ASSERT(instr->left()->representation().IsInteger32());
1258 ASSERT(instr->right()->representation().IsInteger32()); 1269 ASSERT(instr->right()->representation().IsInteger32());
1259 1270
1260 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1271 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1261 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 1272 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1262 return DefineAsRegister(new LBitI(left, right)); 1273 return DefineAsRegister(new(zone()) LBitI(left, right));
1263 } else { 1274 } else {
1264 ASSERT(instr->representation().IsTagged()); 1275 ASSERT(instr->representation().IsTagged());
1265 ASSERT(instr->left()->representation().IsTagged()); 1276 ASSERT(instr->left()->representation().IsTagged());
1266 ASSERT(instr->right()->representation().IsTagged()); 1277 ASSERT(instr->right()->representation().IsTagged());
1267 1278
1268 LOperand* left = UseFixed(instr->left(), r1); 1279 LOperand* left = UseFixed(instr->left(), r1);
1269 LOperand* right = UseFixed(instr->right(), r0); 1280 LOperand* right = UseFixed(instr->right(), r0);
1270 LArithmeticT* result = new LArithmeticT(instr->op(), left, right); 1281 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right);
1271 return MarkAsCall(DefineFixed(result, r0), instr); 1282 return MarkAsCall(DefineFixed(result, r0), instr);
1272 } 1283 }
1273 } 1284 }
1274 1285
1275 1286
1276 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { 1287 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1277 ASSERT(instr->value()->representation().IsInteger32()); 1288 ASSERT(instr->value()->representation().IsInteger32());
1278 ASSERT(instr->representation().IsInteger32()); 1289 ASSERT(instr->representation().IsInteger32());
1279 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); 1290 LOperand* value = UseRegisterAtStart(instr->value());
1291 return DefineAsRegister(new(zone()) LBitNotI(value));
1280 } 1292 }
1281 1293
1282 1294
1283 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1295 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1284 if (instr->representation().IsDouble()) { 1296 if (instr->representation().IsDouble()) {
1285 return DoArithmeticD(Token::DIV, instr); 1297 return DoArithmeticD(Token::DIV, instr);
1286 } else if (instr->representation().IsInteger32()) { 1298 } else if (instr->representation().IsInteger32()) {
1287 // TODO(1042) The fixed register allocation 1299 // TODO(1042) The fixed register allocation
1288 // is needed because we call TypeRecordingBinaryOpStub from 1300 // is needed because we call TypeRecordingBinaryOpStub from
1289 // the generated code, which requires registers r0 1301 // the generated code, which requires registers r0
1290 // and r1 to be used. We should remove that 1302 // and r1 to be used. We should remove that
1291 // when we provide a native implementation. 1303 // when we provide a native implementation.
1292 LOperand* dividend = UseFixed(instr->left(), r0); 1304 LOperand* dividend = UseFixed(instr->left(), r0);
1293 LOperand* divisor = UseFixed(instr->right(), r1); 1305 LOperand* divisor = UseFixed(instr->right(), r1);
1294 return AssignEnvironment(AssignPointerMap( 1306 return AssignEnvironment(AssignPointerMap(
1295 DefineFixed(new LDivI(dividend, divisor), r0))); 1307 DefineFixed(new(zone()) LDivI(dividend, divisor), r0)));
1296 } else { 1308 } else {
1297 return DoArithmeticT(Token::DIV, instr); 1309 return DoArithmeticT(Token::DIV, instr);
1298 } 1310 }
1299 } 1311 }
1300 1312
1301 1313
1302 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1314 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1303 if (instr->representation().IsInteger32()) { 1315 if (instr->representation().IsInteger32()) {
1304 ASSERT(instr->left()->representation().IsInteger32()); 1316 ASSERT(instr->left()->representation().IsInteger32());
1305 ASSERT(instr->right()->representation().IsInteger32()); 1317 ASSERT(instr->right()->representation().IsInteger32());
1306 1318
1307 LModI* mod; 1319 LModI* mod;
1308 if (instr->HasPowerOf2Divisor()) { 1320 if (instr->HasPowerOf2Divisor()) {
1309 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1321 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1310 LOperand* value = UseRegisterAtStart(instr->left()); 1322 LOperand* value = UseRegisterAtStart(instr->left());
1311 mod = new LModI(value, UseOrConstant(instr->right())); 1323 mod = new(zone()) LModI(value, UseOrConstant(instr->right()));
1312 } else { 1324 } else {
1313 LOperand* dividend = UseRegister(instr->left()); 1325 LOperand* dividend = UseRegister(instr->left());
1314 LOperand* divisor = UseRegister(instr->right()); 1326 LOperand* divisor = UseRegister(instr->right());
1315 mod = new LModI(dividend, 1327 mod = new(zone()) LModI(dividend,
1316 divisor, 1328 divisor,
1317 TempRegister(), 1329 TempRegister(),
1318 FixedTemp(d10), 1330 FixedTemp(d10),
1319 FixedTemp(d11)); 1331 FixedTemp(d11));
1320 } 1332 }
1321 1333
1322 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) || 1334 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1323 instr->CheckFlag(HValue::kCanBeDivByZero)) { 1335 instr->CheckFlag(HValue::kCanBeDivByZero)) {
1324 return AssignEnvironment(DefineAsRegister(mod)); 1336 return AssignEnvironment(DefineAsRegister(mod));
1325 } else { 1337 } else {
1326 return DefineAsRegister(mod); 1338 return DefineAsRegister(mod);
1327 } 1339 }
1328 } else if (instr->representation().IsTagged()) { 1340 } else if (instr->representation().IsTagged()) {
1329 return DoArithmeticT(Token::MOD, instr); 1341 return DoArithmeticT(Token::MOD, instr);
1330 } else { 1342 } else {
1331 ASSERT(instr->representation().IsDouble()); 1343 ASSERT(instr->representation().IsDouble());
1332 // We call a C function for double modulo. It can't trigger a GC. 1344 // We call a C function for double modulo. It can't trigger a GC.
1333 // We need to use fixed result register for the call. 1345 // We need to use fixed result register for the call.
1334 // TODO(fschneider): Allow any register as input registers. 1346 // TODO(fschneider): Allow any register as input registers.
1335 LOperand* left = UseFixedDouble(instr->left(), d1); 1347 LOperand* left = UseFixedDouble(instr->left(), d1);
1336 LOperand* right = UseFixedDouble(instr->right(), d2); 1348 LOperand* right = UseFixedDouble(instr->right(), d2);
1337 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); 1349 LArithmeticD* result = new(zone()) LArithmeticD(Token::MOD, left, right);
1338 return MarkAsCall(DefineFixedDouble(result, d1), instr); 1350 return MarkAsCall(DefineFixedDouble(result, d1), instr);
1339 } 1351 }
1340 } 1352 }
1341 1353
1342 1354
1343 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1355 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1344 if (instr->representation().IsInteger32()) { 1356 if (instr->representation().IsInteger32()) {
1345 ASSERT(instr->left()->representation().IsInteger32()); 1357 ASSERT(instr->left()->representation().IsInteger32());
1346 ASSERT(instr->right()->representation().IsInteger32()); 1358 ASSERT(instr->right()->representation().IsInteger32());
1347 LOperand* left; 1359 LOperand* left;
1348 LOperand* right = UseOrConstant(instr->MostConstantOperand()); 1360 LOperand* right = UseOrConstant(instr->MostConstantOperand());
1349 LOperand* temp = NULL; 1361 LOperand* temp = NULL;
1350 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && 1362 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
1351 (instr->CheckFlag(HValue::kCanOverflow) || 1363 (instr->CheckFlag(HValue::kCanOverflow) ||
1352 !right->IsConstantOperand())) { 1364 !right->IsConstantOperand())) {
1353 left = UseRegister(instr->LeastConstantOperand()); 1365 left = UseRegister(instr->LeastConstantOperand());
1354 temp = TempRegister(); 1366 temp = TempRegister();
1355 } else { 1367 } else {
1356 left = UseRegisterAtStart(instr->LeastConstantOperand()); 1368 left = UseRegisterAtStart(instr->LeastConstantOperand());
1357 } 1369 }
1358 LMulI* mul = new LMulI(left, right, temp); 1370 LMulI* mul = new(zone()) LMulI(left, right, temp);
1359 if (instr->CheckFlag(HValue::kCanOverflow) || 1371 if (instr->CheckFlag(HValue::kCanOverflow) ||
1360 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { 1372 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1361 AssignEnvironment(mul); 1373 AssignEnvironment(mul);
1362 } 1374 }
1363 return DefineAsRegister(mul); 1375 return DefineAsRegister(mul);
1364 1376
1365 } else if (instr->representation().IsDouble()) { 1377 } else if (instr->representation().IsDouble()) {
1366 return DoArithmeticD(Token::MUL, instr); 1378 return DoArithmeticD(Token::MUL, instr);
1367 1379
1368 } else { 1380 } else {
1369 return DoArithmeticT(Token::MUL, instr); 1381 return DoArithmeticT(Token::MUL, instr);
1370 } 1382 }
1371 } 1383 }
1372 1384
1373 1385
1374 LInstruction* LChunkBuilder::DoSub(HSub* instr) { 1386 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1375 if (instr->representation().IsInteger32()) { 1387 if (instr->representation().IsInteger32()) {
1376 ASSERT(instr->left()->representation().IsInteger32()); 1388 ASSERT(instr->left()->representation().IsInteger32());
1377 ASSERT(instr->right()->representation().IsInteger32()); 1389 ASSERT(instr->right()->representation().IsInteger32());
1378 LOperand* left = UseRegisterAtStart(instr->left()); 1390 LOperand* left = UseRegisterAtStart(instr->left());
1379 LOperand* right = UseOrConstantAtStart(instr->right()); 1391 LOperand* right = UseOrConstantAtStart(instr->right());
1380 LSubI* sub = new LSubI(left, right); 1392 LSubI* sub = new(zone()) LSubI(left, right);
1381 LInstruction* result = DefineAsRegister(sub); 1393 LInstruction* result = DefineAsRegister(sub);
1382 if (instr->CheckFlag(HValue::kCanOverflow)) { 1394 if (instr->CheckFlag(HValue::kCanOverflow)) {
1383 result = AssignEnvironment(result); 1395 result = AssignEnvironment(result);
1384 } 1396 }
1385 return result; 1397 return result;
1386 } else if (instr->representation().IsDouble()) { 1398 } else if (instr->representation().IsDouble()) {
1387 return DoArithmeticD(Token::SUB, instr); 1399 return DoArithmeticD(Token::SUB, instr);
1388 } else { 1400 } else {
1389 return DoArithmeticT(Token::SUB, instr); 1401 return DoArithmeticT(Token::SUB, instr);
1390 } 1402 }
1391 } 1403 }
1392 1404
1393 1405
1394 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { 1406 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1395 if (instr->representation().IsInteger32()) { 1407 if (instr->representation().IsInteger32()) {
1396 ASSERT(instr->left()->representation().IsInteger32()); 1408 ASSERT(instr->left()->representation().IsInteger32());
1397 ASSERT(instr->right()->representation().IsInteger32()); 1409 ASSERT(instr->right()->representation().IsInteger32());
1398 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1410 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1399 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 1411 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1400 LAddI* add = new LAddI(left, right); 1412 LAddI* add = new(zone()) LAddI(left, right);
1401 LInstruction* result = DefineAsRegister(add); 1413 LInstruction* result = DefineAsRegister(add);
1402 if (instr->CheckFlag(HValue::kCanOverflow)) { 1414 if (instr->CheckFlag(HValue::kCanOverflow)) {
1403 result = AssignEnvironment(result); 1415 result = AssignEnvironment(result);
1404 } 1416 }
1405 return result; 1417 return result;
1406 } else if (instr->representation().IsDouble()) { 1418 } else if (instr->representation().IsDouble()) {
1407 return DoArithmeticD(Token::ADD, instr); 1419 return DoArithmeticD(Token::ADD, instr);
1408 } else { 1420 } else {
1409 ASSERT(instr->representation().IsTagged()); 1421 ASSERT(instr->representation().IsTagged());
1410 return DoArithmeticT(Token::ADD, instr); 1422 return DoArithmeticT(Token::ADD, instr);
1411 } 1423 }
1412 } 1424 }
1413 1425
1414 1426
1415 LInstruction* LChunkBuilder::DoPower(HPower* instr) { 1427 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1416 ASSERT(instr->representation().IsDouble()); 1428 ASSERT(instr->representation().IsDouble());
1417 // We call a C function for double power. It can't trigger a GC. 1429 // We call a C function for double power. It can't trigger a GC.
1418 // We need to use fixed result register for the call. 1430 // We need to use fixed result register for the call.
1419 Representation exponent_type = instr->right()->representation(); 1431 Representation exponent_type = instr->right()->representation();
1420 ASSERT(instr->left()->representation().IsDouble()); 1432 ASSERT(instr->left()->representation().IsDouble());
1421 LOperand* left = UseFixedDouble(instr->left(), d1); 1433 LOperand* left = UseFixedDouble(instr->left(), d1);
1422 LOperand* right = exponent_type.IsDouble() ? 1434 LOperand* right = exponent_type.IsDouble() ?
1423 UseFixedDouble(instr->right(), d2) : 1435 UseFixedDouble(instr->right(), d2) :
1424 UseFixed(instr->right(), r2); 1436 UseFixed(instr->right(), r2);
1425 LPower* result = new LPower(left, right); 1437 LPower* result = new(zone()) LPower(left, right);
1426 return MarkAsCall(DefineFixedDouble(result, d3), 1438 return MarkAsCall(DefineFixedDouble(result, d3),
1427 instr, 1439 instr,
1428 CAN_DEOPTIMIZE_EAGERLY); 1440 CAN_DEOPTIMIZE_EAGERLY);
1429 } 1441 }
1430 1442
1431 1443
1432 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { 1444 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
1433 ASSERT(instr->representation().IsDouble()); 1445 ASSERT(instr->representation().IsDouble());
1434 ASSERT(instr->global_object()->representation().IsTagged()); 1446 ASSERT(instr->global_object()->representation().IsTagged());
1435 LOperand* global_object = UseFixed(instr->global_object(), r0); 1447 LOperand* global_object = UseFixed(instr->global_object(), r0);
1436 LRandom* result = new LRandom(global_object); 1448 LRandom* result = new(zone()) LRandom(global_object);
1437 return MarkAsCall(DefineFixedDouble(result, d7), instr); 1449 return MarkAsCall(DefineFixedDouble(result, d7), instr);
1438 } 1450 }
1439 1451
1440 1452
1441 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1453 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1442 ASSERT(instr->left()->representation().IsTagged()); 1454 ASSERT(instr->left()->representation().IsTagged());
1443 ASSERT(instr->right()->representation().IsTagged()); 1455 ASSERT(instr->right()->representation().IsTagged());
1444 LOperand* left = UseFixed(instr->left(), r1); 1456 LOperand* left = UseFixed(instr->left(), r1);
1445 LOperand* right = UseFixed(instr->right(), r0); 1457 LOperand* right = UseFixed(instr->right(), r0);
1446 LCmpT* result = new LCmpT(left, right); 1458 LCmpT* result = new(zone()) LCmpT(left, right);
1447 return MarkAsCall(DefineFixed(result, r0), instr); 1459 return MarkAsCall(DefineFixed(result, r0), instr);
1448 } 1460 }
1449 1461
1450 1462
1451 LInstruction* LChunkBuilder::DoCompareIDAndBranch( 1463 LInstruction* LChunkBuilder::DoCompareIDAndBranch(
1452 HCompareIDAndBranch* instr) { 1464 HCompareIDAndBranch* instr) {
1453 Representation r = instr->GetInputRepresentation(); 1465 Representation r = instr->GetInputRepresentation();
1454 if (r.IsInteger32()) { 1466 if (r.IsInteger32()) {
1455 ASSERT(instr->left()->representation().IsInteger32()); 1467 ASSERT(instr->left()->representation().IsInteger32());
1456 ASSERT(instr->right()->representation().IsInteger32()); 1468 ASSERT(instr->right()->representation().IsInteger32());
1457 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1469 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1458 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); 1470 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1459 return new LCmpIDAndBranch(left, right); 1471 return new(zone()) LCmpIDAndBranch(left, right);
1460 } else { 1472 } else {
1461 ASSERT(r.IsDouble()); 1473 ASSERT(r.IsDouble());
1462 ASSERT(instr->left()->representation().IsDouble()); 1474 ASSERT(instr->left()->representation().IsDouble());
1463 ASSERT(instr->right()->representation().IsDouble()); 1475 ASSERT(instr->right()->representation().IsDouble());
1464 LOperand* left = UseRegisterAtStart(instr->left()); 1476 LOperand* left = UseRegisterAtStart(instr->left());
1465 LOperand* right = UseRegisterAtStart(instr->right()); 1477 LOperand* right = UseRegisterAtStart(instr->right());
1466 return new LCmpIDAndBranch(left, right); 1478 return new(zone()) LCmpIDAndBranch(left, right);
1467 } 1479 }
1468 } 1480 }
1469 1481
1470 1482
1471 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1483 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1472 HCompareObjectEqAndBranch* instr) { 1484 HCompareObjectEqAndBranch* instr) {
1473 LOperand* left = UseRegisterAtStart(instr->left()); 1485 LOperand* left = UseRegisterAtStart(instr->left());
1474 LOperand* right = UseRegisterAtStart(instr->right()); 1486 LOperand* right = UseRegisterAtStart(instr->right());
1475 return new LCmpObjectEqAndBranch(left, right); 1487 return new(zone()) LCmpObjectEqAndBranch(left, right);
1476 } 1488 }
1477 1489
1478 1490
1479 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch( 1491 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch(
1480 HCompareConstantEqAndBranch* instr) { 1492 HCompareConstantEqAndBranch* instr) {
1481 return new LCmpConstantEqAndBranch(UseRegisterAtStart(instr->value())); 1493 LOperand* value = UseRegisterAtStart(instr->value());
1494 return new(zone()) LCmpConstantEqAndBranch(value);
1482 } 1495 }
1483 1496
1484 1497
1485 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) { 1498 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1486 ASSERT(instr->value()->representation().IsTagged()); 1499 ASSERT(instr->value()->representation().IsTagged());
1487 return new LIsNilAndBranch(UseRegisterAtStart(instr->value())); 1500 return new(zone()) LIsNilAndBranch(UseRegisterAtStart(instr->value()));
1488 } 1501 }
1489 1502
1490 1503
1491 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1504 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1492 ASSERT(instr->value()->representation().IsTagged()); 1505 ASSERT(instr->value()->representation().IsTagged());
1506 LOperand* value = UseRegisterAtStart(instr->value());
1493 LOperand* temp = TempRegister(); 1507 LOperand* temp = TempRegister();
1494 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()), temp); 1508 return new(zone()) LIsObjectAndBranch(value, temp);
1495 } 1509 }
1496 1510
1497 1511
1498 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { 1512 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1499 ASSERT(instr->value()->representation().IsTagged()); 1513 ASSERT(instr->value()->representation().IsTagged());
1514 LOperand* value = UseRegisterAtStart(instr->value());
1500 LOperand* temp = TempRegister(); 1515 LOperand* temp = TempRegister();
1501 return new LIsStringAndBranch(UseRegisterAtStart(instr->value()), temp); 1516 return new(zone()) LIsStringAndBranch(value, temp);
1502 } 1517 }
1503 1518
1504 1519
1505 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1520 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1506 ASSERT(instr->value()->representation().IsTagged()); 1521 ASSERT(instr->value()->representation().IsTagged());
1507 return new LIsSmiAndBranch(Use(instr->value())); 1522 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1508 } 1523 }
1509 1524
1510 1525
1511 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1526 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1512 HIsUndetectableAndBranch* instr) { 1527 HIsUndetectableAndBranch* instr) {
1513 ASSERT(instr->value()->representation().IsTagged()); 1528 ASSERT(instr->value()->representation().IsTagged());
1514 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()), 1529 LOperand* value = UseRegisterAtStart(instr->value());
1515 TempRegister()); 1530 return new(zone()) LIsUndetectableAndBranch(value, TempRegister());
1516 } 1531 }
1517 1532
1518 1533
1519 LInstruction* LChunkBuilder::DoStringCompareAndBranch( 1534 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1520 HStringCompareAndBranch* instr) { 1535 HStringCompareAndBranch* instr) {
1521 ASSERT(instr->left()->representation().IsTagged()); 1536 ASSERT(instr->left()->representation().IsTagged());
1522 ASSERT(instr->right()->representation().IsTagged()); 1537 ASSERT(instr->right()->representation().IsTagged());
1523 LOperand* left = UseFixed(instr->left(), r1); 1538 LOperand* left = UseFixed(instr->left(), r1);
1524 LOperand* right = UseFixed(instr->right(), r0); 1539 LOperand* right = UseFixed(instr->right(), r0);
1525 LStringCompareAndBranch* result = new LStringCompareAndBranch(left, right); 1540 LStringCompareAndBranch* result =
1541 new(zone()) LStringCompareAndBranch(left, right);
1526 return MarkAsCall(result, instr); 1542 return MarkAsCall(result, instr);
1527 } 1543 }
1528 1544
1529 1545
1530 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1546 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1531 HHasInstanceTypeAndBranch* instr) { 1547 HHasInstanceTypeAndBranch* instr) {
1532 ASSERT(instr->value()->representation().IsTagged()); 1548 ASSERT(instr->value()->representation().IsTagged());
1533 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value())); 1549 LOperand* value = UseRegisterAtStart(instr->value());
1550 return new(zone()) LHasInstanceTypeAndBranch(value);
1534 } 1551 }
1535 1552
1536 1553
1537 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1554 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
1538 HGetCachedArrayIndex* instr) { 1555 HGetCachedArrayIndex* instr) {
1539 ASSERT(instr->value()->representation().IsTagged()); 1556 ASSERT(instr->value()->representation().IsTagged());
1540 LOperand* value = UseRegisterAtStart(instr->value()); 1557 LOperand* value = UseRegisterAtStart(instr->value());
1541 1558
1542 return DefineAsRegister(new LGetCachedArrayIndex(value)); 1559 return DefineAsRegister(new(zone()) LGetCachedArrayIndex(value));
1543 } 1560 }
1544 1561
1545 1562
1546 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch( 1563 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch(
1547 HHasCachedArrayIndexAndBranch* instr) { 1564 HHasCachedArrayIndexAndBranch* instr) {
1548 ASSERT(instr->value()->representation().IsTagged()); 1565 ASSERT(instr->value()->representation().IsTagged());
1549 return new LHasCachedArrayIndexAndBranch( 1566 return new(zone()) LHasCachedArrayIndexAndBranch(
1550 UseRegisterAtStart(instr->value())); 1567 UseRegisterAtStart(instr->value()));
1551 } 1568 }
1552 1569
1553 1570
1554 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( 1571 LInstruction* LChunkBuilder::DoClassOfTestAndBranch(
1555 HClassOfTestAndBranch* instr) { 1572 HClassOfTestAndBranch* instr) {
1556 ASSERT(instr->value()->representation().IsTagged()); 1573 ASSERT(instr->value()->representation().IsTagged());
1557 return new LClassOfTestAndBranch(UseRegister(instr->value()), 1574 LOperand* value = UseRegister(instr->value());
1558 TempRegister()); 1575 return new(zone()) LClassOfTestAndBranch(value, TempRegister());
1559 } 1576 }
1560 1577
1561 1578
1562 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) { 1579 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1563 LOperand* array = UseRegisterAtStart(instr->value()); 1580 LOperand* array = UseRegisterAtStart(instr->value());
1564 return DefineAsRegister(new LJSArrayLength(array)); 1581 return DefineAsRegister(new(zone()) LJSArrayLength(array));
1565 } 1582 }
1566 1583
1567 1584
1568 LInstruction* LChunkBuilder::DoFixedArrayBaseLength( 1585 LInstruction* LChunkBuilder::DoFixedArrayBaseLength(
1569 HFixedArrayBaseLength* instr) { 1586 HFixedArrayBaseLength* instr) {
1570 LOperand* array = UseRegisterAtStart(instr->value()); 1587 LOperand* array = UseRegisterAtStart(instr->value());
1571 return DefineAsRegister(new LFixedArrayBaseLength(array)); 1588 return DefineAsRegister(new(zone()) LFixedArrayBaseLength(array));
1572 } 1589 }
1573 1590
1574 1591
1575 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { 1592 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) {
1576 LOperand* object = UseRegisterAtStart(instr->value()); 1593 LOperand* object = UseRegisterAtStart(instr->value());
1577 return DefineAsRegister(new LElementsKind(object)); 1594 return DefineAsRegister(new(zone()) LElementsKind(object));
1578 } 1595 }
1579 1596
1580 1597
1581 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { 1598 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1582 LOperand* object = UseRegister(instr->value()); 1599 LOperand* object = UseRegister(instr->value());
1583 LValueOf* result = new LValueOf(object, TempRegister()); 1600 LValueOf* result = new(zone()) LValueOf(object, TempRegister());
1584 return DefineAsRegister(result); 1601 return DefineAsRegister(result);
1585 } 1602 }
1586 1603
1587 1604
1588 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { 1605 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1589 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), 1606 LOperand* value = UseRegisterAtStart(instr->index());
1590 UseRegister(instr->length()))); 1607 LOperand* length = UseRegister(instr->length());
1608 return AssignEnvironment(new(zone()) LBoundsCheck(value, length));
1591 } 1609 }
1592 1610
1593 1611
1594 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { 1612 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1595 // The control instruction marking the end of a block that completed 1613 // The control instruction marking the end of a block that completed
1596 // abruptly (e.g., threw an exception). There is nothing specific to do. 1614 // abruptly (e.g., threw an exception). There is nothing specific to do.
1597 return NULL; 1615 return NULL;
1598 } 1616 }
1599 1617
1600 1618
1601 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { 1619 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1602 LOperand* value = UseFixed(instr->value(), r0); 1620 LOperand* value = UseFixed(instr->value(), r0);
1603 return MarkAsCall(new LThrow(value), instr); 1621 return MarkAsCall(new(zone()) LThrow(value), instr);
1604 } 1622 }
1605 1623
1606 1624
1607 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { 1625 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1608 return NULL; 1626 return NULL;
1609 } 1627 }
1610 1628
1611 1629
1612 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { 1630 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) {
1613 // All HForceRepresentation instructions should be eliminated in the 1631 // All HForceRepresentation instructions should be eliminated in the
1614 // representation change phase of Hydrogen. 1632 // representation change phase of Hydrogen.
1615 UNREACHABLE(); 1633 UNREACHABLE();
1616 return NULL; 1634 return NULL;
1617 } 1635 }
1618 1636
1619 1637
1620 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1638 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1621 Representation from = instr->from(); 1639 Representation from = instr->from();
1622 Representation to = instr->to(); 1640 Representation to = instr->to();
1623 if (from.IsTagged()) { 1641 if (from.IsTagged()) {
1624 if (to.IsDouble()) { 1642 if (to.IsDouble()) {
1625 LOperand* value = UseRegister(instr->value()); 1643 LOperand* value = UseRegister(instr->value());
1626 LNumberUntagD* res = new LNumberUntagD(value); 1644 LNumberUntagD* res = new(zone()) LNumberUntagD(value);
1627 return AssignEnvironment(DefineAsRegister(res)); 1645 return AssignEnvironment(DefineAsRegister(res));
1628 } else { 1646 } else {
1629 ASSERT(to.IsInteger32()); 1647 ASSERT(to.IsInteger32());
1630 LOperand* value = UseRegisterAtStart(instr->value()); 1648 LOperand* value = UseRegisterAtStart(instr->value());
1631 bool needs_check = !instr->value()->type().IsSmi(); 1649 bool needs_check = !instr->value()->type().IsSmi();
1632 LInstruction* res = NULL; 1650 LInstruction* res = NULL;
1633 if (!needs_check) { 1651 if (!needs_check) {
1634 res = DefineAsRegister(new LSmiUntag(value, needs_check)); 1652 res = DefineAsRegister(new(zone()) LSmiUntag(value, needs_check));
1635 } else { 1653 } else {
1636 LOperand* temp1 = TempRegister(); 1654 LOperand* temp1 = TempRegister();
1637 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() 1655 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()
1638 : NULL; 1656 : NULL;
1639 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d11) 1657 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d11)
1640 : NULL; 1658 : NULL;
1641 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); 1659 res = DefineSameAsFirst(new(zone()) LTaggedToI(value,
1660 temp1,
1661 temp2,
1662 temp3));
1642 res = AssignEnvironment(res); 1663 res = AssignEnvironment(res);
1643 } 1664 }
1644 return res; 1665 return res;
1645 } 1666 }
1646 } else if (from.IsDouble()) { 1667 } else if (from.IsDouble()) {
1647 if (to.IsTagged()) { 1668 if (to.IsTagged()) {
1648 LOperand* value = UseRegister(instr->value()); 1669 LOperand* value = UseRegister(instr->value());
1649 LOperand* temp1 = TempRegister(); 1670 LOperand* temp1 = TempRegister();
1650 LOperand* temp2 = TempRegister(); 1671 LOperand* temp2 = TempRegister();
1651 1672
1652 // Make sure that the temp and result_temp registers are 1673 // Make sure that the temp and result_temp registers are
1653 // different. 1674 // different.
1654 LUnallocated* result_temp = TempRegister(); 1675 LUnallocated* result_temp = TempRegister();
1655 LNumberTagD* result = new LNumberTagD(value, temp1, temp2); 1676 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2);
1656 Define(result, result_temp); 1677 Define(result, result_temp);
1657 return AssignPointerMap(result); 1678 return AssignPointerMap(result);
1658 } else { 1679 } else {
1659 ASSERT(to.IsInteger32()); 1680 ASSERT(to.IsInteger32());
1660 LOperand* value = UseRegister(instr->value()); 1681 LOperand* value = UseRegister(instr->value());
1661 LDoubleToI* res = 1682 LOperand* temp1 = TempRegister();
1662 new LDoubleToI(value, 1683 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1663 TempRegister(), 1684 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2);
1664 instr->CanTruncateToInt32() ? TempRegister() : NULL);
1665 return AssignEnvironment(DefineAsRegister(res)); 1685 return AssignEnvironment(DefineAsRegister(res));
1666 } 1686 }
1667 } else if (from.IsInteger32()) { 1687 } else if (from.IsInteger32()) {
1668 if (to.IsTagged()) { 1688 if (to.IsTagged()) {
1669 HValue* val = instr->value(); 1689 HValue* val = instr->value();
1670 LOperand* value = UseRegisterAtStart(val); 1690 LOperand* value = UseRegisterAtStart(val);
1671 if (val->HasRange() && val->range()->IsInSmiRange()) { 1691 if (val->HasRange() && val->range()->IsInSmiRange()) {
1672 return DefineAsRegister(new LSmiTag(value)); 1692 return DefineAsRegister(new(zone()) LSmiTag(value));
1673 } else { 1693 } else {
1674 LNumberTagI* result = new LNumberTagI(value); 1694 LNumberTagI* result = new(zone()) LNumberTagI(value);
1675 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1695 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1676 } 1696 }
1677 } else { 1697 } else {
1678 ASSERT(to.IsDouble()); 1698 ASSERT(to.IsDouble());
1679 LOperand* value = Use(instr->value()); 1699 LOperand* value = Use(instr->value());
1680 return DefineAsRegister(new LInteger32ToDouble(value)); 1700 return DefineAsRegister(new(zone()) LInteger32ToDouble(value));
1681 } 1701 }
1682 } 1702 }
1683 UNREACHABLE(); 1703 UNREACHABLE();
1684 return NULL; 1704 return NULL;
1685 } 1705 }
1686 1706
1687 1707
1688 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1708 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1689 LOperand* value = UseRegisterAtStart(instr->value()); 1709 LOperand* value = UseRegisterAtStart(instr->value());
1690 return AssignEnvironment(new LCheckNonSmi(value)); 1710 return AssignEnvironment(new(zone()) LCheckNonSmi(value));
1691 } 1711 }
1692 1712
1693 1713
1694 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { 1714 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1695 LOperand* value = UseRegisterAtStart(instr->value()); 1715 LOperand* value = UseRegisterAtStart(instr->value());
1696 LInstruction* result = new LCheckInstanceType(value); 1716 LInstruction* result = new(zone()) LCheckInstanceType(value);
1697 return AssignEnvironment(result); 1717 return AssignEnvironment(result);
1698 } 1718 }
1699 1719
1700 1720
1701 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { 1721 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1702 LOperand* temp1 = TempRegister(); 1722 LOperand* temp1 = TempRegister();
1703 LOperand* temp2 = TempRegister(); 1723 LOperand* temp2 = TempRegister();
1704 LInstruction* result = new LCheckPrototypeMaps(temp1, temp2); 1724 LInstruction* result = new(zone()) LCheckPrototypeMaps(temp1, temp2);
1705 return AssignEnvironment(result); 1725 return AssignEnvironment(result);
1706 } 1726 }
1707 1727
1708 1728
1709 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { 1729 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1710 LOperand* value = UseRegisterAtStart(instr->value()); 1730 LOperand* value = UseRegisterAtStart(instr->value());
1711 return AssignEnvironment(new LCheckSmi(value)); 1731 return AssignEnvironment(new(zone()) LCheckSmi(value));
1712 } 1732 }
1713 1733
1714 1734
1715 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { 1735 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1716 LOperand* value = UseRegisterAtStart(instr->value()); 1736 LOperand* value = UseRegisterAtStart(instr->value());
1717 return AssignEnvironment(new LCheckFunction(value)); 1737 return AssignEnvironment(new(zone()) LCheckFunction(value));
1718 } 1738 }
1719 1739
1720 1740
1721 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { 1741 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1722 LOperand* value = UseRegisterAtStart(instr->value()); 1742 LOperand* value = UseRegisterAtStart(instr->value());
1723 LInstruction* result = new LCheckMap(value); 1743 LInstruction* result = new(zone()) LCheckMap(value);
1724 return AssignEnvironment(result); 1744 return AssignEnvironment(result);
1725 } 1745 }
1726 1746
1727 1747
1728 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { 1748 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1729 HValue* value = instr->value(); 1749 HValue* value = instr->value();
1730 Representation input_rep = value->representation(); 1750 Representation input_rep = value->representation();
1731 LOperand* reg = UseRegister(value); 1751 LOperand* reg = UseRegister(value);
1732 if (input_rep.IsDouble()) { 1752 if (input_rep.IsDouble()) {
1733 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(d11))); 1753 return DefineAsRegister(new(zone()) LClampDToUint8(reg, FixedTemp(d11)));
1734 } else if (input_rep.IsInteger32()) { 1754 } else if (input_rep.IsInteger32()) {
1735 return DefineAsRegister(new LClampIToUint8(reg)); 1755 return DefineAsRegister(new(zone()) LClampIToUint8(reg));
1736 } else { 1756 } else {
1737 ASSERT(input_rep.IsTagged()); 1757 ASSERT(input_rep.IsTagged());
1738 // Register allocator doesn't (yet) support allocation of double 1758 // Register allocator doesn't (yet) support allocation of double
1739 // temps. Reserve d1 explicitly. 1759 // temps. Reserve d1 explicitly.
1740 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(d11)); 1760 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(d11));
1741 return AssignEnvironment(DefineAsRegister(result)); 1761 return AssignEnvironment(DefineAsRegister(result));
1742 } 1762 }
1743 } 1763 }
1744 1764
1745 1765
1746 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { 1766 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) {
1747 HValue* value = instr->value(); 1767 HValue* value = instr->value();
1748 Representation input_rep = value->representation(); 1768 Representation input_rep = value->representation();
1749 LOperand* reg = UseRegister(value); 1769 LOperand* reg = UseRegister(value);
1750 if (input_rep.IsDouble()) { 1770 if (input_rep.IsDouble()) {
1751 LOperand* temp1 = TempRegister(); 1771 LOperand* temp1 = TempRegister();
1752 LOperand* temp2 = TempRegister(); 1772 LOperand* temp2 = TempRegister();
1753 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); 1773 LDoubleToI* res = new(zone()) LDoubleToI(reg, temp1, temp2);
1754 return AssignEnvironment(DefineAsRegister(res)); 1774 return AssignEnvironment(DefineAsRegister(res));
1755 } else if (input_rep.IsInteger32()) { 1775 } else if (input_rep.IsInteger32()) {
1756 // Canonicalization should already have removed the hydrogen instruction in 1776 // Canonicalization should already have removed the hydrogen instruction in
1757 // this case, since it is a noop. 1777 // this case, since it is a noop.
1758 UNREACHABLE(); 1778 UNREACHABLE();
1759 return NULL; 1779 return NULL;
1760 } else { 1780 } else {
1761 ASSERT(input_rep.IsTagged()); 1781 ASSERT(input_rep.IsTagged());
1762 LOperand* temp1 = TempRegister(); 1782 LOperand* temp1 = TempRegister();
1763 LOperand* temp2 = TempRegister(); 1783 LOperand* temp2 = TempRegister();
1764 LOperand* temp3 = FixedTemp(d11); 1784 LOperand* temp3 = FixedTemp(d11);
1765 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); 1785 LTaggedToI* res = new(zone()) LTaggedToI(reg, temp1, temp2, temp3);
1766 return AssignEnvironment(DefineSameAsFirst(res)); 1786 return AssignEnvironment(DefineSameAsFirst(res));
1767 } 1787 }
1768 } 1788 }
1769 1789
1770 1790
1771 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 1791 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1772 return new LReturn(UseFixed(instr->value(), r0)); 1792 return new(zone()) LReturn(UseFixed(instr->value(), r0));
1773 } 1793 }
1774 1794
1775 1795
1776 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1796 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1777 Representation r = instr->representation(); 1797 Representation r = instr->representation();
1778 if (r.IsInteger32()) { 1798 if (r.IsInteger32()) {
1779 return DefineAsRegister(new LConstantI); 1799 return DefineAsRegister(new(zone()) LConstantI);
1780 } else if (r.IsDouble()) { 1800 } else if (r.IsDouble()) {
1781 return DefineAsRegister(new LConstantD); 1801 return DefineAsRegister(new(zone()) LConstantD);
1782 } else if (r.IsTagged()) { 1802 } else if (r.IsTagged()) {
1783 return DefineAsRegister(new LConstantT); 1803 return DefineAsRegister(new(zone()) LConstantT);
1784 } else { 1804 } else {
1785 UNREACHABLE(); 1805 UNREACHABLE();
1786 return NULL; 1806 return NULL;
1787 } 1807 }
1788 } 1808 }
1789 1809
1790 1810
1791 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { 1811 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1792 LLoadGlobalCell* result = new LLoadGlobalCell; 1812 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell;
1793 return instr->RequiresHoleCheck() 1813 return instr->RequiresHoleCheck()
1794 ? AssignEnvironment(DefineAsRegister(result)) 1814 ? AssignEnvironment(DefineAsRegister(result))
1795 : DefineAsRegister(result); 1815 : DefineAsRegister(result);
1796 } 1816 }
1797 1817
1798 1818
1799 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { 1819 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1800 LOperand* global_object = UseFixed(instr->global_object(), r0); 1820 LOperand* global_object = UseFixed(instr->global_object(), r0);
1801 LLoadGlobalGeneric* result = new LLoadGlobalGeneric(global_object); 1821 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object);
1802 return MarkAsCall(DefineFixed(result, r0), instr); 1822 return MarkAsCall(DefineFixed(result, r0), instr);
1803 } 1823 }
1804 1824
1805 1825
1806 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { 1826 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1807 LOperand* value = UseRegister(instr->value()); 1827 LOperand* value = UseRegister(instr->value());
1808 // Use a temp to check the value in the cell in the case where we perform 1828 // Use a temp to check the value in the cell in the case where we perform
1809 // a hole check. 1829 // a hole check.
1810 return instr->RequiresHoleCheck() 1830 return instr->RequiresHoleCheck()
1811 ? AssignEnvironment(new LStoreGlobalCell(value, TempRegister())) 1831 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister()))
1812 : new LStoreGlobalCell(value, NULL); 1832 : new(zone()) LStoreGlobalCell(value, NULL);
1813 } 1833 }
1814 1834
1815 1835
1816 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { 1836 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1817 LOperand* global_object = UseFixed(instr->global_object(), r1); 1837 LOperand* global_object = UseFixed(instr->global_object(), r1);
1818 LOperand* value = UseFixed(instr->value(), r0); 1838 LOperand* value = UseFixed(instr->value(), r0);
1819 LStoreGlobalGeneric* result = 1839 LStoreGlobalGeneric* result =
1820 new LStoreGlobalGeneric(global_object, value); 1840 new(zone()) LStoreGlobalGeneric(global_object, value);
1821 return MarkAsCall(result, instr); 1841 return MarkAsCall(result, instr);
1822 } 1842 }
1823 1843
1824 1844
1825 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 1845 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1826 LOperand* context = UseRegisterAtStart(instr->value()); 1846 LOperand* context = UseRegisterAtStart(instr->value());
1827 LInstruction* result = DefineAsRegister(new LLoadContextSlot(context)); 1847 LInstruction* result =
1848 DefineAsRegister(new(zone()) LLoadContextSlot(context));
1828 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 1849 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1829 } 1850 }
1830 1851
1831 1852
1832 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { 1853 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1833 LOperand* context; 1854 LOperand* context;
1834 LOperand* value; 1855 LOperand* value;
1835 if (instr->NeedsWriteBarrier()) { 1856 if (instr->NeedsWriteBarrier()) {
1836 context = UseTempRegister(instr->context()); 1857 context = UseTempRegister(instr->context());
1837 value = UseTempRegister(instr->value()); 1858 value = UseTempRegister(instr->value());
1838 } else { 1859 } else {
1839 context = UseRegister(instr->context()); 1860 context = UseRegister(instr->context());
1840 value = UseRegister(instr->value()); 1861 value = UseRegister(instr->value());
1841 } 1862 }
1842 LInstruction* result = new LStoreContextSlot(context, value); 1863 LInstruction* result = new(zone()) LStoreContextSlot(context, value);
1843 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 1864 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
1844 } 1865 }
1845 1866
1846 1867
1847 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 1868 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1848 return DefineAsRegister( 1869 return DefineAsRegister(
1849 new LLoadNamedField(UseRegisterAtStart(instr->object()))); 1870 new(zone()) LLoadNamedField(UseRegisterAtStart(instr->object())));
1850 } 1871 }
1851 1872
1852 1873
1853 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( 1874 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic(
1854 HLoadNamedFieldPolymorphic* instr) { 1875 HLoadNamedFieldPolymorphic* instr) {
1855 ASSERT(instr->representation().IsTagged()); 1876 ASSERT(instr->representation().IsTagged());
1856 if (instr->need_generic()) { 1877 if (instr->need_generic()) {
1857 LOperand* obj = UseFixed(instr->object(), r0); 1878 LOperand* obj = UseFixed(instr->object(), r0);
1858 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); 1879 LLoadNamedFieldPolymorphic* result =
1880 new(zone()) LLoadNamedFieldPolymorphic(obj);
1859 return MarkAsCall(DefineFixed(result, r0), instr); 1881 return MarkAsCall(DefineFixed(result, r0), instr);
1860 } else { 1882 } else {
1861 LOperand* obj = UseRegisterAtStart(instr->object()); 1883 LOperand* obj = UseRegisterAtStart(instr->object());
1862 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); 1884 LLoadNamedFieldPolymorphic* result =
1885 new(zone()) LLoadNamedFieldPolymorphic(obj);
1863 return AssignEnvironment(DefineAsRegister(result)); 1886 return AssignEnvironment(DefineAsRegister(result));
1864 } 1887 }
1865 } 1888 }
1866 1889
1867 1890
1868 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { 1891 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1869 LOperand* object = UseFixed(instr->object(), r0); 1892 LOperand* object = UseFixed(instr->object(), r0);
1870 LInstruction* result = DefineFixed(new LLoadNamedGeneric(object), r0); 1893 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), r0);
1871 return MarkAsCall(result, instr); 1894 return MarkAsCall(result, instr);
1872 } 1895 }
1873 1896
1874 1897
1875 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( 1898 LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
1876 HLoadFunctionPrototype* instr) { 1899 HLoadFunctionPrototype* instr) {
1877 return AssignEnvironment(DefineAsRegister( 1900 return AssignEnvironment(DefineAsRegister(
1878 new LLoadFunctionPrototype(UseRegister(instr->function())))); 1901 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
1879 } 1902 }
1880 1903
1881 1904
1882 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) { 1905 LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1883 LOperand* input = UseRegisterAtStart(instr->value()); 1906 LOperand* input = UseRegisterAtStart(instr->value());
1884 return DefineAsRegister(new LLoadElements(input)); 1907 return DefineAsRegister(new(zone()) LLoadElements(input));
1885 } 1908 }
1886 1909
1887 1910
1888 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( 1911 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
1889 HLoadExternalArrayPointer* instr) { 1912 HLoadExternalArrayPointer* instr) {
1890 LOperand* input = UseRegisterAtStart(instr->value()); 1913 LOperand* input = UseRegisterAtStart(instr->value());
1891 return DefineAsRegister(new LLoadExternalArrayPointer(input)); 1914 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1892 } 1915 }
1893 1916
1894 1917
1895 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( 1918 LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
1896 HLoadKeyedFastElement* instr) { 1919 HLoadKeyedFastElement* instr) {
1897 ASSERT(instr->representation().IsTagged()); 1920 ASSERT(instr->representation().IsTagged());
1898 ASSERT(instr->key()->representation().IsInteger32()); 1921 ASSERT(instr->key()->representation().IsInteger32());
1899 LOperand* obj = UseRegisterAtStart(instr->object()); 1922 LOperand* obj = UseRegisterAtStart(instr->object());
1900 LOperand* key = UseRegisterAtStart(instr->key()); 1923 LOperand* key = UseRegisterAtStart(instr->key());
1901 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); 1924 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key);
1902 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1925 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1903 return DefineAsRegister(result); 1926 return DefineAsRegister(result);
1904 } 1927 }
1905 1928
1906 1929
1907 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( 1930 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement(
1908 HLoadKeyedFastDoubleElement* instr) { 1931 HLoadKeyedFastDoubleElement* instr) {
1909 ASSERT(instr->representation().IsDouble()); 1932 ASSERT(instr->representation().IsDouble());
1910 ASSERT(instr->key()->representation().IsInteger32()); 1933 ASSERT(instr->key()->representation().IsInteger32());
1911 LOperand* elements = UseTempRegister(instr->elements()); 1934 LOperand* elements = UseTempRegister(instr->elements());
1912 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1935 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1913 LLoadKeyedFastDoubleElement* result = 1936 LLoadKeyedFastDoubleElement* result =
1914 new LLoadKeyedFastDoubleElement(elements, key); 1937 new(zone()) LLoadKeyedFastDoubleElement(elements, key);
1915 return AssignEnvironment(DefineAsRegister(result)); 1938 return AssignEnvironment(DefineAsRegister(result));
1916 } 1939 }
1917 1940
1918 1941
1919 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( 1942 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1920 HLoadKeyedSpecializedArrayElement* instr) { 1943 HLoadKeyedSpecializedArrayElement* instr) {
1921 ElementsKind elements_kind = instr->elements_kind(); 1944 ElementsKind elements_kind = instr->elements_kind();
1922 ASSERT( 1945 ASSERT(
1923 (instr->representation().IsInteger32() && 1946 (instr->representation().IsInteger32() &&
1924 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1947 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1925 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1948 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1926 (instr->representation().IsDouble() && 1949 (instr->representation().IsDouble() &&
1927 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1950 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1928 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1951 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1929 ASSERT(instr->key()->representation().IsInteger32()); 1952 ASSERT(instr->key()->representation().IsInteger32());
1930 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1953 LOperand* external_pointer = UseRegister(instr->external_pointer());
1931 LOperand* key = UseRegisterOrConstant(instr->key()); 1954 LOperand* key = UseRegisterOrConstant(instr->key());
1932 LLoadKeyedSpecializedArrayElement* result = 1955 LLoadKeyedSpecializedArrayElement* result =
1933 new LLoadKeyedSpecializedArrayElement(external_pointer, key); 1956 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key);
1934 LInstruction* load_instr = DefineAsRegister(result); 1957 LInstruction* load_instr = DefineAsRegister(result);
1935 // An unsigned int array load might overflow and cause a deopt, make sure it 1958 // An unsigned int array load might overflow and cause a deopt, make sure it
1936 // has an environment. 1959 // has an environment.
1937 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? 1960 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ?
1938 AssignEnvironment(load_instr) : load_instr; 1961 AssignEnvironment(load_instr) : load_instr;
1939 } 1962 }
1940 1963
1941 1964
1942 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1965 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1943 LOperand* object = UseFixed(instr->object(), r1); 1966 LOperand* object = UseFixed(instr->object(), r1);
1944 LOperand* key = UseFixed(instr->key(), r0); 1967 LOperand* key = UseFixed(instr->key(), r0);
1945 1968
1946 LInstruction* result = 1969 LInstruction* result =
1947 DefineFixed(new LLoadKeyedGeneric(object, key), r0); 1970 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0);
1948 return MarkAsCall(result, instr); 1971 return MarkAsCall(result, instr);
1949 } 1972 }
1950 1973
1951 1974
1952 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1975 LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
1953 HStoreKeyedFastElement* instr) { 1976 HStoreKeyedFastElement* instr) {
1954 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1977 bool needs_write_barrier = instr->NeedsWriteBarrier();
1955 ASSERT(instr->value()->representation().IsTagged()); 1978 ASSERT(instr->value()->representation().IsTagged());
1956 ASSERT(instr->object()->representation().IsTagged()); 1979 ASSERT(instr->object()->representation().IsTagged());
1957 ASSERT(instr->key()->representation().IsInteger32()); 1980 ASSERT(instr->key()->representation().IsInteger32());
1958 1981
1959 LOperand* obj = UseTempRegister(instr->object()); 1982 LOperand* obj = UseTempRegister(instr->object());
1960 LOperand* val = needs_write_barrier 1983 LOperand* val = needs_write_barrier
1961 ? UseTempRegister(instr->value()) 1984 ? UseTempRegister(instr->value())
1962 : UseRegisterAtStart(instr->value()); 1985 : UseRegisterAtStart(instr->value());
1963 LOperand* key = needs_write_barrier 1986 LOperand* key = needs_write_barrier
1964 ? UseTempRegister(instr->key()) 1987 ? UseTempRegister(instr->key())
1965 : UseRegisterOrConstantAtStart(instr->key()); 1988 : UseRegisterOrConstantAtStart(instr->key());
1966 return new LStoreKeyedFastElement(obj, key, val); 1989 return new(zone()) LStoreKeyedFastElement(obj, key, val);
1967 } 1990 }
1968 1991
1969 1992
1970 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( 1993 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement(
1971 HStoreKeyedFastDoubleElement* instr) { 1994 HStoreKeyedFastDoubleElement* instr) {
1972 ASSERT(instr->value()->representation().IsDouble()); 1995 ASSERT(instr->value()->representation().IsDouble());
1973 ASSERT(instr->elements()->representation().IsTagged()); 1996 ASSERT(instr->elements()->representation().IsTagged());
1974 ASSERT(instr->key()->representation().IsInteger32()); 1997 ASSERT(instr->key()->representation().IsInteger32());
1975 1998
1976 LOperand* elements = UseRegisterAtStart(instr->elements()); 1999 LOperand* elements = UseRegisterAtStart(instr->elements());
1977 LOperand* val = UseTempRegister(instr->value()); 2000 LOperand* val = UseTempRegister(instr->value());
1978 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2001 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1979 2002
1980 return new LStoreKeyedFastDoubleElement(elements, key, val); 2003 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val);
1981 } 2004 }
1982 2005
1983 2006
1984 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( 2007 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
1985 HStoreKeyedSpecializedArrayElement* instr) { 2008 HStoreKeyedSpecializedArrayElement* instr) {
1986 ElementsKind elements_kind = instr->elements_kind(); 2009 ElementsKind elements_kind = instr->elements_kind();
1987 ASSERT( 2010 ASSERT(
1988 (instr->value()->representation().IsInteger32() && 2011 (instr->value()->representation().IsInteger32() &&
1989 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2012 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1990 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2013 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1991 (instr->value()->representation().IsDouble() && 2014 (instr->value()->representation().IsDouble() &&
1992 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 2015 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1993 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 2016 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1994 ASSERT(instr->external_pointer()->representation().IsExternal()); 2017 ASSERT(instr->external_pointer()->representation().IsExternal());
1995 ASSERT(instr->key()->representation().IsInteger32()); 2018 ASSERT(instr->key()->representation().IsInteger32());
1996 2019
1997 LOperand* external_pointer = UseRegister(instr->external_pointer()); 2020 LOperand* external_pointer = UseRegister(instr->external_pointer());
1998 bool val_is_temp_register = 2021 bool val_is_temp_register =
1999 elements_kind == EXTERNAL_PIXEL_ELEMENTS || 2022 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
2000 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 2023 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
2001 LOperand* val = val_is_temp_register 2024 LOperand* val = val_is_temp_register
2002 ? UseTempRegister(instr->value()) 2025 ? UseTempRegister(instr->value())
2003 : UseRegister(instr->value()); 2026 : UseRegister(instr->value());
2004 LOperand* key = UseRegisterOrConstant(instr->key()); 2027 LOperand* key = UseRegisterOrConstant(instr->key());
2005 2028
2006 return new LStoreKeyedSpecializedArrayElement(external_pointer, 2029 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer,
2007 key, 2030 key,
2008 val); 2031 val);
2009 } 2032 }
2010 2033
2011 2034
2012 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2035 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2013 LOperand* obj = UseFixed(instr->object(), r2); 2036 LOperand* obj = UseFixed(instr->object(), r2);
2014 LOperand* key = UseFixed(instr->key(), r1); 2037 LOperand* key = UseFixed(instr->key(), r1);
2015 LOperand* val = UseFixed(instr->value(), r0); 2038 LOperand* val = UseFixed(instr->value(), r0);
2016 2039
2017 ASSERT(instr->object()->representation().IsTagged()); 2040 ASSERT(instr->object()->representation().IsTagged());
2018 ASSERT(instr->key()->representation().IsTagged()); 2041 ASSERT(instr->key()->representation().IsTagged());
2019 ASSERT(instr->value()->representation().IsTagged()); 2042 ASSERT(instr->value()->representation().IsTagged());
2020 2043
2021 return MarkAsCall(new LStoreKeyedGeneric(obj, key, val), instr); 2044 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
2022 } 2045 }
2023 2046
2024 2047
2025 LInstruction* LChunkBuilder::DoTransitionElementsKind( 2048 LInstruction* LChunkBuilder::DoTransitionElementsKind(
2026 HTransitionElementsKind* instr) { 2049 HTransitionElementsKind* instr) {
2027 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS && 2050 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS &&
2028 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) { 2051 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) {
2029 LOperand* object = UseRegister(instr->object()); 2052 LOperand* object = UseRegister(instr->object());
2030 LOperand* new_map_reg = TempRegister(); 2053 LOperand* new_map_reg = TempRegister();
2031 LTransitionElementsKind* result = 2054 LTransitionElementsKind* result =
2032 new LTransitionElementsKind(object, new_map_reg, NULL); 2055 new(zone()) LTransitionElementsKind(object, new_map_reg, NULL);
2033 return DefineSameAsFirst(result); 2056 return DefineSameAsFirst(result);
2034 } else { 2057 } else {
2035 LOperand* object = UseFixed(instr->object(), r0); 2058 LOperand* object = UseFixed(instr->object(), r0);
2036 LOperand* fixed_object_reg = FixedTemp(r2); 2059 LOperand* fixed_object_reg = FixedTemp(r2);
2037 LOperand* new_map_reg = FixedTemp(r3); 2060 LOperand* new_map_reg = FixedTemp(r3);
2038 LTransitionElementsKind* result = 2061 LTransitionElementsKind* result =
2039 new LTransitionElementsKind(object, new_map_reg, fixed_object_reg); 2062 new(zone()) LTransitionElementsKind(object,
2063 new_map_reg,
2064 fixed_object_reg);
2040 return MarkAsCall(DefineFixed(result, r0), instr); 2065 return MarkAsCall(DefineFixed(result, r0), instr);
2041 } 2066 }
2042 } 2067 }
2043 2068
2044 2069
2045 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2070 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2046 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2071 bool needs_write_barrier = instr->NeedsWriteBarrier();
2047 2072
2048 LOperand* obj = needs_write_barrier 2073 LOperand* obj = needs_write_barrier
2049 ? UseTempRegister(instr->object()) 2074 ? UseTempRegister(instr->object())
2050 : UseRegisterAtStart(instr->object()); 2075 : UseRegisterAtStart(instr->object());
2051 2076
2052 LOperand* val = needs_write_barrier 2077 LOperand* val = needs_write_barrier
2053 ? UseTempRegister(instr->value()) 2078 ? UseTempRegister(instr->value())
2054 : UseRegister(instr->value()); 2079 : UseRegister(instr->value());
2055 2080
2056 return new LStoreNamedField(obj, val); 2081 return new(zone()) LStoreNamedField(obj, val);
2057 } 2082 }
2058 2083
2059 2084
2060 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2085 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2061 LOperand* obj = UseFixed(instr->object(), r1); 2086 LOperand* obj = UseFixed(instr->object(), r1);
2062 LOperand* val = UseFixed(instr->value(), r0); 2087 LOperand* val = UseFixed(instr->value(), r0);
2063 2088
2064 LInstruction* result = new LStoreNamedGeneric(obj, val); 2089 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val);
2065 return MarkAsCall(result, instr); 2090 return MarkAsCall(result, instr);
2066 } 2091 }
2067 2092
2068 2093
2069 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { 2094 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2070 LOperand* left = UseRegisterAtStart(instr->left()); 2095 LOperand* left = UseRegisterAtStart(instr->left());
2071 LOperand* right = UseRegisterAtStart(instr->right()); 2096 LOperand* right = UseRegisterAtStart(instr->right());
2072 return MarkAsCall(DefineFixed(new LStringAdd(left, right), r0), instr); 2097 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), r0),
2098 instr);
2073 } 2099 }
2074 2100
2075 2101
2076 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { 2102 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2077 LOperand* string = UseTempRegister(instr->string()); 2103 LOperand* string = UseTempRegister(instr->string());
2078 LOperand* index = UseTempRegister(instr->index()); 2104 LOperand* index = UseTempRegister(instr->index());
2079 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); 2105 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index);
2080 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 2106 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2081 } 2107 }
2082 2108
2083 2109
2084 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { 2110 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2085 LOperand* char_code = UseRegister(instr->value()); 2111 LOperand* char_code = UseRegister(instr->value());
2086 LStringCharFromCode* result = new LStringCharFromCode(char_code); 2112 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code);
2087 return AssignPointerMap(DefineAsRegister(result)); 2113 return AssignPointerMap(DefineAsRegister(result));
2088 } 2114 }
2089 2115
2090 2116
2091 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { 2117 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2092 LOperand* string = UseRegisterAtStart(instr->value()); 2118 LOperand* string = UseRegisterAtStart(instr->value());
2093 return DefineAsRegister(new LStringLength(string)); 2119 return DefineAsRegister(new(zone()) LStringLength(string));
2094 } 2120 }
2095 2121
2096 2122
2097 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { 2123 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2098 LAllocateObject* result = new LAllocateObject(); 2124 LAllocateObject* result = new LAllocateObject();
2099 return AssignPointerMap(DefineAsRegister(result)); 2125 return AssignPointerMap(DefineAsRegister(result));
2100 } 2126 }
2101 2127
2102 2128
2103 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) { 2129 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) {
2104 return MarkAsCall(DefineFixed(new LFastLiteral, r0), instr); 2130 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, r0), instr);
2105 } 2131 }
2106 2132
2107 2133
2108 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { 2134 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2109 return MarkAsCall(DefineFixed(new LArrayLiteral, r0), instr); 2135 return MarkAsCall(DefineFixed(new(zone()) LArrayLiteral, r0), instr);
2110 } 2136 }
2111 2137
2112 2138
2113 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { 2139 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2114 return MarkAsCall(DefineFixed(new LObjectLiteral, r0), instr); 2140 return MarkAsCall(DefineFixed(new(zone()) LObjectLiteral, r0), instr);
2115 } 2141 }
2116 2142
2117 2143
2118 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { 2144 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2119 return MarkAsCall(DefineFixed(new LRegExpLiteral, r0), instr); 2145 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, r0), instr);
2120 } 2146 }
2121 2147
2122 2148
2123 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { 2149 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2124 return MarkAsCall(DefineFixed(new LFunctionLiteral, r0), instr); 2150 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, r0), instr);
2125 } 2151 }
2126 2152
2127 2153
2128 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { 2154 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2129 LOperand* object = UseFixed(instr->object(), r0); 2155 LOperand* object = UseFixed(instr->object(), r0);
2130 LOperand* key = UseFixed(instr->key(), r1); 2156 LOperand* key = UseFixed(instr->key(), r1);
2131 LDeleteProperty* result = new LDeleteProperty(object, key); 2157 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key);
2132 return MarkAsCall(DefineFixed(result, r0), instr); 2158 return MarkAsCall(DefineFixed(result, r0), instr);
2133 } 2159 }
2134 2160
2135 2161
2136 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { 2162 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2137 allocator_->MarkAsOsrEntry(); 2163 allocator_->MarkAsOsrEntry();
2138 current_block_->last_environment()->set_ast_id(instr->ast_id()); 2164 current_block_->last_environment()->set_ast_id(instr->ast_id());
2139 return AssignEnvironment(new LOsrEntry); 2165 return AssignEnvironment(new(zone()) LOsrEntry);
2140 } 2166 }
2141 2167
2142 2168
2143 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { 2169 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2144 int spill_index = chunk()->GetParameterStackSlot(instr->index()); 2170 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2145 return DefineAsSpilled(new LParameter, spill_index); 2171 return DefineAsSpilled(new(zone()) LParameter, spill_index);
2146 } 2172 }
2147 2173
2148 2174
2149 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2175 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2150 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2176 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2151 if (spill_index > LUnallocated::kMaxFixedIndex) { 2177 if (spill_index > LUnallocated::kMaxFixedIndex) {
2152 Abort("Too many spill slots needed for OSR"); 2178 Abort("Too many spill slots needed for OSR");
2153 spill_index = 0; 2179 spill_index = 0;
2154 } 2180 }
2155 return DefineAsSpilled(new LUnknownOSRValue, spill_index); 2181 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
2156 } 2182 }
2157 2183
2158 2184
2159 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { 2185 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2160 argument_count_ -= instr->argument_count(); 2186 argument_count_ -= instr->argument_count();
2161 return MarkAsCall(DefineFixed(new LCallStub, r0), instr); 2187 return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr);
2162 } 2188 }
2163 2189
2164 2190
2165 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { 2191 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2166 // There are no real uses of the arguments object. 2192 // There are no real uses of the arguments object.
2167 // arguments.length and element access are supported directly on 2193 // arguments.length and element access are supported directly on
2168 // stack arguments, and any real arguments object use causes a bailout. 2194 // stack arguments, and any real arguments object use causes a bailout.
2169 // So this value is never used. 2195 // So this value is never used.
2170 return NULL; 2196 return NULL;
2171 } 2197 }
2172 2198
2173 2199
2174 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { 2200 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2175 LOperand* arguments = UseRegister(instr->arguments()); 2201 LOperand* arguments = UseRegister(instr->arguments());
2176 LOperand* length = UseTempRegister(instr->length()); 2202 LOperand* length = UseTempRegister(instr->length());
2177 LOperand* index = UseRegister(instr->index()); 2203 LOperand* index = UseRegister(instr->index());
2178 LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index); 2204 LAccessArgumentsAt* result =
2205 new(zone()) LAccessArgumentsAt(arguments, length, index);
2179 return AssignEnvironment(DefineAsRegister(result)); 2206 return AssignEnvironment(DefineAsRegister(result));
2180 } 2207 }
2181 2208
2182 2209
2183 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { 2210 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2184 LOperand* object = UseFixed(instr->value(), r0); 2211 LOperand* object = UseFixed(instr->value(), r0);
2185 LToFastProperties* result = new LToFastProperties(object); 2212 LToFastProperties* result = new(zone()) LToFastProperties(object);
2186 return MarkAsCall(DefineFixed(result, r0), instr); 2213 return MarkAsCall(DefineFixed(result, r0), instr);
2187 } 2214 }
2188 2215
2189 2216
2190 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { 2217 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2191 LTypeof* result = new LTypeof(UseFixed(instr->value(), r0)); 2218 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), r0));
2192 return MarkAsCall(DefineFixed(result, r0), instr); 2219 return MarkAsCall(DefineFixed(result, r0), instr);
2193 } 2220 }
2194 2221
2195 2222
2196 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { 2223 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2197 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); 2224 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2198 } 2225 }
2199 2226
2200 2227
2201 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2228 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
2202 HIsConstructCallAndBranch* instr) { 2229 HIsConstructCallAndBranch* instr) {
2203 return new LIsConstructCallAndBranch(TempRegister()); 2230 return new(zone()) LIsConstructCallAndBranch(TempRegister());
2204 } 2231 }
2205 2232
2206 2233
2207 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { 2234 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2208 HEnvironment* env = current_block_->last_environment(); 2235 HEnvironment* env = current_block_->last_environment();
2209 ASSERT(env != NULL); 2236 ASSERT(env != NULL);
2210 2237
2211 env->set_ast_id(instr->ast_id()); 2238 env->set_ast_id(instr->ast_id());
2212 2239
2213 env->Drop(instr->pop_count()); 2240 env->Drop(instr->pop_count());
2214 for (int i = 0; i < instr->values()->length(); ++i) { 2241 for (int i = 0; i < instr->values()->length(); ++i) {
2215 HValue* value = instr->values()->at(i); 2242 HValue* value = instr->values()->at(i);
2216 if (instr->HasAssignedIndexAt(i)) { 2243 if (instr->HasAssignedIndexAt(i)) {
2217 env->Bind(instr->GetAssignedIndexAt(i), value); 2244 env->Bind(instr->GetAssignedIndexAt(i), value);
2218 } else { 2245 } else {
2219 env->Push(value); 2246 env->Push(value);
2220 } 2247 }
2221 } 2248 }
2222 2249
2223 // If there is an instruction pending deoptimization environment create a 2250 // If there is an instruction pending deoptimization environment create a
2224 // lazy bailout instruction to capture the environment. 2251 // lazy bailout instruction to capture the environment.
2225 if (pending_deoptimization_ast_id_ == instr->ast_id()) { 2252 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2226 LInstruction* result = new LLazyBailout; 2253 LInstruction* result = new(zone()) LLazyBailout;
2227 result = AssignEnvironment(result); 2254 result = AssignEnvironment(result);
2228 instruction_pending_deoptimization_environment_-> 2255 instruction_pending_deoptimization_environment_->
2229 set_deoptimization_environment(result->environment()); 2256 set_deoptimization_environment(result->environment());
2230 ClearInstructionPendingDeoptimizationEnvironment(); 2257 ClearInstructionPendingDeoptimizationEnvironment();
2231 return result; 2258 return result;
2232 } 2259 }
2233 2260
2234 return NULL; 2261 return NULL;
2235 } 2262 }
2236 2263
2237 2264
2238 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2265 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2239 if (instr->is_function_entry()) { 2266 if (instr->is_function_entry()) {
2240 return MarkAsCall(new LStackCheck, instr); 2267 return MarkAsCall(new(zone()) LStackCheck, instr);
2241 } else { 2268 } else {
2242 ASSERT(instr->is_backwards_branch()); 2269 ASSERT(instr->is_backwards_branch());
2243 return AssignEnvironment(AssignPointerMap(new LStackCheck)); 2270 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck));
2244 } 2271 }
2245 } 2272 }
2246 2273
2247 2274
2248 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2275 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2249 HEnvironment* outer = current_block_->last_environment(); 2276 HEnvironment* outer = current_block_->last_environment();
2250 HConstant* undefined = graph()->GetConstantUndefined(); 2277 HConstant* undefined = graph()->GetConstantUndefined();
2251 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2278 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2252 instr->arguments_count(), 2279 instr->arguments_count(),
2253 instr->function(), 2280 instr->function(),
(...skipping 10 matching lines...) Expand all
2264 HEnvironment* outer = current_block_->last_environment()-> 2291 HEnvironment* outer = current_block_->last_environment()->
2265 DiscardInlined(false); 2292 DiscardInlined(false);
2266 current_block_->UpdateEnvironment(outer); 2293 current_block_->UpdateEnvironment(outer);
2267 return NULL; 2294 return NULL;
2268 } 2295 }
2269 2296
2270 2297
2271 LInstruction* LChunkBuilder::DoIn(HIn* instr) { 2298 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2272 LOperand* key = UseRegisterAtStart(instr->key()); 2299 LOperand* key = UseRegisterAtStart(instr->key());
2273 LOperand* object = UseRegisterAtStart(instr->object()); 2300 LOperand* object = UseRegisterAtStart(instr->object());
2274 LIn* result = new LIn(key, object); 2301 LIn* result = new(zone()) LIn(key, object);
2275 return MarkAsCall(DefineFixed(result, r0), instr); 2302 return MarkAsCall(DefineFixed(result, r0), instr);
2276 } 2303 }
2277 2304
2278 2305
2279 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { 2306 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2280 LOperand* object = UseFixed(instr->enumerable(), r0); 2307 LOperand* object = UseFixed(instr->enumerable(), r0);
2281 LForInPrepareMap* result = new LForInPrepareMap(object); 2308 LForInPrepareMap* result = new(zone()) LForInPrepareMap(object);
2282 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY); 2309 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY);
2283 } 2310 }
2284 2311
2285 2312
2286 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { 2313 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2287 LOperand* map = UseRegister(instr->map()); 2314 LOperand* map = UseRegister(instr->map());
2288 return AssignEnvironment(DefineAsRegister( 2315 return AssignEnvironment(DefineAsRegister(
2289 new LForInCacheArray(map))); 2316 new(zone()) LForInCacheArray(map)));
2290 } 2317 }
2291 2318
2292 2319
2293 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { 2320 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2294 LOperand* value = UseRegisterAtStart(instr->value()); 2321 LOperand* value = UseRegisterAtStart(instr->value());
2295 LOperand* map = UseRegisterAtStart(instr->map()); 2322 LOperand* map = UseRegisterAtStart(instr->map());
2296 return AssignEnvironment(new LCheckMapValue(value, map)); 2323 return AssignEnvironment(new(zone()) LCheckMapValue(value, map));
2297 } 2324 }
2298 2325
2299 2326
2300 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2301 LOperand* object = UseRegister(instr->object()); 2328 LOperand* object = UseRegister(instr->object());
2302 LOperand* index = UseRegister(instr->index()); 2329 LOperand* index = UseRegister(instr->index());
2303 return DefineAsRegister(new LLoadFieldByIndex(object, index)); 2330 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2304 } 2331 }
2305 2332
2306 2333
2307 } } // namespace v8::internal 2334 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698