Bug 1064668 - OdinMonkey: Maintain correct offsets for src line info (r=bbouvier)

--HG--
extra : rebase_source : 62f73408bf57b273d9e043dc93be013a7d085a84
This commit is contained in:
Luke Wagner 2014-09-09 11:33:56 -05:00
parent 010164839f
commit 856798cdc0
2 changed files with 12 additions and 15 deletions

View File

@ -1127,18 +1127,21 @@ class AsmJSModule
// the exported functions have been added.
bool addExportedFunction(PropertyName *name,
uint32_t srcStart,
uint32_t srcEnd,
uint32_t funcSrcBegin,
uint32_t funcSrcEnd,
PropertyName *maybeFieldName,
ArgCoercionVector &&argCoercions,
ReturnType returnType)
{
// NB: funcSrcBegin/funcSrcEnd are given relative to the ScriptSource
// (the entire file) and ExportedFunctions store offsets relative to
// the beginning of the module (so that they are caching-invariant).
JS_ASSERT(isFinishedWithFunctionBodies() && !isFinished());
ExportedFunction func(name, srcStart, srcEnd, maybeFieldName,
mozilla::Move(argCoercions), returnType);
if (exports_.length() >= UINT32_MAX)
return false;
return exports_.append(mozilla::Move(func));
JS_ASSERT(srcStart_ < funcSrcBegin);
JS_ASSERT(funcSrcBegin < funcSrcEnd);
ExportedFunction func(name, funcSrcBegin - srcStart_, funcSrcEnd - srcStart_,
maybeFieldName, mozilla::Move(argCoercions), returnType);
return exports_.length() < UINT32_MAX && exports_.append(mozilla::Move(func));
}
unsigned numExportedFunctions() const {
JS_ASSERT(isFinishedWithFunctionBodies());

View File

@ -1015,13 +1015,8 @@ class MOZ_STACK_CLASS ModuleCompiler
void define(ModuleCompiler &m, ParseNode *fn) {
JS_ASSERT(!defined_);
defined_ = true;
// The begin/end char range is relative to the beginning of the module.
// hence the assertions.
JS_ASSERT(fn->pn_pos.begin > m.srcStart());
JS_ASSERT(fn->pn_pos.begin <= fn->pn_pos.end);
srcBegin_ = fn->pn_pos.begin - m.srcStart();
srcEnd_ = fn->pn_pos.end - m.srcStart();
srcBegin_ = fn->pn_pos.begin;
srcEnd_ = fn->pn_pos.end;
}
uint32_t srcBegin() const { JS_ASSERT(defined_); return srcBegin_; }
@ -1462,7 +1457,6 @@ class MOZ_STACK_CLASS ModuleCompiler
Label &syncInterruptLabel() { return syncInterruptLabel_; }
bool hasError() const { return errorString_ != nullptr; }
const AsmJSModule &module() const { return *module_.get(); }
uint32_t srcStart() const { return module_->srcStart(); }
bool usesSignalHandlersForInterrupt() const { return module_->usesSignalHandlersForInterrupt(); }
bool usesSignalHandlersForOOB() const { return module_->usesSignalHandlersForOOB(); }
bool supportsSimd() const { return supportsSimd_; }