Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 01:34:00 +0000 (01:34 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 01:34:00 +0000 (01:34 +0000)
        - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * kjs/LocalStorage.h: Added.
        (KJS::LocalStorageEntry::LocalStorageEntry):
        (WTF::):
        * kjs/function.h:
        * kjs/nodes.cpp:
        (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27242 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/kjs/LocalStorage.h [new file with mode: 0644]
JavaScriptCore/kjs/function.h
JavaScriptCore/kjs/nodes.cpp

index ab6736b92bc2550b708ec11adcd49eb6524c64cb..1ab7f0549cb453ee090b784ce28f81ca9f08da2d 100644 (file)
@@ -1,3 +1,18 @@
+2007-10-29  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+        
+        - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
+
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * kjs/LocalStorage.h: Added.
+        (KJS::LocalStorageEntry::LocalStorageEntry):
+        (WTF::):
+        * kjs/function.h:
+        * kjs/nodes.cpp:
+        (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
+
 2007-10-29  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Oliver Hunt.
 2007-10-29  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Oliver Hunt.
index f3bbb593d77cdad2326772059b88eb79347cbb98..b20d1c2f08453cf661dd846fdb8b0cf4a59fa4c7 100644 (file)
                                RelativePath="..\..\kjs\list.h"\r
                                >\r
                        </File>\r
                                RelativePath="..\..\kjs\list.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\kjs\LocalStorage.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\kjs\lookup.cpp"\r
                                >\r
                        <File\r
                                RelativePath="..\..\kjs\lookup.cpp"\r
                                >\r
index 82194c4555316bf3d7ad0a38931a8b76c4f8729f..9c2baee60d00ac5f92fb559e18a56e4129806445 100644 (file)
                65E217C008E7EECC0023E5F6 /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65EA4C9C092AF9E20093D800 /* JSLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA4C9A092AF9E20093D800 /* JSLock.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65EA73650BAE35D1001BB560 /* CommonIdentifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65E217C008E7EECC0023E5F6 /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65EA4C9C092AF9E20093D800 /* JSLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA4C9A092AF9E20093D800 /* JSLock.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65EA73650BAE35D1001BB560 /* CommonIdentifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               65F340940CD6C1C000C0CA8B /* LocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 65F340840CD6C0DE00C0CA8B /* LocalStorage.h */; };
                65FB3EB309D109F000F49DEB /* lexer.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3EB209D109F000F49DEB /* lexer.lut.h */; };
                65FB3F4F09D11B2400F49DEB /* date_object.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3F4709D11B2400F49DEB /* date_object.lut.h */; };
                65FB3F5109D11B2400F49DEB /* grammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3F4909D11B2400F49DEB /* grammar.h */; };
                65FB3EB309D109F000F49DEB /* lexer.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3EB209D109F000F49DEB /* lexer.lut.h */; };
                65FB3F4F09D11B2400F49DEB /* date_object.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3F4709D11B2400F49DEB /* date_object.lut.h */; };
                65FB3F5109D11B2400F49DEB /* grammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FB3F4909D11B2400F49DEB /* grammar.h */; };
                65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = "<group>"; tabWidth = 8; };
                65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; };
                65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = "<group>"; };
                65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = "<group>"; tabWidth = 8; };
                65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; };
                65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = "<group>"; };
+               65F340840CD6C0DE00C0CA8B /* LocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorage.h; sourceTree = "<group>"; };
                65FB3EB209D109F000F49DEB /* lexer.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = lexer.lut.h; sourceTree = "<group>"; };
                65FB3F4709D11B2400F49DEB /* date_object.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = date_object.lut.h; sourceTree = "<group>"; };
                65FB3F4809D11B2400F49DEB /* grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = grammar.cpp; sourceTree = "<group>"; };
                65FB3EB209D109F000F49DEB /* lexer.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = lexer.lut.h; sourceTree = "<group>"; };
                65FB3F4709D11B2400F49DEB /* date_object.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = date_object.lut.h; sourceTree = "<group>"; };
                65FB3F4809D11B2400F49DEB /* grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = grammar.cpp; sourceTree = "<group>"; };
                                F692A8660255597D01FF60F7 /* lexer.h */,
                                931C6CF0038EE8DE008635CE /* list.cpp */,
                                931C6CEF038EE8DE008635CE /* list.h */,
                                F692A8660255597D01FF60F7 /* lexer.h */,
                                931C6CF0038EE8DE008635CE /* list.cpp */,
                                931C6CEF038EE8DE008635CE /* list.h */,
+                               65F340840CD6C0DE00C0CA8B /* LocalStorage.h */,
                                F692A8680255597D01FF60F7 /* lookup.cpp */,
                                F692A8690255597D01FF60F7 /* lookup.h */,
                                F692A86A0255597D01FF60F7 /* math_object.cpp */,
                                F692A8680255597D01FF60F7 /* lookup.cpp */,
                                F692A8690255597D01FF60F7 /* lookup.h */,
                                F692A86A0255597D01FF60F7 /* math_object.cpp */,
                                932F5B490822A1C700736975 /* internal.h in Headers */,
                                932F5B4A0822A1C700736975 /* interpreter.h in Headers */,
                                932F5B4B0822A1C700736975 /* lexer.h in Headers */,
                                932F5B490822A1C700736975 /* internal.h in Headers */,
                                932F5B4A0822A1C700736975 /* interpreter.h in Headers */,
                                932F5B4B0822A1C700736975 /* lexer.h in Headers */,
+                               65F340940CD6C1C000C0CA8B /* LocalStorage.h in Headers */,
                                932F5B4D0822A1C700736975 /* lookup.h in Headers */,
                                932F5B4E0822A1C700736975 /* math_object.h in Headers */,
                                932F5B500822A1C700736975 /* nodes.h in Headers */,
                                932F5B4D0822A1C700736975 /* lookup.h in Headers */,
                                932F5B4E0822A1C700736975 /* math_object.h in Headers */,
                                932F5B500822A1C700736975 /* nodes.h in Headers */,
diff --git a/JavaScriptCore/kjs/LocalStorage.h b/JavaScriptCore/kjs/LocalStorage.h
new file mode 100644 (file)
index 0000000..e801cb3
--- /dev/null
@@ -0,0 +1,55 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ *  Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ *  Copyright (C) 2007 Maks Orlovich
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KJS_LOCAL_STORAGE_H
+#define KJS_LOCAL_STORAGE_H
+
+#include <Vector.h>
+
+namespace KJS {
+    class JSValue;
+
+    struct LocalStorageEntry {
+        LocalStorageEntry()
+        {
+        }
+    
+        LocalStorageEntry(JSValue* v, int a)
+            : value(v)
+            , attributes(a)
+        {
+        }
+
+        JSValue* value;
+        int attributes;
+    };
+
+    typedef Vector<LocalStorageEntry, 32> LocalStorage;
+}
+
+namespace WTF {
+    template<> struct VectorTraits<KJS::LocalStorageEntry> : VectorTraitsBase<true, KJS::LocalStorageEntry> { };
+}
+
+#endif // KJS_LOCAL_STORAGE_H
index bf3163f2b3763df7d5520c2f21ca07bbbcb3d2c3..06fb52080ef30f96f43373cc0b5126d5a8686406 100644 (file)
 #ifndef KJS_FUNCTION_H
 #define KJS_FUNCTION_H
 
 #ifndef KJS_FUNCTION_H
 #define KJS_FUNCTION_H
 
+#include "LocalStorage.h"
 #include "SymbolTable.h"
 #include "object.h"
 #include <wtf/OwnPtr.h>
 #include "SymbolTable.h"
 #include "object.h"
 #include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
 
 namespace KJS {
 
 
 namespace KJS {
 
@@ -138,24 +138,6 @@ namespace KJS {
   };
 
   class ActivationImp : public JSObject {
   };
 
   class ActivationImp : public JSObject {
-  public:
-    struct LocalStorageEntry {
-        LocalStorageEntry()
-        {
-        }
-
-        LocalStorageEntry(JSValue* v, int a)
-            : value(v)
-            , attributes(a)
-        {
-        }
-
-        JSValue* value;
-        int attributes;
-    };
-
-    typedef Vector<LocalStorageEntry, 32> LocalStorage;
-
   private:
     struct ActivationImpPrivate {
         ActivationImpPrivate(FunctionImp* f, const List& a)
   private:
     struct ActivationImpPrivate {
         ActivationImpPrivate(FunctionImp* f, const List& a)
index 453cdba5bef98bd6e0c7472ad261ab887196f408..656d320428a791ac3b9a26af0693426161501338 100644 (file)
@@ -3219,7 +3219,7 @@ void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec)
         optimizeVariableAccess();
 
     ASSERT(exec->variableObject()->isActivation());
         optimizeVariableAccess();
 
     ASSERT(exec->variableObject()->isActivation());
-    ActivationImp::LocalStorage& localStorage = static_cast<ActivationImp*>(exec->variableObject())->localStorage();
+    LocalStorage& localStorage = static_cast<ActivationImp*>(exec->variableObject())->localStorage();
     localStorage.reserveCapacity(m_varStack.size() + m_parameters.size() + m_functionStack.size());
     
     int minAttributes = Internal | DontDelete;
     localStorage.reserveCapacity(m_varStack.size() + m_parameters.size() + m_functionStack.size());
     
     int minAttributes = Internal | DontDelete;
@@ -3233,16 +3233,16 @@ void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec)
         int attributes = minAttributes;
         if (node->varType == VarDeclNode::Constant)
             attributes |= ReadOnly;
         int attributes = minAttributes;
         if (node->varType == VarDeclNode::Constant)
             attributes |= ReadOnly;
-        localStorage.append(ActivationImp::LocalStorageEntry(jsUndefined(), attributes));
+        localStorage.append(LocalStorageEntry(jsUndefined(), attributes));
     }
 
     const List& args = *exec->arguments();
     for (i = 0, size = m_parameters.size(); i < size; ++i)
     }
 
     const List& args = *exec->arguments();
     for (i = 0, size = m_parameters.size(); i < size; ++i)
-        localStorage.append(ActivationImp::LocalStorageEntry(args[i], DontDelete));
+        localStorage.append(LocalStorageEntry(args[i], DontDelete));
 
     for (i = 0, size = m_functionStack.size(); i < size; ++i) {
         FuncDeclNode* node = m_functionStack[i];
 
     for (i = 0, size = m_functionStack.size(); i < size; ++i) {
         FuncDeclNode* node = m_functionStack[i];
-        localStorage.append(ActivationImp::LocalStorageEntry(node->makeFunction(exec), minAttributes));
+        localStorage.append(LocalStorageEntry(node->makeFunction(exec), minAttributes));
     }
 }
 
     }
 }