Bug 943719 - Build MFBT in unified mode; r=froydnj,djvj

This commit is contained in:
Ehsan Akhgari 2013-11-27 18:59:50 -05:00
parent 6220f98ec6
commit 19e8a184b6
10 changed files with 62 additions and 36 deletions

View File

@ -269,7 +269,7 @@ class NameResolver
* ParseNode instance given. The prefix is for each subsequent name, and
* should initially be nullptr.
*/
void resolve(ParseNode *cur, HandleAtom prefixArg = NullPtr()) {
void resolve(ParseNode *cur, HandleAtom prefixArg = js::NullPtr()) {
RootedAtom prefix(cx, prefixArg);
if (cur == nullptr)
return;

View File

@ -617,10 +617,10 @@ class ABIArgIter
uint32_t stackBytesConsumedSoFar() const { return gen_.stackBytesConsumedSoFar(); }
};
typedef Vector<MIRType, 8> MIRTypeVector;
typedef js::Vector<MIRType, 8> MIRTypeVector;
typedef ABIArgIter<MIRTypeVector> ABIArgMIRTypeIter;
typedef Vector<VarType, 8> VarTypeVector;
typedef js::Vector<VarType, 8> VarTypeVector;
typedef ABIArgIter<VarTypeVector> ABIArgTypeIter;
class Signature
@ -963,8 +963,8 @@ js::IsValidAsmJSHeapLength(uint32_t length)
namespace {
typedef Vector<PropertyName*,1> LabelVector;
typedef Vector<MBasicBlock*,8> BlockVector;
typedef js::Vector<PropertyName*,1> LabelVector;
typedef js::Vector<MBasicBlock*,8> BlockVector;
// ModuleCompiler encapsulates the compilation of an entire asm.js module. Over
// the course of an ModuleCompiler object's lifetime, many FunctionCompiler
@ -1132,7 +1132,7 @@ class MOZ_STACK_CLASS ModuleCompiler
}
};
typedef Vector<const Func*> FuncPtrVector;
typedef js::Vector<const Func*> FuncPtrVector;
class FuncPtrTable
{
@ -1161,7 +1161,7 @@ class MOZ_STACK_CLASS ModuleCompiler
const Func &elem(unsigned i) const { return *elems_[i]; }
};
typedef Vector<FuncPtrTable> FuncPtrTableVector;
typedef js::Vector<FuncPtrTable> FuncPtrTableVector;
class ExitDescriptor
{
@ -1205,9 +1205,9 @@ class MOZ_STACK_CLASS ModuleCompiler
typedef HashMap<PropertyName*, AsmJSMathBuiltin> MathNameMap;
typedef HashMap<PropertyName*, Global*> GlobalMap;
typedef Vector<Func*> FuncVector;
typedef Vector<AsmJSGlobalAccess> GlobalAccessVector;
typedef Vector<SlowFunction> SlowFunctionVector;
typedef js::Vector<Func*> FuncVector;
typedef js::Vector<AsmJSGlobalAccess> GlobalAccessVector;
typedef js::Vector<SlowFunction> SlowFunctionVector;
ExclusiveContext * cx_;
AsmJSParser & parser_;
@ -1809,10 +1809,10 @@ class FunctionCompiler
private:
typedef HashMap<PropertyName*, Local> LocalMap;
typedef Vector<Value> VarInitializerVector;
typedef js::Vector<Value> VarInitializerVector;
typedef HashMap<PropertyName*, BlockVector> LabeledBlockMap;
typedef HashMap<ParseNode*, BlockVector> UnlabeledBlockMap;
typedef Vector<ParseNode*, 4> NodeStack;
typedef js::Vector<ParseNode*, 4> NodeStack;
ModuleCompiler & m_;
LifoAlloc & lifo_;
@ -2186,7 +2186,7 @@ class FunctionCompiler
uint32_t spIncrement_;
Signature sig_;
MAsmJSCall::Args regArgs_;
Vector<MAsmJSPassStackArg*> stackArgs_;
js::Vector<MAsmJSPassStackArg*> stackArgs_;
bool childClobbers_;
friend class FunctionCompiler;
@ -5129,11 +5129,11 @@ ParallelCompilationEnabled(ExclusiveContext *cx)
struct ParallelGroupState
{
WorkerThreadState &state;
Vector<AsmJSParallelTask> &tasks;
js::Vector<AsmJSParallelTask> &tasks;
int32_t outstandingJobs; // Good work, jobs!
uint32_t compiledJobs;
ParallelGroupState(WorkerThreadState &state, Vector<AsmJSParallelTask> &tasks)
ParallelGroupState(WorkerThreadState &state, js::Vector<AsmJSParallelTask> &tasks)
: state(state), tasks(tasks), outstandingJobs(0), compiledJobs(0)
{ }
};
@ -5302,7 +5302,7 @@ CheckFunctionsParallel(ModuleCompiler &m)
// Allocate scoped AsmJSParallelTask objects. Each contains a unique
// LifoAlloc that provides all necessary memory for compilation.
Vector<AsmJSParallelTask, 0> tasks(m.cx());
js::Vector<AsmJSParallelTask, 0> tasks(m.cx());
if (!tasks.initCapacity(numParallelJobs))
return false;

View File

@ -348,7 +348,7 @@ CallAsmJS(JSContext *cx, unsigned argc, Value *vp)
// internal entry point. The return value is stored in the first element of
// the array (which, therefore, must have length >= 1).
Vector<uint64_t, 8> coercedArgs(cx);
js::Vector<uint64_t, 8> coercedArgs(cx);
if (!coercedArgs.resize(Max<size_t>(1, func.numArgs())))
return false;

View File

@ -466,7 +466,7 @@ DeserializeName(ExclusiveContext *cx, const uint8_t *cursor, PropertyName **name
return cursor;
}
Vector<jschar> tmp(cx);
js::Vector<jschar> tmp(cx);
jschar *src;
if ((size_t(cursor) & (sizeof(jschar) - 1)) != 0) {
// Align 'src' for AtomizeChars.
@ -488,7 +488,7 @@ DeserializeName(ExclusiveContext *cx, const uint8_t *cursor, PropertyName **name
template <class T>
size_t
SerializedVectorSize(const Vector<T, 0, SystemAllocPolicy> &vec)
SerializedVectorSize(const js::Vector<T, 0, SystemAllocPolicy> &vec)
{
size_t size = sizeof(uint32_t);
for (size_t i = 0; i < vec.length(); i++)
@ -498,7 +498,7 @@ SerializedVectorSize(const Vector<T, 0, SystemAllocPolicy> &vec)
template <class T>
uint8_t *
SerializeVector(uint8_t *cursor, const Vector<T, 0, SystemAllocPolicy> &vec)
SerializeVector(uint8_t *cursor, const js::Vector<T, 0, SystemAllocPolicy> &vec)
{
cursor = WriteScalar<uint32_t>(cursor, vec.length());
for (size_t i = 0; i < vec.length(); i++)
@ -508,7 +508,7 @@ SerializeVector(uint8_t *cursor, const Vector<T, 0, SystemAllocPolicy> &vec)
template <class T>
const uint8_t *
DeserializeVector(ExclusiveContext *cx, const uint8_t *cursor, Vector<T, 0, SystemAllocPolicy> *vec)
DeserializeVector(ExclusiveContext *cx, const uint8_t *cursor, js::Vector<T, 0, SystemAllocPolicy> *vec)
{
uint32_t length;
cursor = ReadScalar<uint32_t>(cursor, &length);
@ -799,7 +799,7 @@ class ModuleChars
uint32_t length_;
const jschar *begin_;
uint32_t isFunCtor_;
Vector<PropertyNameWrapper, 0, SystemAllocPolicy> funCtorArgs_;
js::Vector<PropertyNameWrapper, 0, SystemAllocPolicy> funCtorArgs_;
public:
static uint32_t beginOffset(AsmJSParser &parser) {

View File

@ -8309,7 +8309,7 @@ ICCall_Fallback::Compiler::postGenerateStubCode(MacroAssembler &masm, Handle<Ion
}
typedef bool (*CreateThisFn)(JSContext *cx, HandleObject callee, MutableHandleValue rval);
static const VMFunction CreateThisInfo = FunctionInfo<CreateThisFn>(CreateThis);
static const VMFunction CreateThisInfoBaseline = FunctionInfo<CreateThisFn>(CreateThis);
bool
ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm)
@ -8386,7 +8386,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm)
sizeof(Value) + STUB_FRAME_SIZE + sizeof(size_t));
masm.loadValue(calleeSlot2, R1);
masm.push(masm.extractObject(R1, ExtractTemp0));
if (!callVM(CreateThisInfo, masm))
if (!callVM(CreateThisInfoBaseline, masm))
return false;
// Return of CreateThis must be an object.
@ -9395,7 +9395,7 @@ typedef bool(*DoRetSubFallbackFn)(JSContext *cx, BaselineFrame *, ICRetSub_Fallb
static const VMFunction DoRetSubFallbackInfo = FunctionInfo<DoRetSubFallbackFn>(DoRetSubFallback);
typedef bool (*ThrowFn)(JSContext *, HandleValue);
static const VMFunction ThrowInfo = FunctionInfo<ThrowFn>(js::Throw);
static const VMFunction ThrowInfoBaseline = FunctionInfo<ThrowFn>(js::Throw);
bool
ICRetSub_Fallback::Compiler::generateStubCode(MacroAssembler &masm)
@ -9430,7 +9430,7 @@ ICRetSub_Fallback::Compiler::generateStubCode(MacroAssembler &masm)
masm.bind(&rethrow);
EmitRestoreTailCallReg(masm);
masm.pushValue(R1);
return tailCallVM(ThrowInfo, masm);
return tailCallVM(ThrowInfoBaseline, masm);
}
bool
@ -9456,7 +9456,7 @@ ICRetSub_Resume::Compiler::generateStubCode(MacroAssembler &masm)
masm.bind(&rethrow);
EmitRestoreTailCallReg(masm);
masm.pushValue(R1);
if (!tailCallVM(ThrowInfo, masm))
if (!tailCallVM(ThrowInfoBaseline, masm))
return false;
masm.bind(&fail);

View File

@ -3523,7 +3523,7 @@ CodeGenerator::visitInitPropGetterSetter(LInitPropGetterSetter *lir)
}
typedef bool (*CreateThisFn)(JSContext *cx, HandleObject callee, MutableHandleValue rval);
static const VMFunction CreateThisInfo = FunctionInfo<CreateThisFn>(CreateThis);
static const VMFunction CreateThisInfoCodeGen = FunctionInfo<CreateThisFn>(CreateThis);
bool
CodeGenerator::visitCreateThis(LCreateThis *lir)
@ -3535,7 +3535,7 @@ CodeGenerator::visitCreateThis(LCreateThis *lir)
else
pushArg(ToRegister(callee));
return callVM(CreateThisInfo, lir);
return callVM(CreateThisInfoCodeGen, lir);
}
static JSObject *
@ -6635,13 +6635,13 @@ CodeGenerator::visitSetPropertyParIC(OutOfLineUpdateCache *ool, DataPtr<SetPrope
}
typedef bool (*ThrowFn)(JSContext *, HandleValue);
static const VMFunction ThrowInfo = FunctionInfo<ThrowFn>(js::Throw);
static const VMFunction ThrowInfoCodeGen = FunctionInfo<ThrowFn>(js::Throw);
bool
CodeGenerator::visitThrow(LThrow *lir)
{
pushArg(ToValue(lir, LThrow::Value));
return callVM(ThrowInfo, lir);
return callVM(ThrowInfoCodeGen, lir);
}
typedef bool (*BitNotFn)(JSContext *, HandleValue, int *p);

View File

@ -1669,7 +1669,7 @@ IonCompile(JSContext *cx, JSScript *script,
RootedScript builderScript(cx, builder->script());
IonSpewNewFunction(graph, builderScript);
Maybe<AutoProtectHeapForCompilation> protect;
mozilla::Maybe<AutoProtectHeapForCompilation> protect;
if (js_IonOptions.checkThreadSafety &&
cx->runtime()->gcIncrementalState == gc::NO_INCREMENTAL &&
!cx->runtime()->profilingScripts &&

View File

@ -1208,3 +1208,22 @@ JS_PUBLIC_API(char *) JS_vsprintf_append(char *last, const char *fmt, va_list ap
return ss.base;
}
#undef TYPE_INT16
#undef TYPE_UINT16
#undef TYPE_INTN
#undef TYPE_UINTN
#undef TYPE_INT32
#undef TYPE_UINT32
#undef TYPE_INT64
#undef TYPE_UINT64
#undef TYPE_STRING
#undef TYPE_DOUBLE
#undef TYPE_INTSTR
#undef TYPE_WSTRING
#undef TYPE_UNKNOWN
#undef FLAG_LEFT
#undef FLAG_SIGNED
#undef FLAG_SPACED
#undef FLAG_ZEROS
#undef FLAG_NEG

View File

@ -109,7 +109,6 @@ UNIFIED_SOURCES += [
'frontend/NameFunctions.cpp',
'frontend/ParseMaps.cpp',
'frontend/ParseNode.cpp',
'frontend/Parser.cpp',
'frontend/TokenStream.cpp',
'gc/Barrier.cpp',
'gc/Iteration.cpp',
@ -196,11 +195,14 @@ UNIFIED_SOURCES += [
'yarr/YarrSyntaxChecker.cpp',
]
# frontend/Parser.cpp cannot be built in unified mode because of explicit
# template instantiations.
# jsmath.cpp cannot be built in unified mode because it needs to pull rand_s
# from <stdlib.h> on Windows through a preprocessor define.
# jsutil.cpp cannot be built in unified mode because it is needed for
# check-vanilla-allocations.
SOURCES += [
'frontend/Parser.cpp',
'jsmath.cpp',
'jsutil.cpp',
]

View File

@ -63,8 +63,6 @@ mfbt_headers = [
]
mfbt_sources = [
'Compression.cpp',
'decimal/Decimal.cpp',
'double-conversion/bignum-dtoa.cc',
'double-conversion/bignum.cc',
'double-conversion/cached-powers.cc',
@ -82,4 +80,11 @@ mfbt_sources = [
DEFINES['IMPL_MFBT'] = True
EXPORTS.mozilla += ['%s/%s' % (mfbt_root, header) for header in mfbt_headers]
SOURCES += ['%s/%s' % (mfbt_root, src) for src in mfbt_sources]
UNIFIED_SOURCES += ['%s/%s' % (mfbt_root, src) for src in mfbt_sources]
# Compression.cpp cannot be built in unified mode because it pulls in Windows system headers.
# Decimal.cpp doesn't build in unified mode with gcc.
SOURCES += [
mfbt_root + '/Compression.cpp',
mfbt_root + '/decimal/Decimal.cpp',
]