X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/a253471d7f8e4d91bf6ebabab00155c3b387d3d0..93a3786624b2768d89bfa27e46598dc64e2fb70a:/dfg/DFGNodeFlags.cpp diff --git a/dfg/DFGNodeFlags.cpp b/dfg/DFGNodeFlags.cpp index 54e6b69..c5753d2 100644 --- a/dfg/DFGNodeFlags.cpp +++ b/dfg/DFGNodeFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,114 +28,81 @@ #if ENABLE(DFG_JIT) -#include +#include namespace JSC { namespace DFG { -const char* nodeFlagsAsString(NodeFlags flags) +void dumpNodeFlags(PrintStream& out, NodeFlags flags) { - if (!flags) - return ""; + if (!(flags ^ NodeDoesNotExit)) { + out.print(""); + return; + } - static const int size = 128; - static char description[size]; - BoundsCheckedPointer ptr(description, size); - - bool hasPrinted = false; + CommaPrinter comma("|"); if (flags & NodeResultMask) { switch (flags & NodeResultMask) { case NodeResultJS: - ptr.strcat("ResultJS"); + out.print(comma, "JS"); break; case NodeResultNumber: - ptr.strcat("ResultNumber"); + out.print(comma, "Number"); break; case NodeResultInt32: - ptr.strcat("ResultInt32"); + out.print(comma, "Int32"); break; case NodeResultBoolean: - ptr.strcat("ResultBoolean"); + out.print(comma, "Boolean"); break; case NodeResultStorage: - ptr.strcat("ResultStorage"); + out.print(comma, "Storage"); break; default: - ASSERT_NOT_REACHED(); + RELEASE_ASSERT_NOT_REACHED(); break; } - hasPrinted = true; } - if (flags & NodeMustGenerate) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("MustGenerate"); - hasPrinted = true; - } + if (flags & NodeMustGenerate) + out.print(comma, "MustGen"); - if (flags & NodeHasVarArgs) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("HasVarArgs"); - hasPrinted = true; - } + if (flags & NodeHasVarArgs) + out.print(comma, "VarArgs"); - if (flags & NodeClobbersWorld) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("ClobbersWorld"); - hasPrinted = true; - } + if (flags & NodeClobbersWorld) + out.print(comma, "Clobbers"); - if (flags & NodeMightClobber) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("MightClobber"); - hasPrinted = true; - } + if (flags & NodeMightClobber) + out.print(comma, "MightClobber"); - if (flags & NodeUsedAsNumber) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("UsedAsNum"); - hasPrinted = true; - } - - if (flags & NodeNeedsNegZero) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("NeedsNegZero"); - hasPrinted = true; + if (flags & NodeResultMask) { + if (!(flags & NodeUsedAsNumber) && !(flags & NodeNeedsNegZero)) + out.print(comma, "PureInt"); + else if (!(flags & NodeUsedAsNumber)) + out.print(comma, "PureInt(w/ neg zero)"); + else if (!(flags & NodeNeedsNegZero)) + out.print(comma, "PureNum"); + if (flags & NodeUsedAsOther) + out.print(comma, "UseAsOther"); } - if (flags & NodeMayOverflow) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("MayOverflow"); - hasPrinted = true; - } + if (flags & NodeMayOverflow) + out.print(comma, "MayOverflow"); - if (flags & NodeMayNegZero) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("MayNegZero"); - hasPrinted = true; - } + if (flags & NodeMayNegZero) + out.print(comma, "MayNegZero"); - if (flags & NodeUsedAsInt) { - if (hasPrinted) - ptr.strcat("|"); - ptr.strcat("UsedAsInt"); - hasPrinted = true; - } + if (flags & NodeUsedAsInt) + out.print(comma, "UseAsInt"); - *ptr++ = 0; + if (!(flags & NodeDoesNotExit)) + out.print(comma, "CanExit"); - return description; + if (flags & NodeExitsForward) + out.print(comma, "NodeExitsForward"); } - } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT)