mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1019182 - ProfileEntry flags should be zeroed when setting frame data, r=djvj
This commit is contained in:
parent
e07b6107aa
commit
46455c55fd
@ -47,11 +47,9 @@ class ProfileEntry
|
||||
int32_t volatile lineOrPc;
|
||||
|
||||
// General purpose storage describing this frame.
|
||||
uint32_t volatile flags;
|
||||
uint32_t volatile flags_;
|
||||
|
||||
public:
|
||||
ProfileEntry(void) : flags(0) {}
|
||||
|
||||
// These traits are bit masks. Make sure they're powers of 2.
|
||||
enum Flags {
|
||||
// Indicate whether a profile entry represents a CPP frame. If not set,
|
||||
@ -93,26 +91,29 @@ class ProfileEntry
|
||||
const char *label() const volatile { return string; }
|
||||
|
||||
void setJsFrame(JSScript *aScript, jsbytecode *aPc) volatile {
|
||||
flags &= ~IS_CPP_ENTRY;
|
||||
flags_ = 0;
|
||||
spOrScript = aScript;
|
||||
setPC(aPc);
|
||||
}
|
||||
void setCppFrame(void *aSp, uint32_t aLine) volatile {
|
||||
flags |= IS_CPP_ENTRY;
|
||||
flags_ = IS_CPP_ENTRY;
|
||||
spOrScript = aSp;
|
||||
lineOrPc = static_cast<int32_t>(aLine);
|
||||
}
|
||||
|
||||
void setFlag(uint32_t flag) volatile {
|
||||
MOZ_ASSERT(flag != IS_CPP_ENTRY);
|
||||
flags |= flag;
|
||||
flags_ |= flag;
|
||||
}
|
||||
void unsetFlag(uint32_t flag) volatile {
|
||||
MOZ_ASSERT(flag != IS_CPP_ENTRY);
|
||||
flags &= ~flag;
|
||||
flags_ &= ~flag;
|
||||
}
|
||||
bool hasFlag(uint32_t flag) const volatile {
|
||||
return bool(flags & uint32_t(flag));
|
||||
return bool(flags_ & flag);
|
||||
}
|
||||
uint32_t flags() const volatile {
|
||||
return flags_;
|
||||
}
|
||||
|
||||
void *stackAddress() const volatile {
|
||||
@ -140,7 +141,7 @@ class ProfileEntry
|
||||
static size_t offsetOfLabel() { return offsetof(ProfileEntry, string); }
|
||||
static size_t offsetOfSpOrScript() { return offsetof(ProfileEntry, spOrScript); }
|
||||
static size_t offsetOfLineOrPc() { return offsetof(ProfileEntry, lineOrPc); }
|
||||
static size_t offsetOfFlags() { return offsetof(ProfileEntry, flags); }
|
||||
static size_t offsetOfFlags() { return offsetof(ProfileEntry, flags_); }
|
||||
};
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
|
@ -215,6 +215,7 @@ SPSProfiler::enterNative(const char *string, void *sp)
|
||||
if (current < max_) {
|
||||
stack[current].setLabel(string);
|
||||
stack[current].setCppFrame(sp, 0);
|
||||
JS_ASSERT(stack[current].flags() == js::ProfileEntry::IS_CPP_ENTRY);
|
||||
}
|
||||
*size = current + 1;
|
||||
}
|
||||
@ -235,10 +236,14 @@ SPSProfiler::push(const char *string, void *sp, JSScript *script, jsbytecode *pc
|
||||
volatile ProfileEntry &entry = stack[current];
|
||||
entry.setLabel(string);
|
||||
|
||||
if (sp != nullptr)
|
||||
if (sp != nullptr) {
|
||||
entry.setCppFrame(sp, 0);
|
||||
else
|
||||
JS_ASSERT(entry.flags() == js::ProfileEntry::IS_CPP_ENTRY);
|
||||
}
|
||||
else {
|
||||
entry.setJsFrame(script, pc);
|
||||
JS_ASSERT(entry.flags() == 0);
|
||||
}
|
||||
|
||||
// Track if mLabel needs a copy.
|
||||
if (copy)
|
||||
|
@ -362,6 +362,7 @@ public:
|
||||
// been written such that mStack is always consistent.
|
||||
entry.setLabel(aName);
|
||||
entry.setCppFrame(aStackAddress, line);
|
||||
MOZ_ASSERT(entry.flags() == js::ProfileEntry::IS_CPP_ENTRY);
|
||||
|
||||
uint32_t uint_category = static_cast<uint32_t>(aCategory);
|
||||
MOZ_ASSERT(
|
||||
|
Loading…
Reference in New Issue
Block a user