mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
Bug 1096023 - Fix code generation for ClassHook caches when the SPS profiler is active, r=jandem.
This commit is contained in:
parent
83c91ef391
commit
c8d450dc31
20
js/src/jit-test/tests/TypedObject/bug1096023.js
Normal file
20
js/src/jit-test/tests/TypedObject/bug1096023.js
Normal file
@ -0,0 +1,20 @@
|
||||
if (!this.hasOwnProperty("TypedObject"))
|
||||
quit();
|
||||
|
||||
enableSPSProfiling();
|
||||
var T = TypedObject;
|
||||
function check(results, ctor) {
|
||||
for (var i = 0; i < results.length; i++)
|
||||
var S = new T.StructType({f: ctor});
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var s = new S({f: results[i][1]});
|
||||
}
|
||||
}
|
||||
var int8results = [
|
||||
[22, 22],
|
||||
[-128, 128],
|
||||
[-1, 255],
|
||||
[0x75, 0x7575],
|
||||
[-123, 0x7585]
|
||||
];
|
||||
check(int8results, T.int8);
|
@ -8688,7 +8688,8 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
|
||||
|
||||
JitSpew(JitSpew_BaselineIC, " Generating Call_ClassHook stub");
|
||||
ICCall_ClassHook::Compiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(),
|
||||
obj->getClass(), hook, templateObject, constructing);
|
||||
obj->getClass(), hook, templateObject,
|
||||
script->pcToOffset(pc), constructing);
|
||||
ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
|
||||
if (!newStub)
|
||||
return false;
|
||||
@ -9942,7 +9943,7 @@ ICCall_ClassHook::Compiler::generateStubCode(MacroAssembler &masm)
|
||||
|
||||
// If needed, update SPS Profiler frame entry. At this point, BaselineTailCallReg
|
||||
// and scratch can be clobbered.
|
||||
emitProfilingUpdate(masm, BaselineTailCallReg, scratch, ICCall_Native::offsetOfPCOffset());
|
||||
emitProfilingUpdate(masm, BaselineTailCallReg, scratch, ICCall_ClassHook::offsetOfPCOffset());
|
||||
|
||||
// Execute call.
|
||||
masm.setupUnalignedABICall(3, scratch);
|
||||
@ -11316,11 +11317,13 @@ ICCall_Native::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub
|
||||
}
|
||||
|
||||
ICCall_ClassHook::ICCall_ClassHook(JitCode *stubCode, ICStub *firstMonitorStub,
|
||||
const Class *clasp, Native native, HandleObject templateObject)
|
||||
const Class *clasp, Native native,
|
||||
HandleObject templateObject, uint32_t pcOffset)
|
||||
: ICMonitoredStub(ICStub::Call_ClassHook, stubCode, firstMonitorStub),
|
||||
clasp_(clasp),
|
||||
native_(JS_FUNC_TO_DATA_PTR(void *, native)),
|
||||
templateObject_(templateObject)
|
||||
templateObject_(templateObject),
|
||||
pcOffset_(pcOffset)
|
||||
{
|
||||
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
|
||||
// The simulator requires VM calls to be redirected to a special swi
|
||||
@ -11336,7 +11339,7 @@ ICCall_ClassHook::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorS
|
||||
{
|
||||
RootedObject templateObject(cx, other.templateObject_);
|
||||
ICCall_ClassHook *res = New(space, other.jitCode(), firstMonitorStub,
|
||||
other.clasp(), nullptr, templateObject);
|
||||
other.clasp(), nullptr, templateObject, other.pcOffset_);
|
||||
if (res)
|
||||
res->native_ = other.native();
|
||||
return res;
|
||||
|
@ -5907,20 +5907,23 @@ class ICCall_ClassHook : public ICMonitoredStub
|
||||
const Class *clasp_;
|
||||
void *native_;
|
||||
HeapPtrObject templateObject_;
|
||||
uint32_t pcOffset_;
|
||||
|
||||
ICCall_ClassHook(JitCode *stubCode, ICStub *firstMonitorStub,
|
||||
const Class *clasp, Native native, HandleObject templateObject);
|
||||
const Class *clasp, Native native, HandleObject templateObject,
|
||||
uint32_t pcOffset);
|
||||
|
||||
public:
|
||||
static inline ICCall_ClassHook *New(ICStubSpace *space,
|
||||
JitCode *code, ICStub *firstMonitorStub,
|
||||
const Class *clasp, Native native,
|
||||
HandleObject templateObject)
|
||||
HandleObject templateObject,
|
||||
uint32_t pcOffset)
|
||||
{
|
||||
if (!code)
|
||||
return nullptr;
|
||||
return space->allocate<ICCall_ClassHook>(code, firstMonitorStub,
|
||||
clasp, native, templateObject);
|
||||
clasp, native, templateObject, pcOffset);
|
||||
}
|
||||
|
||||
static ICCall_ClassHook *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub,
|
||||
@ -5942,6 +5945,9 @@ class ICCall_ClassHook : public ICMonitoredStub
|
||||
static size_t offsetOfNative() {
|
||||
return offsetof(ICCall_ClassHook, native_);
|
||||
}
|
||||
static size_t offsetOfPCOffset() {
|
||||
return offsetof(ICCall_ClassHook, pcOffset_);
|
||||
}
|
||||
|
||||
// Compiler for this stub kind.
|
||||
class Compiler : public ICCallStubCompiler {
|
||||
@ -5951,6 +5957,7 @@ class ICCall_ClassHook : public ICMonitoredStub
|
||||
const Class *clasp_;
|
||||
Native native_;
|
||||
RootedObject templateObject_;
|
||||
uint32_t pcOffset_;
|
||||
bool generateStubCode(MacroAssembler &masm);
|
||||
|
||||
virtual int32_t getKey() const {
|
||||
@ -5959,19 +5966,21 @@ class ICCall_ClassHook : public ICMonitoredStub
|
||||
|
||||
public:
|
||||
Compiler(JSContext *cx, ICStub *firstMonitorStub,
|
||||
const Class *clasp, Native native, HandleObject templateObject,
|
||||
const Class *clasp, Native native,
|
||||
HandleObject templateObject, uint32_t pcOffset,
|
||||
bool isConstructing)
|
||||
: ICCallStubCompiler(cx, ICStub::Call_ClassHook),
|
||||
firstMonitorStub_(firstMonitorStub),
|
||||
isConstructing_(isConstructing),
|
||||
clasp_(clasp),
|
||||
native_(native),
|
||||
templateObject_(cx, templateObject)
|
||||
templateObject_(cx, templateObject),
|
||||
pcOffset_(pcOffset)
|
||||
{ }
|
||||
|
||||
ICStub *getStub(ICStubSpace *space) {
|
||||
return ICCall_ClassHook::New(space, getStubCode(), firstMonitorStub_,
|
||||
clasp_, native_, templateObject_);
|
||||
clasp_, native_, templateObject_, pcOffset_);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user