author | Douglas Crosher <dtc-moz@scieneer.com> |
Mon, 23 Jun 2014 14:12:16 +1000 | |
changeset 190164 | ad7616fcaefef7e18f52abfdb126e06bc9278337 |
parent 190163 | 3b965d005fb31d3a84ebfa1fdc791603f2c0e809 |
child 190165 | 0842994c648d490a85d695408ee4ce18eee61837 |
push id | 27001 |
push user | kwierso@gmail.com |
push date | Tue, 24 Jun 2014 00:35:42 +0000 |
treeherder | mozilla-central@984cd22ec8c3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | luke |
bugs | 1027441 |
milestone | 33.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -1446,43 +1446,33 @@ class MOZ_STACK_CLASS ModuleCompiler } #endif bool addFunctionCounts(IonScriptCounts *counts) { return module_->addFunctionCounts(counts); } 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) { ScopedJSFreePtr<char> slowFuns; #ifndef JS_MORE_DETERMINISTIC int64_t usecAfter = PRMJ_Now(); int msTotal = (usecAfter - usecBefore_) / PRMJ_USEC_PER_MSEC; if (!slowFunctions_.empty()) { @@ -5392,25 +5382,25 @@ GenerateCode(ModuleCompiler &m, ModuleCo return false; } #if defined(MOZ_VTUNE) || defined(JS_ION_PERF) // Profiling might not be active now, but it may be activated later (perhaps // 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 #ifdef JS_ION_PERF // 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 // Align internal function headers. m.masm().align(CodeAlignment); func.accumulateCompileTime((PRMJ_Now() - before) / PRMJ_USEC_PER_MSEC);
--- a/js/src/jit/AsmJSModule.cpp +++ b/js/src/jit/AsmJSModule.cpp @@ -275,25 +275,31 @@ AsmJSModule::finish(ExclusiveContext *cx // Heap-access metadata used for link-time patching and fault-handling. heapAccesses_ = masm.extractAsmJSHeapAccesses(); // Call-site metadata used for stack unwinding. callSites_ = masm.extractCallSites(); #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. for (size_t i = 0; i < masm.numAsmJSAbsoluteLinks(); i++) { AsmJSAbsoluteLink src = masm.asmJSAbsoluteLink(i); AbsoluteLink link; link.patchAt = CodeOffsetLabel(masm.actualOffset(src.patchAt.offset())); link.target = src.target; @@ -357,29 +363,29 @@ AsmJSModule::finish(ExclusiveContext *cx // not need patching after deserialization. for (size_t i = 0; i < masm.numAsmJSGlobalAccesses(); i++) { AsmJSGlobalAccess a = masm.asmJSGlobalAccess(i); masm.patchAsmJSGlobalAccess(a.patchAt, code_, globalData(), a.globalDataOffset); } #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 for (size_t i = 0; i < perfProfiledBlocksFunctions_.length(); i++) { 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]; r.startOffset = masm.actualOffset(r.startOffset); r.endOffset = masm.actualOffset(r.endOffset); } } #endif
--- a/js/src/jit/AsmJSModule.h +++ b/js/src/jit/AsmJSModule.h @@ -198,16 +198,20 @@ class AsmJSModule void initInterpOffset(unsigned off) { JS_ASSERT(!interpCodeOffset_); interpCodeOffset_ = off; } void initIonOffset(unsigned off) { 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; const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor); bool clone(ExclusiveContext *cx, Exit *out) const; }; typedef int32_t (*CodePtr)(uint64_t *args, uint8_t *global); @@ -271,16 +275,20 @@ class AsmJSModule argCoercions_ = mozilla::Move(rhs.argCoercions_); pod = rhs.pod; } void initCodeOffset(unsigned off) { 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_; } uint32_t startOffsetInModule() const { return pod.startOffsetInModule_; } uint32_t endOffsetInModule() const { @@ -743,17 +751,16 @@ class AsmJSModule #endif /*************************************************************************/ // This function is called after compiling the function bodies (before // 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()); } /*************************************************************************/ // Exported functions are added after finishFunctionBodies() and before // finish(). The list of exported functions can be accessed any time after // the exported functions have been added.