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

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

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

Powered by Google App Engine
This is Rietveld 408576698