Bug 566700 - Remove sharp-syntax generation from the toSource methods. r=dmandelin

This commit is contained in:
Jeff Walden
2012-01-20 23:39:37 -08:00
parent f44f87f012
commit 1071936250
3 changed files with 63 additions and 126 deletions

View File

@@ -1412,20 +1412,20 @@ JSObject::makeDenseArraySlow(JSContext *cx)
class ArraySharpDetector
{
JSContext *cx;
jschar *chars;
JSHashEntry *he;
bool alreadySeen;
bool sharp;
public:
ArraySharpDetector(JSContext *cx)
: cx(cx),
chars(NULL),
he(NULL),
alreadySeen(false),
sharp(false)
{}
bool init(JSObject *obj) {
he = js_EnterSharpObject(cx, obj, NULL, &chars);
he = js_EnterSharpObject(cx, obj, NULL, &alreadySeen);
if (!he)
return false;
sharp = IS_SHARP(he);
@@ -1433,23 +1433,11 @@ class ArraySharpDetector
}
bool initiallySharp() const {
JS_ASSERT_IF(sharp, hasSharpChars());
JS_ASSERT_IF(sharp, alreadySeen);
return sharp;
}
bool hasSharpChars() const {
return chars != NULL;
}
jschar *takeSharpChars() {
jschar *ret = chars;
chars = NULL;
return ret;
}
~ArraySharpDetector() {
if (chars)
cx->free_(chars);
if (he && !sharp)
js_LeaveSharpObject(cx, NULL);
}