diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-17 13:51:02 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-17 13:51:02 +0000 |
commit | 9a2224a97c7d258fc1f0e5fad30706987880ce22 (patch) | |
tree | 506d755bc01b2b894adb0d5b3169258b6e21bd20 /js/src/frontend | |
parent | 62311832e964ac30a75efacaa53ed93039d7d7a6 (diff) | |
download | UXP-9a2224a97c7d258fc1f0e5fad30706987880ce22.tar UXP-9a2224a97c7d258fc1f0e5fad30706987880ce22.tar.gz UXP-9a2224a97c7d258fc1f0e5fad30706987880ce22.tar.lz UXP-9a2224a97c7d258fc1f0e5fad30706987880ce22.tar.xz UXP-9a2224a97c7d258fc1f0e5fad30706987880ce22.zip |
Revert "Remove JSOP_SPREADCALLARRAY and just use JSOP_NEWARRAY again."
This reverts commit 912c3f5cbc512557794a3dfd7bc5cb4994413dfe.
Diffstat (limited to 'js/src/frontend')
-rw-r--r-- | js/src/frontend/BytecodeEmitter.cpp | 9 | ||||
-rw-r--r-- | js/src/frontend/BytecodeEmitter.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 7f9fa8a5d..ea6baeec7 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -9192,7 +9192,7 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn) return false; } - if (!emitArray(args, argc)) + if (!emitArray(args, argc, JSOP_SPREADCALLARRAY)) return false; if (optCodeEmitted) { @@ -9683,11 +9683,11 @@ BytecodeEmitter::emitArrayLiteral(ParseNode* pn) } } - return emitArray(pn->pn_head, pn->pn_count); + return emitArray(pn->pn_head, pn->pn_count, JSOP_NEWARRAY); } bool -BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count) +BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count, JSOp op) { /* @@ -9698,6 +9698,7 @@ BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count) * to avoid dup'ing and popping the array as each element is added, as * JSOP_SETELEM/JSOP_SETPROP would do. */ + MOZ_ASSERT(op == JSOP_NEWARRAY || op == JSOP_SPREADCALLARRAY); uint32_t nspread = 0; for (ParseNode* elt = pn; elt; elt = elt->pn_next) { @@ -9718,7 +9719,7 @@ BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count) // For arrays with spread, this is a very pessimistic allocation, the // minimum possible final size. - if (!emitUint32Operand(JSOP_NEWARRAY, count - nspread)) // ARRAY + if (!emitUint32Operand(op, count - nspread)) // ARRAY return false; ParseNode* pn2 = pn; diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index 29050c846..814fa11d4 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -521,7 +521,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter MOZ_MUST_USE bool emitAtomOp(ParseNode* pn, JSOp op); MOZ_MUST_USE bool emitArrayLiteral(ParseNode* pn); - MOZ_MUST_USE bool emitArray(ParseNode* pn, uint32_t count); + MOZ_MUST_USE bool emitArray(ParseNode* pn, uint32_t count, JSOp op); MOZ_MUST_USE bool emitArrayComp(ParseNode* pn); MOZ_MUST_USE bool emitInternedScopeOp(uint32_t index, JSOp op); |