mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 989759 part 2 - Dispatch base on the instruction identifier. r=jandem
This commit is contained in:
parent
fdad35afca
commit
caf7ff8cc4
@ -244,6 +244,8 @@ class IonFrameIterator
|
||||
class IonJSFrameLayout;
|
||||
class IonBailoutIterator;
|
||||
|
||||
class RResumePoint;
|
||||
|
||||
// Reads frame information in snapshot-encoding order (that is, outermost frame
|
||||
// to innermost frame).
|
||||
class SnapshotIterator
|
||||
@ -291,8 +293,9 @@ class SnapshotIterator
|
||||
return UndefinedValue();
|
||||
}
|
||||
|
||||
const RResumePoint *resumePoint() const {
|
||||
return recover_.resumePoint();
|
||||
const RResumePoint *resumePoint() const;
|
||||
const RInstruction *instruction() const {
|
||||
return recover_.instruction();
|
||||
}
|
||||
|
||||
uint32_t numAllocations() const;
|
||||
|
@ -1499,6 +1499,12 @@ SnapshotIterator::allocationValue(const RValueAllocation &alloc)
|
||||
}
|
||||
}
|
||||
|
||||
const RResumePoint *
|
||||
SnapshotIterator::resumePoint() const
|
||||
{
|
||||
return instruction()->toResumePoint();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SnapshotIterator::numAllocations() const
|
||||
{
|
||||
|
@ -13,10 +13,24 @@
|
||||
using namespace js;
|
||||
using namespace js::jit;
|
||||
|
||||
void
|
||||
RInstruction::readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw)
|
||||
{
|
||||
uint32_t op = reader.readUnsigned();
|
||||
switch (Opcode(op)) {
|
||||
case Recover_ResumePoint:
|
||||
new (raw->addr()) RResumePoint(reader);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSUME_UNREACHABLE("Bad decoding of the previous instruction?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MResumePoint::writeRecoverData(CompactBufferWriter &writer) const
|
||||
{
|
||||
writer.writeUnsigned(uint32_t(Recover_ResumePoint));
|
||||
writer.writeUnsigned(uint32_t(RInstruction::Recover_ResumePoint));
|
||||
|
||||
MBasicBlock *bb = block();
|
||||
JSFunction *fun = bb->info().funMaybeLazy();
|
||||
@ -94,11 +108,3 @@ RResumePoint::RResumePoint(CompactBufferReader &reader)
|
||||
IonSpew(IonSpew_Snapshots, "Read RResumePoint (pc offset %u, nslots %u)",
|
||||
pcOffset_, numOperands_);
|
||||
}
|
||||
|
||||
void
|
||||
RResumePoint::readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw)
|
||||
{
|
||||
mozilla::DebugOnly<uint32_t> op = reader.readUnsigned();
|
||||
MOZ_ASSERT(op == uint32_t(Recover_ResumePoint));
|
||||
new (raw->addr()) RResumePoint(reader);
|
||||
}
|
||||
|
@ -7,35 +7,64 @@
|
||||
#ifndef jit_Recover_h
|
||||
#define jit_Recover_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include "jit/Snapshots.h"
|
||||
|
||||
namespace js {
|
||||
namespace jit {
|
||||
|
||||
enum RecoverOpcode
|
||||
class RResumePoint;
|
||||
|
||||
class RInstruction
|
||||
{
|
||||
Recover_ResumePoint = 0
|
||||
public:
|
||||
enum Opcode
|
||||
{
|
||||
Recover_ResumePoint = 0
|
||||
};
|
||||
|
||||
virtual Opcode opcode() const = 0;
|
||||
|
||||
bool isResumePoint() const {
|
||||
return opcode() == Recover_ResumePoint;
|
||||
}
|
||||
inline const RResumePoint *toResumePoint() const;
|
||||
|
||||
virtual uint32_t numOperands() const = 0;
|
||||
|
||||
static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw);
|
||||
};
|
||||
|
||||
class RResumePoint
|
||||
class RResumePoint MOZ_FINAL : public RInstruction
|
||||
{
|
||||
private:
|
||||
uint32_t pcOffset_; // Offset from script->code.
|
||||
uint32_t numOperands_; // Number of slots.
|
||||
|
||||
friend class RInstruction;
|
||||
RResumePoint(CompactBufferReader &reader);
|
||||
|
||||
public:
|
||||
static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw);
|
||||
virtual Opcode opcode() const {
|
||||
return Recover_ResumePoint;
|
||||
}
|
||||
|
||||
uint32_t pcOffset() const {
|
||||
return pcOffset_;
|
||||
}
|
||||
uint32_t numOperands() const {
|
||||
virtual uint32_t numOperands() const {
|
||||
return numOperands_;
|
||||
}
|
||||
};
|
||||
|
||||
const RResumePoint *
|
||||
RInstruction::toResumePoint() const
|
||||
{
|
||||
MOZ_ASSERT(isResumePoint());
|
||||
return static_cast<const RResumePoint *>(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ void
|
||||
RecoverReader::readFrame()
|
||||
{
|
||||
JS_ASSERT(moreFrames());
|
||||
RResumePoint::readRecoverData(reader_, &rawData_);
|
||||
RInstruction::readRecoverData(reader_, &rawData_);
|
||||
framesRead_++;
|
||||
}
|
||||
|
||||
|
@ -441,8 +441,8 @@ class SnapshotReader
|
||||
}
|
||||
};
|
||||
|
||||
typedef mozilla::AlignedStorage<2 * sizeof(uint32_t)> RInstructionStorage;
|
||||
class RResumePoint;
|
||||
typedef mozilla::AlignedStorage<4 * sizeof(uint32_t)> RInstructionStorage;
|
||||
class RInstruction;
|
||||
|
||||
class RecoverReader
|
||||
{
|
||||
@ -473,8 +473,8 @@ class RecoverReader
|
||||
return frameCount_;
|
||||
}
|
||||
|
||||
const RResumePoint *resumePoint() const {
|
||||
return reinterpret_cast<const RResumePoint *>(rawData_.addr());
|
||||
const RInstruction *instruction() const {
|
||||
return reinterpret_cast<const RInstruction *>(rawData_.addr());
|
||||
}
|
||||
|
||||
bool resumeAfter() const {
|
||||
|
Loading…
Reference in New Issue
Block a user