mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1189059: Replace setObjectMetadataCallback with enableObjectMetadataCallback, fix callers. r=fitzgen
--HG-- extra : rebase_source : e510e16c42641082d94024f679ff5fa06374b96f
This commit is contained in:
parent
3157f0bcb7
commit
ec09437edc
@ -1377,12 +1377,11 @@ ShellObjectMetadataCallback(JSContext* cx, JSObject*)
|
||||
}
|
||||
|
||||
static bool
|
||||
SetObjectMetadataCallback(JSContext* cx, unsigned argc, Value* vp)
|
||||
EnableShellObjectMetadataCallback(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool enabled = args.length() ? ToBoolean(args[0]) : false;
|
||||
SetObjectMetadataCallback(cx, enabled ? ShellObjectMetadataCallback : nullptr);
|
||||
SetObjectMetadataCallback(cx, ShellObjectMetadataCallback);
|
||||
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@ -2934,9 +2933,9 @@ gc::ZealModeHelpText),
|
||||
"isRelazifiableFunction(fun)",
|
||||
" Ture if fun is a JSFunction with a relazifiable JSScript."),
|
||||
|
||||
JS_FN_HELP("setObjectMetadataCallback", SetObjectMetadataCallback, 1, 0,
|
||||
"setObjectMetadataCallback(fn)",
|
||||
" Specify function to supply metadata for all newly created objects."),
|
||||
JS_FN_HELP("enableShellObjectMetadataCallback", EnableShellObjectMetadataCallback, 0, 0,
|
||||
"enableShellObjectMetadataCallback()",
|
||||
" Use ShellObjectMetadataCallback to supply metadata for all newly created objects."),
|
||||
|
||||
JS_FN_HELP("getObjectMetadata", GetObjectMetadata, 1, 0,
|
||||
"getObjectMetadata(obj)",
|
||||
|
@ -4,7 +4,7 @@
|
||||
function f() {
|
||||
for (var i=0; i<100; i++) {
|
||||
if (i === 20)
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
var o = {x: 1};
|
||||
if (i >= 20) {
|
||||
var md = getObjectMetadata(o);
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
setObjectMetadataCallback(function(obj) {});
|
||||
enableShellObjectMetadataCallback();
|
||||
function foo(x, y) {
|
||||
this.g = x + y;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
setObjectMetadataCallback(function(obj) {});
|
||||
enableShellObjectMetadataCallback();
|
||||
eval(uneval({'-1':true}));
|
||||
|
@ -1,4 +1,4 @@
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
var g = newGlobal()
|
||||
g.eval("function f(a) { return h(); }");
|
||||
g.h = function () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
|
||||
function Foo() {
|
||||
this.x = 0;
|
||||
|
@ -4,8 +4,6 @@ load(libdir + "asserts.js");
|
||||
|
||||
let dbg1, dbg2, root1, root2;
|
||||
|
||||
function FakeMetadata() {}
|
||||
|
||||
function isTrackingAllocations(global, dbgObj) {
|
||||
const site = dbgObj.makeDebuggeeValue(global.eval("({})")).allocationSite;
|
||||
if (site) {
|
||||
@ -65,7 +63,7 @@ test("Setting trackingAllocationSites to true should throw if the debugger " +
|
||||
let d1r2 = dbg1.addDebuggee(root2);
|
||||
|
||||
// Can't install allocation hooks for root2 with this set.
|
||||
root2.setObjectMetadataCallback(function () { return new FakeMetadata; });
|
||||
root2.enableShellObjectMetadataCallback();
|
||||
|
||||
assertThrowsInstanceOf(() => dbg1.memory.trackingAllocationSites = true,
|
||||
Error);
|
||||
@ -96,7 +94,7 @@ test("Re-enabling throws an error if we can't reinstall allocations tracking " +
|
||||
let d1r2 = dbg1.addDebuggee(root2);
|
||||
|
||||
// Can't install allocation hooks for root2 with this set.
|
||||
root2.setObjectMetadataCallback(function () { return new FakeMetadata; });
|
||||
root2.enableShellObjectMetadataCallback();
|
||||
|
||||
assertThrowsInstanceOf(() => dbg1.enabled = true,
|
||||
Error);
|
||||
|
@ -14,6 +14,6 @@ function reportCompare () {
|
||||
}
|
||||
reportCompare();
|
||||
gczeal(4, 1000);
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
for (var i = 0; i < 10000; ++i)
|
||||
reportCompare();
|
||||
|
@ -1,5 +1,9 @@
|
||||
// |jit-test| error: x is not defined
|
||||
setObjectMetadataCallback(function(obj) {
|
||||
|
||||
// enableShellObjectMetadataCallback ignores its argument, because we don't
|
||||
// permit metadata callbacks to run JS any more, so this test may be
|
||||
// unnecessary. We'll preserve its structure just in case.
|
||||
enableShellObjectMetadataCallback(function(obj) {
|
||||
var res = {};
|
||||
return res;
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
function callback(obj) {}
|
||||
setObjectMetadataCallback(callback);
|
||||
enableShellObjectMetadataCallback();
|
||||
gczeal(7);
|
||||
var statusitems = [];
|
||||
|
@ -1,4 +1,4 @@
|
||||
gczeal(7,1);
|
||||
setObjectMetadataCallback(setObjectMetadataCallback);
|
||||
enableShellObjectMetadataCallback();
|
||||
gczeal(false);
|
||||
var statusitems = [];
|
||||
|
@ -1,3 +1,3 @@
|
||||
gczeal(11);
|
||||
function callback(obj) {}
|
||||
setObjectMetadataCallback(callback);
|
||||
enableShellObjectMetadataCallback();
|
||||
|
@ -1,5 +1,5 @@
|
||||
function r() {
|
||||
for (var x in undefined) {}
|
||||
}
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
r();
|
||||
|
@ -7,7 +7,7 @@ this.__defineGetter__("x",
|
||||
}
|
||||
);
|
||||
function callback(obj) {}
|
||||
setObjectMetadataCallback(callback);
|
||||
enableShellObjectMetadataCallback();
|
||||
evaluate("\
|
||||
var { ArrayType, StructType, uint32 } = TypedObject;\
|
||||
var L = 1024;\
|
||||
|
@ -1,7 +1,7 @@
|
||||
setJitCompilerOption("baseline.warmup.trigger", 10);
|
||||
setJitCompilerOption("ion.warmup.trigger", 20);
|
||||
|
||||
setObjectMetadataCallback(true);
|
||||
enableShellObjectMetadataCallback();
|
||||
(function(){
|
||||
for(var i = 0; i < 100; i++) {
|
||||
try{
|
||||
|
@ -1,4 +1,7 @@
|
||||
setObjectMetadataCallback(function( r, ... d) {});
|
||||
// enableShellObjectMetadataCallback ignores its argument, because we don't
|
||||
// permit metadata callbacks to run JS any more, so this test may be
|
||||
// unnecessary. We'll preserve its structure just in case.
|
||||
enableShellObjectMetadataCallback(function( r, ... d) {});
|
||||
setJitCompilerOption("ion.warmup.trigger", 20);
|
||||
var uceFault = function (i) {
|
||||
if (i > 98)
|
||||
|
@ -4,7 +4,11 @@ gczeal(14);
|
||||
// The object metadata callback can iterate over the stack. Thus during the
|
||||
// allocation of the lambda we might inspect the stack which is still incomplete
|
||||
// because the lambda is not yet reconstructed.
|
||||
setObjectMetadataCallback(function() {});
|
||||
//
|
||||
// enableShellObjectMetadataCallback ignores its argument, because we don't
|
||||
// permit metadata callbacks to run JS any more, so this test may be
|
||||
// unnecessary. We'll preserve its structure just in case.
|
||||
enableShellObjectMetadataCallback(function() {});
|
||||
function f() {
|
||||
(function() {
|
||||
'' ^ Object
|
||||
@ -17,7 +21,8 @@ for (var j = 0; j < 99; ++j) {
|
||||
|
||||
try {
|
||||
x = true;
|
||||
setObjectMetadataCallback(function([x, y, z], ... Debugger) {});
|
||||
// Same comment as above.
|
||||
enableShellObjectMetadataCallback(function([x, y, z], ... Debugger) {});
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
var f = function() {
|
||||
function g() {
|
||||
|
Loading…
Reference in New Issue
Block a user