Bug 1417028 - Shrink VMFunction size. r=nbp

This commit is contained in:
Jan de Mooij 2017-11-15 09:51:01 +01:00
parent ac5c31d028
commit 4d75391b6b

View File

@ -27,7 +27,7 @@ class TypedArrayObject;
namespace jit {
enum DataType {
enum DataType : uint8_t {
Type_Void,
Type_Bool,
Type_Int32,
@ -40,14 +40,14 @@ enum DataType {
struct PopValues
{
uint32_t numValues;
uint8_t numValues;
explicit PopValues(uint32_t numValues)
explicit constexpr PopValues(uint8_t numValues)
: numValues(numValues)
{ }
};
enum MaybeTailCall {
enum MaybeTailCall : bool {
TailCall,
NonTailCall
};
@ -72,11 +72,24 @@ struct VMFunction
// Address of the C function.
void* wrapped;
#ifdef JS_TRACE_LOGGING
const char* name_;
#endif
// Number of arguments expected, excluding JSContext * as an implicit
// first argument and an outparam as a possible implicit final argument.
uint32_t explicitArgs;
// Note: a maximum of seven root types is supported.
enum RootType : uint8_t {
RootNone = 0,
RootObject,
RootString,
RootId,
RootFunction,
RootValue,
RootCell
};
// Contains an combination of enumerated types used by the gc for marking
// arguments of the VM wrapper.
uint64_t argumentRootTypes;
enum ArgProperties {
WordByValue = 0,
@ -96,6 +109,13 @@ struct VMFunction
// have them.
uint32_t argumentPassedInFloatRegs;
// Number of arguments expected, excluding JSContext * as an implicit
// first argument and an outparam as a possible implicit final argument.
uint8_t explicitArgs;
// The root type of the out param if outParam == Type_Handle.
RootType outParamRootType;
// The outparam may be any Type_*, and must be the final argument to the
// function, if not Void. outParam != Void implies that the return type
// has a boolean failure mode.
@ -110,28 +130,10 @@ struct VMFunction
// nullptr before discarding its value.
DataType returnType;
// Note: a maximum of seven root types is supported.
enum RootType {
RootNone = 0,
RootObject,
RootString,
RootId,
RootFunction,
RootValue,
RootCell
};
// Contains an combination of enumerated types used by the gc for marking
// arguments of the VM wrapper.
uint64_t argumentRootTypes;
// The root type of the out param if outParam == Type_Handle.
RootType outParamRootType;
// Number of Values the VM wrapper should pop from the stack when it returns.
// Used by baseline IC stubs so that they can use tail calls to call the VM
// wrapper.
uint32_t extraValuesToPop;
uint8_t extraValuesToPop;
// On some architectures, called functions need to explicitly push their
// return address, for a tail call, there is nothing to push, so tail-callness
@ -159,9 +161,11 @@ struct VMFunction
return ((argumentPassedInFloatRegs >> explicitArg) & 1) == 1;
}
#ifdef JS_TRACE_LOGGING
const char* name() const {
return name_;
}
#endif
// Return the stack size consumed by explicit arguments.
size_t explicitStackSlots() const {
@ -233,17 +237,19 @@ struct VMFunction
VMFunction(void* wrapped, const char* name, uint32_t explicitArgs, uint32_t argumentProperties,
uint32_t argumentPassedInFloatRegs, uint64_t argRootTypes,
DataType outParam, RootType outParamRootType, DataType returnType,
uint32_t extraValuesToPop = 0, MaybeTailCall expectTailCall = NonTailCall)
uint8_t extraValuesToPop = 0, MaybeTailCall expectTailCall = NonTailCall)
: next(nullptr),
wrapped(wrapped),
#ifdef JS_TRACE_LOGGING
name_(name),
explicitArgs(explicitArgs),
#endif
argumentRootTypes(argRootTypes),
argumentProperties(argumentProperties),
argumentPassedInFloatRegs(argumentPassedInFloatRegs),
explicitArgs(explicitArgs),
outParamRootType(outParamRootType),
outParam(outParam),
returnType(returnType),
argumentRootTypes(argRootTypes),
outParamRootType(outParamRootType),
extraValuesToPop(extraValuesToPop),
expectTailCall(expectTailCall)
{ }
@ -251,14 +257,16 @@ struct VMFunction
VMFunction(const VMFunction& o)
: next(nullptr),
wrapped(o.wrapped),
#ifdef JS_TRACE_LOGGING
name_(o.name_),
explicitArgs(o.explicitArgs),
#endif
argumentRootTypes(o.argumentRootTypes),
argumentProperties(o.argumentProperties),
argumentPassedInFloatRegs(o.argumentPassedInFloatRegs),
explicitArgs(o.explicitArgs),
outParamRootType(o.outParamRootType),
outParam(o.outParam),
returnType(o.returnType),
argumentRootTypes(o.argumentRootTypes),
outParamRootType(o.outParamRootType),
extraValuesToPop(o.extraValuesToPop),
expectTailCall(o.expectTailCall)
{