Bug 918321 - Remove some dead code from the JS engine; r=luke

This commit is contained in:
Ehsan Akhgari 2013-09-19 10:34:45 -04:00
parent 33ae841ed4
commit 37d1ee3b1b
13 changed files with 7 additions and 173 deletions

View File

@ -239,12 +239,6 @@ IsBinaryArray(JSContext *cx, HandleObject obj)
return IsBlockOfKind(cx, obj, TypeRepresentation::Array);
}
static inline bool
IsBinaryStruct(JSContext *cx, HandleObject obj)
{
return IsBlockOfKind(cx, obj, TypeRepresentation::Struct);
}
const Class js::DataClass = {
"Data",
JSCLASS_HAS_CACHED_PROTO(JSProto_Data),

View File

@ -605,8 +605,6 @@ EmitNonLocalJumpFixup(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *t
#undef FLUSH_POPS
}
static const jsatomid INVALID_ATOMID = -1;
static ptrdiff_t
EmitGoto(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *toStmt, ptrdiff_t *lastp,
SrcNoteType noteType = SRC_NULL)

View File

@ -164,13 +164,6 @@ CaseBody(ParseNode *pn)
return BinaryRight(pn);
}
static inline JSAtom *
StringAtom(ParseNode *pn)
{
JS_ASSERT(pn->isKind(PNK_STRING));
return pn->pn_atom;
}
static inline bool
IsExpressionStatement(ParseNode *pn)
{
@ -285,19 +278,6 @@ FunctionStatementList(ParseNode *fn)
return last;
}
static inline ParseNode *
FunctionLastReturnStatementOrNull(ParseNode *fn)
{
ParseNode *listIter = ListHead(FunctionStatementList(fn));
ParseNode *lastReturn = NULL;
while (listIter) {
if (listIter->isKind(PNK_RETURN))
lastReturn = listIter;
listIter = listIter->pn_next;
}
return lastReturn;
}
static inline bool
IsNormalObjectField(ExclusiveContext *cx, ParseNode *pn)
{

View File

@ -1180,19 +1180,6 @@ jit::BuildPhiReverseMapping(MIRGraph &graph)
return true;
}
static inline MBasicBlock *
SkipContainedLoop(MBasicBlock *block, MBasicBlock *header)
{
while (block->loopHeader() || block->isLoopHeader()) {
if (block->loopHeader())
block = block->loopHeader();
if (block == header)
break;
block = block->loopPredecessor();
}
return block;
}
#ifdef DEBUG
static bool
CheckSuccessorImpliesPredecessor(MBasicBlock *A, MBasicBlock *B)

View File

@ -695,6 +695,7 @@ MarkCalleeToken(JSTracer *trc, CalleeToken token)
}
}
#ifdef JS_NUNBOX32
static inline uintptr_t
ReadAllocation(const IonFrameIterator &frame, const LAllocation *a)
{
@ -710,6 +711,7 @@ ReadAllocation(const IonFrameIterator &frame, const LAllocation *a)
uint8_t *argv = reinterpret_cast<uint8_t *>(frame.jsFrame()->argv());
return *reinterpret_cast<uintptr_t *>(argv + index);
}
#endif
static void
MarkActualArguments(JSTracer *trc, const IonFrameIterator &frame)
@ -725,6 +727,7 @@ MarkActualArguments(JSTracer *trc, const IonFrameIterator &frame)
gc::MarkValueRoot(trc, &argv[i], "ion-argv");
}
#ifdef JS_NUNBOX32
static inline void
WriteAllocation(const IonFrameIterator &frame, const LAllocation *a, uintptr_t value)
{
@ -742,6 +745,7 @@ WriteAllocation(const IonFrameIterator &frame, const LAllocation *a, uintptr_t v
uint8_t *argv = reinterpret_cast<uint8_t *>(frame.jsFrame()->argv());
*reinterpret_cast<uintptr_t *>(argv + index) = value;
}
#endif
static void
MarkIonJSFrame(JSTracer *trc, const IonFrameIterator &frame)

View File

@ -1328,14 +1328,6 @@ MMod::canBePowerOfTwoDivisor() const
return true;
}
static inline MDefinition *
TryFold(MDefinition *original, MDefinition *replacement)
{
if (original->type() == replacement->type())
return replacement;
return original;
}
MDefinition *
MMod::foldsTo(bool useValueNumbers)
{

View File

@ -8455,7 +8455,7 @@ class MAsmJSStoreHeap : public MBinaryInstruction, public MAsmJSHeapAccess
class MAsmJSLoadGlobalVar : public MNullaryInstruction
{
MAsmJSLoadGlobalVar(MIRType type, unsigned globalDataOffset, bool isConstant)
: globalDataOffset_(globalDataOffset), isConstant_(isConstant)
: globalDataOffset_(globalDataOffset)
{
JS_ASSERT(type == MIRType_Int32 || type == MIRType_Double);
setResultType(type);
@ -8463,7 +8463,6 @@ class MAsmJSLoadGlobalVar : public MNullaryInstruction
}
unsigned globalDataOffset_;
bool isConstant_;
public:
INSTRUCTION_HEADER(AsmJSLoadGlobalVar);

View File

@ -15,10 +15,10 @@
using namespace js;
using namespace js::crash;
static const int stack_snapshot_max_size = 32768;
#if defined(XP_WIN)
static const int stack_snapshot_max_size = 32768;
#include <windows.h>
static bool

View File

@ -52,11 +52,6 @@ id_prototype(JSContext *cx) {
return NameToId(cx->names().classPrototype);
}
static inline jsid
id_length(JSContext *cx) {
return NameToId(cx->names().length);
}
static inline jsid
id___proto__(JSContext *cx) {
return NameToId(cx->names().proto);
@ -2737,24 +2732,6 @@ TypeObject::print()
// Type Analysis
/////////////////////////////////////////////////////////////////////
static inline TypeObject *
GetInitializerType(JSContext *cx, JSScript *script, jsbytecode *pc)
{
if (!script->compileAndGo)
return NULL;
JSOp op = JSOp(*pc);
JS_ASSERT(op == JSOP_NEWARRAY || op == JSOP_NEWOBJECT || op == JSOP_NEWINIT);
bool isArray = (op == JSOP_NEWARRAY || (op == JSOP_NEWINIT && GET_UINT8(pc) == JSProto_Array));
JSProtoKey key = isArray ? JSProto_Array : JSProto_Object;
if (UseNewTypeForInitializer(cx, script, pc, key))
return NULL;
return TypeScript::InitObject(cx, script, pc, key);
}
/*
* Persistent constraint clearing out newScript and definite properties from
* an object should a property on another object get a getter or setter.
@ -3200,78 +3177,6 @@ types::UseNewTypeForClone(JSFunction *fun)
// TypeScript
/////////////////////////////////////////////////////////////////////
/*
* Returns true if we don't expect to compute the correct types for some value
* pushed by the specified bytecode.
*/
static inline bool
IgnorePushed(const jsbytecode *pc, unsigned index)
{
switch (JSOp(*pc)) {
/* We keep track of the scopes pushed by BINDNAME separately. */
case JSOP_BINDNAME:
case JSOP_BINDGNAME:
case JSOP_BINDINTRINSIC:
return true;
/* Stack not consistent in TRY_BRANCH_AFTER_COND. */
case JSOP_IN:
case JSOP_EQ:
case JSOP_NE:
case JSOP_LT:
case JSOP_LE:
case JSOP_GT:
case JSOP_GE:
return (index == 0);
/* Value not determining result is not pushed by OR/AND. */
case JSOP_OR:
case JSOP_AND:
return (index == 0);
/* Holes tracked separately. */
case JSOP_HOLE:
return (index == 0);
/* Storage for 'with' and 'let' blocks not monitored. */
case JSOP_ENTERWITH:
case JSOP_ENTERBLOCK:
case JSOP_ENTERLET0:
case JSOP_ENTERLET1:
return true;
/* We don't keep track of the iteration state for 'for in' or 'for each in' loops. */
case JSOP_ITER:
case JSOP_ITERNEXT:
case JSOP_MOREITER:
case JSOP_ENDITER:
return true;
/* Ops which can manipulate values pushed by opcodes we don't model. */
case JSOP_DUP:
case JSOP_DUP2:
case JSOP_SWAP:
case JSOP_PICK:
return true;
/* We don't keep track of state indicating whether there is a pending exception. */
case JSOP_FINALLY:
return true;
/*
* We don't treat GETLOCAL immediately followed by a pop as a use-before-def,
* and while the type will have been inferred correctly the method JIT
* may not have written the local's initial undefined value to the stack,
* leaving a stale value.
*/
case JSOP_GETLOCAL:
return JSOp(pc[JSOP_GETLOCAL_LENGTH]) == JSOP_POP;
default:
return false;
}
}
bool
JSScript::makeTypes(JSContext *cx)
{

View File

@ -1963,7 +1963,6 @@ JSScript::finalize(FreeOp *fop)
}
static const uint32_t GSN_CACHE_THRESHOLD = 100;
static const uint32_t GSN_CACHE_MAP_INIT_SIZE = 20;
void
GSNCache::purge()

View File

@ -2718,13 +2718,6 @@ GetScriptReferent(JSObject *obj)
return static_cast<JSScript *>(obj->getPrivate());
}
static inline void
SetScriptReferent(JSObject *obj, JSScript *script)
{
JS_ASSERT(obj->getClass() == &DebuggerScript_class);
obj->setPrivateGCThing(script);
}
static void
DebuggerScript_trace(JSTracer *trc, JSObject *obj)
{

View File

@ -60,17 +60,6 @@ using namespace js::types;
using mozilla::DebugOnly;
using mozilla::PodCopy;
/* Some objects (e.g., With) delegate 'this' to another object. */
static inline JSObject *
CallThisObjectHook(JSContext *cx, HandleObject obj, Value *argv)
{
JSObject *thisp = JSObject::thisObject(cx, obj);
if (!thisp)
return NULL;
argv[-1].setObject(*thisp);
return thisp;
}
/*
* Note: when Clang 3.2 (32-bit) inlines the two functions below in Interpret,
* the conservative stack scanner leaks a ton of memory and this negatively

View File

@ -1302,11 +1302,6 @@ template<> inline const int TypeIDOfType<float>() { return ScalarTypeRepresentat
template<> inline const int TypeIDOfType<double>() { return ScalarTypeRepresentation::TYPE_FLOAT64; }
template<> inline const int TypeIDOfType<uint8_clamped>() { return ScalarTypeRepresentation::TYPE_UINT8_CLAMPED; }
template<typename NativeType> static inline const bool ElementTypeMayBeDouble() { return false; }
template<> inline const bool ElementTypeMayBeDouble<uint32_t>() { return true; }
template<> inline const bool ElementTypeMayBeDouble<float>() { return true; }
template<> inline const bool ElementTypeMayBeDouble<double>() { return true; }
template<typename ElementType>
static inline JSObject *
NewArray(JSContext *cx, uint32_t nelements);
@ -1334,7 +1329,6 @@ class TypedArrayObjectTemplate : public TypedArrayObject
static const int ArrayTypeID() { return TypeIDOfType<NativeType>(); }
static const bool ArrayTypeIsUnsigned() { return TypeIsUnsigned<NativeType>(); }
static const bool ArrayTypeIsFloatingPoint() { return TypeIsFloatingPoint<NativeType>(); }
static const bool ArrayElementTypeMayBeDouble() { return ElementTypeMayBeDouble<NativeType>(); }
static const size_t BYTES_PER_ELEMENT = sizeof(ThisType);