summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/BytecodeEmitter.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 18:03:08 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 18:03:08 +0200
commit6cc615bbe5224cf74fc302a6fb72d0de56feb719 (patch)
tree858f6ed2731bfdcc47231d0de00139368a045558 /js/src/frontend/BytecodeEmitter.h
parent66b55fbc0a2cddcd3a8ef6b15528b3c48c01e4a8 (diff)
downloadUXP-6cc615bbe5224cf74fc302a6fb72d0de56feb719.tar
UXP-6cc615bbe5224cf74fc302a6fb72d0de56feb719.tar.gz
UXP-6cc615bbe5224cf74fc302a6fb72d0de56feb719.tar.lz
UXP-6cc615bbe5224cf74fc302a6fb72d0de56feb719.tar.xz
UXP-6cc615bbe5224cf74fc302a6fb72d0de56feb719.zip
Improve efficiency of (C++) heap allocations related to
BytecodeEmitter::code. While there, also add some sanity checks and clean up code.
Diffstat (limited to 'js/src/frontend/BytecodeEmitter.h')
-rw-r--r--js/src/frontend/BytecodeEmitter.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h
index 32668a34c..814fa11d4 100644
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -109,10 +109,12 @@ struct CGYieldOffsetList {
void finish(YieldOffsetArray& array, uint32_t prologueLength);
};
-// Use zero inline elements because these go on the stack and affect how many
-// nested functions are possible.
-typedef Vector<jsbytecode, 0> BytecodeVector;
-typedef Vector<jssrcnote, 0> SrcNotesVector;
+static size_t MaxBytecodeLength = INT32_MAX;
+static size_t MaxSrcNotesLength = INT32_MAX;
+
+// Have a few inline elements to avoid heap allocation for tiny sequences.
+typedef Vector<jsbytecode, 256> BytecodeVector;
+typedef Vector<jssrcnote, 64> SrcNotesVector;
// Linked list of jump instructions that need to be patched. The linked list is
// stored in the bytes of the incomplete bytecode that will be patched, so no