summaryrefslogtreecommitdiff
path: root/js/src/vm/Stack.cpp
diff options
context:
space:
mode:
authorFranklinDM <mrmineshafter17@gmail.com>2023-03-17 18:44:51 +0800
committerFranklinDM <mrmineshafter17@gmail.com>2023-03-17 20:29:18 +0800
commit0c35e43441ec35bbd0e35105c1609fd8eeba624d (patch)
tree041b2c825cc9112f6a34f4397cf297c42c268df6 /js/src/vm/Stack.cpp
parent947768348186fb8613cc2dce1cfd85aa26a52d11 (diff)
downloaduxp-0c35e43441ec35bbd0e35105c1609fd8eeba624d.tar.gz
Issue #2166 - Part 1: Use alignas/alignof for public JS::ProfilingFrameIterator's internal storage
... of a private wasm or JIT profiling frame iterator. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1338374
Diffstat (limited to 'js/src/vm/Stack.cpp')
-rw-r--r--js/src/vm/Stack.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp
index cdc1046bcc..de34b40ecb 100644
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -1756,7 +1756,10 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSContext* cx, const Register
static_assert(sizeof(wasm::ProfilingFrameIterator) <= StorageSpace &&
sizeof(jit::JitProfilingFrameIterator) <= StorageSpace,
- "Need to increase storage");
+ "ProfilingFrameIterator::storage_ is too small");
+ static_assert(alignof(void*) >= alignof(wasm::ProfilingFrameIterator) &&
+ alignof(void*) >= alignof(jit::JitProfilingFrameIterator),
+ "ProfilingFrameIterator::storage_ is too weakly aligned");
iteratorConstruct(state);
settle();
@@ -1810,14 +1813,14 @@ JS::ProfilingFrameIterator::iteratorConstruct(const RegisterState& state)
MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
if (activation_->isWasm()) {
- new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asWasm(), state);
+ new (storage()) wasm::ProfilingFrameIterator(*activation_->asWasm(), state);
// Set savedPrevJitTop_ to the actual jitTop_ from the runtime.
savedPrevJitTop_ = activation_->cx()->runtime()->jitTop;
return;
}
MOZ_ASSERT(activation_->asJit()->isActive());
- new (storage_.addr()) jit::JitProfilingFrameIterator(rt_, state);
+ new (storage()) jit::JitProfilingFrameIterator(rt_, state);
}
void
@@ -1827,13 +1830,13 @@ JS::ProfilingFrameIterator::iteratorConstruct()
MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
if (activation_->isWasm()) {
- new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asWasm());
+ new (storage()) wasm::ProfilingFrameIterator(*activation_->asWasm());
return;
}
MOZ_ASSERT(activation_->asJit()->isActive());
MOZ_ASSERT(savedPrevJitTop_ != nullptr);
- new (storage_.addr()) jit::JitProfilingFrameIterator(savedPrevJitTop_);
+ new (storage()) jit::JitProfilingFrameIterator(savedPrevJitTop_);
}
void