зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322076 - Remove BytecodeEmitter::emit*InBranch. r=anba
This commit is contained in:
Родитель
90c91d64dc
Коммит
e5a4f8c3db
|
@ -3434,6 +3434,11 @@ BytecodeEmitter::wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth, In
|
|||
bool
|
||||
BytecodeEmitter::emitDefault(ParseNode* defaultExpr, ParseNode* pattern)
|
||||
{
|
||||
IfEmitter ifUndefined(this);
|
||||
if (!ifUndefined.emitIf(Nothing())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!emit1(JSOP_DUP)) { // VALUE VALUE
|
||||
return false;
|
||||
}
|
||||
|
@ -3443,21 +3448,19 @@ BytecodeEmitter::emitDefault(ParseNode* defaultExpr, ParseNode* pattern)
|
|||
if (!emit1(JSOP_STRICTEQ)) { // VALUE EQL?
|
||||
return false;
|
||||
}
|
||||
// Emit source note to enable ion compilation.
|
||||
if (!newSrcNote(SRC_IF)) {
|
||||
|
||||
if (!ifUndefined.emitThen()) { // VALUE
|
||||
return false;
|
||||
}
|
||||
JumpList jump;
|
||||
if (!emitJump(JSOP_IFEQ, &jump)) { // VALUE
|
||||
|
||||
if (!emit1(JSOP_POP)) { //
|
||||
return false;
|
||||
}
|
||||
if (!emit1(JSOP_POP)) { // .
|
||||
if (!emitInitializer(defaultExpr, pattern)) { // DEFAULTVALUE
|
||||
return false;
|
||||
}
|
||||
if (!emitInitializerInBranch(defaultExpr, pattern)) { // DEFAULTVALUE
|
||||
return false;
|
||||
}
|
||||
if (!emitJumpTargetAndPatch(jump)) {
|
||||
|
||||
if (!ifUndefined.emitEnd()) { // VALUE/DEFAULTVALUE
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -3521,13 +3524,6 @@ BytecodeEmitter::emitInitializer(ParseNode* initializer, ParseNode* pattern)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::emitInitializerInBranch(ParseNode* initializer, ParseNode* pattern)
|
||||
{
|
||||
TDZCheckCache tdzCache(this);
|
||||
return emitInitializer(initializer, pattern);
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::emitDestructuringOpsArray(ListNode* pattern, DestructuringFlavor flav)
|
||||
{
|
||||
|
@ -8450,34 +8446,13 @@ BytecodeEmitter::emitFunctionFormalParameters(ListNode* paramsBody)
|
|||
// If we have an initializer, emit the initializer and assign it
|
||||
// to the argument slot. TDZ is taken care of afterwards.
|
||||
MOZ_ASSERT(hasParameterExprs);
|
||||
if (!emitArgOp(JSOP_GETARG, argSlot)) {
|
||||
|
||||
if (!emitArgOp(JSOP_GETARG, argSlot)) { // ARG
|
||||
return false;
|
||||
}
|
||||
if (!emit1(JSOP_DUP)) {
|
||||
return false;
|
||||
}
|
||||
if (!emit1(JSOP_UNDEFINED)) {
|
||||
return false;
|
||||
}
|
||||
if (!emit1(JSOP_STRICTEQ)) {
|
||||
return false;
|
||||
}
|
||||
// Emit source note to enable Ion compilation.
|
||||
if (!newSrcNote(SRC_IF)) {
|
||||
return false;
|
||||
}
|
||||
JumpList jump;
|
||||
if (!emitJump(JSOP_IFEQ, &jump)) {
|
||||
return false;
|
||||
}
|
||||
if (!emit1(JSOP_POP)) {
|
||||
return false;
|
||||
}
|
||||
if (!emitInitializerInBranch(initializer, bindingElement)) {
|
||||
return false;
|
||||
}
|
||||
if (!emitJumpTargetAndPatch(jump)) {
|
||||
return false;
|
||||
|
||||
if (!emitDefault(initializer, bindingElement)) {
|
||||
return false; // ARG/DEFAULT
|
||||
}
|
||||
} else if (isRest) {
|
||||
if (!emit1(JSOP_REST)) {
|
||||
|
@ -9438,16 +9413,6 @@ BytecodeEmitter::emitTree(ParseNode* pn, ValueUsage valueUsage /* = ValueUsage::
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::emitTreeInBranch(ParseNode* pn,
|
||||
ValueUsage valueUsage /* = ValueUsage::WantValue */)
|
||||
{
|
||||
// Code that may be conditionally executed always need their own TDZ
|
||||
// cache.
|
||||
TDZCheckCache tdzCache(this);
|
||||
return emitTree(pn, valueUsage);
|
||||
}
|
||||
|
||||
static bool
|
||||
AllocSrcNote(JSContext* cx, SrcNotesVector& notes, unsigned* index)
|
||||
{
|
||||
|
|
|
@ -467,10 +467,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
|||
MOZ_MUST_USE bool emitTree(ParseNode* pn, ValueUsage valueUsage = ValueUsage::WantValue,
|
||||
EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
|
||||
|
||||
// Emit code for the tree rooted at pn with its own TDZ cache.
|
||||
MOZ_MUST_USE bool emitTreeInBranch(ParseNode* pn,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
|
||||
// Emit global, eval, or module code for tree rooted at body. Always
|
||||
// encompasses the entire source.
|
||||
MOZ_MUST_USE bool emitScript(ParseNode* body);
|
||||
|
@ -774,7 +770,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
|||
MOZ_MUST_USE bool setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name);
|
||||
|
||||
MOZ_MUST_USE bool emitInitializer(ParseNode* initializer, ParseNode* pattern);
|
||||
MOZ_MUST_USE bool emitInitializerInBranch(ParseNode* initializer, ParseNode* pattern);
|
||||
|
||||
MOZ_MUST_USE bool emitCallSiteObject(CallSiteNode* callSiteObj);
|
||||
MOZ_MUST_USE bool emitTemplateString(ListNode* templateString);
|
||||
|
|
Загрузка…
Ссылка в новой задаче