- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5210
REGRESSION: for/in loop with var changes global variable instead of making local
Test: fast/js/for-in-var-scope.html
* kjs/nodes.cpp:
(valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
(ForInNode::execute): Break out of the scope chain loop once we find and set the
loop variable. We don't want to set multiple loop variables.
(ForInNode::processVarDecls): Process the declaration of the loop variable.
- other cleanup
* kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
* kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
instead of defining it here a second time.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12564
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-02-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5210
+ REGRESSION: for/in loop with var changes global variable instead of making local
+
+ Test: fast/js/for-in-var-scope.html
+
+ * kjs/nodes.cpp:
+ (valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
+ (ForInNode::execute): Break out of the scope chain loop once we find and set the
+ loop variable. We don't want to set multiple loop variables.
+ (ForInNode::processVarDecls): Process the declaration of the loop variable.
+
+ - other cleanup
+
+ * kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
+ * kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
+ instead of defining it here a second time.
+
2006-02-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by Hyatt.
// ECMA 11.13
-#if __GNUC__
-// gcc refuses to inline this without the always_inline, but inlining it does help
-static inline JSValue *valueForReadModifyAssignment(ExecState * exec, JSValue *v1, JSValue *v2, Operator oper) __attribute__((always_inline));
-#endif
-
-static inline JSValue *valueForReadModifyAssignment(ExecState * exec, JSValue *v1, JSValue *v2, Operator oper)
+static ALWAYS_INLINE JSValue *valueForReadModifyAssignment(ExecState * exec, JSValue *v1, JSValue *v2, Operator oper)
{
JSValue *v;
int i1;
JSObject *o;
do {
o = *iter;
- if (o->getPropertySlot(exec, ident, slot))
+ if (o->getPropertySlot(exec, ident, slot)) {
o->put(exec, ident, str);
-
+ break;
+ }
++iter;
} while (iter != end);
void ForInNode::processVarDecls(ExecState *exec)
{
+ if (varDecl)
+ varDecl->processVarDecls(exec);
statement->processVarDecls(exec);
}
return deleteProperty(exec, Identifier::from(propertyName));
}
-static inline
-#ifdef __GNUC__
-__attribute__((always_inline))
-#endif
-JSValue *tryGetAndCallProperty(ExecState *exec, const JSObject *object, const Identifier &propertyName) {
+static ALWAYS_INLINE JSValue *tryGetAndCallProperty(ExecState *exec, const JSObject *object, const Identifier &propertyName) {
JSValue *v = object->get(exec, propertyName);
if (v->isObject()) {
JSObject *o = static_cast<JSObject*>(v);
return realloc(p, n);
}
-#ifndef WIN32
+#if !WIN32
void fastMallocRegisterThread(pthread_t thread)
{
}
#else
-#include <new>
-#include <stdio.h>
-#include <stddef.h>
-#if defined HAVE_STDINT_H
+#if HAVE_STDINT_H
#include <stdint.h>
-#elif defined HAVE_INTTYPES_H
+#elif HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
-#include <string.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include "TCSpinLock.h"
-#include "TCPageMap.h"
-#include "TCSystemAlloc.h"
+#include "AlwaysInline.h"
#include "Assertions.h"
-
-#ifdef __GNUC__
-#define ALWAYS_INLINE inline __attribute__((always_inline))
-#else
-#define ALWAYS_INLINE inline
-#endif
+#include "TCPageMap.h"
+#include "TCSpinLock.h"
+#include "TCSystemAlloc.h"
+#include <errno.h>
+#include <new>
+#include <pthread.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#if KXC_CHANGES
namespace KXMLCore {