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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 222263002: Fix approximation of CanDeoptimize() and other small store elimination fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 8 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 | « no previous file | src/hydrogen-store-elimination.cc » ('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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // Verify that all uses are in the graph. 835 // Verify that all uses are in the graph.
836 for (HUseIterator use = uses(); !use.Done(); use.Advance()) { 836 for (HUseIterator use = uses(); !use.Done(); use.Advance()) {
837 if (use.value()->IsInstruction()) { 837 if (use.value()->IsInstruction()) {
838 ASSERT(HInstruction::cast(use.value())->IsLinked()); 838 ASSERT(HInstruction::cast(use.value())->IsLinked());
839 } 839 }
840 } 840 }
841 } 841 }
842 #endif 842 #endif
843 843
844 844
845 static bool HasPrimitiveRepresentation(HValue* instr) {
846 return instr->representation().IsInteger32() ||
847 instr->representation().IsDouble();
848 }
849
850
851 bool HInstruction::CanDeoptimize() { 845 bool HInstruction::CanDeoptimize() {
852 // TODO(titzer): make this a virtual method? 846 // TODO(titzer): make this a virtual method?
853 switch (opcode()) { 847 switch (opcode()) {
848 case HValue::kAbnormalExit:
854 case HValue::kAccessArgumentsAt: 849 case HValue::kAccessArgumentsAt:
855 case HValue::kApplyArguments: 850 case HValue::kAllocate:
856 case HValue::kArgumentsElements: 851 case HValue::kArgumentsElements:
857 case HValue::kArgumentsLength: 852 case HValue::kArgumentsLength:
858 case HValue::kArgumentsObject: 853 case HValue::kArgumentsObject:
854 case HValue::kBlockEntry:
859 case HValue::kBoundsCheckBaseIndexInformation: 855 case HValue::kBoundsCheckBaseIndexInformation:
856 case HValue::kCallFunction:
857 case HValue::kCallJSFunction:
858 case HValue::kCallNew:
859 case HValue::kCallNewArray:
860 case HValue::kCallStub:
861 case HValue::kCallWithDescriptor:
860 case HValue::kCapturedObject: 862 case HValue::kCapturedObject:
861 case HValue::kClampToUint8: 863 case HValue::kClassOfTestAndBranch:
864 case HValue::kCompareGeneric:
865 case HValue::kCompareHoleAndBranch:
866 case HValue::kCompareMap:
867 case HValue::kCompareMinusZeroAndBranch:
868 case HValue::kCompareNumericAndBranch:
869 case HValue::kCompareObjectEqAndBranch:
862 case HValue::kConstant: 870 case HValue::kConstant:
871 case HValue::kConstructDouble:
863 case HValue::kContext: 872 case HValue::kContext:
864 case HValue::kDateField:
865 case HValue::kDebugBreak: 873 case HValue::kDebugBreak:
866 case HValue::kDeclareGlobals: 874 case HValue::kDeclareGlobals:
867 case HValue::kDiv: 875 case HValue::kDoubleBits:
868 case HValue::kDummyUse: 876 case HValue::kDummyUse:
869 case HValue::kEnterInlined: 877 case HValue::kEnterInlined:
870 case HValue::kEnvironmentMarker: 878 case HValue::kEnvironmentMarker:
871 case HValue::kForInCacheArray: 879 case HValue::kForceRepresentation:
872 case HValue::kForInPrepareMap:
873 case HValue::kFunctionLiteral:
874 case HValue::kGetCachedArrayIndex: 880 case HValue::kGetCachedArrayIndex:
875 case HValue::kGoto: 881 case HValue::kGoto:
882 case HValue::kHasCachedArrayIndexAndBranch:
883 case HValue::kHasInstanceTypeAndBranch:
876 case HValue::kInnerAllocatedObject: 884 case HValue::kInnerAllocatedObject:
877 case HValue::kInstanceOf: 885 case HValue::kInstanceOf:
878 case HValue::kInstanceOfKnownGlobal: 886 case HValue::kInstanceOfKnownGlobal:
879 case HValue::kInvokeFunction: 887 case HValue::kIsConstructCallAndBranch:
888 case HValue::kIsObjectAndBranch:
889 case HValue::kIsSmiAndBranch:
890 case HValue::kIsStringAndBranch:
891 case HValue::kIsUndetectableAndBranch:
880 case HValue::kLeaveInlined: 892 case HValue::kLeaveInlined:
881 case HValue::kLoadContextSlot:
882 case HValue::kLoadFieldByIndex: 893 case HValue::kLoadFieldByIndex:
883 case HValue::kLoadFunctionPrototype:
884 case HValue::kLoadGlobalCell:
885 case HValue::kLoadGlobalGeneric: 894 case HValue::kLoadGlobalGeneric:
886 case HValue::kLoadKeyed:
887 case HValue::kLoadKeyedGeneric:
888 case HValue::kLoadNamedField: 895 case HValue::kLoadNamedField:
889 case HValue::kLoadNamedGeneric: 896 case HValue::kLoadNamedGeneric:
890 case HValue::kLoadRoot: 897 case HValue::kLoadRoot:
891 case HValue::kMapEnumLength: 898 case HValue::kMapEnumLength:
899 case HValue::kMathMinMax:
900 case HValue::kParameter:
901 case HValue::kPhi:
902 case HValue::kPushArgument:
903 case HValue::kRegExpLiteral:
904 case HValue::kReturn:
905 case HValue::kRor:
906 case HValue::kSar:
907 case HValue::kSeqStringGetChar:
908 case HValue::kStoreCodeEntry:
909 case HValue::kStoreKeyed:
910 case HValue::kStoreNamedGeneric:
911 case HValue::kStringCharCodeAt:
912 case HValue::kStringCharFromCode:
913 case HValue::kThisFunction:
914 case HValue::kTypeofIsAndBranch:
915 case HValue::kUnknownOSRValue:
916 case HValue::kUseConst:
917 return false;
918
919 case HValue::kAdd:
920 case HValue::kApplyArguments:
921 case HValue::kBitwise:
922 case HValue::kBoundsCheck:
923 case HValue::kBranch:
924 case HValue::kCallRuntime:
925 case HValue::kChange:
926 case HValue::kCheckHeapObject:
927 case HValue::kCheckInstanceType:
928 case HValue::kCheckMapValue:
929 case HValue::kCheckMaps:
930 case HValue::kCheckSmi:
931 case HValue::kCheckValue:
932 case HValue::kClampToUint8:
933 case HValue::kDateField:
934 case HValue::kDeoptimize:
935 case HValue::kDiv:
936 case HValue::kForInCacheArray:
937 case HValue::kForInPrepareMap:
938 case HValue::kFunctionLiteral:
939 case HValue::kInvokeFunction:
940 case HValue::kLoadContextSlot:
941 case HValue::kLoadFunctionPrototype:
942 case HValue::kLoadGlobalCell:
943 case HValue::kLoadKeyed:
944 case HValue::kLoadKeyedGeneric:
892 case HValue::kMathFloorOfDiv: 945 case HValue::kMathFloorOfDiv:
893 case HValue::kMathMinMax:
894 case HValue::kMod: 946 case HValue::kMod:
895 case HValue::kMul: 947 case HValue::kMul:
896 case HValue::kOsrEntry: 948 case HValue::kOsrEntry:
897 case HValue::kParameter:
898 case HValue::kPower: 949 case HValue::kPower:
899 case HValue::kPushArgument:
900 case HValue::kRor:
901 case HValue::kSar:
902 case HValue::kSeqStringGetChar:
903 case HValue::kSeqStringSetChar: 950 case HValue::kSeqStringSetChar:
904 case HValue::kShl: 951 case HValue::kShl:
905 case HValue::kShr: 952 case HValue::kShr:
906 case HValue::kSimulate: 953 case HValue::kSimulate:
907 case HValue::kStackCheck: 954 case HValue::kStackCheck:
908 case HValue::kStoreCodeEntry:
909 case HValue::kStoreContextSlot: 955 case HValue::kStoreContextSlot:
910 case HValue::kStoreGlobalCell: 956 case HValue::kStoreGlobalCell:
911 case HValue::kStoreKeyed:
912 case HValue::kStoreKeyedGeneric: 957 case HValue::kStoreKeyedGeneric:
913 case HValue::kStoreNamedField: 958 case HValue::kStoreNamedField:
914 case HValue::kStoreNamedGeneric:
915 case HValue::kStringAdd: 959 case HValue::kStringAdd:
916 case HValue::kStringCharCodeAt: 960 case HValue::kStringCompareAndBranch:
917 case HValue::kStringCharFromCode:
918 case HValue::kSub: 961 case HValue::kSub:
919 case HValue::kThisFunction:
920 case HValue::kToFastProperties: 962 case HValue::kToFastProperties:
921 case HValue::kTransitionElementsKind: 963 case HValue::kTransitionElementsKind:
922 case HValue::kTrapAllocationMemento: 964 case HValue::kTrapAllocationMemento:
923 case HValue::kTypeof: 965 case HValue::kTypeof:
924 case HValue::kUnaryMathOperation: 966 case HValue::kUnaryMathOperation:
925 case HValue::kUseConst:
926 case HValue::kWrapReceiver: 967 case HValue::kWrapReceiver:
927 return false;
928 case HValue::kForceRepresentation:
929 case HValue::kAdd:
930 case HValue::kBitwise:
931 case HValue::kChange:
932 case HValue::kCompareGeneric:
933 // These instructions might deoptimize if they are not primitive.
934 if (!HasPrimitiveRepresentation(this)) return true;
935 for (int i = 0; i < OperandCount(); i++) {
936 HValue* input = OperandAt(i);
937 if (!HasPrimitiveRepresentation(input)) return true;
938 }
939 return false;
940 default:
941 return true; 968 return true;
942 } 969 }
970 UNREACHABLE();
971 return true;
943 } 972 }
944 973
945 974
946 void HDummyUse::PrintDataTo(StringStream* stream) { 975 void HDummyUse::PrintDataTo(StringStream* stream) {
947 value()->PrintNameTo(stream); 976 value()->PrintNameTo(stream);
948 } 977 }
949 978
950 979
951 void HEnvironmentMarker::PrintDataTo(StringStream* stream) { 980 void HEnvironmentMarker::PrintDataTo(StringStream* stream) {
952 stream->Add("%s var[%d]", kind() == BIND ? "bind" : "lookup", index()); 981 stream->Add("%s var[%d]", kind() == BIND ? "bind" : "lookup", index());
(...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4697 break; 4726 break;
4698 case kExternalMemory: 4727 case kExternalMemory:
4699 stream->Add("[external-memory]"); 4728 stream->Add("[external-memory]");
4700 break; 4729 break;
4701 } 4730 }
4702 4731
4703 stream->Add("@%d", offset()); 4732 stream->Add("@%d", offset());
4704 } 4733 }
4705 4734
4706 } } // namespace v8::internal 4735 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-store-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698