summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/BytecodeCompiler.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-02-02 12:47:28 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-02-02 12:47:28 +0100
commite547de64c80b98d661999c0788c09210d9d4a37e (patch)
tree19b0f1b8dd67c3cff002ecad5d10de6c5e806801 /js/src/frontend/BytecodeCompiler.cpp
parent278eda6a09e9177678d57a2da2b6a8ddcb503b1c (diff)
downloadUXP-e547de64c80b98d661999c0788c09210d9d4a37e.tar
UXP-e547de64c80b98d661999c0788c09210d9d4a37e.tar.gz
UXP-e547de64c80b98d661999c0788c09210d9d4a37e.tar.lz
UXP-e547de64c80b98d661999c0788c09210d9d4a37e.tar.xz
UXP-e547de64c80b98d661999c0788c09210d9d4a37e.zip
Stage 1-1: Implement Function.prototype.toString revision proposal.
Tag #960
Diffstat (limited to 'js/src/frontend/BytecodeCompiler.cpp')
-rw-r--r--js/src/frontend/BytecodeCompiler.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp
index 76afe80b1..b5be5f5ac 100644
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -77,7 +77,7 @@ class MOZ_STACK_CLASS BytecodeCompiler
bool canLazilyParse();
bool createParser();
bool createSourceAndParser(Maybe<uint32_t> parameterListEnd = Nothing());
- bool createScript();
+ bool createScript(uint32_t preludeStart = 0);
bool emplaceEmitter(Maybe<BytecodeEmitter>& emitter, SharedContext* sharedContext);
bool handleParseFailure(const Directives& newDirectives);
bool deoptimizeArgumentsInEnclosingScripts(JSContext* cx, HandleObject environment);
@@ -242,10 +242,11 @@ BytecodeCompiler::createSourceAndParser(Maybe<uint32_t> parameterListEnd /* = No
}
bool
-BytecodeCompiler::createScript()
+BytecodeCompiler::createScript(uint32_t preludeStart /* = 0 */)
{
script = JSScript::Create(cx, options,
- sourceObject, /* sourceStart = */ 0, sourceBuffer.length());
+ sourceObject, /* sourceStart = */ 0, sourceBuffer.length(),
+ preludeStart);
return script != nullptr;
}
@@ -456,7 +457,7 @@ BytecodeCompiler::compileStandaloneFunction(MutableHandleFunction fun,
if (fn->pn_funbox->function()->isInterpreted()) {
MOZ_ASSERT(fun == fn->pn_funbox->function());
- if (!createScript())
+ if (!createScript(fn->pn_funbox->preludeStart))
return false;
Maybe<BytecodeEmitter> emitter;
@@ -650,7 +651,8 @@ frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const cha
MOZ_ASSERT(sourceObject);
Rooted<JSScript*> script(cx, JSScript::Create(cx, options, sourceObject,
- lazy->begin(), lazy->end()));
+ lazy->begin(), lazy->end(),
+ lazy->preludeStart()));
if (!script)
return false;