summaryrefslogtreecommitdiffstats
path: root/js/src/jsscript.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-01 19:14:11 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-17 06:25:24 -0500
commit3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4 (patch)
treed1f38e0fc9c35838279f191036741532c1657647 /js/src/jsscript.cpp
parentf07d5707c77e73031b6921faac165ca7f8d577c6 (diff)
downloadUXP-3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4.tar
UXP-3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4.tar.gz
UXP-3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4.tar.lz
UXP-3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4.tar.xz
UXP-3a3de55aadd9d3a2aafc3638c7a9b0c23584cef4.zip
Bug 1343481 - Part 3: Add JSOP_AWAIT and rename {yieldIndex,yieldOffset} to {yieldAndAwaitIndex,yieldAndAwaitOffset}.
Tag #1287
Diffstat (limited to 'js/src/jsscript.cpp')
-rw-r--r--js/src/jsscript.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp
index eb74a1ec6..bdd411d04 100644
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -402,8 +402,8 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
ntrynotes = script->trynotes()->length;
if (script->hasScopeNotes())
nscopenotes = script->scopeNotes()->length;
- if (script->hasYieldOffsets())
- nyieldoffsets = script->yieldOffsets().length();
+ if (script->hasYieldAndAwaitOffsets())
+ nyieldoffsets = script->yieldAndAwaitOffsets().length();
nTypeSets = script->nTypeSets();
funLength = script->funLength();
@@ -902,7 +902,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
}
for (i = 0; i < nyieldoffsets; ++i) {
- uint32_t* offset = &script->yieldOffsets()[i];
+ uint32_t* offset = &script->yieldAndAwaitOffsets()[i];
if (!xdr->codeUint32(offset))
return false;
}
@@ -2456,7 +2456,7 @@ ScriptDataSize(uint32_t nscopes, uint32_t nconsts, uint32_t nobjects,
if (nscopenotes != 0)
size += sizeof(ScopeNoteArray) + nscopenotes * sizeof(ScopeNote);
if (nyieldoffsets != 0)
- size += sizeof(YieldOffsetArray) + nyieldoffsets * sizeof(uint32_t);
+ size += sizeof(YieldAndAwaitOffsetArray) + nyieldoffsets * sizeof(uint32_t);
return size;
}
@@ -2558,10 +2558,10 @@ JSScript::partiallyInit(ExclusiveContext* cx, HandleScript script, uint32_t nsco
cursor += sizeof(ScopeNoteArray);
}
- YieldOffsetArray* yieldOffsets = nullptr;
+ YieldAndAwaitOffsetArray* yieldAndAwaitOffsets = nullptr;
if (nyieldoffsets != 0) {
- yieldOffsets = reinterpret_cast<YieldOffsetArray*>(cursor);
- cursor += sizeof(YieldOffsetArray);
+ yieldAndAwaitOffsets = reinterpret_cast<YieldAndAwaitOffsetArray*>(cursor);
+ cursor += sizeof(YieldAndAwaitOffsetArray);
}
if (nconsts != 0) {
@@ -2602,8 +2602,8 @@ JSScript::partiallyInit(ExclusiveContext* cx, HandleScript script, uint32_t nsco
}
if (nyieldoffsets != 0) {
- yieldOffsets->init(reinterpret_cast<uint32_t*>(cursor), nyieldoffsets);
- size_t vectorSize = nyieldoffsets * sizeof(script->yieldOffsets()[0]);
+ yieldAndAwaitOffsets->init(reinterpret_cast<uint32_t*>(cursor), nyieldoffsets);
+ size_t vectorSize = nyieldoffsets * sizeof(script->yieldAndAwaitOffsets()[0]);
#ifdef DEBUG
memset(cursor, 0, vectorSize);
#endif
@@ -2623,10 +2623,10 @@ JSScript::initFunctionPrototype(ExclusiveContext* cx, Handle<JSScript*> script,
uint32_t numObjects = 0;
uint32_t numTryNotes = 0;
uint32_t numScopeNotes = 0;
- uint32_t numYieldOffsets = 0;
+ uint32_t numYieldAndAwaitOffsets = 0;
uint32_t numTypeSets = 0;
if (!partiallyInit(cx, script, numScopes, numConsts, numObjects, numTryNotes,
- numScopeNotes, numYieldOffsets, numTypeSets))
+ numScopeNotes, numYieldAndAwaitOffsets, numTypeSets))
{
return false;
}
@@ -2739,7 +2739,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
if (!partiallyInit(cx, script,
bce->scopeList.length(), bce->constList.length(), bce->objectList.length,
bce->tryNoteList.length(), bce->scopeNoteList.length(),
- bce->yieldOffsetList.length(), bce->typesetCount))
+ bce->yieldAndAwaitOffsetList.length(), bce->typesetCount))
{
return false;
}
@@ -2794,8 +2794,8 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
// Copy yield offsets last, as the generator kind is set in
// initFromFunctionBox.
- if (bce->yieldOffsetList.length() != 0)
- bce->yieldOffsetList.finish(script->yieldOffsets(), prologueLength);
+ if (bce->yieldAndAwaitOffsetList.length() != 0)
+ bce->yieldAndAwaitOffsetList.finish(script->yieldAndAwaitOffsets(), prologueLength);
#ifdef DEBUG
script->assertValidJumpTargets();
@@ -3242,7 +3242,7 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
uint32_t nscopes = src->scopes()->length;
uint32_t ntrynotes = src->hasTrynotes() ? src->trynotes()->length : 0;
uint32_t nscopenotes = src->hasScopeNotes() ? src->scopeNotes()->length : 0;
- uint32_t nyieldoffsets = src->hasYieldOffsets() ? src->yieldOffsets().length() : 0;
+ uint32_t nyieldoffsets = src->hasYieldAndAwaitOffsets() ? src->yieldAndAwaitOffsets().length() : 0;
/* Script data */
@@ -3380,8 +3380,10 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
dst->trynotes()->vector = Rebase<JSTryNote>(dst, src, src->trynotes()->vector);
if (nscopenotes != 0)
dst->scopeNotes()->vector = Rebase<ScopeNote>(dst, src, src->scopeNotes()->vector);
- if (nyieldoffsets != 0)
- dst->yieldOffsets().vector_ = Rebase<uint32_t>(dst, src, src->yieldOffsets().vector_);
+ if (nyieldoffsets != 0) {
+ dst->yieldAndAwaitOffsets().vector_ =
+ Rebase<uint32_t>(dst, src, src->yieldAndAwaitOffsets().vector_);
+ }
/*
* Function delazification assumes that their script does not have a