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

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

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); 554 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE));
555 } 555 }
556 556
557 557
558 LOperand* LChunkBuilder::UseAtStart(HValue* value) { 558 LOperand* LChunkBuilder::UseAtStart(HValue* value) {
559 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, 559 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE,
560 LUnallocated::USED_AT_START)); 560 LUnallocated::USED_AT_START));
561 } 561 }
562 562
563 563
564 static inline bool CanBeImmediateConstant(HValue* value) {
565 return value->IsConstant() && HConstant::cast(value)->NotInNewSpace();
566 }
567
568
564 LOperand* LChunkBuilder::UseOrConstant(HValue* value) { 569 LOperand* LChunkBuilder::UseOrConstant(HValue* value) {
565 return value->IsConstant() 570 return CanBeImmediateConstant(value)
566 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 571 ? chunk_->DefineConstantOperand(HConstant::cast(value))
567 : Use(value); 572 : Use(value);
568 } 573 }
569 574
570 575
571 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) { 576 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) {
572 return value->IsConstant() 577 return CanBeImmediateConstant(value)
573 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 578 ? chunk_->DefineConstantOperand(HConstant::cast(value))
574 : UseAtStart(value); 579 : UseAtStart(value);
575 } 580 }
576 581
577 582
578 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) { 583 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) {
579 return value->IsConstant() 584 return CanBeImmediateConstant(value)
580 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 585 ? chunk_->DefineConstantOperand(HConstant::cast(value))
581 : UseRegister(value); 586 : UseRegister(value);
582 } 587 }
583 588
584 589
585 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { 590 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
586 return value->IsConstant() 591 return CanBeImmediateConstant(value)
587 ? chunk_->DefineConstantOperand(HConstant::cast(value)) 592 ? chunk_->DefineConstantOperand(HConstant::cast(value))
588 : UseRegisterAtStart(value); 593 : UseRegisterAtStart(value);
589 } 594 }
590 595
591 596
592 LOperand* LChunkBuilder::UseConstant(HValue* value) { 597 LOperand* LChunkBuilder::UseConstant(HValue* value) {
593 return chunk_->DefineConstantOperand(HConstant::cast(value)); 598 return chunk_->DefineConstantOperand(HConstant::cast(value));
594 } 599 }
595 600
596 601
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 if (needs_environment && !instr->HasEnvironment()) { 706 if (needs_environment && !instr->HasEnvironment()) {
702 instr = AssignEnvironment(instr); 707 instr = AssignEnvironment(instr);
703 } 708 }
704 709
705 return instr; 710 return instr;
706 } 711 }
707 712
708 713
709 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { 714 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
710 ASSERT(!instr->HasPointerMap()); 715 ASSERT(!instr->HasPointerMap());
711 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); 716 instr->set_pointer_map(new(zone()) LPointerMap(zone()));
712 return instr; 717 return instr;
713 } 718 }
714 719
715 720
716 LUnallocated* LChunkBuilder::TempRegister() { 721 LUnallocated* LChunkBuilder::TempRegister() {
717 LUnallocated* operand = 722 LUnallocated* operand =
718 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); 723 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER);
719 int vreg = allocator_->GetVirtualRegister(); 724 int vreg = allocator_->GetVirtualRegister();
720 if (!allocator_->AllocationOk()) { 725 if (!allocator_->AllocationOk()) {
721 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); 726 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 906 }
902 block->set_argument_count(argument_count_); 907 block->set_argument_count(argument_count_);
903 next_block_ = NULL; 908 next_block_ = NULL;
904 current_block_ = NULL; 909 current_block_ = NULL;
905 } 910 }
906 911
907 912
908 void LChunkBuilder::VisitInstruction(HInstruction* current) { 913 void LChunkBuilder::VisitInstruction(HInstruction* current) {
909 HInstruction* old_current = current_instruction_; 914 HInstruction* old_current = current_instruction_;
910 current_instruction_ = current; 915 current_instruction_ = current;
911 if (current->has_position()) position_ = current->position();
912 916
913 LInstruction* instr = NULL; 917 LInstruction* instr = NULL;
914 if (current->CanReplaceWithDummyUses()) { 918 if (current->CanReplaceWithDummyUses()) {
915 HValue* first_operand = current->OperandCount() == 0 919 HValue* first_operand = current->OperandCount() == 0
916 ? graph()->GetConstant1() 920 ? graph()->GetConstant1()
917 : current->OperandAt(0); 921 : current->OperandAt(0);
918 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); 922 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
919 for (int i = 1; i < current->OperandCount(); ++i) { 923 for (int i = 1; i < current->OperandCount(); ++i) {
920 LInstruction* dummy = 924 LInstruction* dummy =
921 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); 925 new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; 960 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
957 } 961 }
958 for (TempIterator it(instr); !it.Done(); it.Advance()) { 962 for (TempIterator it(instr); !it.Done(); it.Advance()) {
959 LUnallocated* operand = LUnallocated::cast(it.Current()); 963 LUnallocated* operand = LUnallocated::cast(it.Current());
960 if (operand->HasFixedPolicy()) ++fixed; 964 if (operand->HasFixedPolicy()) ++fixed;
961 } 965 }
962 ASSERT(fixed == 0 || used_at_start == 0); 966 ASSERT(fixed == 0 || used_at_start == 0);
963 } 967 }
964 #endif 968 #endif
965 969
966 instr->set_position(position_);
967 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 970 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
968 instr = AssignPointerMap(instr); 971 instr = AssignPointerMap(instr);
969 } 972 }
970 if (FLAG_stress_environments && !instr->HasEnvironment()) { 973 if (FLAG_stress_environments && !instr->HasEnvironment()) {
971 instr = AssignEnvironment(instr); 974 instr = AssignEnvironment(instr);
972 } 975 }
973 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && instr->IsGoto() && 976 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && instr->IsGoto() &&
974 LGoto::cast(instr)->jumps_to_join()) { 977 LGoto::cast(instr)->jumps_to_join()) {
975 // TODO(olivf) Since phis of spilled values are joined as registers 978 // TODO(olivf) Since phis of spilled values are joined as registers
976 // (not in the stack slot), we need to allow the goto gaps to keep one 979 // (not in the stack slot), we need to allow the goto gaps to keep one
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 HInstanceOfKnownGlobal* instr) { 1146 HInstanceOfKnownGlobal* instr) {
1144 LInstanceOfKnownGlobal* result = 1147 LInstanceOfKnownGlobal* result =
1145 new(zone()) LInstanceOfKnownGlobal( 1148 new(zone()) LInstanceOfKnownGlobal(
1146 UseFixed(instr->context(), esi), 1149 UseFixed(instr->context(), esi),
1147 UseFixed(instr->left(), InstanceofStub::left()), 1150 UseFixed(instr->left(), InstanceofStub::left()),
1148 FixedTemp(edi)); 1151 FixedTemp(edi));
1149 return MarkAsCall(DefineFixed(result, eax), instr); 1152 return MarkAsCall(DefineFixed(result, eax), instr);
1150 } 1153 }
1151 1154
1152 1155
1153 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) {
1154 LOperand* object = UseRegisterAtStart(instr->object());
1155 return DefineAsRegister(new(zone()) LInstanceSize(object));
1156 }
1157
1158
1159 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1156 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1160 LOperand* receiver = UseRegister(instr->receiver()); 1157 LOperand* receiver = UseRegister(instr->receiver());
1161 LOperand* function = UseRegisterAtStart(instr->function()); 1158 LOperand* function = UseRegisterAtStart(instr->function());
1162 LOperand* temp = TempRegister(); 1159 LOperand* temp = TempRegister();
1163 LWrapReceiver* result = 1160 LWrapReceiver* result =
1164 new(zone()) LWrapReceiver(receiver, function, temp); 1161 new(zone()) LWrapReceiver(receiver, function, temp);
1165 return AssignEnvironment(DefineSameAsFirst(result)); 1162 return AssignEnvironment(DefineSameAsFirst(result));
1166 } 1163 }
1167 1164
1168 1165
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 ASSERT(instr->right()->representation().Equals(r)); 1721 ASSERT(instr->right()->representation().Equals(r));
1725 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1722 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1726 LOperand* right = UseOrConstantAtStart(instr->right()); 1723 LOperand* right = UseOrConstantAtStart(instr->right());
1727 return new(zone()) LCompareNumericAndBranch(left, right); 1724 return new(zone()) LCompareNumericAndBranch(left, right);
1728 } else { 1725 } else {
1729 ASSERT(r.IsDouble()); 1726 ASSERT(r.IsDouble());
1730 ASSERT(instr->left()->representation().IsDouble()); 1727 ASSERT(instr->left()->representation().IsDouble());
1731 ASSERT(instr->right()->representation().IsDouble()); 1728 ASSERT(instr->right()->representation().IsDouble());
1732 LOperand* left; 1729 LOperand* left;
1733 LOperand* right; 1730 LOperand* right;
1734 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { 1731 if (CanBeImmediateConstant(instr->left()) &&
1735 left = UseRegisterOrConstantAtStart(instr->left()); 1732 CanBeImmediateConstant(instr->right())) {
1736 right = UseRegisterOrConstantAtStart(instr->right()); 1733 // The code generator requires either both inputs to be constant
1734 // operands, or neither.
1735 left = UseConstant(instr->left());
1736 right = UseConstant(instr->right());
1737 } else { 1737 } else {
1738 left = UseRegisterAtStart(instr->left()); 1738 left = UseRegisterAtStart(instr->left());
1739 right = UseRegisterAtStart(instr->right()); 1739 right = UseRegisterAtStart(instr->right());
1740 } 1740 }
1741 return new(zone()) LCompareNumericAndBranch(left, right); 1741 return new(zone()) LCompareNumericAndBranch(left, right);
1742 } 1742 }
1743 } 1743 }
1744 1744
1745 1745
1746 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1746 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 LOperand* value = UseRegister(instr->value()); 1925 LOperand* value = UseRegister(instr->value());
1926 return DefineSameAsFirst(new(zone()) LDummyUse(value)); 1926 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1927 } 1927 }
1928 from = Representation::Tagged(); 1928 from = Representation::Tagged();
1929 } 1929 }
1930 // Only mark conversions that might need to allocate as calling rather than 1930 // Only mark conversions that might need to allocate as calling rather than
1931 // all changes. This makes simple, non-allocating conversion not have to force 1931 // all changes. This makes simple, non-allocating conversion not have to force
1932 // building a stack frame. 1932 // building a stack frame.
1933 if (from.IsTagged()) { 1933 if (from.IsTagged()) {
1934 if (to.IsDouble()) { 1934 if (to.IsDouble()) {
1935 info()->MarkAsDeferredCalling();
1936 LOperand* value = UseRegister(instr->value()); 1935 LOperand* value = UseRegister(instr->value());
1937 // Temp register only necessary for minus zero check. 1936 // Temp register only necessary for minus zero check.
1938 LOperand* temp = TempRegister(); 1937 LOperand* temp = TempRegister();
1939 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); 1938 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp);
1940 return AssignEnvironment(DefineAsRegister(res)); 1939 return AssignEnvironment(DefineAsRegister(res));
1941 } else if (to.IsSmi()) { 1940 } else if (to.IsSmi()) {
1942 HValue* val = instr->value(); 1941 HValue* val = instr->value();
1943 LOperand* value = UseRegister(val); 1942 LOperand* value = UseRegister(val);
1944 if (val->type().IsSmi()) { 1943 if (val->type().IsSmi()) {
1945 return DefineSameAsFirst(new(zone()) LDummyUse(value)); 1944 return DefineSameAsFirst(new(zone()) LDummyUse(value));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 : NULL; 1995 : NULL;
1997 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); 1996 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1998 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1997 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1999 } else { 1998 } else {
2000 LNumberTagI* result = new(zone()) LNumberTagI(value); 1999 LNumberTagI* result = new(zone()) LNumberTagI(value);
2001 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 2000 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
2002 } 2001 }
2003 } else if (to.IsSmi()) { 2002 } else if (to.IsSmi()) {
2004 HValue* val = instr->value(); 2003 HValue* val = instr->value();
2005 LOperand* value = UseRegister(val); 2004 LOperand* value = UseRegister(val);
2006 LInstruction* result = 2005 LInstruction* result = val->CheckFlag(HInstruction::kUint32)
2007 DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); 2006 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value))
2007 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value));
2008 if (val->HasRange() && val->range()->IsInSmiRange()) { 2008 if (val->HasRange() && val->range()->IsInSmiRange()) {
2009 return result; 2009 return result;
2010 } 2010 }
2011 return AssignEnvironment(result); 2011 return AssignEnvironment(result);
2012 } else { 2012 } else {
2013 ASSERT(to.IsDouble()); 2013 ASSERT(to.IsDouble());
2014 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 2014 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
2015 LOperand* temp = FixedTemp(xmm1); 2015 LOperand* temp = FixedTemp(xmm1);
2016 return DefineAsRegister( 2016 return DefineAsRegister(
2017 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); 2017 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2736 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2737 LOperand* object = UseRegister(instr->object()); 2737 LOperand* object = UseRegister(instr->object());
2738 LOperand* index = UseTempRegister(instr->index()); 2738 LOperand* index = UseTempRegister(instr->index());
2739 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2739 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2740 } 2740 }
2741 2741
2742 2742
2743 } } // namespace v8::internal 2743 } } // namespace v8::internal
2744 2744
2745 #endif // V8_TARGET_ARCH_IA32 2745 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698