Bug 777190 - Don't compress files with huge strings; reenable source compression. r=jorendorff

This commit is contained in:
Benjamin Peterson
2012-07-30 19:23:46 -07:00
parent 362b03decb
commit 0210a7b3bd
7 changed files with 170 additions and 80 deletions

View File

@@ -80,7 +80,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
if (!CheckLength(cx, length))
return NULL;
AutoAttachToRuntime attacher(cx->runtime);
SourceCompressionToken sct(cx->runtime);
SourceCompressionToken sct(cx);
ScriptSource *ss = NULL;
if (!cx->hasRunOption(JSOPTION_ONLY_CNG_SOURCE) || options.compileAndGo) {
ss = ScriptSource::createFromSource(cx, chars, length, false, &sct);
@@ -92,6 +92,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
Parser parser(cx, options, chars, length, /* foldConstants = */ true);
if (!parser.init())
return NULL;
parser.sct = &sct;
SharedContext sc(cx, scopeChain, /* fun = */ NULL, /* funbox = */ NULL, StrictModeFromContext(cx));
@@ -245,7 +246,7 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
if (!CheckLength(cx, length))
return false;
AutoAttachToRuntime attacher(cx->runtime);
SourceCompressionToken sct(cx->runtime);
SourceCompressionToken sct(cx);
ScriptSource *ss = ScriptSource::createFromSource(cx, chars, length, true, &sct);
if (!ss)
return NULL;
@@ -255,6 +256,7 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
Parser parser(cx, options, chars, length, /* foldConstants = */ true);
if (!parser.init())
return false;
parser.sct = &sct;
JS_ASSERT(fun);
SharedContext funsc(cx, /* scopeChain = */ NULL, fun, /* funbox = */ NULL,