[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:03:14 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 3e1ce6e55138041ad81dcc1709cd71849b1d4135
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 18 22:49:26 2002 +0000
- simplified the ExecState class, which was showing up in profiles
Sped up JavaScript iBench by 6%.
* kjs/interpreter.h: Removed the level of indirection, and made it all inline.
* kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
- fixed an oversight in my sort speedup
* kjs/array_object.h: Add pushUndefinedObjectsToEnd.
* kjs/array_object.cpp:
(ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
(ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
Pushes all undefined to the end of the array.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 79d6936..b5ed59b 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,22 @@
2002-11-18 Darin Adler <darin at apple.com>
+ - simplified the ExecState class, which was showing up in profiles
+
+ Sped up JavaScript iBench by 6%.
+
+ * kjs/interpreter.h: Removed the level of indirection, and made it all inline.
+ * kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
+
+ - fixed an oversight in my sort speedup
+
+ * kjs/array_object.h: Add pushUndefinedObjectsToEnd.
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
+ Pushes all undefined to the end of the array.
+
+2002-11-18 Darin Adler <darin at apple.com>
+
- fix worst speed problems on the sort page of the iBench JavaScript test
Sped up JavaScript iBench by 70%, the sort page by 88%.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 79d6936..b5ed59b 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,5 +1,22 @@
2002-11-18 Darin Adler <darin at apple.com>
+ - simplified the ExecState class, which was showing up in profiles
+
+ Sped up JavaScript iBench by 6%.
+
+ * kjs/interpreter.h: Removed the level of indirection, and made it all inline.
+ * kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
+
+ - fixed an oversight in my sort speedup
+
+ * kjs/array_object.h: Add pushUndefinedObjectsToEnd.
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
+ Pushes all undefined to the end of the array.
+
+2002-11-18 Darin Adler <darin at apple.com>
+
- fix worst speed problems on the sort page of the iBench JavaScript test
Sped up JavaScript iBench by 70%, the sort page by 88%.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 79d6936..b5ed59b 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,5 +1,22 @@
2002-11-18 Darin Adler <darin at apple.com>
+ - simplified the ExecState class, which was showing up in profiles
+
+ Sped up JavaScript iBench by 6%.
+
+ * kjs/interpreter.h: Removed the level of indirection, and made it all inline.
+ * kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
+
+ - fixed an oversight in my sort speedup
+
+ * kjs/array_object.h: Add pushUndefinedObjectsToEnd.
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
+ Pushes all undefined to the end of the array.
+
+2002-11-18 Darin Adler <darin at apple.com>
+
- fix worst speed problems on the sort page of the iBench JavaScript test
Sped up JavaScript iBench by 70%, the sort page by 88%.
diff --git a/JavaScriptCore/kjs/array_object.cpp b/JavaScriptCore/kjs/array_object.cpp
index 5f316f8..d6dbd61 100644
--- a/JavaScriptCore/kjs/array_object.cpp
+++ b/JavaScriptCore/kjs/array_object.cpp
@@ -202,8 +202,10 @@ static int compareByStringForQSort(const void *a, const void *b)
void ArrayInstanceImp::sort(ExecState *exec)
{
+ int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd();
+
execForCompareByStringForQSort = exec;
- qsort(storage, length, sizeof(ValueImp *), compareByStringForQSort);
+ qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareByStringForQSort);
execForCompareByStringForQSort = 0;
}
@@ -235,12 +237,32 @@ static int compareWithCompareFunctionForQSort(const void *a, const void *b)
void ArrayInstanceImp::sort(ExecState *exec, Object &compareFunction)
{
+ int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd();
+
CompareWithCompareFunctionArguments args(exec, compareFunction.imp());
compareWithCompareFunctionArguments = &args;
- qsort(storage, length, sizeof(ValueImp *), compareWithCompareFunctionForQSort);
+ qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareWithCompareFunctionForQSort);
compareWithCompareFunctionArguments = 0;
}
+unsigned ArrayInstanceImp::pushUndefinedObjectsToEnd()
+{
+ ValueImp *undefined = UndefinedImp::staticUndefined;
+
+ unsigned o = 0;
+ for (unsigned i = 0; i != length; ++i) {
+ ValueImp *v = storage[i];
+ if (v && v != undefined) {
+ if (o != i)
+ storage[o] = v;
+ o++;
+ }
+ }
+ if (o != length)
+ memset(storage + o, 0, sizeof(ValueImp *) * (length - o));
+ return o;
+}
+
// ------------------------------ ArrayPrototypeImp ----------------------------
const ClassInfo ArrayPrototypeImp::info = {"Array", &ArrayInstanceImp::info, &arrayTable, 0};
diff --git a/JavaScriptCore/kjs/array_object.h b/JavaScriptCore/kjs/array_object.h
index abfdb76..a255d6c 100644
--- a/JavaScriptCore/kjs/array_object.h
+++ b/JavaScriptCore/kjs/array_object.h
@@ -55,6 +55,8 @@ namespace KJS {
private:
void setLength(unsigned newLength);
+ unsigned pushUndefinedObjectsToEnd();
+
unsigned length;
unsigned capacity;
ValueImp **storage;
diff --git a/JavaScriptCore/kjs/interpreter.cpp b/JavaScriptCore/kjs/interpreter.cpp
index 791275a..8684eb7 100644
--- a/JavaScriptCore/kjs/interpreter.cpp
+++ b/JavaScriptCore/kjs/interpreter.cpp
@@ -317,59 +317,5 @@ void Interpreter::finalCheck()
}
#endif
-// ------------------------------ ExecState --------------------------------------
-
-namespace KJS {
- class ExecStateImp
- {
- public:
- ExecStateImp(Interpreter *interp, ContextImp *con)
- : interpreter(interp), context(con) {};
- Interpreter *interpreter;
- ContextImp *context;
- Value exception;
- };
-};
-
-ExecState::~ExecState()
-{
- delete rep;
-}
-
-Interpreter *ExecState::interpreter() const
-{
- return rep->interpreter;
-}
-
-const Context ExecState::context() const
-{
- return rep->context;
-}
-
-void ExecState::setException(const Value &e)
-{
- rep->exception = e;
-}
-
-void ExecState::clearException()
-{
- rep->exception = Value();
-}
-
-Value ExecState::exception() const
-{
- return rep->exception;
-}
-
-bool ExecState::hadException() const
-{
- return !rep->exception.isNull();
-}
-
-ExecState::ExecState(Interpreter *interp, ContextImp *con)
-{
- rep = new ExecStateImp(interp,con);
-}
-
void Interpreter::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
diff --git a/JavaScriptCore/kjs/interpreter.h b/JavaScriptCore/kjs/interpreter.h
index 4f7106a..0baa2cd 100644
--- a/JavaScriptCore/kjs/interpreter.h
+++ b/JavaScriptCore/kjs/interpreter.h
@@ -368,30 +368,31 @@ namespace KJS {
friend class FunctionImp;
friend class GlobalFuncImp;
public:
- virtual ~ExecState();
-
/**
* Returns the interpreter associated with this execution state
*
* @return The interpreter executing the script
*/
- Interpreter *interpreter() const;
+ Interpreter *interpreter() const { return _interpreter; }
/**
* Returns the execution context associated with this execution state
*
* @return The current execution state context
*/
- const Context context() const;
+ const Context context() const { return _context; }
- void setException(const Value &e);
- void clearException();
- Value exception() const;
- bool hadException() const;
+ void setException(const Value &e) { _exception = e; }
+ void clearException() { _exception = Value(); }
+ Value exception() const { return _exception; }
+ bool hadException() const { return !_exception.isNull(); }
private:
- ExecState(Interpreter *interp, ContextImp *con);
- ExecStateImp *rep;
+ ExecState(Interpreter *interp, ContextImp *con)
+ : _interpreter(interp), _context(con) { }
+ Interpreter *_interpreter;
+ ContextImp *_context;
+ Value _exception;
};
}; // namespace
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list