Extract the snapshot code for a single slot into determineSlotType() und use that method in snapshot().

This commit is contained in:
Andreas Gal 2008-09-09 15:06:23 +02:00
parent 32f22d2e1e
commit 6a76d26107
2 changed files with 16 additions and 8 deletions

View File

@ -1419,7 +1419,7 @@ TraceRecorder::set(jsval* p, LIns* i, bool initializing)
}
LIns*
TraceRecorder::get(jsval* p)
TraceRecorder::get(jsval* p) const
{
return tracker.get(p);
}
@ -1536,6 +1536,18 @@ bool TraceRecorder::selectCallablePeerFragment(Fragment** first)
return (*first)->code();
}
uint8
TraceRecorder::determineSlotType(jsval* vp) const
{
uint8 m;
LIns* i = get(vp);
m = isNumber(*vp)
? (isPromoteInt(i) ? JSVAL_INT : JSVAL_DOUBLE)
: JSVAL_TAG(*vp);
JS_ASSERT((m != JSVAL_INT) || isInt32(*vp));
return m;
}
SideExit*
TraceRecorder::snapshot(ExitType exitType)
{
@ -1577,12 +1589,7 @@ TraceRecorder::snapshot(ExitType exitType)
interpreter is using. For numbers we have to check what kind of store we used last
(integer or double) to figure out what the side exit show reflect in its typemap. */
FORALL_SLOTS(cx, ngslots, traceMonitor->globalSlots->data(), callDepth,
LIns* i = get(vp);
*m = isNumber(*vp)
? (isPromoteInt(i) ? JSVAL_INT : JSVAL_DOUBLE)
: JSVAL_TAG(*vp);
JS_ASSERT((*m != JSVAL_INT) || isInt32(*vp));
++m;
*m++ = determineSlotType(vp);
);
JS_ASSERT(unsigned(m - exit.typeMap) == ngslots + stackSlots);
return &exit;

View File

@ -253,7 +253,7 @@ class TraceRecorder {
nanojit::LIns* guard(bool expected, nanojit::LIns* cond, nanojit::ExitType exitType);
nanojit::LIns* addName(nanojit::LIns* ins, const char* name);
nanojit::LIns* get(jsval* p);
nanojit::LIns* get(jsval* p) const;
nanojit::LIns* writeBack(nanojit::LIns* i, nanojit::LIns* base, ptrdiff_t offset);
void set(jsval* p, nanojit::LIns* l, bool initializing = false);
@ -341,6 +341,7 @@ public:
nanojit::GuardRecord* expectedInnerExit);
~TraceRecorder();
uint8 TraceRecorder::determineSlotType(jsval* vp) const;
nanojit::SideExit* snapshot(nanojit::ExitType exitType);
nanojit::Fragment* getFragment() const { return fragment; }
bool isLoopHeader(JSContext* cx) const;