mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 1437c48ae58d (bug 1030945) for introducing a new hazard, CLOSED TREE
This commit is contained in:
parent
5e6d3185c6
commit
bcf16ff0d1
@ -1,40 +0,0 @@
|
|||||||
function AsmModule(stdlib, foreign, heap) {
|
|
||||||
"use asm";
|
|
||||||
var ffi = foreign.t;
|
|
||||||
|
|
||||||
function doTest() {
|
|
||||||
ffi();
|
|
||||||
}
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
doTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
return { test: test };
|
|
||||||
}
|
|
||||||
|
|
||||||
let stack;
|
|
||||||
|
|
||||||
function tester() {
|
|
||||||
stack = saveStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
const buf = ArrayBuffer(1024*8);
|
|
||||||
const module = AsmModule(this, { t: tester }, buf);
|
|
||||||
module.test();
|
|
||||||
|
|
||||||
print(stack);
|
|
||||||
assertEq(stack.functionDisplayName, "tester");
|
|
||||||
|
|
||||||
assertEq(stack.parent.functionDisplayName, "doTest");
|
|
||||||
assertEq(stack.parent.line, 6);
|
|
||||||
assertEq(stack.parent.column, 4);
|
|
||||||
|
|
||||||
assertEq(stack.parent.parent.functionDisplayName, "test");
|
|
||||||
assertEq(stack.parent.parent.line, 10);
|
|
||||||
assertEq(stack.parent.parent.column, 4);
|
|
||||||
|
|
||||||
assertEq(stack.parent.parent.parent.line, 24);
|
|
||||||
assertEq(stack.parent.parent.parent.column, 0);
|
|
||||||
|
|
||||||
assertEq(stack.parent.parent.parent.parent, null);
|
|
@ -393,14 +393,17 @@ SavedStacks::init()
|
|||||||
|
|
||||||
return frames.init();
|
return frames.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SavedStacks::saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame)
|
SavedStacks::saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame)
|
||||||
{
|
{
|
||||||
JS_ASSERT(initialized());
|
JS_ASSERT(initialized());
|
||||||
JS_ASSERT(&cx->compartment()->savedStacks() == this);
|
JS_ASSERT(&cx->compartment()->savedStacks() == this);
|
||||||
FrameIter iter(cx);
|
|
||||||
|
ScriptFrameIter iter(cx);
|
||||||
return insertFrames(cx, iter, frame);
|
return insertFrames(cx, iter, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SavedStacks::sweep(JSRuntime *rt)
|
SavedStacks::sweep(JSRuntime *rt)
|
||||||
{
|
{
|
||||||
@ -459,7 +462,7 @@ SavedStacks::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SavedStacks::insertFrames(JSContext *cx, FrameIter &iter, MutableHandleSavedFrame frame)
|
SavedStacks::insertFrames(JSContext *cx, ScriptFrameIter &iter, MutableHandleSavedFrame frame)
|
||||||
{
|
{
|
||||||
if (iter.done()) {
|
if (iter.done()) {
|
||||||
frame.set(nullptr);
|
frame.set(nullptr);
|
||||||
@ -474,43 +477,26 @@ SavedStacks::insertFrames(JSContext *cx, FrameIter &iter, MutableHandleSavedFram
|
|||||||
// in js/src/jit-test/tests/saved-stacks/bug-1006876-too-much-recursion.js).
|
// in js/src/jit-test/tests/saved-stacks/bug-1006876-too-much-recursion.js).
|
||||||
JS_CHECK_RECURSION_DONT_REPORT(cx, return false);
|
JS_CHECK_RECURSION_DONT_REPORT(cx, return false);
|
||||||
|
|
||||||
|
RootedScript script(cx, iter.script());
|
||||||
JSPrincipals* principals = iter.compartment()->principals;
|
jsbytecode *pc = iter.pc();
|
||||||
RootedAtom name(cx, iter.isNonEvalFunctionFrame() ? iter.functionDisplayAtom() : nullptr);
|
RootedFunction callee(cx, iter.maybeCallee());
|
||||||
|
// script and callee should keep compartment alive.
|
||||||
// When we have a |JSScript| for this frame, use |getLocation| to get a
|
JSCompartment *compartment = iter.compartment();
|
||||||
// potentially memoized location result and copy it into |location|. When we
|
|
||||||
// do not have a |JSScript| for this frame (asm.js frames), we take a slow
|
|
||||||
// path that doesn't employ memoization, and update |location|'s slots
|
|
||||||
// directly.
|
|
||||||
LocationValue location;+ if (iter.hasScript()) {
|
|
||||||
JSScript *script = iter.script();
|
|
||||||
jsbytecode *pc = iter.pc();
|
|
||||||
if (!getLocation(cx, script, pc, &location))
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
const char *filename = iter.scriptFilename();
|
|
||||||
if (!filename)
|
|
||||||
filename = "";
|
|
||||||
location.source.set(Atomize(cx, filename, strlen(filename)));
|
|
||||||
if (!location.source)
|
|
||||||
return false;
|
|
||||||
uint32_t column;
|
|
||||||
location.line = iter.computeLine(&column);
|
|
||||||
location.column = column;
|
|
||||||
}
|
|
||||||
|
|
||||||
RootedSavedFrame parentFrame(cx);
|
RootedSavedFrame parentFrame(cx);
|
||||||
if (!insertFrames(cx, ++iter, &parentFrame))
|
if (!insertFrames(cx, ++iter, &parentFrame))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
LocationValue location;
|
||||||
|
if (!getLocation(cx, script, pc, &location))
|
||||||
|
return false;
|
||||||
|
|
||||||
SavedFrame::AutoLookupRooter lookup(cx,
|
SavedFrame::AutoLookupRooter lookup(cx,
|
||||||
location.source,
|
location.source,
|
||||||
location.line,
|
location.line,
|
||||||
location.column,
|
location.column,
|
||||||
name,
|
callee ? callee->displayAtom() : nullptr,
|
||||||
parentFrame,
|
parentFrame,
|
||||||
principals);
|
compartment->principals);
|
||||||
|
|
||||||
frame.set(getOrCreateSavedFrame(cx, lookup));
|
frame.set(getOrCreateSavedFrame(cx, lookup));
|
||||||
return frame.get() != nullptr;
|
return frame.get() != nullptr;
|
||||||
|
@ -108,17 +108,22 @@ class SavedStacks {
|
|||||||
void sweep(JSRuntime *rt);
|
void sweep(JSRuntime *rt);
|
||||||
uint32_t count();
|
uint32_t count();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SavedFrame::Set frames;
|
SavedFrame::Set frames;
|
||||||
JSObject *savedFrameProto;
|
JSObject *savedFrameProto;
|
||||||
bool insertFrames(JSContext *cx, FrameIter &iter, MutableHandleSavedFrame frame);
|
|
||||||
|
bool insertFrames(JSContext *cx, ScriptFrameIter &iter, MutableHandleSavedFrame frame);
|
||||||
SavedFrame *getOrCreateSavedFrame(JSContext *cx, const SavedFrame::Lookup &lookup);
|
SavedFrame *getOrCreateSavedFrame(JSContext *cx, const SavedFrame::Lookup &lookup);
|
||||||
// |SavedFrame.prototype| is created lazily and held weakly. It should only
|
// |SavedFrame.prototype| is created lazily and held weakly. It should only
|
||||||
// be accessed through this method.
|
// be accessed through this method.
|
||||||
JSObject *getOrCreateSavedFramePrototype(JSContext *cx);
|
JSObject *getOrCreateSavedFramePrototype(JSContext *cx);
|
||||||
SavedFrame *createFrameFromLookup(JSContext *cx, const SavedFrame::Lookup &lookup);
|
SavedFrame *createFrameFromLookup(JSContext *cx, const SavedFrame::Lookup &lookup);
|
||||||
|
|
||||||
// Cache for memoizing PCToLineNumber lookups.
|
// Cache for memoizing PCToLineNumber lookups.
|
||||||
|
|
||||||
struct PCKey {
|
struct PCKey {
|
||||||
PCKey(JSScript *script, jsbytecode *pc) : script(script), pc(pc) { }
|
PCKey(JSScript *script, jsbytecode *pc) : script(script), pc(pc) { }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user