summaryrefslogtreecommitdiffstats
path: root/js/src/gc/Allocator.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-20 10:05:23 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-03-20 10:07:06 +0100
commit7197b308fb97cd8ab7a972df6a3a17a7a265b594 (patch)
treee6a36f10a28710bac1b901915a643ce398580cdf /js/src/gc/Allocator.cpp
parent173a526ec0bedec17f35cc838b9c7d47a5ce13b7 (diff)
parenta413cf72888dcb5197ba44aba547b8d496231cff (diff)
downloadUXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar
UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.gz
UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.lz
UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.xz
UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.zip
Make RegExp.prototype return a regular object instead of an instance.
This resolves #77. Merged remote-tracking branch 'janek/js_regexp_ordinary-object_1'
Diffstat (limited to 'js/src/gc/Allocator.cpp')
-rw-r--r--js/src/gc/Allocator.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp
index 3994d5a5b..212493d86 100644
--- a/js/src/gc/Allocator.cpp
+++ b/js/src/gc/Allocator.cpp
@@ -39,8 +39,12 @@ js::Allocate(ExclusiveContext* cx, AllocKind kind, size_t nDynamicSlots, Initial
MOZ_ASSERT_IF(nDynamicSlots != 0, clasp->isNative() || clasp->isProxy());
// Off-main-thread alloc cannot trigger GC or make runtime assertions.
- if (!cx->isJSContext())
- return GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
+ if (!cx->isJSContext()) {
+ JSObject* obj = GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
+ if (MOZ_UNLIKELY(allowGC && !obj))
+ ReportOutOfMemory(cx);
+ return obj;
+ }
JSContext* ncx = cx->asJSContext();
JSRuntime* rt = ncx->runtime();