mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 01:08:39 +09:00
1342497 - Baldr: store current frame, not previous frame, in wasm::FrameIterator
1342497 - Baldr: store current frame, not previous frame, in wasm::FrameIterator.
This commit is contained in:
parent
b3e4157642
commit
5dde8c1c4a
2 changed files with 21 additions and 28 deletions
|
|
@ -57,7 +57,6 @@ FrameIterator::FrameIterator()
|
|||
callsite_(nullptr),
|
||||
codeRange_(nullptr),
|
||||
fp_(nullptr),
|
||||
pc_(nullptr),
|
||||
unwind_(Unwind::False),
|
||||
missingFrameMessage_(false)
|
||||
{
|
||||
|
|
@ -70,7 +69,6 @@ FrameIterator::FrameIterator(WasmActivation* activation, Unwind unwind)
|
|||
callsite_(nullptr),
|
||||
codeRange_(nullptr),
|
||||
fp_(activation->fp()),
|
||||
pc_(nullptr),
|
||||
unwind_(unwind),
|
||||
missingFrameMessage_(false)
|
||||
{
|
||||
|
|
@ -84,7 +82,6 @@ FrameIterator::FrameIterator(WasmActivation* activation, Unwind unwind)
|
|||
MOZ_ASSERT(done());
|
||||
return;
|
||||
}
|
||||
pc_ = (uint8_t*)pc;
|
||||
|
||||
code_ = activation_->compartment()->wasm.lookupCode(pc);
|
||||
MOZ_ASSERT(code_);
|
||||
|
|
@ -111,12 +108,8 @@ FrameIterator::operator++()
|
|||
{
|
||||
MOZ_ASSERT(!done());
|
||||
if (fp_) {
|
||||
DebugOnly<uint8_t*> oldfp = fp_;
|
||||
fp_ += callsite_->stackDepth();
|
||||
MOZ_ASSERT_IF(code_->profilingEnabled(), fp_ == CallerFPFromFP(oldfp));
|
||||
settle();
|
||||
} else if (codeRange_) {
|
||||
MOZ_ASSERT(codeRange_);
|
||||
codeRange_ = nullptr;
|
||||
missingFrameMessage_ = true;
|
||||
} else {
|
||||
|
|
@ -128,6 +121,9 @@ FrameIterator::operator++()
|
|||
void
|
||||
FrameIterator::settle()
|
||||
{
|
||||
if (unwind_ == Unwind::True)
|
||||
activation_->unwindFP(fp_);
|
||||
|
||||
void* returnAddress = ReturnAddressFromFP(fp_);
|
||||
|
||||
code_ = activation_->compartment()->wasm.lookupCode(returnAddress);
|
||||
|
|
@ -136,30 +132,28 @@ FrameIterator::settle()
|
|||
codeRange_ = code_->lookupRange(returnAddress);
|
||||
MOZ_ASSERT(codeRange_);
|
||||
|
||||
switch (codeRange_->kind()) {
|
||||
case CodeRange::Function:
|
||||
pc_ = (uint8_t*)returnAddress;
|
||||
callsite_ = code_->lookupCallSite(returnAddress);
|
||||
MOZ_ASSERT(callsite_);
|
||||
break;
|
||||
case CodeRange::Entry:
|
||||
if (codeRange_->kind() == CodeRange::Entry) {
|
||||
fp_ = nullptr;
|
||||
pc_ = nullptr;
|
||||
code_ = nullptr;
|
||||
codeRange_ = nullptr;
|
||||
callsite_ = nullptr;
|
||||
|
||||
if (unwind_ == Unwind::True)
|
||||
activation_->unwindFP(nullptr);
|
||||
MOZ_ASSERT(done());
|
||||
break;
|
||||
case CodeRange::ImportJitExit:
|
||||
case CodeRange::ImportInterpExit:
|
||||
case CodeRange::TrapExit:
|
||||
case CodeRange::DebugTrap:
|
||||
case CodeRange::Inline:
|
||||
case CodeRange::FarJumpIsland:
|
||||
MOZ_CRASH("Should not encounter an exit during iteration");
|
||||
return;
|
||||
}
|
||||
|
||||
if (unwind_ == Unwind::True)
|
||||
activation_->unwindFP(fp_);
|
||||
MOZ_RELEASE_ASSERT(codeRange_->kind() == CodeRange::Function);
|
||||
|
||||
callsite_ = code_->lookupCallSite(returnAddress);
|
||||
MOZ_ASSERT(callsite_);
|
||||
|
||||
DebugOnly<uint8_t*> oldfp = fp_;
|
||||
fp_ += callsite_->stackDepth();
|
||||
MOZ_ASSERT_IF(code_->profilingEnabled(), fp_ == CallerFPFromFP(oldfp));
|
||||
|
||||
MOZ_ASSERT(!done());
|
||||
}
|
||||
|
||||
const char*
|
||||
|
|
@ -225,7 +219,7 @@ Instance*
|
|||
FrameIterator::instance() const
|
||||
{
|
||||
MOZ_ASSERT(!done() && debugEnabled());
|
||||
return TlsDataFromFP(fp_ + callsite_->stackDepth())->instance;
|
||||
return TlsDataFromFP(fp_)->instance;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -243,7 +237,7 @@ FrameIterator::debugFrame() const
|
|||
{
|
||||
MOZ_ASSERT(!done() && debugEnabled());
|
||||
// The fp() points to wasm::Frame.
|
||||
void* buf = static_cast<uint8_t*>(fp_ + callsite_->stackDepth()) - DebugFrame::offsetOfFrame();
|
||||
void* buf = static_cast<uint8_t*>(fp_) - DebugFrame::offsetOfFrame();
|
||||
return static_cast<DebugFrame*>(buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class FrameIterator
|
|||
const CallSite* callsite_;
|
||||
const CodeRange* codeRange_;
|
||||
uint8_t* fp_;
|
||||
uint8_t* pc_;
|
||||
Unwind unwind_;
|
||||
bool missingFrameMessage_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue