From 3bee6e23e241893300be778921bd9be2ce222746 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 16 Jul 2013 01:32:18 -0400 Subject: [PATCH] Bug 893897. Don't deoptimize typeobjects in TypeScript::MonitorAssign if they only have a few properties. r=bhackett --- js/src/jsinferinlines.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index 5712b768ddd..37b34717b34 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -966,7 +966,14 @@ TypeScript::MonitorAssign(JSContext *cx, HandleObject obj, jsid id) uint32_t i; if (js_IdIsIndex(id, &i)) return; - MarkTypeObjectUnknownProperties(cx, obj->type()); + + // But if we don't have too many properties yet, don't do anything. The + // idea here is that normal object initialization should not trigger + // deoptimization in most cases, while actual usage as a hashmap should. + TypeObject* type = obj->type(); + if (type->getPropertyCount() < 8) + return; + MarkTypeObjectUnknownProperties(cx, type); } }