diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-07-13 23:02:36 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:41 -0400 |
commit | 22dba02b7bcab4d6dfe6b326ecc0a746e5a87191 (patch) | |
tree | 63d231709fe5745edef27b7b43bd9844006d7bfc /js/src/jsscript.cpp | |
parent | 53e46b1e12ef01ccaabb3256738ea1eac74b7941 (diff) | |
download | UXP-22dba02b7bcab4d6dfe6b326ecc0a746e5a87191.tar UXP-22dba02b7bcab4d6dfe6b326ecc0a746e5a87191.tar.gz UXP-22dba02b7bcab4d6dfe6b326ecc0a746e5a87191.tar.lz UXP-22dba02b7bcab4d6dfe6b326ecc0a746e5a87191.tar.xz UXP-22dba02b7bcab4d6dfe6b326ecc0a746e5a87191.zip |
1216630 - Rename preludeStart and postludeEnd to toStringStart and toStringEnd and misc fixes.
Diffstat (limited to 'js/src/jsscript.cpp')
-rw-r--r-- | js/src/jsscript.cpp | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index ad4cb2338..fc7438e3b 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -235,8 +235,8 @@ XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun, HandleScript scri { uint32_t begin = script->sourceStart(); uint32_t end = script->sourceEnd(); - uint32_t preludeStart = script->preludeStart(); - uint32_t postludeEnd = script->postludeEnd(); + uint32_t toStringStart = script->toStringStart(); + uint32_t toStringEnd = script->toStringEnd(); uint32_t lineno = script->lineno(); uint32_t column = script->column(); @@ -244,8 +244,8 @@ XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun, HandleScript scri packedFields = lazy->packedFields(); MOZ_ASSERT(begin == lazy->begin()); MOZ_ASSERT(end == lazy->end()); - MOZ_ASSERT(preludeStart == lazy->preludeStart()); - MOZ_ASSERT(postludeEnd == lazy->postludeEnd()); + MOZ_ASSERT(toStringStart == lazy->toStringStart()); + MOZ_ASSERT(toStringEnd == lazy->toStringEnd()); MOZ_ASSERT(lineno == lazy->lineno()); MOZ_ASSERT(column == lazy->column()); // We can assert we have no inner functions because we don't @@ -259,12 +259,12 @@ XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun, HandleScript scri if (mode == XDR_DECODE) { lazy.set(LazyScript::Create(cx, fun, script, enclosingScope, script, - packedFields, begin, end, preludeStart, lineno, column)); + packedFields, begin, end, toStringStart, lineno, column)); if (!lazy) return false; - lazy->setPostludeEnd(postludeEnd); + lazy->setToStringEnd(toStringEnd); // As opposed to XDRLazyScript, we need to restore the runtime bits // of the script, as we are trying to match the fact this function @@ -614,9 +614,9 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip return false; if (!xdr->codeUint32(&script->sourceEnd_)) return false; - if (!xdr->codeUint32(&script->preludeStart_)) + if (!xdr->codeUint32(&script->toStringStart_)) return false; - if (!xdr->codeUint32(&script->postludeEnd_)) + if (!xdr->codeUint32(&script->toStringEnd_)) return false; if (!xdr->codeUint32(&lineno) || @@ -948,8 +948,8 @@ js::XDRLazyScript(XDRState<mode>* xdr, HandleScope enclosingScope, HandleScript { uint32_t begin; uint32_t end; - uint32_t preludeStart; - uint32_t postludeEnd; + uint32_t toStringStart; + uint32_t toStringEnd; uint32_t lineno; uint32_t column; uint64_t packedFields; @@ -963,16 +963,16 @@ js::XDRLazyScript(XDRState<mode>* xdr, HandleScope enclosingScope, HandleScript begin = lazy->begin(); end = lazy->end(); - preludeStart = lazy->preludeStart(); - postludeEnd = lazy->postludeEnd(); + toStringStart = lazy->toStringStart(); + toStringEnd = lazy->toStringEnd(); lineno = lazy->lineno(); column = lazy->column(); packedFields = lazy->packedFields(); } if (!xdr->codeUint32(&begin) || !xdr->codeUint32(&end) || - !xdr->codeUint32(&preludeStart) || - !xdr->codeUint32(&postludeEnd) || + !xdr->codeUint32(&toStringStart) || + !xdr->codeUint32(&toStringEnd) || !xdr->codeUint32(&lineno) || !xdr->codeUint32(&column) || !xdr->codeUint64(&packedFields)) { @@ -981,10 +981,10 @@ js::XDRLazyScript(XDRState<mode>* xdr, HandleScope enclosingScope, HandleScript if (mode == XDR_DECODE) { lazy.set(LazyScript::Create(cx, fun, nullptr, enclosingScope, enclosingScript, - packedFields, begin, end, preludeStart, lineno, column)); + packedFields, begin, end, toStringStart, lineno, column)); if (!lazy) return false; - lazy->setPostludeEnd(postludeEnd); + lazy->setToStringEnd(toStringEnd); fun->initLazyScript(lazy); } } @@ -1033,8 +1033,8 @@ JSScript::setDefaultClassConstructorSpan(JSObject* sourceObject, uint32_t start, { MOZ_ASSERT(isDefaultClassConstructor()); setSourceObject(sourceObject); - preludeStart_ = start; - postludeEnd_ = end; + toStringStart_ = start; + toStringEnd_ = end; } js::ScriptSourceObject& @@ -1468,7 +1468,7 @@ JSScript::sourceData(JSContext* cx, HandleScript script) JSScript::sourceDataForToString(JSContext* cx, HandleScript script) { MOZ_ASSERT(script->scriptSource()->hasSourceData()); - return script->scriptSource()->substring(cx, script->preludeStart(), script->postludeEnd()); + return script->scriptSource()->substring(cx, script->toStringStart(), script->toStringEnd()); } UncompressedSourceCache::AutoHoldEntry::AutoHoldEntry() @@ -2470,9 +2470,15 @@ JSScript::initCompartment(ExclusiveContext* cx) /* static */ JSScript* JSScript::Create(ExclusiveContext* cx, const ReadOnlyCompileOptions& options, HandleObject sourceObject, uint32_t bufStart, uint32_t bufEnd, - uint32_t preludeStart, uint32_t postludeEnd) + uint32_t toStringStart, uint32_t toStringEnd) { + // bufStart and bufEnd specify the range of characters parsed by the + // Parser to produce this script. toStringStart and toStringEnd specify + // the range of characters to be returned for Function.prototype.toString. MOZ_ASSERT(bufStart <= bufEnd); + MOZ_ASSERT(toStringStart <= toStringEnd); + MOZ_ASSERT(toStringStart <= bufStart); + MOZ_ASSERT(toStringEnd >= bufEnd); RootedScript script(cx, Allocate<JSScript>(cx)); if (!script) @@ -2492,8 +2498,8 @@ JSScript::Create(ExclusiveContext* cx, const ReadOnlyCompileOptions& options, script->setSourceObject(sourceObject); script->sourceStart_ = bufStart; script->sourceEnd_ = bufEnd; - script->preludeStart_ = preludeStart; - script->postludeEnd_ = postludeEnd; + script->toStringStart_ = toStringStart; + script->toStringEnd_ = toStringEnd; return script; } @@ -3430,7 +3436,7 @@ CreateEmptyScriptForClone(JSContext* cx, HandleScript src) .setVersion(src->getVersion()); return JSScript::Create(cx, options, sourceObject, src->sourceStart(), src->sourceEnd(), - src->preludeStart(), src->postludeEnd()); + src->toStringStart(), src->toStringEnd()); } JSScript* @@ -3981,7 +3987,7 @@ JSScript::formalLivesInArgumentsObject(unsigned argSlot) LazyScript::LazyScript(JSFunction* fun, void* table, uint64_t packedFields, uint32_t begin, uint32_t end, - uint32_t preludeStart, uint32_t lineno, uint32_t column) + uint32_t toStringStart, uint32_t lineno, uint32_t column) : script_(nullptr), function_(fun), enclosingScope_(nullptr), @@ -3990,12 +3996,13 @@ LazyScript::LazyScript(JSFunction* fun, void* table, uint64_t packedFields, packedFields_(packedFields), begin_(begin), end_(end), - preludeStart_(preludeStart), - postludeEnd_(end), + toStringStart_(toStringStart), + toStringEnd_(end), lineno_(lineno), column_(column) { MOZ_ASSERT(begin <= end); + MOZ_ASSERT(toStringStart <= begin); } void @@ -4041,7 +4048,7 @@ LazyScript::maybeForwardedScriptSource() const /* static */ LazyScript* LazyScript::CreateRaw(ExclusiveContext* cx, HandleFunction fun, uint64_t packedFields, uint32_t begin, uint32_t end, - uint32_t preludeStart, uint32_t lineno, uint32_t column) + uint32_t toStringStart, uint32_t lineno, uint32_t column) { union { PackedView p; @@ -4070,7 +4077,7 @@ LazyScript::CreateRaw(ExclusiveContext* cx, HandleFunction fun, cx->compartment()->scheduleDelazificationForDebugger(); return new (res) LazyScript(fun, table.forget(), packed, begin, end, - preludeStart, lineno, column); + toStringStart, lineno, column); } /* static */ LazyScript* @@ -4079,7 +4086,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun, Handle<GCVector<JSFunction*, 8>> innerFunctions, JSVersion version, uint32_t begin, uint32_t end, - uint32_t preludeStart, uint32_t lineno, uint32_t column) + uint32_t toStringStart, uint32_t lineno, uint32_t column) { union { PackedView p; @@ -4103,7 +4110,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun, p.isDerivedClassConstructor = false; p.needsHomeObject = false; - LazyScript* res = LazyScript::CreateRaw(cx, fun, packedFields, begin, end, preludeStart, + LazyScript* res = LazyScript::CreateRaw(cx, fun, packedFields, begin, end, toStringStart, lineno, column); if (!res) return nullptr; @@ -4125,7 +4132,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun, HandleScript script, HandleScope enclosingScope, HandleScript enclosingScript, uint64_t packedFields, uint32_t begin, uint32_t end, - uint32_t preludeStart, uint32_t lineno, uint32_t column) + uint32_t toStringStart, uint32_t lineno, uint32_t column) { // Dummy atom which is not a valid property name. RootedAtom dummyAtom(cx, cx->names().comma); @@ -4134,7 +4141,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun, // holding this lazy script. HandleFunction dummyFun = fun; - LazyScript* res = LazyScript::CreateRaw(cx, fun, packedFields, begin, end, preludeStart, + LazyScript* res = LazyScript::CreateRaw(cx, fun, packedFields, begin, end, toStringStart, lineno, column); if (!res) return nullptr; |