mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1115847 - Commit correct version of patch from bug 1100337. (r=me)
This commit is contained in:
parent
f7a220a203
commit
71c71ab2e2
@ -1039,9 +1039,9 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
|
|||||||
|
|
||||||
if (excInfo && excInfo->propagatingIonExceptionForDebugMode() && resumeAfter) {
|
if (excInfo && excInfo->propagatingIonExceptionForDebugMode() && resumeAfter) {
|
||||||
// When propagating an exception for debug mode, set the
|
// When propagating an exception for debug mode, set the
|
||||||
// return address as the return-from-IC for the throwing op,
|
// return address as native code for the throwing op, so that
|
||||||
// so that Debugger hooks report the correct pc offset of the
|
// Debugger hooks report the correct pc offset of the throwing
|
||||||
// throwing op instead of its successor.
|
// op instead of its successor.
|
||||||
//
|
//
|
||||||
// This should not be done if we are at a resume-at point, as
|
// This should not be done if we are at a resume-at point, as
|
||||||
// might be the case when propagating an exception thrown from
|
// might be the case when propagating an exception thrown from
|
||||||
@ -1051,10 +1051,8 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
|
|||||||
//
|
//
|
||||||
// Note that we never resume into this address, it is set for
|
// Note that we never resume into this address, it is set for
|
||||||
// the sake of frame iterators giving the correct answer.
|
// the sake of frame iterators giving the correct answer.
|
||||||
ICEntry &icEntry = baselineScript->anyKindICEntryFromPCOffset(iter.pcOffset());
|
jsbytecode *throwPC = script->offsetToPC(iter.pcOffset());
|
||||||
nativeCodeForPC = baselineScript->returnAddressForIC(icEntry);
|
nativeCodeForPC = baselineScript->nativeCodeForPC(script, throwPC);
|
||||||
} else {
|
|
||||||
MOZ_ASSERT(nativeCodeForPC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(nativeCodeForPC);
|
MOZ_ASSERT(nativeCodeForPC);
|
||||||
|
@ -214,8 +214,9 @@ CollectJitStackScripts(JSContext *cx, const Debugger::ExecutionObservableSet &ob
|
|||||||
// Otherwise, we are in the middle of handling an
|
// Otherwise, we are in the middle of handling an
|
||||||
// exception. This happens since we could have bailed out
|
// exception. This happens since we could have bailed out
|
||||||
// in place from Ion after a throw, settling on the pc
|
// in place from Ion after a throw, settling on the pc
|
||||||
// *after* the bytecode that threw the exception, which
|
// which may have no ICEntry (e.g., Ion is free to insert
|
||||||
// may have no ICEntry.
|
// resume points after non-effectful ops for better
|
||||||
|
// register allocation).
|
||||||
MOZ_ASSERT(iter.baselineFrame()->isDebuggerHandlingException());
|
MOZ_ASSERT(iter.baselineFrame()->isDebuggerHandlingException());
|
||||||
jsbytecode *pc = script->baselineScript()->pcForNativeAddress(script, retAddr);
|
jsbytecode *pc = script->baselineScript()->pcForNativeAddress(script, retAddr);
|
||||||
if (!entries.append(DebugModeOSREntry(script, script->pcToOffset(pc))))
|
if (!entries.append(DebugModeOSREntry(script, script->pcToOffset(pc))))
|
||||||
@ -400,24 +401,9 @@ PatchBaselineFramesForDebugMode(JSContext *cx, const Debugger::ExecutionObservab
|
|||||||
BaselineScript *bl = script->baselineScript();
|
BaselineScript *bl = script->baselineScript();
|
||||||
ICEntry::Kind kind = entry.frameKind;
|
ICEntry::Kind kind = entry.frameKind;
|
||||||
|
|
||||||
if (kind == ICEntry::Kind_Op || kind == ICEntry::Kind_NonOp) {
|
if (kind == ICEntry::Kind_Op) {
|
||||||
uint8_t *retAddr;
|
// Case A above.
|
||||||
if (kind == ICEntry::Kind_Op) {
|
//
|
||||||
// Case A above.
|
|
||||||
retAddr = bl->returnAddressForIC(bl->icEntryFromPCOffset(pcOffset));
|
|
||||||
} else {
|
|
||||||
// Case H above.
|
|
||||||
//
|
|
||||||
// It could happen that the in-place Ion bailout chose the
|
|
||||||
// return-from-IC address of a NonOp IC for the frame
|
|
||||||
// iterators to report the correct bytecode pc.
|
|
||||||
//
|
|
||||||
// See note under propagatingIonExceptionForDebugMode in
|
|
||||||
// InitFromBailout.
|
|
||||||
MOZ_ASSERT(iter.baselineFrame()->isDebuggerHandlingException());
|
|
||||||
retAddr = bl->returnAddressForIC(bl->anyKindICEntryFromPCOffset(pcOffset));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patching these cases needs to patch both the stub frame and
|
// Patching these cases needs to patch both the stub frame and
|
||||||
// the baseline frame. The stub frame is patched below. For
|
// the baseline frame. The stub frame is patched below. For
|
||||||
// the baseline frame here, we resume right after the IC
|
// the baseline frame here, we resume right after the IC
|
||||||
@ -425,6 +411,7 @@ PatchBaselineFramesForDebugMode(JSContext *cx, const Debugger::ExecutionObservab
|
|||||||
//
|
//
|
||||||
// Since we're using the same IC stub code, we can resume
|
// Since we're using the same IC stub code, we can resume
|
||||||
// directly to the IC resume address.
|
// directly to the IC resume address.
|
||||||
|
uint8_t *retAddr = bl->returnAddressForIC(bl->icEntryFromPCOffset(pcOffset));
|
||||||
SpewPatchBaselineFrame(prev->returnAddress(), retAddr, script, kind, pc);
|
SpewPatchBaselineFrame(prev->returnAddress(), retAddr, script, kind, pc);
|
||||||
DebugModeOSRVolatileJitFrameIterator::forwardLiveIterators(
|
DebugModeOSRVolatileJitFrameIterator::forwardLiveIterators(
|
||||||
cx, prev->returnAddress(), retAddr);
|
cx, prev->returnAddress(), retAddr);
|
||||||
|
@ -550,14 +550,16 @@ BaselineScript::returnAddressForIC(const ICEntry &ent)
|
|||||||
return method()->raw() + ent.returnOffset().offset();
|
return method()->raw() + ent.returnOffset().offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
ICEntry &
|
||||||
size_t ComputeBinarySearchMid(BaselineScript *baseline, uint32_t pcOffset)
|
BaselineScript::icEntryFromPCOffset(uint32_t pcOffset)
|
||||||
{
|
{
|
||||||
|
// Multiple IC entries can have the same PC offset, but this method only looks for
|
||||||
|
// those which have isForOp() set.
|
||||||
size_t bottom = 0;
|
size_t bottom = 0;
|
||||||
size_t top = baseline->numICEntries();
|
size_t top = numICEntries();
|
||||||
size_t mid = bottom + (top - bottom) / 2;
|
size_t mid = bottom + (top - bottom) / 2;
|
||||||
while (mid < top) {
|
while (mid < top) {
|
||||||
ICEntry &midEntry = baseline->icEntry(mid);
|
ICEntry &midEntry = icEntry(mid);
|
||||||
if (midEntry.pcOffset() < pcOffset)
|
if (midEntry.pcOffset() < pcOffset)
|
||||||
bottom = mid + 1;
|
bottom = mid + 1;
|
||||||
else if (midEntry.pcOffset() > pcOffset)
|
else if (midEntry.pcOffset() > pcOffset)
|
||||||
@ -566,28 +568,6 @@ size_t ComputeBinarySearchMid(BaselineScript *baseline, uint32_t pcOffset)
|
|||||||
break;
|
break;
|
||||||
mid = bottom + (top - bottom) / 2;
|
mid = bottom + (top - bottom) / 2;
|
||||||
}
|
}
|
||||||
return mid;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICEntry &
|
|
||||||
BaselineScript::anyKindICEntryFromPCOffset(uint32_t pcOffset)
|
|
||||||
{
|
|
||||||
size_t mid = ComputeBinarySearchMid(this, pcOffset);
|
|
||||||
|
|
||||||
// Return any IC entry with a matching PC offset.
|
|
||||||
for (size_t i = mid; i < numICEntries() && icEntry(i).pcOffset() == pcOffset; i--)
|
|
||||||
return icEntry(i);
|
|
||||||
for (size_t i = mid+1; i < numICEntries() && icEntry(i).pcOffset() == pcOffset; i++)
|
|
||||||
return icEntry(i);
|
|
||||||
MOZ_CRASH("Invalid PC offset for IC entry.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ICEntry &
|
|
||||||
BaselineScript::icEntryFromPCOffset(uint32_t pcOffset)
|
|
||||||
{
|
|
||||||
// Multiple IC entries can have the same PC offset, but this method only looks for
|
|
||||||
// those which have isForOp() set.
|
|
||||||
size_t mid = ComputeBinarySearchMid(this, pcOffset);
|
|
||||||
|
|
||||||
// Found an IC entry with a matching PC offset. Search backward, and then
|
// Found an IC entry with a matching PC offset. Search backward, and then
|
||||||
// forward from this IC entry, looking for one with the same PC offset which
|
// forward from this IC entry, looking for one with the same PC offset which
|
||||||
|
@ -330,7 +330,6 @@ struct BaselineScript
|
|||||||
ICEntry &icEntry(size_t index);
|
ICEntry &icEntry(size_t index);
|
||||||
ICEntry *maybeICEntryFromReturnOffset(CodeOffsetLabel returnOffset);
|
ICEntry *maybeICEntryFromReturnOffset(CodeOffsetLabel returnOffset);
|
||||||
ICEntry &icEntryFromReturnOffset(CodeOffsetLabel returnOffset);
|
ICEntry &icEntryFromReturnOffset(CodeOffsetLabel returnOffset);
|
||||||
ICEntry &anyKindICEntryFromPCOffset(uint32_t pcOffset);
|
|
||||||
ICEntry &icEntryFromPCOffset(uint32_t pcOffset);
|
ICEntry &icEntryFromPCOffset(uint32_t pcOffset);
|
||||||
ICEntry &icEntryFromPCOffset(uint32_t pcOffset, ICEntry *prevLookedUpEntry);
|
ICEntry &icEntryFromPCOffset(uint32_t pcOffset, ICEntry *prevLookedUpEntry);
|
||||||
ICEntry *maybeICEntryFromReturnAddress(uint8_t *returnAddr);
|
ICEntry *maybeICEntryFromReturnAddress(uint8_t *returnAddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user