OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/lithium-inl.h" | 10 #include "src/lithium-inl.h" |
11 #include "src/mips/lithium-codegen-mips.h" | 11 #include "src/mips/lithium-codegen-mips.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 #define DEFINE_COMPILE(type) \ | 16 #define DEFINE_COMPILE(type) \ |
17 void L##type::CompileToNative(LCodeGen* generator) { \ | 17 void L##type::CompileToNative(LCodeGen* generator) { \ |
18 generator->Do##type(this); \ | 18 generator->Do##type(this); \ |
19 } | 19 } |
20 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 20 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
21 #undef DEFINE_COMPILE | 21 #undef DEFINE_COMPILE |
22 | 22 |
23 #ifdef DEBUG | 23 #ifdef DEBUG |
24 void LInstruction::VerifyCall() { | 24 void LInstruction::VerifyCall() { |
25 // Call instructions can use only fixed registers as temporaries and | 25 // Call instructions can use only fixed registers as temporaries and |
26 // outputs because all registers are blocked by the calling convention. | 26 // outputs because all registers are blocked by the calling convention. |
27 // Inputs operands must use a fixed register or use-at-start policy or | 27 // Inputs operands must use a fixed register or use-at-start policy or |
28 // a non-register policy. | 28 // a non-register policy. |
29 ASSERT(Output() == NULL || | 29 DCHECK(Output() == NULL || |
30 LUnallocated::cast(Output())->HasFixedPolicy() || | 30 LUnallocated::cast(Output())->HasFixedPolicy() || |
31 !LUnallocated::cast(Output())->HasRegisterPolicy()); | 31 !LUnallocated::cast(Output())->HasRegisterPolicy()); |
32 for (UseIterator it(this); !it.Done(); it.Advance()) { | 32 for (UseIterator it(this); !it.Done(); it.Advance()) { |
33 LUnallocated* operand = LUnallocated::cast(it.Current()); | 33 LUnallocated* operand = LUnallocated::cast(it.Current()); |
34 ASSERT(operand->HasFixedPolicy() || | 34 DCHECK(operand->HasFixedPolicy() || |
35 operand->IsUsedAtStart()); | 35 operand->IsUsedAtStart()); |
36 } | 36 } |
37 for (TempIterator it(this); !it.Done(); it.Advance()) { | 37 for (TempIterator it(this); !it.Done(); it.Advance()) { |
38 LUnallocated* operand = LUnallocated::cast(it.Current()); | 38 LUnallocated* operand = LUnallocated::cast(it.Current()); |
39 ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); | 39 DCHECK(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); |
40 } | 40 } |
41 } | 41 } |
42 #endif | 42 #endif |
43 | 43 |
44 | 44 |
45 void LInstruction::PrintTo(StringStream* stream) { | 45 void LInstruction::PrintTo(StringStream* stream) { |
46 stream->Add("%s ", this->Mnemonic()); | 46 stream->Add("%s ", this->Mnemonic()); |
47 | 47 |
48 PrintOutputOperandTo(stream); | 48 PrintOutputOperandTo(stream); |
49 | 49 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 elements()->PrintTo(stream); | 355 elements()->PrintTo(stream); |
356 stream->Add("["); | 356 stream->Add("["); |
357 key()->PrintTo(stream); | 357 key()->PrintTo(stream); |
358 if (hydrogen()->IsDehoisted()) { | 358 if (hydrogen()->IsDehoisted()) { |
359 stream->Add(" + %d] <-", base_offset()); | 359 stream->Add(" + %d] <-", base_offset()); |
360 } else { | 360 } else { |
361 stream->Add("] <- "); | 361 stream->Add("] <- "); |
362 } | 362 } |
363 | 363 |
364 if (value() == NULL) { | 364 if (value() == NULL) { |
365 ASSERT(hydrogen()->IsConstantHoleStore() && | 365 DCHECK(hydrogen()->IsConstantHoleStore() && |
366 hydrogen()->value()->representation().IsDouble()); | 366 hydrogen()->value()->representation().IsDouble()); |
367 stream->Add("<the hole(nan)>"); | 367 stream->Add("<the hole(nan)>"); |
368 } else { | 368 } else { |
369 value()->PrintTo(stream); | 369 value()->PrintTo(stream); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 374 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
375 object()->PrintTo(stream); | 375 object()->PrintTo(stream); |
(...skipping 15 matching lines...) Expand all Loading... |
391 if (kind == DOUBLE_REGISTERS) spill_slot_count_++; | 391 if (kind == DOUBLE_REGISTERS) spill_slot_count_++; |
392 return spill_slot_count_++; | 392 return spill_slot_count_++; |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { | 396 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { |
397 int index = GetNextSpillIndex(kind); | 397 int index = GetNextSpillIndex(kind); |
398 if (kind == DOUBLE_REGISTERS) { | 398 if (kind == DOUBLE_REGISTERS) { |
399 return LDoubleStackSlot::Create(index, zone()); | 399 return LDoubleStackSlot::Create(index, zone()); |
400 } else { | 400 } else { |
401 ASSERT(kind == GENERAL_REGISTERS); | 401 DCHECK(kind == GENERAL_REGISTERS); |
402 return LStackSlot::Create(index, zone()); | 402 return LStackSlot::Create(index, zone()); |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 | 406 |
407 LPlatformChunk* LChunkBuilder::Build() { | 407 LPlatformChunk* LChunkBuilder::Build() { |
408 ASSERT(is_unused()); | 408 DCHECK(is_unused()); |
409 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 409 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
410 LPhase phase("L_Building chunk", chunk_); | 410 LPhase phase("L_Building chunk", chunk_); |
411 status_ = BUILDING; | 411 status_ = BUILDING; |
412 | 412 |
413 // If compiling for OSR, reserve space for the unoptimized frame, | 413 // If compiling for OSR, reserve space for the unoptimized frame, |
414 // which will be subsumed into this frame. | 414 // which will be subsumed into this frame. |
415 if (graph()->has_osr()) { | 415 if (graph()->has_osr()) { |
416 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 416 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
417 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 417 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
418 } | 418 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 instr = AssignEnvironment(instr); | 609 instr = AssignEnvironment(instr); |
610 // We can't really figure out if the environment is needed or not. | 610 // We can't really figure out if the environment is needed or not. |
611 instr->environment()->set_has_been_used(); | 611 instr->environment()->set_has_been_used(); |
612 } | 612 } |
613 | 613 |
614 return instr; | 614 return instr; |
615 } | 615 } |
616 | 616 |
617 | 617 |
618 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 618 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
619 ASSERT(!instr->HasPointerMap()); | 619 DCHECK(!instr->HasPointerMap()); |
620 instr->set_pointer_map(new(zone()) LPointerMap(zone())); | 620 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
621 return instr; | 621 return instr; |
622 } | 622 } |
623 | 623 |
624 | 624 |
625 LUnallocated* LChunkBuilder::TempRegister() { | 625 LUnallocated* LChunkBuilder::TempRegister() { |
626 LUnallocated* operand = | 626 LUnallocated* operand = |
627 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 627 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
628 int vreg = allocator_->GetVirtualRegister(); | 628 int vreg = allocator_->GetVirtualRegister(); |
629 if (!allocator_->AllocationOk()) { | 629 if (!allocator_->AllocationOk()) { |
(...skipping 13 matching lines...) Expand all Loading... |
643 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 643 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
644 vreg = 0; | 644 vreg = 0; |
645 } | 645 } |
646 operand->set_virtual_register(vreg); | 646 operand->set_virtual_register(vreg); |
647 return operand; | 647 return operand; |
648 } | 648 } |
649 | 649 |
650 | 650 |
651 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 651 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
652 LUnallocated* operand = ToUnallocated(reg); | 652 LUnallocated* operand = ToUnallocated(reg); |
653 ASSERT(operand->HasFixedPolicy()); | 653 DCHECK(operand->HasFixedPolicy()); |
654 return operand; | 654 return operand; |
655 } | 655 } |
656 | 656 |
657 | 657 |
658 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { | 658 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { |
659 LUnallocated* operand = ToUnallocated(reg); | 659 LUnallocated* operand = ToUnallocated(reg); |
660 ASSERT(operand->HasFixedPolicy()); | 660 DCHECK(operand->HasFixedPolicy()); |
661 return operand; | 661 return operand; |
662 } | 662 } |
663 | 663 |
664 | 664 |
665 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 665 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
666 return new(zone()) LLabel(instr->block()); | 666 return new(zone()) LLabel(instr->block()); |
667 } | 667 } |
668 | 668 |
669 | 669 |
670 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { | 670 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { |
671 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); | 671 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); |
672 } | 672 } |
673 | 673 |
674 | 674 |
675 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) { | 675 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) { |
676 UNREACHABLE(); | 676 UNREACHABLE(); |
677 return NULL; | 677 return NULL; |
678 } | 678 } |
679 | 679 |
680 | 680 |
681 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { | 681 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
682 return AssignEnvironment(new(zone()) LDeoptimize); | 682 return AssignEnvironment(new(zone()) LDeoptimize); |
683 } | 683 } |
684 | 684 |
685 | 685 |
686 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 686 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
687 HBitwiseBinaryOperation* instr) { | 687 HBitwiseBinaryOperation* instr) { |
688 if (instr->representation().IsSmiOrInteger32()) { | 688 if (instr->representation().IsSmiOrInteger32()) { |
689 ASSERT(instr->left()->representation().Equals(instr->representation())); | 689 DCHECK(instr->left()->representation().Equals(instr->representation())); |
690 ASSERT(instr->right()->representation().Equals(instr->representation())); | 690 DCHECK(instr->right()->representation().Equals(instr->representation())); |
691 LOperand* left = UseRegisterAtStart(instr->left()); | 691 LOperand* left = UseRegisterAtStart(instr->left()); |
692 | 692 |
693 HValue* right_value = instr->right(); | 693 HValue* right_value = instr->right(); |
694 LOperand* right = NULL; | 694 LOperand* right = NULL; |
695 int constant_value = 0; | 695 int constant_value = 0; |
696 bool does_deopt = false; | 696 bool does_deopt = false; |
697 if (right_value->IsConstant()) { | 697 if (right_value->IsConstant()) { |
698 HConstant* constant = HConstant::cast(right_value); | 698 HConstant* constant = HConstant::cast(right_value); |
699 right = chunk_->DefineConstantOperand(constant); | 699 right = chunk_->DefineConstantOperand(constant); |
700 constant_value = constant->Integer32Value() & 0x1f; | 700 constant_value = constant->Integer32Value() & 0x1f; |
(...skipping 20 matching lines...) Expand all Loading... |
721 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 721 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
722 return does_deopt ? AssignEnvironment(result) : result; | 722 return does_deopt ? AssignEnvironment(result) : result; |
723 } else { | 723 } else { |
724 return DoArithmeticT(op, instr); | 724 return DoArithmeticT(op, instr); |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 | 728 |
729 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 729 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
730 HArithmeticBinaryOperation* instr) { | 730 HArithmeticBinaryOperation* instr) { |
731 ASSERT(instr->representation().IsDouble()); | 731 DCHECK(instr->representation().IsDouble()); |
732 ASSERT(instr->left()->representation().IsDouble()); | 732 DCHECK(instr->left()->representation().IsDouble()); |
733 ASSERT(instr->right()->representation().IsDouble()); | 733 DCHECK(instr->right()->representation().IsDouble()); |
734 if (op == Token::MOD) { | 734 if (op == Token::MOD) { |
735 LOperand* left = UseFixedDouble(instr->left(), f2); | 735 LOperand* left = UseFixedDouble(instr->left(), f2); |
736 LOperand* right = UseFixedDouble(instr->right(), f4); | 736 LOperand* right = UseFixedDouble(instr->right(), f4); |
737 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 737 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
738 // We call a C function for double modulo. It can't trigger a GC. We need | 738 // We call a C function for double modulo. It can't trigger a GC. We need |
739 // to use fixed result register for the call. | 739 // to use fixed result register for the call. |
740 // TODO(fschneider): Allow any register as input registers. | 740 // TODO(fschneider): Allow any register as input registers. |
741 return MarkAsCall(DefineFixedDouble(result, f2), instr); | 741 return MarkAsCall(DefineFixedDouble(result, f2), instr); |
742 } else { | 742 } else { |
743 LOperand* left = UseRegisterAtStart(instr->left()); | 743 LOperand* left = UseRegisterAtStart(instr->left()); |
744 LOperand* right = UseRegisterAtStart(instr->right()); | 744 LOperand* right = UseRegisterAtStart(instr->right()); |
745 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 745 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
746 return DefineAsRegister(result); | 746 return DefineAsRegister(result); |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 751 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
752 HBinaryOperation* instr) { | 752 HBinaryOperation* instr) { |
753 HValue* left = instr->left(); | 753 HValue* left = instr->left(); |
754 HValue* right = instr->right(); | 754 HValue* right = instr->right(); |
755 ASSERT(left->representation().IsTagged()); | 755 DCHECK(left->representation().IsTagged()); |
756 ASSERT(right->representation().IsTagged()); | 756 DCHECK(right->representation().IsTagged()); |
757 LOperand* context = UseFixed(instr->context(), cp); | 757 LOperand* context = UseFixed(instr->context(), cp); |
758 LOperand* left_operand = UseFixed(left, a1); | 758 LOperand* left_operand = UseFixed(left, a1); |
759 LOperand* right_operand = UseFixed(right, a0); | 759 LOperand* right_operand = UseFixed(right, a0); |
760 LArithmeticT* result = | 760 LArithmeticT* result = |
761 new(zone()) LArithmeticT(op, context, left_operand, right_operand); | 761 new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
762 return MarkAsCall(DefineFixed(result, v0), instr); | 762 return MarkAsCall(DefineFixed(result, v0), instr); |
763 } | 763 } |
764 | 764 |
765 | 765 |
766 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 766 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
767 ASSERT(is_building()); | 767 DCHECK(is_building()); |
768 current_block_ = block; | 768 current_block_ = block; |
769 next_block_ = next_block; | 769 next_block_ = next_block; |
770 if (block->IsStartBlock()) { | 770 if (block->IsStartBlock()) { |
771 block->UpdateEnvironment(graph_->start_environment()); | 771 block->UpdateEnvironment(graph_->start_environment()); |
772 argument_count_ = 0; | 772 argument_count_ = 0; |
773 } else if (block->predecessors()->length() == 1) { | 773 } else if (block->predecessors()->length() == 1) { |
774 // We have a single predecessor => copy environment and outgoing | 774 // We have a single predecessor => copy environment and outgoing |
775 // argument count from the predecessor. | 775 // argument count from the predecessor. |
776 ASSERT(block->phis()->length() == 0); | 776 DCHECK(block->phis()->length() == 0); |
777 HBasicBlock* pred = block->predecessors()->at(0); | 777 HBasicBlock* pred = block->predecessors()->at(0); |
778 HEnvironment* last_environment = pred->last_environment(); | 778 HEnvironment* last_environment = pred->last_environment(); |
779 ASSERT(last_environment != NULL); | 779 DCHECK(last_environment != NULL); |
780 // Only copy the environment, if it is later used again. | 780 // Only copy the environment, if it is later used again. |
781 if (pred->end()->SecondSuccessor() == NULL) { | 781 if (pred->end()->SecondSuccessor() == NULL) { |
782 ASSERT(pred->end()->FirstSuccessor() == block); | 782 DCHECK(pred->end()->FirstSuccessor() == block); |
783 } else { | 783 } else { |
784 if (pred->end()->FirstSuccessor()->block_id() > block->block_id() || | 784 if (pred->end()->FirstSuccessor()->block_id() > block->block_id() || |
785 pred->end()->SecondSuccessor()->block_id() > block->block_id()) { | 785 pred->end()->SecondSuccessor()->block_id() > block->block_id()) { |
786 last_environment = last_environment->Copy(); | 786 last_environment = last_environment->Copy(); |
787 } | 787 } |
788 } | 788 } |
789 block->UpdateEnvironment(last_environment); | 789 block->UpdateEnvironment(last_environment); |
790 ASSERT(pred->argument_count() >= 0); | 790 DCHECK(pred->argument_count() >= 0); |
791 argument_count_ = pred->argument_count(); | 791 argument_count_ = pred->argument_count(); |
792 } else { | 792 } else { |
793 // We are at a state join => process phis. | 793 // We are at a state join => process phis. |
794 HBasicBlock* pred = block->predecessors()->at(0); | 794 HBasicBlock* pred = block->predecessors()->at(0); |
795 // No need to copy the environment, it cannot be used later. | 795 // No need to copy the environment, it cannot be used later. |
796 HEnvironment* last_environment = pred->last_environment(); | 796 HEnvironment* last_environment = pred->last_environment(); |
797 for (int i = 0; i < block->phis()->length(); ++i) { | 797 for (int i = 0; i < block->phis()->length(); ++i) { |
798 HPhi* phi = block->phis()->at(i); | 798 HPhi* phi = block->phis()->at(i); |
799 if (phi->HasMergedIndex()) { | 799 if (phi->HasMergedIndex()) { |
800 last_environment->SetValueAt(phi->merged_index(), phi); | 800 last_environment->SetValueAt(phi->merged_index(), phi); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 | 832 |
833 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 833 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
834 HInstruction* old_current = current_instruction_; | 834 HInstruction* old_current = current_instruction_; |
835 current_instruction_ = current; | 835 current_instruction_ = current; |
836 | 836 |
837 LInstruction* instr = NULL; | 837 LInstruction* instr = NULL; |
838 if (current->CanReplaceWithDummyUses()) { | 838 if (current->CanReplaceWithDummyUses()) { |
839 if (current->OperandCount() == 0) { | 839 if (current->OperandCount() == 0) { |
840 instr = DefineAsRegister(new(zone()) LDummy()); | 840 instr = DefineAsRegister(new(zone()) LDummy()); |
841 } else { | 841 } else { |
842 ASSERT(!current->OperandAt(0)->IsControlInstruction()); | 842 DCHECK(!current->OperandAt(0)->IsControlInstruction()); |
843 instr = DefineAsRegister(new(zone()) | 843 instr = DefineAsRegister(new(zone()) |
844 LDummyUse(UseAny(current->OperandAt(0)))); | 844 LDummyUse(UseAny(current->OperandAt(0)))); |
845 } | 845 } |
846 for (int i = 1; i < current->OperandCount(); ++i) { | 846 for (int i = 1; i < current->OperandCount(); ++i) { |
847 if (current->OperandAt(i)->IsControlInstruction()) continue; | 847 if (current->OperandAt(i)->IsControlInstruction()) continue; |
848 LInstruction* dummy = | 848 LInstruction* dummy = |
849 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 849 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
850 dummy->set_hydrogen_value(current); | 850 dummy->set_hydrogen_value(current); |
851 chunk_->AddInstruction(dummy, current_block_); | 851 chunk_->AddInstruction(dummy, current_block_); |
852 } | 852 } |
853 } else { | 853 } else { |
854 HBasicBlock* successor; | 854 HBasicBlock* successor; |
855 if (current->IsControlInstruction() && | 855 if (current->IsControlInstruction() && |
856 HControlInstruction::cast(current)->KnownSuccessorBlock(&successor) && | 856 HControlInstruction::cast(current)->KnownSuccessorBlock(&successor) && |
857 successor != NULL) { | 857 successor != NULL) { |
858 instr = new(zone()) LGoto(successor); | 858 instr = new(zone()) LGoto(successor); |
859 } else { | 859 } else { |
860 instr = current->CompileToLithium(this); | 860 instr = current->CompileToLithium(this); |
861 } | 861 } |
862 } | 862 } |
863 | 863 |
864 argument_count_ += current->argument_delta(); | 864 argument_count_ += current->argument_delta(); |
865 ASSERT(argument_count_ >= 0); | 865 DCHECK(argument_count_ >= 0); |
866 | 866 |
867 if (instr != NULL) { | 867 if (instr != NULL) { |
868 AddInstruction(instr, current); | 868 AddInstruction(instr, current); |
869 } | 869 } |
870 | 870 |
871 current_instruction_ = old_current; | 871 current_instruction_ = old_current; |
872 } | 872 } |
873 | 873 |
874 | 874 |
875 void LChunkBuilder::AddInstruction(LInstruction* instr, | 875 void LChunkBuilder::AddInstruction(LInstruction* instr, |
(...skipping 21 matching lines...) Expand all Loading... |
897 LUnallocated* operand = LUnallocated::cast(it.Current()); | 897 LUnallocated* operand = LUnallocated::cast(it.Current()); |
898 if (operand->IsUsedAtStart()) ++used_at_start; | 898 if (operand->IsUsedAtStart()) ++used_at_start; |
899 } | 899 } |
900 if (instr->Output() != NULL) { | 900 if (instr->Output() != NULL) { |
901 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; | 901 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
902 } | 902 } |
903 for (TempIterator it(instr); !it.Done(); it.Advance()) { | 903 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
904 LUnallocated* operand = LUnallocated::cast(it.Current()); | 904 LUnallocated* operand = LUnallocated::cast(it.Current()); |
905 if (operand->HasFixedPolicy()) ++fixed; | 905 if (operand->HasFixedPolicy()) ++fixed; |
906 } | 906 } |
907 ASSERT(fixed == 0 || used_at_start == 0); | 907 DCHECK(fixed == 0 || used_at_start == 0); |
908 } | 908 } |
909 #endif | 909 #endif |
910 | 910 |
911 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 911 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
912 instr = AssignPointerMap(instr); | 912 instr = AssignPointerMap(instr); |
913 } | 913 } |
914 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 914 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
915 instr = AssignEnvironment(instr); | 915 instr = AssignEnvironment(instr); |
916 } | 916 } |
917 chunk_->AddInstruction(instr, current_block_); | 917 chunk_->AddInstruction(instr, current_block_); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (!easy_case && | 956 if (!easy_case && |
957 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || | 957 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || |
958 !expected.IsGeneric())) { | 958 !expected.IsGeneric())) { |
959 branch = AssignEnvironment(branch); | 959 branch = AssignEnvironment(branch); |
960 } | 960 } |
961 return branch; | 961 return branch; |
962 } | 962 } |
963 | 963 |
964 | 964 |
965 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 965 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
966 ASSERT(instr->value()->representation().IsTagged()); | 966 DCHECK(instr->value()->representation().IsTagged()); |
967 LOperand* value = UseRegisterAtStart(instr->value()); | 967 LOperand* value = UseRegisterAtStart(instr->value()); |
968 LOperand* temp = TempRegister(); | 968 LOperand* temp = TempRegister(); |
969 return new(zone()) LCmpMapAndBranch(value, temp); | 969 return new(zone()) LCmpMapAndBranch(value, temp); |
970 } | 970 } |
971 | 971 |
972 | 972 |
973 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { | 973 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { |
974 info()->MarkAsRequiresFrame(); | 974 info()->MarkAsRequiresFrame(); |
975 return DefineAsRegister( | 975 return DefineAsRegister( |
976 new(zone()) LArgumentsLength(UseRegister(length->value()))); | 976 new(zone()) LArgumentsLength(UseRegister(length->value()))); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 case kMathClz32: | 1133 case kMathClz32: |
1134 return DoMathClz32(instr); | 1134 return DoMathClz32(instr); |
1135 default: | 1135 default: |
1136 UNREACHABLE(); | 1136 UNREACHABLE(); |
1137 return NULL; | 1137 return NULL; |
1138 } | 1138 } |
1139 } | 1139 } |
1140 | 1140 |
1141 | 1141 |
1142 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1142 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
1143 ASSERT(instr->representation().IsDouble()); | 1143 DCHECK(instr->representation().IsDouble()); |
1144 ASSERT(instr->value()->representation().IsDouble()); | 1144 DCHECK(instr->value()->representation().IsDouble()); |
1145 LOperand* input = UseFixedDouble(instr->value(), f4); | 1145 LOperand* input = UseFixedDouble(instr->value(), f4); |
1146 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr); | 1146 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr); |
1147 } | 1147 } |
1148 | 1148 |
1149 | 1149 |
1150 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { | 1150 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { |
1151 LOperand* input = UseRegisterAtStart(instr->value()); | 1151 LOperand* input = UseRegisterAtStart(instr->value()); |
1152 LMathClz32* result = new(zone()) LMathClz32(input); | 1152 LMathClz32* result = new(zone()) LMathClz32(input); |
1153 return DefineAsRegister(result); | 1153 return DefineAsRegister(result); |
1154 } | 1154 } |
1155 | 1155 |
1156 | 1156 |
1157 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1157 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
1158 ASSERT(instr->representation().IsDouble()); | 1158 DCHECK(instr->representation().IsDouble()); |
1159 ASSERT(instr->value()->representation().IsDouble()); | 1159 DCHECK(instr->value()->representation().IsDouble()); |
1160 LOperand* input = UseRegister(instr->value()); | 1160 LOperand* input = UseRegister(instr->value()); |
1161 LOperand* temp1 = TempRegister(); | 1161 LOperand* temp1 = TempRegister(); |
1162 LOperand* temp2 = TempRegister(); | 1162 LOperand* temp2 = TempRegister(); |
1163 LOperand* double_temp = TempDoubleRegister(); | 1163 LOperand* double_temp = TempDoubleRegister(); |
1164 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1164 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
1165 return DefineAsRegister(result); | 1165 return DefineAsRegister(result); |
1166 } | 1166 } |
1167 | 1167 |
1168 | 1168 |
1169 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1169 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 } | 1264 } |
1265 | 1265 |
1266 | 1266 |
1267 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1267 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
1268 return DoShift(Token::SHL, instr); | 1268 return DoShift(Token::SHL, instr); |
1269 } | 1269 } |
1270 | 1270 |
1271 | 1271 |
1272 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1272 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1273 if (instr->representation().IsSmiOrInteger32()) { | 1273 if (instr->representation().IsSmiOrInteger32()) { |
1274 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1274 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1275 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1275 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1276 ASSERT(instr->CheckFlag(HValue::kTruncatingToInt32)); | 1276 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); |
1277 | 1277 |
1278 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1278 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1279 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1279 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1280 return DefineAsRegister(new(zone()) LBitI(left, right)); | 1280 return DefineAsRegister(new(zone()) LBitI(left, right)); |
1281 } else { | 1281 } else { |
1282 return DoArithmeticT(instr->op(), instr); | 1282 return DoArithmeticT(instr->op(), instr); |
1283 } | 1283 } |
1284 } | 1284 } |
1285 | 1285 |
1286 | 1286 |
1287 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { | 1287 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { |
1288 ASSERT(instr->representation().IsSmiOrInteger32()); | 1288 DCHECK(instr->representation().IsSmiOrInteger32()); |
1289 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1289 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1290 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1290 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1291 LOperand* dividend = UseRegister(instr->left()); | 1291 LOperand* dividend = UseRegister(instr->left()); |
1292 int32_t divisor = instr->right()->GetInteger32Constant(); | 1292 int32_t divisor = instr->right()->GetInteger32Constant(); |
1293 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I( | 1293 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I( |
1294 dividend, divisor)); | 1294 dividend, divisor)); |
1295 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || | 1295 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || |
1296 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) || | 1296 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) || |
1297 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) && | 1297 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) && |
1298 divisor != 1 && divisor != -1)) { | 1298 divisor != 1 && divisor != -1)) { |
1299 result = AssignEnvironment(result); | 1299 result = AssignEnvironment(result); |
1300 } | 1300 } |
1301 return result; | 1301 return result; |
1302 } | 1302 } |
1303 | 1303 |
1304 | 1304 |
1305 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) { | 1305 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) { |
1306 ASSERT(instr->representation().IsInteger32()); | 1306 DCHECK(instr->representation().IsInteger32()); |
1307 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1307 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1308 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1308 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1309 LOperand* dividend = UseRegister(instr->left()); | 1309 LOperand* dividend = UseRegister(instr->left()); |
1310 int32_t divisor = instr->right()->GetInteger32Constant(); | 1310 int32_t divisor = instr->right()->GetInteger32Constant(); |
1311 LInstruction* result = DefineAsRegister(new(zone()) LDivByConstI( | 1311 LInstruction* result = DefineAsRegister(new(zone()) LDivByConstI( |
1312 dividend, divisor)); | 1312 dividend, divisor)); |
1313 if (divisor == 0 || | 1313 if (divisor == 0 || |
1314 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || | 1314 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || |
1315 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { | 1315 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { |
1316 result = AssignEnvironment(result); | 1316 result = AssignEnvironment(result); |
1317 } | 1317 } |
1318 return result; | 1318 return result; |
1319 } | 1319 } |
1320 | 1320 |
1321 | 1321 |
1322 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { | 1322 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { |
1323 ASSERT(instr->representation().IsSmiOrInteger32()); | 1323 DCHECK(instr->representation().IsSmiOrInteger32()); |
1324 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1324 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1325 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1325 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1326 LOperand* dividend = UseRegister(instr->left()); | 1326 LOperand* dividend = UseRegister(instr->left()); |
1327 LOperand* divisor = UseRegister(instr->right()); | 1327 LOperand* divisor = UseRegister(instr->right()); |
1328 LInstruction* result = | 1328 LInstruction* result = |
1329 DefineAsRegister(new(zone()) LDivI(dividend, divisor)); | 1329 DefineAsRegister(new(zone()) LDivI(dividend, divisor)); |
1330 if (instr->CheckFlag(HValue::kCanBeDivByZero) || | 1330 if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
1331 instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1331 instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
1332 (instr->CheckFlag(HValue::kCanOverflow) && | 1332 (instr->CheckFlag(HValue::kCanOverflow) && |
1333 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) || | 1333 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) || |
1334 (!instr->IsMathFloorOfDiv() && | 1334 (!instr->IsMathFloorOfDiv() && |
1335 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) { | 1335 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) { |
(...skipping 27 matching lines...) Expand all Loading... |
1363 dividend, divisor)); | 1363 dividend, divisor)); |
1364 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || | 1364 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || |
1365 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) { | 1365 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) { |
1366 result = AssignEnvironment(result); | 1366 result = AssignEnvironment(result); |
1367 } | 1367 } |
1368 return result; | 1368 return result; |
1369 } | 1369 } |
1370 | 1370 |
1371 | 1371 |
1372 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { | 1372 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
1373 ASSERT(instr->representation().IsInteger32()); | 1373 DCHECK(instr->representation().IsInteger32()); |
1374 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1374 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1375 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1375 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1376 LOperand* dividend = UseRegister(instr->left()); | 1376 LOperand* dividend = UseRegister(instr->left()); |
1377 int32_t divisor = instr->right()->GetInteger32Constant(); | 1377 int32_t divisor = instr->right()->GetInteger32Constant(); |
1378 LOperand* temp = | 1378 LOperand* temp = |
1379 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || | 1379 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
1380 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? | 1380 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
1381 NULL : TempRegister(); | 1381 NULL : TempRegister(); |
1382 LInstruction* result = DefineAsRegister( | 1382 LInstruction* result = DefineAsRegister( |
1383 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); | 1383 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
1384 if (divisor == 0 || | 1384 if (divisor == 0 || |
1385 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { | 1385 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
1386 result = AssignEnvironment(result); | 1386 result = AssignEnvironment(result); |
1387 } | 1387 } |
1388 return result; | 1388 return result; |
1389 } | 1389 } |
1390 | 1390 |
1391 | 1391 |
1392 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { | 1392 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
1393 ASSERT(instr->representation().IsSmiOrInteger32()); | 1393 DCHECK(instr->representation().IsSmiOrInteger32()); |
1394 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1394 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1395 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1395 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1396 LOperand* dividend = UseRegister(instr->left()); | 1396 LOperand* dividend = UseRegister(instr->left()); |
1397 LOperand* divisor = UseRegister(instr->right()); | 1397 LOperand* divisor = UseRegister(instr->right()); |
1398 LFlooringDivI* div = new(zone()) LFlooringDivI(dividend, divisor); | 1398 LFlooringDivI* div = new(zone()) LFlooringDivI(dividend, divisor); |
1399 return AssignEnvironment(DefineAsRegister(div)); | 1399 return AssignEnvironment(DefineAsRegister(div)); |
1400 } | 1400 } |
1401 | 1401 |
1402 | 1402 |
1403 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1403 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
1404 if (instr->RightIsPowerOf2()) { | 1404 if (instr->RightIsPowerOf2()) { |
1405 return DoFlooringDivByPowerOf2I(instr); | 1405 return DoFlooringDivByPowerOf2I(instr); |
1406 } else if (instr->right()->IsConstant()) { | 1406 } else if (instr->right()->IsConstant()) { |
1407 return DoFlooringDivByConstI(instr); | 1407 return DoFlooringDivByConstI(instr); |
1408 } else { | 1408 } else { |
1409 return DoFlooringDivI(instr); | 1409 return DoFlooringDivI(instr); |
1410 } | 1410 } |
1411 } | 1411 } |
1412 | 1412 |
1413 | 1413 |
1414 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1414 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
1415 ASSERT(instr->representation().IsSmiOrInteger32()); | 1415 DCHECK(instr->representation().IsSmiOrInteger32()); |
1416 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1416 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1417 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1417 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1418 LOperand* dividend = UseRegisterAtStart(instr->left()); | 1418 LOperand* dividend = UseRegisterAtStart(instr->left()); |
1419 int32_t divisor = instr->right()->GetInteger32Constant(); | 1419 int32_t divisor = instr->right()->GetInteger32Constant(); |
1420 LInstruction* result = DefineSameAsFirst(new(zone()) LModByPowerOf2I( | 1420 LInstruction* result = DefineSameAsFirst(new(zone()) LModByPowerOf2I( |
1421 dividend, divisor)); | 1421 dividend, divisor)); |
1422 if (instr->CheckFlag(HValue::kLeftCanBeNegative) && | 1422 if (instr->CheckFlag(HValue::kLeftCanBeNegative) && |
1423 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1423 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1424 result = AssignEnvironment(result); | 1424 result = AssignEnvironment(result); |
1425 } | 1425 } |
1426 return result; | 1426 return result; |
1427 } | 1427 } |
1428 | 1428 |
1429 | 1429 |
1430 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) { | 1430 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) { |
1431 ASSERT(instr->representation().IsSmiOrInteger32()); | 1431 DCHECK(instr->representation().IsSmiOrInteger32()); |
1432 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1432 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1433 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1433 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1434 LOperand* dividend = UseRegister(instr->left()); | 1434 LOperand* dividend = UseRegister(instr->left()); |
1435 int32_t divisor = instr->right()->GetInteger32Constant(); | 1435 int32_t divisor = instr->right()->GetInteger32Constant(); |
1436 LInstruction* result = DefineAsRegister(new(zone()) LModByConstI( | 1436 LInstruction* result = DefineAsRegister(new(zone()) LModByConstI( |
1437 dividend, divisor)); | 1437 dividend, divisor)); |
1438 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1438 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1439 result = AssignEnvironment(result); | 1439 result = AssignEnvironment(result); |
1440 } | 1440 } |
1441 return result; | 1441 return result; |
1442 } | 1442 } |
1443 | 1443 |
1444 | 1444 |
1445 LInstruction* LChunkBuilder::DoModI(HMod* instr) { | 1445 LInstruction* LChunkBuilder::DoModI(HMod* instr) { |
1446 ASSERT(instr->representation().IsSmiOrInteger32()); | 1446 DCHECK(instr->representation().IsSmiOrInteger32()); |
1447 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1447 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1448 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1448 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1449 LOperand* dividend = UseRegister(instr->left()); | 1449 LOperand* dividend = UseRegister(instr->left()); |
1450 LOperand* divisor = UseRegister(instr->right()); | 1450 LOperand* divisor = UseRegister(instr->right()); |
1451 LInstruction* result = DefineAsRegister(new(zone()) LModI( | 1451 LInstruction* result = DefineAsRegister(new(zone()) LModI( |
1452 dividend, divisor)); | 1452 dividend, divisor)); |
1453 if (instr->CheckFlag(HValue::kCanBeDivByZero) || | 1453 if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
1454 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1454 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1455 result = AssignEnvironment(result); | 1455 result = AssignEnvironment(result); |
1456 } | 1456 } |
1457 return result; | 1457 return result; |
1458 } | 1458 } |
1459 | 1459 |
1460 | 1460 |
1461 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1461 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
1462 if (instr->representation().IsSmiOrInteger32()) { | 1462 if (instr->representation().IsSmiOrInteger32()) { |
1463 return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr); | 1463 return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr); |
1464 } else if (instr->representation().IsDouble()) { | 1464 } else if (instr->representation().IsDouble()) { |
1465 return DoArithmeticD(Token::MOD, instr); | 1465 return DoArithmeticD(Token::MOD, instr); |
1466 } else { | 1466 } else { |
1467 return DoArithmeticT(Token::MOD, instr); | 1467 return DoArithmeticT(Token::MOD, instr); |
1468 } | 1468 } |
1469 } | 1469 } |
1470 | 1470 |
1471 | 1471 |
1472 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1472 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1473 if (instr->representation().IsSmiOrInteger32()) { | 1473 if (instr->representation().IsSmiOrInteger32()) { |
1474 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1474 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1475 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1475 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1476 HValue* left = instr->BetterLeftOperand(); | 1476 HValue* left = instr->BetterLeftOperand(); |
1477 HValue* right = instr->BetterRightOperand(); | 1477 HValue* right = instr->BetterRightOperand(); |
1478 LOperand* left_op; | 1478 LOperand* left_op; |
1479 LOperand* right_op; | 1479 LOperand* right_op; |
1480 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); | 1480 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); |
1481 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero); | 1481 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero); |
1482 | 1482 |
1483 if (right->IsConstant()) { | 1483 if (right->IsConstant()) { |
1484 HConstant* constant = HConstant::cast(right); | 1484 HConstant* constant = HConstant::cast(right); |
1485 int32_t constant_value = constant->Integer32Value(); | 1485 int32_t constant_value = constant->Integer32Value(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 } | 1528 } |
1529 return DoArithmeticD(Token::MUL, instr); | 1529 return DoArithmeticD(Token::MUL, instr); |
1530 } else { | 1530 } else { |
1531 return DoArithmeticT(Token::MUL, instr); | 1531 return DoArithmeticT(Token::MUL, instr); |
1532 } | 1532 } |
1533 } | 1533 } |
1534 | 1534 |
1535 | 1535 |
1536 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1536 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
1537 if (instr->representation().IsSmiOrInteger32()) { | 1537 if (instr->representation().IsSmiOrInteger32()) { |
1538 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1538 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1539 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1539 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1540 LOperand* left = UseRegisterAtStart(instr->left()); | 1540 LOperand* left = UseRegisterAtStart(instr->left()); |
1541 LOperand* right = UseOrConstantAtStart(instr->right()); | 1541 LOperand* right = UseOrConstantAtStart(instr->right()); |
1542 LSubI* sub = new(zone()) LSubI(left, right); | 1542 LSubI* sub = new(zone()) LSubI(left, right); |
1543 LInstruction* result = DefineAsRegister(sub); | 1543 LInstruction* result = DefineAsRegister(sub); |
1544 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1544 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1545 result = AssignEnvironment(result); | 1545 result = AssignEnvironment(result); |
1546 } | 1546 } |
1547 return result; | 1547 return result; |
1548 } else if (instr->representation().IsDouble()) { | 1548 } else if (instr->representation().IsDouble()) { |
1549 return DoArithmeticD(Token::SUB, instr); | 1549 return DoArithmeticD(Token::SUB, instr); |
1550 } else { | 1550 } else { |
1551 return DoArithmeticT(Token::SUB, instr); | 1551 return DoArithmeticT(Token::SUB, instr); |
1552 } | 1552 } |
1553 } | 1553 } |
1554 | 1554 |
1555 | 1555 |
1556 LInstruction* LChunkBuilder::DoMultiplyAdd(HMul* mul, HValue* addend) { | 1556 LInstruction* LChunkBuilder::DoMultiplyAdd(HMul* mul, HValue* addend) { |
1557 LOperand* multiplier_op = UseRegisterAtStart(mul->left()); | 1557 LOperand* multiplier_op = UseRegisterAtStart(mul->left()); |
1558 LOperand* multiplicand_op = UseRegisterAtStart(mul->right()); | 1558 LOperand* multiplicand_op = UseRegisterAtStart(mul->right()); |
1559 LOperand* addend_op = UseRegisterAtStart(addend); | 1559 LOperand* addend_op = UseRegisterAtStart(addend); |
1560 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op, | 1560 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op, |
1561 multiplicand_op)); | 1561 multiplicand_op)); |
1562 } | 1562 } |
1563 | 1563 |
1564 | 1564 |
1565 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1565 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
1566 if (instr->representation().IsSmiOrInteger32()) { | 1566 if (instr->representation().IsSmiOrInteger32()) { |
1567 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1567 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1568 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1568 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1569 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1569 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1570 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1570 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1571 LAddI* add = new(zone()) LAddI(left, right); | 1571 LAddI* add = new(zone()) LAddI(left, right); |
1572 LInstruction* result = DefineAsRegister(add); | 1572 LInstruction* result = DefineAsRegister(add); |
1573 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1573 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1574 result = AssignEnvironment(result); | 1574 result = AssignEnvironment(result); |
1575 } | 1575 } |
1576 return result; | 1576 return result; |
1577 } else if (instr->representation().IsExternal()) { | 1577 } else if (instr->representation().IsExternal()) { |
1578 ASSERT(instr->left()->representation().IsExternal()); | 1578 DCHECK(instr->left()->representation().IsExternal()); |
1579 ASSERT(instr->right()->representation().IsInteger32()); | 1579 DCHECK(instr->right()->representation().IsInteger32()); |
1580 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); | 1580 DCHECK(!instr->CheckFlag(HValue::kCanOverflow)); |
1581 LOperand* left = UseRegisterAtStart(instr->left()); | 1581 LOperand* left = UseRegisterAtStart(instr->left()); |
1582 LOperand* right = UseOrConstantAtStart(instr->right()); | 1582 LOperand* right = UseOrConstantAtStart(instr->right()); |
1583 LAddI* add = new(zone()) LAddI(left, right); | 1583 LAddI* add = new(zone()) LAddI(left, right); |
1584 LInstruction* result = DefineAsRegister(add); | 1584 LInstruction* result = DefineAsRegister(add); |
1585 return result; | 1585 return result; |
1586 } else if (instr->representation().IsDouble()) { | 1586 } else if (instr->representation().IsDouble()) { |
1587 if (kArchVariant == kMips32r2) { | 1587 if (kArchVariant == kMips32r2) { |
1588 if (instr->left()->IsMul()) | 1588 if (instr->left()->IsMul()) |
1589 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1589 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
1590 | 1590 |
1591 if (instr->right()->IsMul()) { | 1591 if (instr->right()->IsMul()) { |
1592 ASSERT(!instr->left()->IsMul()); | 1592 DCHECK(!instr->left()->IsMul()); |
1593 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); | 1593 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); |
1594 } | 1594 } |
1595 } | 1595 } |
1596 return DoArithmeticD(Token::ADD, instr); | 1596 return DoArithmeticD(Token::ADD, instr); |
1597 } else { | 1597 } else { |
1598 return DoArithmeticT(Token::ADD, instr); | 1598 return DoArithmeticT(Token::ADD, instr); |
1599 } | 1599 } |
1600 } | 1600 } |
1601 | 1601 |
1602 | 1602 |
1603 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1603 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
1604 LOperand* left = NULL; | 1604 LOperand* left = NULL; |
1605 LOperand* right = NULL; | 1605 LOperand* right = NULL; |
1606 if (instr->representation().IsSmiOrInteger32()) { | 1606 if (instr->representation().IsSmiOrInteger32()) { |
1607 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1607 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1608 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1608 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1609 left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1609 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1610 right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1610 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1611 } else { | 1611 } else { |
1612 ASSERT(instr->representation().IsDouble()); | 1612 DCHECK(instr->representation().IsDouble()); |
1613 ASSERT(instr->left()->representation().IsDouble()); | 1613 DCHECK(instr->left()->representation().IsDouble()); |
1614 ASSERT(instr->right()->representation().IsDouble()); | 1614 DCHECK(instr->right()->representation().IsDouble()); |
1615 left = UseRegisterAtStart(instr->left()); | 1615 left = UseRegisterAtStart(instr->left()); |
1616 right = UseRegisterAtStart(instr->right()); | 1616 right = UseRegisterAtStart(instr->right()); |
1617 } | 1617 } |
1618 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); | 1618 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); |
1619 } | 1619 } |
1620 | 1620 |
1621 | 1621 |
1622 LInstruction* LChunkBuilder::DoPower(HPower* instr) { | 1622 LInstruction* LChunkBuilder::DoPower(HPower* instr) { |
1623 ASSERT(instr->representation().IsDouble()); | 1623 DCHECK(instr->representation().IsDouble()); |
1624 // We call a C function for double power. It can't trigger a GC. | 1624 // We call a C function for double power. It can't trigger a GC. |
1625 // We need to use fixed result register for the call. | 1625 // We need to use fixed result register for the call. |
1626 Representation exponent_type = instr->right()->representation(); | 1626 Representation exponent_type = instr->right()->representation(); |
1627 ASSERT(instr->left()->representation().IsDouble()); | 1627 DCHECK(instr->left()->representation().IsDouble()); |
1628 LOperand* left = UseFixedDouble(instr->left(), f2); | 1628 LOperand* left = UseFixedDouble(instr->left(), f2); |
1629 LOperand* right = exponent_type.IsDouble() ? | 1629 LOperand* right = exponent_type.IsDouble() ? |
1630 UseFixedDouble(instr->right(), f4) : | 1630 UseFixedDouble(instr->right(), f4) : |
1631 UseFixed(instr->right(), a2); | 1631 UseFixed(instr->right(), a2); |
1632 LPower* result = new(zone()) LPower(left, right); | 1632 LPower* result = new(zone()) LPower(left, right); |
1633 return MarkAsCall(DefineFixedDouble(result, f0), | 1633 return MarkAsCall(DefineFixedDouble(result, f0), |
1634 instr, | 1634 instr, |
1635 CAN_DEOPTIMIZE_EAGERLY); | 1635 CAN_DEOPTIMIZE_EAGERLY); |
1636 } | 1636 } |
1637 | 1637 |
1638 | 1638 |
1639 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1639 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1640 ASSERT(instr->left()->representation().IsTagged()); | 1640 DCHECK(instr->left()->representation().IsTagged()); |
1641 ASSERT(instr->right()->representation().IsTagged()); | 1641 DCHECK(instr->right()->representation().IsTagged()); |
1642 LOperand* context = UseFixed(instr->context(), cp); | 1642 LOperand* context = UseFixed(instr->context(), cp); |
1643 LOperand* left = UseFixed(instr->left(), a1); | 1643 LOperand* left = UseFixed(instr->left(), a1); |
1644 LOperand* right = UseFixed(instr->right(), a0); | 1644 LOperand* right = UseFixed(instr->right(), a0); |
1645 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1645 LCmpT* result = new(zone()) LCmpT(context, left, right); |
1646 return MarkAsCall(DefineFixed(result, v0), instr); | 1646 return MarkAsCall(DefineFixed(result, v0), instr); |
1647 } | 1647 } |
1648 | 1648 |
1649 | 1649 |
1650 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1650 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1651 HCompareNumericAndBranch* instr) { | 1651 HCompareNumericAndBranch* instr) { |
1652 Representation r = instr->representation(); | 1652 Representation r = instr->representation(); |
1653 if (r.IsSmiOrInteger32()) { | 1653 if (r.IsSmiOrInteger32()) { |
1654 ASSERT(instr->left()->representation().Equals(r)); | 1654 DCHECK(instr->left()->representation().Equals(r)); |
1655 ASSERT(instr->right()->representation().Equals(r)); | 1655 DCHECK(instr->right()->representation().Equals(r)); |
1656 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1656 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
1657 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1657 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
1658 return new(zone()) LCompareNumericAndBranch(left, right); | 1658 return new(zone()) LCompareNumericAndBranch(left, right); |
1659 } else { | 1659 } else { |
1660 ASSERT(r.IsDouble()); | 1660 DCHECK(r.IsDouble()); |
1661 ASSERT(instr->left()->representation().IsDouble()); | 1661 DCHECK(instr->left()->representation().IsDouble()); |
1662 ASSERT(instr->right()->representation().IsDouble()); | 1662 DCHECK(instr->right()->representation().IsDouble()); |
1663 LOperand* left = UseRegisterAtStart(instr->left()); | 1663 LOperand* left = UseRegisterAtStart(instr->left()); |
1664 LOperand* right = UseRegisterAtStart(instr->right()); | 1664 LOperand* right = UseRegisterAtStart(instr->right()); |
1665 return new(zone()) LCompareNumericAndBranch(left, right); | 1665 return new(zone()) LCompareNumericAndBranch(left, right); |
1666 } | 1666 } |
1667 } | 1667 } |
1668 | 1668 |
1669 | 1669 |
1670 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1670 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
1671 HCompareObjectEqAndBranch* instr) { | 1671 HCompareObjectEqAndBranch* instr) { |
1672 LOperand* left = UseRegisterAtStart(instr->left()); | 1672 LOperand* left = UseRegisterAtStart(instr->left()); |
(...skipping 11 matching lines...) Expand all Loading... |
1684 | 1684 |
1685 LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch( | 1685 LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch( |
1686 HCompareMinusZeroAndBranch* instr) { | 1686 HCompareMinusZeroAndBranch* instr) { |
1687 LOperand* value = UseRegister(instr->value()); | 1687 LOperand* value = UseRegister(instr->value()); |
1688 LOperand* scratch = TempRegister(); | 1688 LOperand* scratch = TempRegister(); |
1689 return new(zone()) LCompareMinusZeroAndBranch(value, scratch); | 1689 return new(zone()) LCompareMinusZeroAndBranch(value, scratch); |
1690 } | 1690 } |
1691 | 1691 |
1692 | 1692 |
1693 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1693 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
1694 ASSERT(instr->value()->representation().IsTagged()); | 1694 DCHECK(instr->value()->representation().IsTagged()); |
1695 LOperand* temp = TempRegister(); | 1695 LOperand* temp = TempRegister(); |
1696 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), | 1696 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), |
1697 temp); | 1697 temp); |
1698 } | 1698 } |
1699 | 1699 |
1700 | 1700 |
1701 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1701 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
1702 ASSERT(instr->value()->representation().IsTagged()); | 1702 DCHECK(instr->value()->representation().IsTagged()); |
1703 LOperand* temp = TempRegister(); | 1703 LOperand* temp = TempRegister(); |
1704 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()), | 1704 return new(zone()) LIsStringAndBranch(UseRegisterAtStart(instr->value()), |
1705 temp); | 1705 temp); |
1706 } | 1706 } |
1707 | 1707 |
1708 | 1708 |
1709 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { | 1709 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { |
1710 ASSERT(instr->value()->representation().IsTagged()); | 1710 DCHECK(instr->value()->representation().IsTagged()); |
1711 return new(zone()) LIsSmiAndBranch(Use(instr->value())); | 1711 return new(zone()) LIsSmiAndBranch(Use(instr->value())); |
1712 } | 1712 } |
1713 | 1713 |
1714 | 1714 |
1715 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( | 1715 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( |
1716 HIsUndetectableAndBranch* instr) { | 1716 HIsUndetectableAndBranch* instr) { |
1717 ASSERT(instr->value()->representation().IsTagged()); | 1717 DCHECK(instr->value()->representation().IsTagged()); |
1718 return new(zone()) LIsUndetectableAndBranch( | 1718 return new(zone()) LIsUndetectableAndBranch( |
1719 UseRegisterAtStart(instr->value()), TempRegister()); | 1719 UseRegisterAtStart(instr->value()), TempRegister()); |
1720 } | 1720 } |
1721 | 1721 |
1722 | 1722 |
1723 LInstruction* LChunkBuilder::DoStringCompareAndBranch( | 1723 LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
1724 HStringCompareAndBranch* instr) { | 1724 HStringCompareAndBranch* instr) { |
1725 ASSERT(instr->left()->representation().IsTagged()); | 1725 DCHECK(instr->left()->representation().IsTagged()); |
1726 ASSERT(instr->right()->representation().IsTagged()); | 1726 DCHECK(instr->right()->representation().IsTagged()); |
1727 LOperand* context = UseFixed(instr->context(), cp); | 1727 LOperand* context = UseFixed(instr->context(), cp); |
1728 LOperand* left = UseFixed(instr->left(), a1); | 1728 LOperand* left = UseFixed(instr->left(), a1); |
1729 LOperand* right = UseFixed(instr->right(), a0); | 1729 LOperand* right = UseFixed(instr->right(), a0); |
1730 LStringCompareAndBranch* result = | 1730 LStringCompareAndBranch* result = |
1731 new(zone()) LStringCompareAndBranch(context, left, right); | 1731 new(zone()) LStringCompareAndBranch(context, left, right); |
1732 return MarkAsCall(result, instr); | 1732 return MarkAsCall(result, instr); |
1733 } | 1733 } |
1734 | 1734 |
1735 | 1735 |
1736 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( | 1736 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( |
1737 HHasInstanceTypeAndBranch* instr) { | 1737 HHasInstanceTypeAndBranch* instr) { |
1738 ASSERT(instr->value()->representation().IsTagged()); | 1738 DCHECK(instr->value()->representation().IsTagged()); |
1739 LOperand* value = UseRegisterAtStart(instr->value()); | 1739 LOperand* value = UseRegisterAtStart(instr->value()); |
1740 return new(zone()) LHasInstanceTypeAndBranch(value); | 1740 return new(zone()) LHasInstanceTypeAndBranch(value); |
1741 } | 1741 } |
1742 | 1742 |
1743 | 1743 |
1744 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( | 1744 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( |
1745 HGetCachedArrayIndex* instr) { | 1745 HGetCachedArrayIndex* instr) { |
1746 ASSERT(instr->value()->representation().IsTagged()); | 1746 DCHECK(instr->value()->representation().IsTagged()); |
1747 LOperand* value = UseRegisterAtStart(instr->value()); | 1747 LOperand* value = UseRegisterAtStart(instr->value()); |
1748 | 1748 |
1749 return DefineAsRegister(new(zone()) LGetCachedArrayIndex(value)); | 1749 return DefineAsRegister(new(zone()) LGetCachedArrayIndex(value)); |
1750 } | 1750 } |
1751 | 1751 |
1752 | 1752 |
1753 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch( | 1753 LInstruction* LChunkBuilder::DoHasCachedArrayIndexAndBranch( |
1754 HHasCachedArrayIndexAndBranch* instr) { | 1754 HHasCachedArrayIndexAndBranch* instr) { |
1755 ASSERT(instr->value()->representation().IsTagged()); | 1755 DCHECK(instr->value()->representation().IsTagged()); |
1756 return new(zone()) LHasCachedArrayIndexAndBranch( | 1756 return new(zone()) LHasCachedArrayIndexAndBranch( |
1757 UseRegisterAtStart(instr->value())); | 1757 UseRegisterAtStart(instr->value())); |
1758 } | 1758 } |
1759 | 1759 |
1760 | 1760 |
1761 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( | 1761 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( |
1762 HClassOfTestAndBranch* instr) { | 1762 HClassOfTestAndBranch* instr) { |
1763 ASSERT(instr->value()->representation().IsTagged()); | 1763 DCHECK(instr->value()->representation().IsTagged()); |
1764 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()), | 1764 return new(zone()) LClassOfTestAndBranch(UseRegister(instr->value()), |
1765 TempRegister()); | 1765 TempRegister()); |
1766 } | 1766 } |
1767 | 1767 |
1768 | 1768 |
1769 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) { | 1769 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) { |
1770 LOperand* map = UseRegisterAtStart(instr->value()); | 1770 LOperand* map = UseRegisterAtStart(instr->value()); |
1771 return DefineAsRegister(new(zone()) LMapEnumLength(map)); | 1771 return DefineAsRegister(new(zone()) LMapEnumLength(map)); |
1772 } | 1772 } |
1773 | 1773 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 LInstruction* result = DefineAsRegister(new(zone()) LNumberUntagD(value)); | 1856 LInstruction* result = DefineAsRegister(new(zone()) LNumberUntagD(value)); |
1857 if (!val->representation().IsSmi()) result = AssignEnvironment(result); | 1857 if (!val->representation().IsSmi()) result = AssignEnvironment(result); |
1858 return result; | 1858 return result; |
1859 } else if (to.IsSmi()) { | 1859 } else if (to.IsSmi()) { |
1860 LOperand* value = UseRegister(val); | 1860 LOperand* value = UseRegister(val); |
1861 if (val->type().IsSmi()) { | 1861 if (val->type().IsSmi()) { |
1862 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1862 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
1863 } | 1863 } |
1864 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1864 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
1865 } else { | 1865 } else { |
1866 ASSERT(to.IsInteger32()); | 1866 DCHECK(to.IsInteger32()); |
1867 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1867 if (val->type().IsSmi() || val->representation().IsSmi()) { |
1868 LOperand* value = UseRegisterAtStart(val); | 1868 LOperand* value = UseRegisterAtStart(val); |
1869 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); | 1869 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); |
1870 } else { | 1870 } else { |
1871 LOperand* value = UseRegister(val); | 1871 LOperand* value = UseRegister(val); |
1872 LOperand* temp1 = TempRegister(); | 1872 LOperand* temp1 = TempRegister(); |
1873 LOperand* temp2 = TempDoubleRegister(); | 1873 LOperand* temp2 = TempDoubleRegister(); |
1874 LInstruction* result = | 1874 LInstruction* result = |
1875 DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2)); | 1875 DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2)); |
1876 if (!val->representation().IsSmi()) result = AssignEnvironment(result); | 1876 if (!val->representation().IsSmi()) result = AssignEnvironment(result); |
1877 return result; | 1877 return result; |
1878 } | 1878 } |
1879 } | 1879 } |
1880 } else if (from.IsDouble()) { | 1880 } else if (from.IsDouble()) { |
1881 if (to.IsTagged()) { | 1881 if (to.IsTagged()) { |
1882 info()->MarkAsDeferredCalling(); | 1882 info()->MarkAsDeferredCalling(); |
1883 LOperand* value = UseRegister(val); | 1883 LOperand* value = UseRegister(val); |
1884 LOperand* temp1 = TempRegister(); | 1884 LOperand* temp1 = TempRegister(); |
1885 LOperand* temp2 = TempRegister(); | 1885 LOperand* temp2 = TempRegister(); |
1886 LUnallocated* result_temp = TempRegister(); | 1886 LUnallocated* result_temp = TempRegister(); |
1887 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); | 1887 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); |
1888 return AssignPointerMap(Define(result, result_temp)); | 1888 return AssignPointerMap(Define(result, result_temp)); |
1889 } else if (to.IsSmi()) { | 1889 } else if (to.IsSmi()) { |
1890 LOperand* value = UseRegister(val); | 1890 LOperand* value = UseRegister(val); |
1891 return AssignEnvironment( | 1891 return AssignEnvironment( |
1892 DefineAsRegister(new(zone()) LDoubleToSmi(value))); | 1892 DefineAsRegister(new(zone()) LDoubleToSmi(value))); |
1893 } else { | 1893 } else { |
1894 ASSERT(to.IsInteger32()); | 1894 DCHECK(to.IsInteger32()); |
1895 LOperand* value = UseRegister(val); | 1895 LOperand* value = UseRegister(val); |
1896 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value)); | 1896 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value)); |
1897 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result); | 1897 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result); |
1898 return result; | 1898 return result; |
1899 } | 1899 } |
1900 } else if (from.IsInteger32()) { | 1900 } else if (from.IsInteger32()) { |
1901 info()->MarkAsDeferredCalling(); | 1901 info()->MarkAsDeferredCalling(); |
1902 if (to.IsTagged()) { | 1902 if (to.IsTagged()) { |
1903 if (!instr->CheckFlag(HValue::kCanOverflow)) { | 1903 if (!instr->CheckFlag(HValue::kCanOverflow)) { |
1904 LOperand* value = UseRegisterAtStart(val); | 1904 LOperand* value = UseRegisterAtStart(val); |
(...skipping 12 matching lines...) Expand all Loading... |
1917 return AssignPointerMap(DefineAsRegister(result)); | 1917 return AssignPointerMap(DefineAsRegister(result)); |
1918 } | 1918 } |
1919 } else if (to.IsSmi()) { | 1919 } else if (to.IsSmi()) { |
1920 LOperand* value = UseRegister(val); | 1920 LOperand* value = UseRegister(val); |
1921 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); | 1921 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); |
1922 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1922 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1923 result = AssignEnvironment(result); | 1923 result = AssignEnvironment(result); |
1924 } | 1924 } |
1925 return result; | 1925 return result; |
1926 } else { | 1926 } else { |
1927 ASSERT(to.IsDouble()); | 1927 DCHECK(to.IsDouble()); |
1928 if (val->CheckFlag(HInstruction::kUint32)) { | 1928 if (val->CheckFlag(HInstruction::kUint32)) { |
1929 return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val))); | 1929 return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val))); |
1930 } else { | 1930 } else { |
1931 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); | 1931 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); |
1932 } | 1932 } |
1933 } | 1933 } |
1934 } | 1934 } |
1935 UNREACHABLE(); | 1935 UNREACHABLE(); |
1936 return NULL; | 1936 return NULL; |
1937 } | 1937 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 HValue* value = instr->value(); | 1982 HValue* value = instr->value(); |
1983 Representation input_rep = value->representation(); | 1983 Representation input_rep = value->representation(); |
1984 LOperand* reg = UseRegister(value); | 1984 LOperand* reg = UseRegister(value); |
1985 if (input_rep.IsDouble()) { | 1985 if (input_rep.IsDouble()) { |
1986 // Revisit this decision, here and 8 lines below. | 1986 // Revisit this decision, here and 8 lines below. |
1987 return DefineAsRegister(new(zone()) LClampDToUint8(reg, | 1987 return DefineAsRegister(new(zone()) LClampDToUint8(reg, |
1988 TempDoubleRegister())); | 1988 TempDoubleRegister())); |
1989 } else if (input_rep.IsInteger32()) { | 1989 } else if (input_rep.IsInteger32()) { |
1990 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); | 1990 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); |
1991 } else { | 1991 } else { |
1992 ASSERT(input_rep.IsSmiOrTagged()); | 1992 DCHECK(input_rep.IsSmiOrTagged()); |
1993 LClampTToUint8* result = | 1993 LClampTToUint8* result = |
1994 new(zone()) LClampTToUint8(reg, TempDoubleRegister()); | 1994 new(zone()) LClampTToUint8(reg, TempDoubleRegister()); |
1995 return AssignEnvironment(DefineAsRegister(result)); | 1995 return AssignEnvironment(DefineAsRegister(result)); |
1996 } | 1996 } |
1997 } | 1997 } |
1998 | 1998 |
1999 | 1999 |
2000 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { | 2000 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { |
2001 HValue* value = instr->value(); | 2001 HValue* value = instr->value(); |
2002 ASSERT(value->representation().IsDouble()); | 2002 DCHECK(value->representation().IsDouble()); |
2003 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); | 2003 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); |
2004 } | 2004 } |
2005 | 2005 |
2006 | 2006 |
2007 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) { | 2007 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) { |
2008 LOperand* lo = UseRegister(instr->lo()); | 2008 LOperand* lo = UseRegister(instr->lo()); |
2009 LOperand* hi = UseRegister(instr->hi()); | 2009 LOperand* hi = UseRegister(instr->hi()); |
2010 return DefineAsRegister(new(zone()) LConstructDouble(hi, lo)); | 2010 return DefineAsRegister(new(zone()) LConstructDouble(hi, lo)); |
2011 } | 2011 } |
2012 | 2012 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2127 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
2128 } | 2128 } |
2129 | 2129 |
2130 | 2130 |
2131 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { | 2131 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
2132 return DefineAsRegister(new(zone()) LLoadRoot); | 2132 return DefineAsRegister(new(zone()) LLoadRoot); |
2133 } | 2133 } |
2134 | 2134 |
2135 | 2135 |
2136 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2136 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2137 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2137 DCHECK(instr->key()->representation().IsSmiOrInteger32()); |
2138 ElementsKind elements_kind = instr->elements_kind(); | 2138 ElementsKind elements_kind = instr->elements_kind(); |
2139 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2139 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2140 LInstruction* result = NULL; | 2140 LInstruction* result = NULL; |
2141 | 2141 |
2142 if (!instr->is_typed_elements()) { | 2142 if (!instr->is_typed_elements()) { |
2143 LOperand* obj = NULL; | 2143 LOperand* obj = NULL; |
2144 if (instr->representation().IsDouble()) { | 2144 if (instr->representation().IsDouble()) { |
2145 obj = UseRegister(instr->elements()); | 2145 obj = UseRegister(instr->elements()); |
2146 } else { | 2146 } else { |
2147 ASSERT(instr->representation().IsSmiOrTagged()); | 2147 DCHECK(instr->representation().IsSmiOrTagged()); |
2148 obj = UseRegisterAtStart(instr->elements()); | 2148 obj = UseRegisterAtStart(instr->elements()); |
2149 } | 2149 } |
2150 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2150 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
2151 } else { | 2151 } else { |
2152 ASSERT( | 2152 DCHECK( |
2153 (instr->representation().IsInteger32() && | 2153 (instr->representation().IsInteger32() && |
2154 !IsDoubleOrFloatElementsKind(elements_kind)) || | 2154 !IsDoubleOrFloatElementsKind(elements_kind)) || |
2155 (instr->representation().IsDouble() && | 2155 (instr->representation().IsDouble() && |
2156 IsDoubleOrFloatElementsKind(elements_kind))); | 2156 IsDoubleOrFloatElementsKind(elements_kind))); |
2157 LOperand* backing_store = UseRegister(instr->elements()); | 2157 LOperand* backing_store = UseRegister(instr->elements()); |
2158 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); | 2158 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); |
2159 } | 2159 } |
2160 | 2160 |
2161 if ((instr->is_external() || instr->is_fixed_typed_array()) ? | 2161 if ((instr->is_external() || instr->is_fixed_typed_array()) ? |
2162 // see LCodeGen::DoLoadKeyedExternalArray | 2162 // see LCodeGen::DoLoadKeyedExternalArray |
(...skipping 20 matching lines...) Expand all Loading... |
2183 | 2183 |
2184 LInstruction* result = | 2184 LInstruction* result = |
2185 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key, vector), | 2185 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key, vector), |
2186 v0); | 2186 v0); |
2187 return MarkAsCall(result, instr); | 2187 return MarkAsCall(result, instr); |
2188 } | 2188 } |
2189 | 2189 |
2190 | 2190 |
2191 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2191 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2192 if (!instr->is_typed_elements()) { | 2192 if (!instr->is_typed_elements()) { |
2193 ASSERT(instr->elements()->representation().IsTagged()); | 2193 DCHECK(instr->elements()->representation().IsTagged()); |
2194 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2194 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2195 LOperand* object = NULL; | 2195 LOperand* object = NULL; |
2196 LOperand* val = NULL; | 2196 LOperand* val = NULL; |
2197 LOperand* key = NULL; | 2197 LOperand* key = NULL; |
2198 | 2198 |
2199 if (instr->value()->representation().IsDouble()) { | 2199 if (instr->value()->representation().IsDouble()) { |
2200 object = UseRegisterAtStart(instr->elements()); | 2200 object = UseRegisterAtStart(instr->elements()); |
2201 key = UseRegisterOrConstantAtStart(instr->key()); | 2201 key = UseRegisterOrConstantAtStart(instr->key()); |
2202 val = UseRegister(instr->value()); | 2202 val = UseRegister(instr->value()); |
2203 } else { | 2203 } else { |
2204 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2204 DCHECK(instr->value()->representation().IsSmiOrTagged()); |
2205 if (needs_write_barrier) { | 2205 if (needs_write_barrier) { |
2206 object = UseTempRegister(instr->elements()); | 2206 object = UseTempRegister(instr->elements()); |
2207 val = UseTempRegister(instr->value()); | 2207 val = UseTempRegister(instr->value()); |
2208 key = UseTempRegister(instr->key()); | 2208 key = UseTempRegister(instr->key()); |
2209 } else { | 2209 } else { |
2210 object = UseRegisterAtStart(instr->elements()); | 2210 object = UseRegisterAtStart(instr->elements()); |
2211 val = UseRegisterAtStart(instr->value()); | 2211 val = UseRegisterAtStart(instr->value()); |
2212 key = UseRegisterOrConstantAtStart(instr->key()); | 2212 key = UseRegisterOrConstantAtStart(instr->key()); |
2213 } | 2213 } |
2214 } | 2214 } |
2215 | 2215 |
2216 return new(zone()) LStoreKeyed(object, key, val); | 2216 return new(zone()) LStoreKeyed(object, key, val); |
2217 } | 2217 } |
2218 | 2218 |
2219 ASSERT( | 2219 DCHECK( |
2220 (instr->value()->representation().IsInteger32() && | 2220 (instr->value()->representation().IsInteger32() && |
2221 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 2221 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
2222 (instr->value()->representation().IsDouble() && | 2222 (instr->value()->representation().IsDouble() && |
2223 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 2223 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
2224 ASSERT((instr->is_fixed_typed_array() && | 2224 DCHECK((instr->is_fixed_typed_array() && |
2225 instr->elements()->representation().IsTagged()) || | 2225 instr->elements()->representation().IsTagged()) || |
2226 (instr->is_external() && | 2226 (instr->is_external() && |
2227 instr->elements()->representation().IsExternal())); | 2227 instr->elements()->representation().IsExternal())); |
2228 LOperand* val = UseRegister(instr->value()); | 2228 LOperand* val = UseRegister(instr->value()); |
2229 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2229 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2230 LOperand* backing_store = UseRegister(instr->elements()); | 2230 LOperand* backing_store = UseRegister(instr->elements()); |
2231 return new(zone()) LStoreKeyed(backing_store, key, val); | 2231 return new(zone()) LStoreKeyed(backing_store, key, val); |
2232 } | 2232 } |
2233 | 2233 |
2234 | 2234 |
2235 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2235 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2236 LOperand* context = UseFixed(instr->context(), cp); | 2236 LOperand* context = UseFixed(instr->context(), cp); |
2237 LOperand* obj = UseFixed(instr->object(), KeyedStoreIC::ReceiverRegister()); | 2237 LOperand* obj = UseFixed(instr->object(), KeyedStoreIC::ReceiverRegister()); |
2238 LOperand* key = UseFixed(instr->key(), KeyedStoreIC::NameRegister()); | 2238 LOperand* key = UseFixed(instr->key(), KeyedStoreIC::NameRegister()); |
2239 LOperand* val = UseFixed(instr->value(), KeyedStoreIC::ValueRegister()); | 2239 LOperand* val = UseFixed(instr->value(), KeyedStoreIC::ValueRegister()); |
2240 | 2240 |
2241 ASSERT(instr->object()->representation().IsTagged()); | 2241 DCHECK(instr->object()->representation().IsTagged()); |
2242 ASSERT(instr->key()->representation().IsTagged()); | 2242 DCHECK(instr->key()->representation().IsTagged()); |
2243 ASSERT(instr->value()->representation().IsTagged()); | 2243 DCHECK(instr->value()->representation().IsTagged()); |
2244 | 2244 |
2245 return MarkAsCall( | 2245 return MarkAsCall( |
2246 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr); | 2246 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr); |
2247 } | 2247 } |
2248 | 2248 |
2249 | 2249 |
2250 LInstruction* LChunkBuilder::DoTransitionElementsKind( | 2250 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
2251 HTransitionElementsKind* instr) { | 2251 HTransitionElementsKind* instr) { |
2252 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2252 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
2253 LOperand* object = UseRegister(instr->object()); | 2253 LOperand* object = UseRegister(instr->object()); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 | 2366 |
2367 | 2367 |
2368 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2368 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
2369 LOperand* context = UseFixed(instr->context(), cp); | 2369 LOperand* context = UseFixed(instr->context(), cp); |
2370 return MarkAsCall( | 2370 return MarkAsCall( |
2371 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr); | 2371 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr); |
2372 } | 2372 } |
2373 | 2373 |
2374 | 2374 |
2375 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2375 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2376 ASSERT(argument_count_ == 0); | 2376 DCHECK(argument_count_ == 0); |
2377 allocator_->MarkAsOsrEntry(); | 2377 allocator_->MarkAsOsrEntry(); |
2378 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2378 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2379 return AssignEnvironment(new(zone()) LOsrEntry); | 2379 return AssignEnvironment(new(zone()) LOsrEntry); |
2380 } | 2380 } |
2381 | 2381 |
2382 | 2382 |
2383 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2383 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
2384 LParameter* result = new(zone()) LParameter; | 2384 LParameter* result = new(zone()) LParameter; |
2385 if (instr->kind() == HParameter::STACK_PARAMETER) { | 2385 if (instr->kind() == HParameter::STACK_PARAMETER) { |
2386 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2386 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
2387 return DefineAsSpilled(result, spill_index); | 2387 return DefineAsSpilled(result, spill_index); |
2388 } else { | 2388 } else { |
2389 ASSERT(info()->IsStub()); | 2389 DCHECK(info()->IsStub()); |
2390 CodeStubInterfaceDescriptor* descriptor = | 2390 CodeStubInterfaceDescriptor* descriptor = |
2391 info()->code_stub()->GetInterfaceDescriptor(); | 2391 info()->code_stub()->GetInterfaceDescriptor(); |
2392 int index = static_cast<int>(instr->index()); | 2392 int index = static_cast<int>(instr->index()); |
2393 Register reg = descriptor->GetEnvironmentParameterRegister(index); | 2393 Register reg = descriptor->GetEnvironmentParameterRegister(index); |
2394 return DefineFixed(result, reg); | 2394 return DefineFixed(result, reg); |
2395 } | 2395 } |
2396 } | 2396 } |
2397 | 2397 |
2398 | 2398 |
2399 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2399 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 instr->ReplayEnvironment(current_block_->last_environment()); | 2475 instr->ReplayEnvironment(current_block_->last_environment()); |
2476 return NULL; | 2476 return NULL; |
2477 } | 2477 } |
2478 | 2478 |
2479 | 2479 |
2480 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2480 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2481 if (instr->is_function_entry()) { | 2481 if (instr->is_function_entry()) { |
2482 LOperand* context = UseFixed(instr->context(), cp); | 2482 LOperand* context = UseFixed(instr->context(), cp); |
2483 return MarkAsCall(new(zone()) LStackCheck(context), instr); | 2483 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
2484 } else { | 2484 } else { |
2485 ASSERT(instr->is_backwards_branch()); | 2485 DCHECK(instr->is_backwards_branch()); |
2486 LOperand* context = UseAny(instr->context()); | 2486 LOperand* context = UseAny(instr->context()); |
2487 return AssignEnvironment( | 2487 return AssignEnvironment( |
2488 AssignPointerMap(new(zone()) LStackCheck(context))); | 2488 AssignPointerMap(new(zone()) LStackCheck(context))); |
2489 } | 2489 } |
2490 } | 2490 } |
2491 | 2491 |
2492 | 2492 |
2493 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2493 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2494 HEnvironment* outer = current_block_->last_environment(); | 2494 HEnvironment* outer = current_block_->last_environment(); |
2495 outer->set_ast_id(instr->ReturnId()); | 2495 outer->set_ast_id(instr->ReturnId()); |
(...skipping 15 matching lines...) Expand all Loading... |
2511 | 2511 |
2512 | 2512 |
2513 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2513 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2514 LInstruction* pop = NULL; | 2514 LInstruction* pop = NULL; |
2515 | 2515 |
2516 HEnvironment* env = current_block_->last_environment(); | 2516 HEnvironment* env = current_block_->last_environment(); |
2517 | 2517 |
2518 if (env->entry()->arguments_pushed()) { | 2518 if (env->entry()->arguments_pushed()) { |
2519 int argument_count = env->arguments_environment()->parameter_count(); | 2519 int argument_count = env->arguments_environment()->parameter_count(); |
2520 pop = new(zone()) LDrop(argument_count); | 2520 pop = new(zone()) LDrop(argument_count); |
2521 ASSERT(instr->argument_delta() == -argument_count); | 2521 DCHECK(instr->argument_delta() == -argument_count); |
2522 } | 2522 } |
2523 | 2523 |
2524 HEnvironment* outer = current_block_->last_environment()-> | 2524 HEnvironment* outer = current_block_->last_environment()-> |
2525 DiscardInlined(false); | 2525 DiscardInlined(false); |
2526 current_block_->UpdateEnvironment(outer); | 2526 current_block_->UpdateEnvironment(outer); |
2527 | 2527 |
2528 return pop; | 2528 return pop; |
2529 } | 2529 } |
2530 | 2530 |
2531 | 2531 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 LOperand* context = UseFixed(instr->context(), cp); | 2571 LOperand* context = UseFixed(instr->context(), cp); |
2572 LOperand* function = UseRegisterAtStart(instr->function()); | 2572 LOperand* function = UseRegisterAtStart(instr->function()); |
2573 LAllocateBlockContext* result = | 2573 LAllocateBlockContext* result = |
2574 new(zone()) LAllocateBlockContext(context, function); | 2574 new(zone()) LAllocateBlockContext(context, function); |
2575 return MarkAsCall(DefineFixed(result, cp), instr); | 2575 return MarkAsCall(DefineFixed(result, cp), instr); |
2576 } | 2576 } |
2577 | 2577 |
2578 } } // namespace v8::internal | 2578 } } // namespace v8::internal |
2579 | 2579 |
2580 #endif // V8_TARGET_ARCH_MIPS | 2580 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |