[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:31:19 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit eabbfb443e20813a469b85272017c264f2ad8cfd
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 15 00:59:18 2002 +0000
Fix major JavaScript memory leak. run-plt says cvs-base improved
by 2% and cvs-js-performance improved by 7%. However, this was
within the possible noise level in each case.
The fix was to store ValueImp *'s in the array instead of Value
objects, since the Value wrapper will keep a ref and make the
object immortal.
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp):
(ArrayInstanceImp::get):
(ArrayInstanceImp::put):
(ArrayInstanceImp::hasProperty):
(ArrayInstanceImp::deleteProperty):
(ArrayInstanceImp::setLength):
(ArrayInstanceImp::mark):
* kjs/array_object.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1878742..3f3624d 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,23 @@
+2002-08-14 Maciej Stachowiak <mjs at apple.com>
+
+ Fix major JavaScript memory leak. run-plt says cvs-base improved
+ by 2% and cvs-js-performance improved by 7%. However, this was
+ within the possible noise level in each case.
+
+ The fix was to store ValueImp *'s in the array instead of Value
+ objects, since the Value wrapper will keep a ref and make the
+ object immortal.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::get):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::hasProperty):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::mark):
+ * kjs/array_object.h:
+
2002-08-13 Maciej Stachowiak <mjs at apple.com>
Add the ability to determine the classes of live JavaScript
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 1878742..3f3624d 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-08-14 Maciej Stachowiak <mjs at apple.com>
+
+ Fix major JavaScript memory leak. run-plt says cvs-base improved
+ by 2% and cvs-js-performance improved by 7%. However, this was
+ within the possible noise level in each case.
+
+ The fix was to store ValueImp *'s in the array instead of Value
+ objects, since the Value wrapper will keep a ref and make the
+ object immortal.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::get):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::hasProperty):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::mark):
+ * kjs/array_object.h:
+
2002-08-13 Maciej Stachowiak <mjs at apple.com>
Add the ability to determine the classes of live JavaScript
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 1878742..3f3624d 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,23 @@
+2002-08-14 Maciej Stachowiak <mjs at apple.com>
+
+ Fix major JavaScript memory leak. run-plt says cvs-base improved
+ by 2% and cvs-js-performance improved by 7%. However, this was
+ within the possible noise level in each case.
+
+ The fix was to store ValueImp *'s in the array instead of Value
+ objects, since the Value wrapper will keep a ref and make the
+ object immortal.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::get):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::hasProperty):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::mark):
+ * kjs/array_object.h:
+
2002-08-13 Maciej Stachowiak <mjs at apple.com>
Add the ability to determine the classes of live JavaScript
diff --git a/JavaScriptCore/kjs/array_object.cpp b/JavaScriptCore/kjs/array_object.cpp
index 9c549a1..6a7a2aa 100644
--- a/JavaScriptCore/kjs/array_object.cpp
+++ b/JavaScriptCore/kjs/array_object.cpp
@@ -43,20 +43,24 @@ ArrayInstanceImp::ArrayInstanceImp(const Object &proto, unsigned initialLength)
: ObjectImp(proto)
, length(initialLength)
, capacity(length)
- , storage(length ? new Undefined[length] : 0)
+ , storage(length ? new (ValueImp *)[length] : 0)
{
+ unsigned l = length;
+ for (unsigned i = 0; i < l; ++i) {
+ storage[i] = Undefined().imp();
+ }
}
ArrayInstanceImp::ArrayInstanceImp(const Object &proto, const List &list)
: ObjectImp(proto)
, length(list.size())
, capacity(length)
- , storage(length ? new Undefined[length] : 0)
+ , storage(length ? new (ValueImp *)[length] : 0)
{
ListIterator it = list.begin();
const unsigned l = length;
for (unsigned i = 0; i < l; ++i) {
- storage[i] = it++;
+ storage[i] = (it++).imp();
}
}
@@ -75,7 +79,7 @@ Value ArrayInstanceImp::get(ExecState *exec, const UString &propertyName) const
if (ok) {
if (index >= length)
return Undefined();
- return storage[index];
+ return Value(storage[index]);
}
return ObjectImp::get(exec, propertyName);
@@ -85,7 +89,7 @@ Value ArrayInstanceImp::get(ExecState *exec, unsigned index) const
{
if (index >= length)
return Undefined();
- return storage[index];
+ return Value(storage[index]);
}
// Special implementation of [[Put]] - see ECMA 15.4.5.1
@@ -100,7 +104,7 @@ void ArrayInstanceImp::put(ExecState *exec, const UString &propertyName, const V
unsigned index = propertyName.toULong(&ok);
if (ok) {
setLength(index + 1);
- storage[index] = value;
+ storage[index] = value.imp();
return;
}
@@ -110,7 +114,7 @@ void ArrayInstanceImp::put(ExecState *exec, const UString &propertyName, const V
void ArrayInstanceImp::put(ExecState *exec, unsigned index, const Value &value, int attr)
{
setLength(index + 1);
- storage[index] = value;
+ storage[index] = value.imp();
}
bool ArrayInstanceImp::hasProperty(ExecState *exec, const UString &propertyName) const
@@ -123,7 +127,7 @@ bool ArrayInstanceImp::hasProperty(ExecState *exec, const UString &propertyName)
if (ok) {
if (index >= length)
return false;
- return !storage[index].isA(UndefinedType);
+ return storage[index]->type() != UndefinedType;
}
return ObjectImp::hasProperty(exec, propertyName);
@@ -133,7 +137,7 @@ bool ArrayInstanceImp::hasProperty(ExecState *exec, unsigned index) const
{
if (index >= length)
return false;
- return !storage[index].isA(UndefinedType);
+ return storage[index]->type() != UndefinedType;
}
bool ArrayInstanceImp::deleteProperty(ExecState *exec, const UString &propertyName)
@@ -146,7 +150,7 @@ bool ArrayInstanceImp::deleteProperty(ExecState *exec, const UString &propertyNa
if (ok) {
if (index >= length)
return true;
- storage[index] = Undefined();
+ storage[index] = Undefined().imp();
return true;
}
@@ -157,7 +161,7 @@ bool ArrayInstanceImp::deleteProperty(ExecState *exec, unsigned index)
{
if (index >= length)
return true;
- storage[index] = Undefined();
+ storage[index] = Undefined().imp();
return true;
}
@@ -166,14 +170,16 @@ void ArrayInstanceImp::setLength(unsigned newLength)
if (newLength < length) {
const unsigned l = length;
for (unsigned i = newLength; i < l; ++i)
- storage[i] = Undefined();
+ storage[i] = Undefined().imp();
}
if (newLength > capacity) {
unsigned newCapacity = (newLength * 3 + 1) / 2;
- Value *newStorage = new Undefined [newCapacity];
+ ValueImp **newStorage = new (ValueImp *)[newCapacity];
const unsigned l = length;
for (unsigned i = 0; i < l; ++i)
newStorage[i] = storage[i];
+ for (unsigned i = l; i < newLength; i++)
+ newStorage[i] = Undefined().imp();
delete [] storage;
storage = newStorage;
capacity = newCapacity;
@@ -186,7 +192,7 @@ void ArrayInstanceImp::mark()
ObjectImp::mark();
const unsigned l = length;
for (unsigned i = 0; i < l; ++i) {
- ValueImp *imp = storage[i].imp();
+ ValueImp *imp = storage[i];
if (!imp->marked())
imp->mark();
}
diff --git a/JavaScriptCore/kjs/array_object.h b/JavaScriptCore/kjs/array_object.h
index a11f5a4..32dd764 100644
--- a/JavaScriptCore/kjs/array_object.h
+++ b/JavaScriptCore/kjs/array_object.h
@@ -54,7 +54,7 @@ namespace KJS {
unsigned length;
unsigned capacity;
- Value *storage;
+ ValueImp **storage;
};
class ArrayPrototypeImp : public ArrayInstanceImp {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list