Merge tracemonkey to mozilla-central.

This commit is contained in:
Robert Sayre 2009-04-08 00:33:02 -04:00
commit f31f49d3c4
4 changed files with 25 additions and 12 deletions

View File

@ -1348,7 +1348,8 @@ JS_InitStandardClasses(JSContext *cx, JSObject *obj)
/* Define a top-level property 'undefined' with the undefined value. */
atom = cx->runtime->atomState.typeAtoms[JSTYPE_VOID];
if (!OBJ_DEFINE_PROPERTY(cx, obj, ATOM_TO_JSID(atom), JSVAL_VOID,
NULL, NULL, JSPROP_PERMANENT, NULL)) {
JS_PropertyStub, JS_PropertyStub, JSPROP_PERMANENT,
NULL)) {
return JS_FALSE;
}
@ -1558,7 +1559,8 @@ JS_ResolveStandardClass(JSContext *cx, JSObject *obj, jsval id,
if (idstr == ATOM_TO_STRING(atom)) {
*resolved = JS_TRUE;
return OBJ_DEFINE_PROPERTY(cx, obj, ATOM_TO_JSID(atom), JSVAL_VOID,
NULL, NULL, JSPROP_PERMANENT, NULL);
JS_PropertyStub, JS_PropertyStub,
JSPROP_PERMANENT, NULL);
}
/* Try for class constructors/prototypes named by well-known atoms. */
@ -1652,7 +1654,8 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj)
atom = rt->atomState.typeAtoms[JSTYPE_VOID];
if (!AlreadyHasOwnProperty(cx, obj, atom) &&
!OBJ_DEFINE_PROPERTY(cx, obj, ATOM_TO_JSID(atom), JSVAL_VOID,
NULL, NULL, JSPROP_PERMANENT, NULL)) {
JS_PropertyStub, JS_PropertyStub, JSPROP_PERMANENT,
NULL)) {
return JS_FALSE;
}

View File

@ -1181,6 +1181,15 @@ PopulateReportBlame(JSContext *cx, JSErrorReport *report)
void
js_ReportOutOfMemory(JSContext *cx)
{
#ifdef JS_TRACER
/*
* If we are in a builtin called directly from trace, don't report an
* error. We will retry in the interpreter instead.
*/
if (JS_ON_TRACE(cx) && !cx->bailExit)
return;
#endif
JSErrorReport report;
JSErrorReporter onError = cx->errorReporter;

View File

@ -2076,8 +2076,7 @@ fail:
JS_UNLOCK_GC(rt);
#endif
METER(astats->fail++);
if (!JS_ON_TRACE(cx))
JS_ReportOutOfMemory(cx);
js_ReportOutOfMemory(cx);
return NULL;
}
@ -2123,8 +2122,7 @@ RefillDoubleFreeList(JSContext *cx)
if (didGC || JS_ON_TRACE(cx)) {
METER(rt->gcStats.doubleArenaStats.fail++);
JS_UNLOCK_GC(rt);
if (!JS_ON_TRACE(cx))
JS_ReportOutOfMemory(cx);
js_ReportOutOfMemory(cx);
return NULL;
}
js_GC(cx, GC_LAST_DITCH);

View File

@ -1909,6 +1909,12 @@ TraceRecorder::lazilyImportGlobalSlot(unsigned slot)
{
if (slot != uint16(slot)) /* we use a table of 16-bit ints, bail out if that's not enough */
return false;
/*
* If the global object grows too large, alloca in js_ExecuteTree might fail, so
* abort tracing on global objects with unreasonably many slots.
*/
if (globalObj->dslots[-1] > 4096)
return false;
jsval* vp = &STOBJ_GET_SLOT(globalObj, slot);
if (known(vp))
return true; /* we already have it */
@ -4936,9 +4942,7 @@ js_DeepBail(JSContext *cx)
JS_TRACE_MONITOR(cx).onTrace = false;
JS_TRACE_MONITOR(cx).prohibitRecording = true;
LeaveTree(*cx->interpState, cx->bailExit);
#ifdef DEBUG
cx->bailExit = NULL;
#endif
cx->builtinStatus |= JSBUILTIN_BAILED;
}
@ -5894,7 +5898,7 @@ TraceRecorder::test_property_cache(JSObject* obj, LIns* obj_ins, JSObject*& obj2
// No need to guard native-ness of global object.
JS_ASSERT(OBJ_IS_NATIVE(globalObj));
if (aobj != globalObj) {
size_t op_offset = 0;
size_t op_offset = offsetof(JSObjectOps, newObjectMap);
if (mode == JOF_PROP || mode == JOF_VARPROP) {
JS_ASSERT(!(format & JOF_SET));
op_offset = offsetof(JSObjectOps, getProperty);
@ -8036,10 +8040,9 @@ TraceRecorder::record_FastNativeCallComplete()
boxed if the type guard generated by unbox_jsval() fails. */
if (JSTN_ERRTYPE(pendingTraceableNative) == FAIL_STATUS) {
#ifdef DEBUG
// Keep cx->bailExit null when it's invalid.
lir->insStorei(INS_CONSTPTR(NULL), cx_ins, (int) offsetof(JSContext, bailExit));
#endif
LIns* status = lir->insLoad(LIR_ld, cx_ins, (int) offsetof(JSContext, builtinStatus));
if (pendingTraceableNative == generatedTraceableNative) {
LIns* ok_ins = v_ins;