зеркало из https://github.com/mozilla/gecko-dev.git
Bug 987556 Part 6 Use JS::SourceBufferHolder in JS::Compile() and JS::CompileFunction() r=luke
This commit is contained in:
Родитель
a13edfd03a
Коммит
262b148f53
|
@ -4525,7 +4525,7 @@ JS::CompileOptions::wrap(JSContext *cx, JSCompartment *compartment)
|
|||
|
||||
JSScript *
|
||||
JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const jschar *chars, size_t length)
|
||||
SourceBufferHolder &srcBuf)
|
||||
{
|
||||
JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
|
||||
AssertHeapIsIdle(cx);
|
||||
|
@ -4533,10 +4533,17 @@ JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &optio
|
|||
assertSameCompartment(cx, obj);
|
||||
AutoLastFrameCheck lfc(cx);
|
||||
|
||||
SourceBufferHolder srcBuf(chars, length, SourceBufferHolder::NoOwnership);
|
||||
return frontend::CompileScript(cx, &cx->tempLifoAlloc(), obj, NullPtr(), options, srcBuf);
|
||||
}
|
||||
|
||||
JSScript *
|
||||
JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const jschar *chars, size_t length)
|
||||
{
|
||||
SourceBufferHolder srcBuf(chars, length, SourceBufferHolder::NoOwnership);
|
||||
return Compile(cx, obj, options, srcBuf);
|
||||
}
|
||||
|
||||
JSScript *
|
||||
JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const char *bytes, size_t length)
|
||||
|
@ -4690,7 +4697,7 @@ JS_GetGlobalFromScript(JSScript *script)
|
|||
JS_PUBLIC_API(JSFunction *)
|
||||
JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const char *name, unsigned nargs, const char *const *argnames,
|
||||
const jschar *chars, size_t length)
|
||||
SourceBufferHolder &srcBuf)
|
||||
{
|
||||
JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
|
||||
AssertHeapIsIdle(cx);
|
||||
|
@ -4717,7 +4724,6 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOption
|
|||
if (!fun)
|
||||
return nullptr;
|
||||
|
||||
SourceBufferHolder srcBuf(chars, length, SourceBufferHolder::NoOwnership);
|
||||
if (!frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf))
|
||||
return nullptr;
|
||||
|
||||
|
@ -4731,6 +4737,15 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOption
|
|||
return fun;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSFunction *)
|
||||
JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const char *name, unsigned nargs, const char *const *argnames,
|
||||
const jschar *chars, size_t length)
|
||||
{
|
||||
SourceBufferHolder srcBuf(chars, length, SourceBufferHolder::NoOwnership);
|
||||
return JS::CompileFunction(cx, obj, options, name, nargs, argnames, srcBuf);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSFunction *)
|
||||
JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const char *name, unsigned nargs, const char *const *argnames,
|
||||
|
|
|
@ -3733,6 +3733,10 @@ extern JS_PUBLIC_API(JSScript *)
|
|||
Compile(JSContext *cx, JS::HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const jschar *chars, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
Compile(JSContext *cx, JS::HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
SourceBufferHolder &srcBuf);
|
||||
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
Compile(JSContext *cx, JS::HandleObject obj, const ReadOnlyCompileOptions &options, FILE *file);
|
||||
|
||||
|
@ -3776,6 +3780,11 @@ CompileFunction(JSContext *cx, JS::HandleObject obj, const ReadOnlyCompileOption
|
|||
const char *name, unsigned nargs, const char *const *argnames,
|
||||
const jschar *chars, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API(JSFunction *)
|
||||
CompileFunction(JSContext *cx, JS::HandleObject obj, const ReadOnlyCompileOptions &options,
|
||||
const char *name, unsigned nargs, const char *const *argnames,
|
||||
SourceBufferHolder &srcBuf);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
extern JS_PUBLIC_API(JSString *)
|
||||
|
|
Загрузка…
Ссылка в новой задаче