summaryrefslogtreecommitdiffstats
path: root/js/src/frontend
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-09-02 18:59:51 -0500
committertrav90 <travawine@palemoon.org>2018-09-02 20:07:47 -0500
commit36cb80d1cac66a1511bec4ad97947a2deeab2e08 (patch)
tree71212ddd26aa7a37b5ef4c5390e3e33c4db69c94 /js/src/frontend
parentb4aed63f5758b955e84840c5871b1301ccb6968f (diff)
downloadUXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar
UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.gz
UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.lz
UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.xz
UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.zip
Call the relevant scope-data constructor when allocating it, and poison/mark as undefined the memory for the trailing array of BindingNames, ratther than impermissibly PodZero-ing non-trivial classes.
Diffstat (limited to 'js/src/frontend')
-rw-r--r--js/src/frontend/Parser.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index 343621194..7bfab87a3 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -1453,13 +1453,11 @@ template <typename Scope>
static typename Scope::Data*
NewEmptyBindingData(ExclusiveContext* cx, LifoAlloc& alloc, uint32_t numBindings)
{
+ using Data = typename Scope::Data;
size_t allocSize = Scope::sizeOfData(numBindings);
- auto* bindings = static_cast<typename Scope::Data*>(alloc.alloc(allocSize));
- if (!bindings) {
+ auto* bindings = alloc.allocInSize<Data>(allocSize, numBindings);
+ if (!bindings)
ReportOutOfMemory(cx);
- return nullptr;
- }
- PodZero(bindings);
return bindings;
}