Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Feb 2006 01:43:16 +0000 (01:43 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Feb 2006 01:43:16 +0000 (01:43 +0000)
        - 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

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kxmlcore/FastMalloc.cpp

index 6945f44fa0265975a4ac8194f8cd65a9b91d592c..68a6d73888eff5c507d0b38432f5fe9652f86ef2 100644 (file)
@@ -1,3 +1,24 @@
+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.
index 900d3b2d13eb5c4e74e3ab91d483a8f7c12df891..35a21abfbf6e8bc6e85fdf5ac1db4791b4331e53 100644 (file)
@@ -1237,12 +1237,7 @@ JSValue *ConditionalNode::evaluate(ExecState *exec)
 
 // 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;
@@ -1859,9 +1854,10 @@ Completion ForInNode::execute(ExecState *exec)
         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);
         
@@ -1915,6 +1911,8 @@ Completion ForInNode::execute(ExecState *exec)
 
 void ForInNode::processVarDecls(ExecState *exec)
 {
+  if (varDecl)
+    varDecl->processVarDecls(exec);
   statement->processVarDecls(exec);
 }
 
index aa0374f84c160959d43e6062254bde79eaa98464..1698319d25cb87869bfb4f46bce36c0f3ed7ae42 100644 (file)
@@ -327,11 +327,7 @@ bool JSObject::deleteProperty(ExecState *exec, unsigned propertyName)
   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);
index 03a8ba19fe9ffd0269aa1f55e213c03dca06d201..2217598822cec701563acc6a01e0918c4c7c0994 100644 (file)
@@ -95,7 +95,7 @@ void *fastRealloc(void* p, size_t n)
     return realloc(p, n);
 }
 
-#ifndef WIN32
+#if !WIN32
 void fastMallocRegisterThread(pthread_t thread) 
 {
 }
@@ -105,32 +105,27 @@ 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 {