mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1027441 - OdinMonkey: Fix use of size() with pending pool entries. r=luke
This commit is contained in:
parent
1012b132ee
commit
e879e0b7ad
@ -1451,33 +1451,23 @@ class MOZ_STACK_CLASS ModuleCompiler
|
||||
}
|
||||
|
||||
void startFunctionBodies() {
|
||||
JS_ASSERT(masm_.size() == 0);
|
||||
module_->startFunctionBodies();
|
||||
}
|
||||
void finishFunctionBodies() {
|
||||
JS_ASSERT(!finishedFunctionBodies_);
|
||||
masm_.align(AsmJSPageSize);
|
||||
finishedFunctionBodies_ = true;
|
||||
module_->finishFunctionBodies(masm_.size());
|
||||
module_->finishFunctionBodies(masm_.currentOffset());
|
||||
}
|
||||
|
||||
void setInterpExitOffset(unsigned exitIndex) {
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exit(exitIndex).initInterpOffset(masm_.size());
|
||||
module_->exit(exitIndex).initInterpOffset(masm_.currentOffset());
|
||||
}
|
||||
void setIonExitOffset(unsigned exitIndex) {
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exit(exitIndex).initIonOffset(masm_.size());
|
||||
module_->exit(exitIndex).initIonOffset(masm_.currentOffset());
|
||||
}
|
||||
void setEntryOffset(unsigned exportIndex) {
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exportedFunction(exportIndex).initCodeOffset(masm_.size());
|
||||
module_->exportedFunction(exportIndex).initCodeOffset(masm_.currentOffset());
|
||||
}
|
||||
|
||||
void buildCompilationTimeReport(bool storedInCache, ScopedJSFreePtr<char> *out) {
|
||||
@ -5397,7 +5387,7 @@ GenerateCode(ModuleCompiler &m, ModuleCompiler::Func &func, MIRGenerator &mir, L
|
||||
// after the module has been cached and reloaded from the cache). Function
|
||||
// profiling info isn't huge, so store it always (in --enable-profiling
|
||||
// builds, which is only Nightly builds, but default).
|
||||
if (!m.addProfiledFunction(func, m.masm().size()))
|
||||
if (!m.addProfiledFunction(func, m.masm().currentOffset()))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@ -5405,7 +5395,7 @@ GenerateCode(ModuleCompiler &m, ModuleCompiler::Func &func, MIRGenerator &mir, L
|
||||
// Per-block profiling info uses significantly more memory so only store
|
||||
// this information if it is actively requested.
|
||||
if (PerfBlockEnabled()) {
|
||||
if (!m.addPerfProfiledBlocks(mir.perfSpewer(), func, m.masm().size()))
|
||||
if (!m.addPerfProfiledBlocks(mir.perfSpewer(), func, m.masm().currentOffset()))
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -280,15 +280,21 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl
|
||||
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
// ARM requires the offsets to be updated.
|
||||
pod.functionBytes_ = masm.actualOffset(pod.functionBytes_);
|
||||
for (size_t i = 0; i < heapAccesses_.length(); i++) {
|
||||
AsmJSHeapAccess &a = heapAccesses_[i];
|
||||
a.setOffset(masm.actualOffset(a.offset()));
|
||||
}
|
||||
for (unsigned i = 0; i < numExportedFunctions(); i++)
|
||||
exportedFunction(i).updateCodeOffset(masm);
|
||||
for (unsigned i = 0; i < numExits(); i++)
|
||||
exit(i).updateOffsets(masm);
|
||||
for (size_t i = 0; i < callSites_.length(); i++) {
|
||||
CallSite &c = callSites_[i];
|
||||
c.setReturnAddressOffset(masm.actualOffset(c.returnAddressOffset()));
|
||||
}
|
||||
#endif
|
||||
JS_ASSERT(pod.functionBytes_ % AsmJSPageSize == 0);
|
||||
|
||||
// Absolute link metadata: absolute addresses that refer to some fixed
|
||||
// address in the address space.
|
||||
@ -362,12 +368,11 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
|
||||
// Fix up the code offsets. Note the endCodeOffset should not be
|
||||
// filtered through 'actualOffset' as it is generated using 'size()'
|
||||
// rather than a label.
|
||||
// Fix up the code offsets.
|
||||
for (size_t i = 0; i < profiledFunctions_.length(); i++) {
|
||||
ProfiledFunction &pf = profiledFunctions_[i];
|
||||
pf.pod.startCodeOffset = masm.actualOffset(pf.pod.startCodeOffset);
|
||||
pf.pod.endCodeOffset = masm.actualOffset(pf.pod.endCodeOffset);
|
||||
}
|
||||
#endif
|
||||
#ifdef JS_ION_PERF
|
||||
@ -375,6 +380,7 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl
|
||||
ProfiledBlocksFunction &pbf = perfProfiledBlocksFunctions_[i];
|
||||
pbf.pod.startCodeOffset = masm.actualOffset(pbf.pod.startCodeOffset);
|
||||
pbf.endInlineCodeOffset = masm.actualOffset(pbf.endInlineCodeOffset);
|
||||
pbf.pod.endCodeOffset = masm.actualOffset(pbf.pod.endCodeOffset);
|
||||
BasicBlocksVector &basicBlocks = pbf.blocks;
|
||||
for (uint32_t i = 0; i < basicBlocks.length(); i++) {
|
||||
Record &r = basicBlocks[i];
|
||||
|
@ -203,6 +203,10 @@ class AsmJSModule
|
||||
JS_ASSERT(!ionCodeOffset_);
|
||||
ionCodeOffset_ = off;
|
||||
}
|
||||
void updateOffsets(jit::MacroAssembler &masm) {
|
||||
interpCodeOffset_ = masm.actualOffset(interpCodeOffset_);
|
||||
ionCodeOffset_ = masm.actualOffset(ionCodeOffset_);
|
||||
}
|
||||
|
||||
size_t serializedSize() const;
|
||||
uint8_t *serialize(uint8_t *cursor) const;
|
||||
@ -276,6 +280,10 @@ class AsmJSModule
|
||||
JS_ASSERT(pod.codeOffset_ == UINT32_MAX);
|
||||
pod.codeOffset_ = off;
|
||||
}
|
||||
void updateCodeOffset(jit::MacroAssembler &masm) {
|
||||
pod.codeOffset_ = masm.actualOffset(pod.codeOffset_);
|
||||
}
|
||||
|
||||
|
||||
PropertyName *name() const {
|
||||
return name_;
|
||||
@ -748,7 +756,6 @@ class AsmJSModule
|
||||
// compiling entries/exits) to record the extent of compiled function code.
|
||||
void finishFunctionBodies(size_t functionBytes) {
|
||||
JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies());
|
||||
JS_ASSERT(functionBytes % AsmJSPageSize == 0);
|
||||
pod.functionBytes_ = functionBytes;
|
||||
JS_ASSERT(isFinishedWithFunctionBodies());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user