mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 911204 - Directly heap allocate CompileErrors when parsing off thread, r=billm.
This commit is contained in:
parent
f93fdc5148
commit
2209a370c7
@ -202,6 +202,9 @@ ParseTask::~ParseTask()
|
||||
|
||||
// ParseTask takes over ownership of its input exclusive context.
|
||||
js_delete(cx);
|
||||
|
||||
for (size_t i = 0; i < errors.length(); i++)
|
||||
js_delete(errors[i]);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -550,7 +553,7 @@ WorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void *toke
|
||||
if (maybecx) {
|
||||
AutoCompartment ac(maybecx, parseTask->scopeChain);
|
||||
for (size_t i = 0; i < parseTask->errors.length(); i++)
|
||||
parseTask->errors[i].throwError(maybecx);
|
||||
parseTask->errors[i]->throwError(maybecx);
|
||||
}
|
||||
|
||||
JSScript *script = parseTask->script;
|
||||
@ -677,9 +680,12 @@ ExclusiveContext::setWorkerThread(WorkerThread *workerThread)
|
||||
frontend::CompileError &
|
||||
ExclusiveContext::addPendingCompileError()
|
||||
{
|
||||
if (!workerThread->parseTask->errors.append(frontend::CompileError()))
|
||||
frontend::CompileError *error = js_new<frontend::CompileError>();
|
||||
if (!error)
|
||||
MOZ_CRASH();
|
||||
return workerThread->parseTask->errors.back();
|
||||
if (!workerThread->parseTask->errors.append(error))
|
||||
MOZ_CRASH();
|
||||
return *error;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -389,7 +389,7 @@ struct ParseTask
|
||||
|
||||
// Any errors or warnings produced during compilation. These are reported
|
||||
// when finishing the script.
|
||||
Vector<frontend::CompileError> errors;
|
||||
Vector<frontend::CompileError *> errors;
|
||||
|
||||
ParseTask(ExclusiveContext *cx, const CompileOptions &options,
|
||||
const jschar *chars, size_t length, JSObject *scopeChain,
|
||||
|
Loading…
x
Reference in New Issue
Block a user