Reviewers: mvstanton,

Description:
Remove unused bailout reasons.

This also adds a script to the tools directory that allows to grep for
unused bailout reasons. For now the script needs to be run manually.

[email protected]

Please review this at https://codereview.chromium.org/1237623003/

Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-frame-constants-2

Affected files (+16, -31 lines):
  M src/bailout-reason.h
  A tools/check-unused-bailouts.sh


Index: src/bailout-reason.h
diff --git a/src/bailout-reason.h b/src/bailout-reason.h
index 38bad55dce9a8684c713f7a21074369012bd9594..a597165c58d06f46a7920f9aaa308bbe518537cc 100644
--- a/src/bailout-reason.h
+++ b/src/bailout-reason.h
@@ -36,15 +36,10 @@ namespace internal {
"Bad value context for arguments value") \ V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \ V(kBailoutWasNotPrepared, "Bailout was not prepared") \ - V(kBinaryStubGenerateFloatingPointCode, \ - "BinaryStub_GenerateFloatingPointCode") \ V(kBothRegistersWereSmisInSelectNonSmi, \ "Both registers were smis in SelectNonSmi") \ - V(kBuiltinFunctionCannotBeOptimized, "Builtin function cannot be optimized") \ V(kCallToAJavaScriptRuntimeFunction, \ "Call to a JavaScript runtime function") \ - V(kCannotTranslatePositionInChangedArea, \ - "Cannot translate position in changed area") \ V(kClassLiteral, "Class literal") \ V(kCodeGenerationFailed, "Code generation failed") \ V(kCodeObjectNotProperlyPatched, "Code object not properly patched") \
@@ -70,7 +65,6 @@ namespace internal {
V(kEmitLoadRegisterUnsupportedDoubleImmediate, \ "EmitLoadRegister: Unsupported double immediate") \ V(kEval, "eval") \ - V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \ V(kExpectedAlignmentMarker, "Expected alignment marker") \ V(kExpectedAllocationSite, "Expected allocation site") \ V(kExpectedFunctionObject, "Expected function object in register") \
@@ -79,21 +73,12 @@ namespace internal {
V(kExpectedNonIdenticalObjects, "Expected non-identical objects") \ V(kExpectedNonNullContext, "Expected non-null context") \ V(kExpectedPositiveZero, "Expected +0.0") \ - V(kExpectedAllocationSiteInCell, "Expected AllocationSite in property cell") \ - V(kExpectedFixedArrayInFeedbackVector, \ - "Expected fixed array in feedback vector") \ - V(kExpectedFixedArrayInRegisterA2, "Expected fixed array in register a2") \ - V(kExpectedFixedArrayInRegisterEbx, "Expected fixed array in register ebx") \ - V(kExpectedFixedArrayInRegisterR2, "Expected fixed array in register r2") \ - V(kExpectedFixedArrayInRegisterRbx, "Expected fixed array in register rbx") \ V(kExpectedNewSpaceObject, "Expected new space object") \ - V(kExpectedSmiOrHeapNumber, "Expected smi or HeapNumber") \ V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \ V(kExpectingAlignmentForCopyBytes, "Expecting alignment for CopyBytes") \ V(kExportDeclaration, "Export declaration") \ V(kExternalStringExpectedButNotFound, \ "External string expected, but not found") \ - V(kFailedBailedOutLastTime, "Failed/bailed out last time") \ V(kForInStatementOptimizationIsDisabled, \ "ForInStatement optimization is disabled") \ V(kForInStatementWithNonLocalEachVariable, \
@@ -101,7 +86,6 @@ namespace internal {
V(kForOfStatement, "ForOfStatement") \ V(kFrameIsExpectedToBeAligned, "Frame is expected to be aligned") \ V(kFunctionCallsEval, "Function calls eval") \ - V(kFunctionIsAGenerator, "Function is a generator") \ V(kFunctionWithIllegalRedeclaration, "Function with illegal redeclaration") \ V(kGeneratedCodeIsTooLarge, "Generated code is too large") \ V(kGeneratorFailedToResume, "Generator failed to resume") \
@@ -111,8 +95,6 @@ namespace internal {
V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \ V(kHydrogenFilter, "Optimization disabled by filter") \ V(kImportDeclaration, "Import declaration") \ - V(kImproperObjectOnPrototypeChainForStore, \ - "Improper object on prototype chain for store") \ V(kIndexIsNegative, "Index is negative") \ V(kIndexIsTooLarge, "Index is too large") \ V(kInlinedRuntimeFunctionFastOneByteArrayJoin, \
@@ -149,13 +131,11 @@ namespace internal {
V(kJSObjectWithFastElementsMapHasSlowElements, \ "JSObject with fast elements map has slow elements") \ V(kLetBindingReInitialization, "Let binding re-initialization") \ - V(kLhsHasBeenClobbered, "lhs has been clobbered") \ V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \ V(kLiveEdit, "LiveEdit") \ V(kLookupVariableInCountOperation, "Lookup variable in count operation") \ V(kMapBecameDeprecated, "Map became deprecated") \ V(kMapBecameUnstable, "Map became unstable") \ - V(kMapIsNoLongerInEax, "Map is no longer in eax") \ V(kNativeFunctionLiteral, "Native function literal") \ V(kNeedSmiLiteral, "Need a Smi literal here") \ V(kNoCasesLeft, "No cases left") \
@@ -173,8 +153,6 @@ namespace internal {
"Not enough virtual registers (regalloc)") \ V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \ V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \ - V(kOddballInStringTableIsNotUndefinedOrTheHole, \ - "Oddball in string table is not undefined or the hole") \ V(kOffsetOutOfRange, "Offset out of range") \ V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \ V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \
@@ -194,19 +172,15 @@ namespace internal {
"Out of virtual registers while trying to allocate temp register") \ V(kParseScopeError, "Parse/scope error") \ V(kPossibleDirectCallToEval, "Possible direct call to eval") \ - V(kPreconditionsWereNotMet, "Preconditions were not met") \ V(kReceivedInvalidReturnAddress, "Received invalid return address") \ V(kReferenceToAVariableWhichRequiresDynamicLookup, \ "Reference to a variable which requires dynamic lookup") \ V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \ V(kReferenceToUninitializedVariable, "Reference to uninitialized variable") \ V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \ - V(kRegisterWasClobbered, "Register was clobbered") \ V(kRememberedSetPointerInNewSpace, "Remembered set pointer is in new space") \ V(kRestParameter, "Rest parameters") \ V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \ - V(kRhsHasBeenClobbered, "Rhs has been clobbered") \ - V(kScopedBlock, "ScopedBlock") \ V(kScriptContext, "Allocation of script context") \ V(kSmiAdditionOverflow, "Smi addition overflow") \ V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
@@ -234,7 +208,6 @@ namespace internal {
"The instruction to patch should be an ori") \ V(kTheSourceAndDestinationAreTheSame, \ "The source and destination are the same") \ - V(kTheStackPointerIsNotAligned, "The stack pointer is not aligned.") \ V(kTheStackWasCorruptedByMacroAssemblerCall, \ "The stack was corrupted by MacroAssembler::Call()") \ V(kTooManyParametersLocals, "Too many parameters/locals") \
@@ -250,7 +223,6 @@ namespace internal {
V(kUnableToEncodeValueAsSmi, "Unable to encode value as smi") \ V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \ V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \ - V(kUndefinedValueNotLoaded, "Undefined value not loaded") \ V(kUnexpectedAllocationTop, "Unexpected allocation top") \ V(kUnexpectedColorFound, "Unexpected color bit pattern found") \ V(kUnexpectedElementsKindInArrayConstructor, \
@@ -261,8 +233,6 @@ namespace internal {
"Unexpected fallthrough from CharFromCode slow case") \ V(kUnexpectedFallThroughFromStringComparison, \ "Unexpected fall-through from string comparison") \ - V(kUnexpectedFallThroughInBinaryStubGenerateFloatingPointCode, \ - "Unexpected fall-through in BinaryStub_GenerateFloatingPointCode") \ V(kUnexpectedFallthroughToCharCodeAtSlowCase, \ "Unexpected fallthrough to CharCodeAt slow case") \ V(kUnexpectedFallthroughToCharFromCodeSlowCase, \
@@ -293,7 +263,6 @@ namespace internal {
V(kUnexpectedValue, "Unexpected value") \ V(kUnexpectedUnusedPropertiesOfStringWrapper, \ "Unexpected unused properties of string wrapper") \ - V(kUnimplemented, "unimplemented") \ V(kUnsupportedConstCompoundAssignment, \ "Unsupported const compound assignment") \ V(kUnsupportedCountOperationWithConst, \
Index: tools/check-unused-bailouts.sh
diff --git a/tools/check-unused-bailouts.sh b/tools/check-unused-bailouts.sh
new file mode 100755
index 0000000000000000000000000000000000000000..2b5dce1fd0d9ef3ea18cd53c5520c8f28099a665
--- /dev/null
+++ b/tools/check-unused-bailouts.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copyright 2015 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+bailouts=$(grep -oP 'V\(\K(k[^,]*)' "$v8_root/src/bailout-reason.h")
+
+for bailout in $bailouts; do
+  bailout_uses=$(grep -r $bailout "$v8_root/src" | wc -l)
+  if [ $bailout_uses -eq "1" ]; then
+    echo "Bailout reason \"$bailout\" seems to be unused."
+  fi
+done
+
+echo "Kthxbye."


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to