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

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

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

Powered by Google App Engine
This is Rietveld 408576698