diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-24 12:28:12 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-24 12:28:12 +0100 |
commit | 76aa8d5652a168c73fbdbc0816069361f3434a20 (patch) | |
tree | 5cba1b96e8d02f657d64f1ea43421d2af044e3c3 /js/src/jsopcode.cpp | |
parent | 37f0a017e4a0d39d6c69d1877102b9afe29eadb7 (diff) | |
download | uxp-76aa8d5652a168c73fbdbc0816069361f3434a20.tar.gz |
Bug 1147371: Implement JSOP_PICK and JSOP_UNPICK in the expression decompiler
Issue mcp-graveyard/UXP#74
Diffstat (limited to 'js/src/jsopcode.cpp')
-rw-r--r-- | js/src/jsopcode.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 31bbfb4717..eadbca4f81 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -460,6 +460,34 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint offsetStack[stackDepth] = tmp; } break; + + case JSOP_PICK: { + jsbytecode* pc = script_->offsetToPC(offset); + unsigned n = GET_UINT8(pc); + MOZ_ASSERT(ndefs == n + 1); + if (offsetStack) { + uint32_t top = stackDepth + n; + uint32_t tmp = offsetStack[stackDepth]; + for (uint32_t i = stackDepth; i < top; i++) + offsetStack[i] = offsetStack[i + 1]; + offsetStack[top] = tmp; + } + break; + } + + case JSOP_UNPICK: { + jsbytecode* pc = script_->offsetToPC(offset); + unsigned n = GET_UINT8(pc); + MOZ_ASSERT(ndefs == n + 1); + if (offsetStack) { + uint32_t top = stackDepth + n; + uint32_t tmp = offsetStack[top]; + for (uint32_t i = top; i > stackDepth; i--) + offsetStack[i] = offsetStack[i - 1]; + offsetStack[stackDepth] = tmp; + } + break; + } } stackDepth += ndefs; return stackDepth; |