Bug 928507: Properly hide JS::Handle's assignment operator; add 'repoint' method to deal with the fallout; fix C1Spewer, IonSpewer, and CompileOptions. r=terrence

This commit is contained in:
Jim Blandy 2013-10-21 12:56:44 -07:00
Родитель ab08cf6060
Коммит 53a9ab4dc3
5 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -455,13 +455,16 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
bool operator!=(const T &other) const { return *ptr != other; }
bool operator==(const T &other) const { return *ptr == other; }
/* Change this handle to point to the same rooted location RHS does. */
void repoint(const Handle &rhs) { ptr = rhs.address(); }
private:
Handle() {}
const T *ptr;
template <typename S>
void operator=(S v) MOZ_DELETE;
template <typename S> void operator=(S) MOZ_DELETE;
void operator=(Handle) MOZ_DELETE;
};
/*

Просмотреть файл

@ -31,7 +31,7 @@ C1Spewer::beginFunction(MIRGraph *graph, HandleScript script)
return;
this->graph = graph;
this->script = script;
this->script.repoint(script);
fprintf(spewout_, "begin_compilation\n");
if (script) {

Просмотреть файл

@ -161,7 +161,7 @@ IonSpewer::beginFunction(MIRGraph *graph, HandleScript function)
}
this->graph = graph;
this->function = function;
this->function.repoint(function);
c1Spewer.beginFunction(graph, function);
jsonSpewer.beginFunction(function);

Просмотреть файл

@ -4466,7 +4466,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options, const char
AutoFile file;
if (!file.open(cx, filename))
return nullptr;
options = options.setFileAndLine(filename, 1);
options.setFileAndLine(filename, 1);
JSScript *script = Compile(cx, obj, options, file.fp());
return script;
}

Просмотреть файл

@ -3469,7 +3469,7 @@ class JS_PUBLIC_API(CompileOptions)
}
CompileOptions &setSourceMapURL(const jschar *s) { sourceMapURL = s; return *this; }
CompileOptions &setColumn(unsigned c) { column = c; return *this; }
CompileOptions &setElement(Handle<JSObject*> e) { element = e; return *this; }
CompileOptions &setElement(Handle<JSObject*> e) { element.repoint(e); return *this; }
CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
CompileOptions &setForEval(bool eval) { forEval = eval; return *this; }
CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }