Reverted fix for this bug, because it was part of a time range that caused a performance
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Oct 2005 00:46:25 +0000 (00:46 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Oct 2005 00:46:25 +0000 (00:46 +0000)
regression:

<rdar://problem/4260481> Remove Reference type from JavaScriptCore

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

20 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/kjs/IdentifierSequencedSet.cpp [deleted file]
JavaScriptCore/kjs/IdentifierSequencedSet.h [deleted file]
JavaScriptCore/kjs/array_instance.h
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/object.h
JavaScriptCore/kjs/property_map.cpp
JavaScriptCore/kjs/property_map.h
JavaScriptCore/kjs/protect.h
JavaScriptCore/kjs/protected_reference.h [new file with mode: 0644]
JavaScriptCore/kjs/reference.cpp [new file with mode: 0644]
JavaScriptCore/kjs/reference.h [new file with mode: 0644]
JavaScriptCore/kjs/reference_list.cpp [new file with mode: 0644]
JavaScriptCore/kjs/reference_list.h [new file with mode: 0644]
JavaScriptCore/kjs/ustring.h
JavaScriptCore/kxmlcore/HashSet.h

index d3be7a1a2d4ece8d770b2bce90aedd98e7ba63bb..79abfc144e772cfbe8e65278cebeaf26be8b0293 100644 (file)
@@ -1,3 +1,10 @@
+2005-10-15  Maciej Stachowiak  <mjs@apple.com>
+
+       Reverted fix for this bug, because it was part of a time range that caused a performance
+       regression:
+       
+       <rdar://problem/4260481> Remove Reference type from JavaScriptCore
+
 2005-10-15  Darin Adler  <darin@apple.com>
 
         * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
index cbaa56e7c9804836cde19a9b9f0e6f67f0480bc1..938f3b7ce2a43f14a715db765dc4c819d3d46344 100644 (file)
                37B800EF08EBB65B0035B474 /* HashTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65DFC92D08EA173A00F7300B /* HashTable.cpp */; };
                37B800F008EBB65B0035B474 /* HashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92E08EA173A00F7300B /* HashTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
                37B800F108EBB65C0035B474 /* HashTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92F08EA173A00F7300B /* HashTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               6512E62B08F3BA8B004A15B6 /* IdentifierSequencedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D6D61C08F2676800958B28 /* IdentifierSequencedSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               6512E63608F3BADE004A15B6 /* IdentifierSequencedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65D6D61B08F2676800958B28 /* IdentifierSequencedSet.cpp */; };
                65162EEB08E6A1FE007556CD /* SharedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65162EEA08E6A1FE007556CD /* SharedPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65162F0208E6A2D0007556CD /* SharedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65162EEA08E6A1FE007556CD /* SharedPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               652C107F08DA7B1E0020887D /* protected_reference.h in Headers */ = {isa = PBXBuildFile; fileRef = 652C107E08DA7B1E0020887D /* protected_reference.h */; };
                6541BD7208E80A17002CBEE7 /* TCPageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */; };
                6541BD7308E80A17002CBEE7 /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */; };
                6541BD7408E80A17002CBEE7 /* TCSystemAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */; };
@@ -45,8 +44,6 @@
                65621E6E089E859700760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65621E6F089E85D300760F35 /* property_slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* property_slot.cpp */; };
                65621E70089E85D300760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               65D6D61D08F2676800958B28 /* IdentifierSequencedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65D6D61B08F2676800958B28 /* IdentifierSequencedSet.cpp */; };
-               65D6D61E08F2676800958B28 /* IdentifierSequencedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D6D61C08F2676800958B28 /* IdentifierSequencedSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65D7D19C08F10B5B0015ABD8 /* FastMallocInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */; };
                65DFC93008EA173A00F7300B /* HashFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92A08EA173A00F7300B /* HashFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65DFC93108EA173A00F7300B /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92B08EA173A00F7300B /* HashMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -95,6 +92,8 @@
                932F5B600822A1C700736975 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = F68EBB8C0255D4C601FF60F7 /* config.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5B610822A1C700736975 /* JavaScriptCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */; };
                932F5B620822A1C700736975 /* simple_number.h in Headers */ = {isa = PBXBuildFile; fileRef = F50888B6030BB74C012A967E /* simple_number.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               932F5B630822A1C700736975 /* reference_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F54F0800030CD22001B5C2EB /* reference_list.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               932F5B640822A1C700736975 /* reference.h in Headers */ = {isa = PBXBuildFile; fileRef = F5341391030CEEB1018BE7F3 /* reference.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5B650822A1C700736975 /* completion.h in Headers */ = {isa = PBXBuildFile; fileRef = F5BB2BC5030F772101FCFE1D /* completion.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5B660822A1C700736975 /* identifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A349A038AE7C6008635CE /* identifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5B670822A1C700736975 /* array_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 938772E5038BFE19008635CE /* array_instance.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5BA80822A1C700736975 /* ustring.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* ustring.cpp */; };
                932F5BA90822A1C700736975 /* value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8870255597D01FF60F7 /* value.cpp */; };
                932F5BAB0822A1C700736975 /* nodes2string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5FFE656026B47A6018635CA /* nodes2string.cpp */; };
+               932F5BAC0822A1C700736975 /* reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5341390030CEEB1018BE7F3 /* reference.cpp */; settings = {ATTRIBUTES = (Private, ); }; };
+               932F5BAD0822A1C700736975 /* reference_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5341394030CF5F8018BE7F3 /* reference_list.cpp */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5BAE0822A1C700736975 /* identifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933A349D038AE80F008635CE /* identifier.cpp */; };
                932F5BAF0822A1C700736975 /* scope_chain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9374D3A8038D9D74008635CE /* scope_chain.cpp */; };
                932F5BB00822A1C700736975 /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 931C6CF0038EE8DE008635CE /* list.cpp */; };
                A85D8210087B2822006A9172 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = F68EBB8C0255D4C601FF60F7 /* config.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D8211087B2822006A9172 /* JavaScriptCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */; };
                A85D8212087B2822006A9172 /* simple_number.h in Headers */ = {isa = PBXBuildFile; fileRef = F50888B6030BB74C012A967E /* simple_number.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A85D8213087B2822006A9172 /* reference_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F54F0800030CD22001B5C2EB /* reference_list.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A85D8214087B2822006A9172 /* reference.h in Headers */ = {isa = PBXBuildFile; fileRef = F5341391030CEEB1018BE7F3 /* reference.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D8215087B2822006A9172 /* completion.h in Headers */ = {isa = PBXBuildFile; fileRef = F5BB2BC5030F772101FCFE1D /* completion.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D8216087B2822006A9172 /* identifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A349A038AE7C6008635CE /* identifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D8217087B2822006A9172 /* array_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 938772E5038BFE19008635CE /* array_instance.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D8258087B2822006A9172 /* ustring.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* ustring.cpp */; };
                A85D8259087B2822006A9172 /* value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8870255597D01FF60F7 /* value.cpp */; };
                A85D825A087B2822006A9172 /* nodes2string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5FFE656026B47A6018635CA /* nodes2string.cpp */; };
+               A85D825B087B2822006A9172 /* reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5341390030CEEB1018BE7F3 /* reference.cpp */; settings = {ATTRIBUTES = (Private, ); }; };
+               A85D825C087B2822006A9172 /* reference_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5341394030CF5F8018BE7F3 /* reference_list.cpp */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D825D087B2822006A9172 /* identifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933A349D038AE80F008635CE /* identifier.cpp */; };
                A85D825E087B2822006A9172 /* scope_chain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9374D3A8038D9D74008635CE /* scope_chain.cpp */; };
                A85D825F087B2822006A9172 /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 931C6CF0038EE8DE008635CE /* list.cpp */; };
                A883C7F408EA12860051473E /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */; };
                A883C7F508EA12860051473E /* TCSystemAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */; };
                A883C7F608EA12860051473E /* TCSystemAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */; };
+               A883C7F708EA12A20051473E /* protected_reference.h in Headers */ = {isa = PBXBuildFile; fileRef = 652C107E08DA7B1E0020887D /* protected_reference.h */; };
                A8BC0DFC08D43D6D00379918 /* ucptable.c in Headers */ = {isa = PBXBuildFile; fileRef = 93E26C0D08B1520900F85226 /* ucptable.c */; };
 /* End PBXBuildFile section */
 
                65162EEA08E6A1FE007556CD /* SharedPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SharedPtr.h; sourceTree = "<group>"; };
                651F6412039D5B5F0078395C /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; };
                651F6413039D5B5F0078395C /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; };
+               652C107E08DA7B1E0020887D /* protected_reference.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protected_reference.h; sourceTree = "<group>"; };
                6541720E039E08B90058BFEB /* dftables.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dftables.c; path = pcre/dftables.c; sourceTree = "<group>"; };
                6541720F039E08B90058BFEB /* pcre.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pcre.h; path = pcre/pcre.h; sourceTree = "<group>"; };
                65417217039E0B280058BFEB /* pcre-config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "pcre-config.h"; path = "pcre/pcre-config.h"; sourceTree = "<group>"; };
                65621E6B089E859700760F35 /* property_slot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = property_slot.cpp; sourceTree = "<group>"; };
                65621E6C089E859700760F35 /* property_slot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = property_slot.h; sourceTree = "<group>"; };
                65C02FBB0637462A003E7EE6 /* protect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protect.h; sourceTree = "<group>"; };
-               65D6D61B08F2676800958B28 /* IdentifierSequencedSet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IdentifierSequencedSet.cpp; sourceTree = "<group>"; };
-               65D6D61C08F2676800958B28 /* IdentifierSequencedSet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IdentifierSequencedSet.h; sourceTree = "<group>"; };
                65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FastMallocInternal.h; sourceTree = "<group>"; };
                65DFC92A08EA173A00F7300B /* HashFunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; };
                65DFC92B08EA173A00F7300B /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HashMap.h; sourceTree = "<group>"; };
                93F1981A08245AAE001E9ABC /* keywords.table */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keywords.table; sourceTree = "<group>"; };
                A85D8288087B2822006A9172 /* JavaScriptCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                F50888B6030BB74C012A967E /* simple_number.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = simple_number.h; sourceTree = "<group>"; };
+               F5341390030CEEB1018BE7F3 /* reference.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reference.cpp; sourceTree = "<group>"; };
+               F5341391030CEEB1018BE7F3 /* reference.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = reference.h; sourceTree = "<group>"; };
+               F5341394030CF5F8018BE7F3 /* reference_list.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = reference_list.cpp; sourceTree = "<group>"; };
+               F54F0800030CD22001B5C2EB /* reference_list.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = reference_list.h; sourceTree = "<group>"; };
                F5BB2BC5030F772101FCFE1D /* completion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = completion.h; sourceTree = "<group>"; };
                F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JavaScriptCorePrefix.h; path = ../JavaScriptCorePrefix.h; sourceTree = "<group>"; };
                F5FFE656026B47A6018635CA /* nodes2string.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = nodes2string.cpp; sourceTree = "<group>"; };
                08FB77AEFE84172EC02AAC07 /* Classes */ = {
                        isa = PBXGroup;
                        children = (
-                               65D6D61B08F2676800958B28 /* IdentifierSequencedSet.cpp */,
-                               65D6D61C08F2676800958B28 /* IdentifierSequencedSet.h */,
                                65621E6B089E859700760F35 /* property_slot.cpp */,
                                65621E6C089E859700760F35 /* property_slot.h */,
                                938772E5038BFE19008635CE /* array_instance.h */,
                                650B68D80639033F009D42DE /* protected_values.cpp */,
+                               652C107E08DA7B1E0020887D /* protected_reference.h */,
                                650B68D90639033F009D42DE /* protected_values.h */,
                                F692A84E0255597D01FF60F7 /* array_object.h */,
                                F692A84D0255597D01FF60F7 /* array_object.cpp */,
                                F692A87A0255597D01FF60F7 /* property_map.h */,
                                F692A8790255597D01FF60F7 /* property_map.cpp */,
                                65C02FBB0637462A003E7EE6 /* protect.h */,
+                               F5341390030CEEB1018BE7F3 /* reference.cpp */,
+                               F5341391030CEEB1018BE7F3 /* reference.h */,
+                               F54F0800030CD22001B5C2EB /* reference_list.h */,
+                               F5341394030CF5F8018BE7F3 /* reference_list.cpp */,
                                F692A87B0255597D01FF60F7 /* regexp_object.cpp */,
                                F692A87C0255597D01FF60F7 /* regexp_object.h */,
                                F692A87D0255597D01FF60F7 /* regexp.cpp */,
                                932F5B600822A1C700736975 /* config.h in Headers */,
                                932F5B610822A1C700736975 /* JavaScriptCorePrefix.h in Headers */,
                                932F5B620822A1C700736975 /* simple_number.h in Headers */,
+                               932F5B630822A1C700736975 /* reference_list.h in Headers */,
+                               932F5B640822A1C700736975 /* reference.h in Headers */,
                                932F5B650822A1C700736975 /* completion.h in Headers */,
                                932F5B660822A1C700736975 /* identifier.h in Headers */,
                                932F5B670822A1C700736975 /* array_instance.h in Headers */,
                                93E26BFE08B151D400F85226 /* ucpinternal.h in Headers */,
                                93E26C1308B1523D00F85226 /* ucptable.c in Headers */,
                                93E26CCF08B2921900F85226 /* softlinking.h in Headers */,
+                               652C107F08DA7B1E0020887D /* protected_reference.h in Headers */,
                                65162EEB08E6A1FE007556CD /* SharedPtr.h in Headers */,
                                65E217BD08E7EECC0023E5F6 /* Assertions.h in Headers */,
                                65E217C008E7EECC0023E5F6 /* FastMalloc.h in Headers */,
                                65DFC93508EA173A00F7300B /* HashTraits.h in Headers */,
                                6557E8F808EA5D4D0049CDFC /* HashMapPtrSpec.h in Headers */,
                                65D7D19C08F10B5B0015ABD8 /* FastMallocInternal.h in Headers */,
-                               65D6D61E08F2676800958B28 /* IdentifierSequencedSet.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A85D8210087B2822006A9172 /* config.h in Headers */,
                                A85D8211087B2822006A9172 /* JavaScriptCorePrefix.h in Headers */,
                                A85D8212087B2822006A9172 /* simple_number.h in Headers */,
+                               A85D8213087B2822006A9172 /* reference_list.h in Headers */,
+                               A85D8214087B2822006A9172 /* reference.h in Headers */,
                                A85D8215087B2822006A9172 /* completion.h in Headers */,
                                A85D8216087B2822006A9172 /* identifier.h in Headers */,
                                A85D8217087B2822006A9172 /* array_instance.h in Headers */,
                                A883C7F308EA12860051473E /* TCPageMap.h in Headers */,
                                A883C7F408EA12860051473E /* TCSpinLock.h in Headers */,
                                A883C7F608EA12860051473E /* TCSystemAlloc.h in Headers */,
+                               A883C7F708EA12A20051473E /* protected_reference.h in Headers */,
                                37B800EB08EBB6520035B474 /* HashFunctions.h in Headers */,
                                37B800EC08EBB6540035B474 /* HashMap.h in Headers */,
                                37B800ED08EBB6540035B474 /* HashMapPtrSpec.h in Headers */,
                                37B800EE08EBB65A0035B474 /* HashSet.h in Headers */,
                                37B800F008EBB65B0035B474 /* HashTable.h in Headers */,
                                37B800F108EBB65C0035B474 /* HashTraits.h in Headers */,
-                               6512E62B08F3BA8B004A15B6 /* IdentifierSequencedSet.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                932F5BA80822A1C700736975 /* ustring.cpp in Sources */,
                                932F5BA90822A1C700736975 /* value.cpp in Sources */,
                                932F5BAB0822A1C700736975 /* nodes2string.cpp in Sources */,
+                               932F5BAC0822A1C700736975 /* reference.cpp in Sources */,
+                               932F5BAD0822A1C700736975 /* reference_list.cpp in Sources */,
                                932F5BAE0822A1C700736975 /* identifier.cpp in Sources */,
                                932F5BAF0822A1C700736975 /* scope_chain.cpp in Sources */,
                                932F5BB00822A1C700736975 /* list.cpp in Sources */,
                                65E217BF08E7EECC0023E5F6 /* FastMalloc.cpp in Sources */,
                                6541BD7408E80A17002CBEE7 /* TCSystemAlloc.cpp in Sources */,
                                65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */,
-                               65D6D61D08F2676800958B28 /* IdentifierSequencedSet.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A85D8258087B2822006A9172 /* ustring.cpp in Sources */,
                                A85D8259087B2822006A9172 /* value.cpp in Sources */,
                                A85D825A087B2822006A9172 /* nodes2string.cpp in Sources */,
+                               A85D825B087B2822006A9172 /* reference.cpp in Sources */,
+                               A85D825C087B2822006A9172 /* reference_list.cpp in Sources */,
                                A85D825D087B2822006A9172 /* identifier.cpp in Sources */,
                                A85D825E087B2822006A9172 /* scope_chain.cpp in Sources */,
                                A85D825F087B2822006A9172 /* list.cpp in Sources */,
                                A883C7F008EA12860051473E /* FastMalloc.cpp in Sources */,
                                A883C7F508EA12860051473E /* TCSystemAlloc.cpp in Sources */,
                                37B800EF08EBB65B0035B474 /* HashTable.cpp in Sources */,
-                               6512E63608F3BADE004A15B6 /* IdentifierSequencedSet.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/JavaScriptCore/kjs/IdentifierSequencedSet.cpp b/JavaScriptCore/kjs/IdentifierSequencedSet.cpp
deleted file mode 100644 (file)
index 203b4d5..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- mode: c++; c-basic-offset: 4 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2005 Apple Computer, Inc
- *
- *  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 Steet, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "IdentifierSequencedSet.h"
-
-namespace KJS {
-
-IdentifierSequencedSet::IdentifierSequencedSet()
-    : m_vector(0),
-      m_vectorLength(0),
-      m_vectorCapacity(0)
-{
-}
-
-void IdentifierSequencedSet::deallocateVector()
-{
-    for (int i = 0; i < m_vectorLength; ++i) {
-        (m_vector + i)->~Identifier();
-    }
-    fastFree(m_vector);
-}
-
-IdentifierSequencedSet::~IdentifierSequencedSet()
-{
-    deallocateVector();
-}
-
-void IdentifierSequencedSet::insert(const Identifier& ident)
-{
-    if (!m_set.insert(ident.ustring().impl()).second)
-        return;
-    
-    if (m_vectorLength == m_vectorCapacity) {
-        m_vectorCapacity = m_vectorCapacity == 0 ? 16 : m_vectorCapacity * 11 / 10;
-        Identifier *newVector = reinterpret_cast<Identifier *>(fastMalloc(m_vectorCapacity * sizeof(Identifier)));
-        for (int i = 0; i < m_vectorLength; ++i) {
-            new (newVector + i) Identifier(m_vector[i]);
-        }
-        deallocateVector();
-        m_vector = newVector;
-    }
-    new (m_vector + m_vectorLength) Identifier(ident);
-    ++m_vectorLength;
-}
-
-} // namespace KJS
-
diff --git a/JavaScriptCore/kjs/IdentifierSequencedSet.h b/JavaScriptCore/kjs/IdentifierSequencedSet.h
deleted file mode 100644 (file)
index 3788d55..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// -*- mode: c++; c-basic-offset: 4 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2005 Apple Computer, Inc
- *
- *  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 Steet, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef KJS_IDENTIFIER_SEQUENCED_SET_H
-#define KJS_IDENTIFIER_SEQUENCED_SET_H
-
-#include "identifier.h"
-
-#include <kxmlcore/HashSet.h>
-
-namespace KJS {
-
-    class IdentifierSequencedSet;
-
-    class IdentifierSequencedSetIterator {
-    private:
-        friend class IdentifierSequencedSet;
-        IdentifierSequencedSetIterator(const Identifier *position) : m_position(position) {}
-
-    public:
-        typedef IdentifierSequencedSetIterator iterator;
-
-        IdentifierSequencedSetIterator() {}
-        
-        // default copy, assignment and destructor are ok
-        
-        const Identifier& operator*() const 
-        { 
-            return *m_position; 
-        }
-
-        const Identifier *operator->() const 
-        { 
-            return &(operator*()); 
-        }
-        
-        iterator& operator++() 
-        { 
-            ++m_position; 
-            return *this;
-        }
-        
-        // postfix ++ intentionally omitted
-        
-        // Comparison.
-        bool operator==(const iterator& other) const
-        { 
-            return m_position == other.m_position; 
-        }
-        
-        bool operator!=(const iterator& other) const 
-        { 
-            return m_position != other.m_position; 
-        }
-        
-    private:
-        const Identifier *m_position;
-    };
-
-    class IdentifierSequencedSet {
-    public:
-        typedef IdentifierSequencedSetIterator iterator;
-
-        IdentifierSequencedSet();
-        ~IdentifierSequencedSet();
-
-        void insert(const Identifier&);
-        iterator begin() const { return iterator(m_vector); }
-        iterator end() const { return iterator(m_vector + m_vectorLength); }
-        int size() const { return m_vectorLength; }
-
-    private:
-        void deallocateVector();
-
-        typedef HashSet<UString::Impl *, PointerHash<UString::Impl *> > IdentifierSet;
-        IdentifierSet m_set;
-
-        Identifier *m_vector;
-        int m_vectorLength;
-        int m_vectorCapacity;
-    };
-
-
-} // namespace KJS
-
-
-#endif // KJS_IDENTIFIER_SEQUENCED_SET_H
index 3338629293733fefa653e5f6ef3be849bbbd7168..afdeb5666d9ae96c554c3f2a315f81297fd53f05 100644 (file)
@@ -39,7 +39,7 @@ namespace KJS {
     virtual void put(ExecState *exec, unsigned propertyName, ValueImp *value, int attr = None);
     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
     virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
-    virtual void getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames);
+    virtual ReferenceList propList(ExecState *exec, bool recursive);
 
     virtual void mark();
 
index 957a94a32d2f1683f2d080914babb995aafae9cd..63717828f2fbf36fb255f0eec9e041c46c4c29d2 100644 (file)
@@ -28,9 +28,9 @@
 #include "interpreter.h"
 #include "object.h"
 #include "operations.h"
+#include "reference_list.h"
 #include "types.h"
 #include "value.h"
-#include "IdentifierSequencedSet.h"
 
 #include "array_object.lut.h"
 
@@ -185,18 +185,20 @@ bool ArrayInstanceImp::deleteProperty(ExecState *exec, unsigned index)
   return ObjectImp::deleteProperty(exec, Identifier::from(index));
 }
 
-void ArrayInstanceImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames)
+ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive)
 {
+  ReferenceList properties = ObjectImp::propList(exec,recursive);
+
   // avoid fetching this every time through the loop
   ValueImp *undefined = jsUndefined();
 
   for (unsigned i = 0; i < storageLength; ++i) {
     ValueImp *imp = storage[i];
-    if (imp && imp != undefined)
-      propertyNames.insert(Identifier::from(i));
+    if (imp && imp != undefined) {
+      properties.append(Reference(this, i));
+    }
   }
-
-  ObjectImp::getPropertyNames(exec, propertyNames);
+  return properties;
 }
 
 void ArrayInstanceImp::resizeStorage(unsigned newLength)
@@ -228,18 +230,18 @@ void ArrayInstanceImp::setLength(unsigned newLength, ExecState *exec)
   }
 
   if (newLength < length) {
-    IdentifierSequencedSet sparseProperties;
+    ReferenceList sparseProperties;
     
-    _prop.getSparseArrayPropertyNames(sparseProperties);
-
-    IdentifierSequencedSetIterator end = sparseProperties.end();
+    _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
     
-    for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
-      Identifier name = *it;
+    ReferenceListIterator it = sparseProperties.begin();
+    while (it != sparseProperties.end()) {
+      Reference ref = it++;
       bool ok;
-      unsigned index = name.toArrayIndex(&ok);
-      if (ok && index > newLength)
-        deleteProperty(exec, name);
+      unsigned index = ref.getPropertyName(exec).toArrayIndex(&ok);
+      if (ok && index > newLength) {
+       ref.deleteValue(exec);
+      }
     }
   }
   
@@ -346,18 +348,19 @@ unsigned ArrayInstanceImp::pushUndefinedObjectsToEnd(ExecState *exec)
         }
     }
     
-    IdentifierSequencedSet sparseProperties;
-    _prop.getSparseArrayPropertyNames(sparseProperties);
-    unsigned newLength = o + sparseProperties.size();
+    ReferenceList sparseProperties;
+    _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
+    unsigned newLength = o + sparseProperties.length();
 
-    if (newLength > storageLength)
+    if (newLength > storageLength) {
       resizeStorage(newLength);
+    } 
 
-    IdentifierSequencedSetIterator end = sparseProperties.end();
-    for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
-      Identifier name = *it;
-      storage[o] = get(exec, name);
-      ObjectImp::deleteProperty(exec, name);
+    ReferenceListIterator it = sparseProperties.begin();
+    while (it != sparseProperties.end()) {
+      Reference ref = it++;
+      storage[o] = ref.getValue(exec);
+      ObjectImp::deleteProperty(exec, ref.getPropertyName(exec));
       o++;
     }
     
index c4588bb75ff36d22bdabd194b45ee0bfd58979fd..12a03837a18a4bf23056489ccbf060427f9959fa 100644 (file)
@@ -43,7 +43,7 @@
 #include "lexer.h"
 #include "operations.h"
 #include "ustring.h"
-#include "IdentifierSequencedSet.h"
+#include "reference_list.h"
 
 using namespace KJS;
 
@@ -1769,7 +1769,7 @@ Completion ForInNode::execute(ExecState *exec)
   ValueImp *retval = 0;
   ObjectImp *v;
   Completion c;
-  IdentifierSequencedSet propertyNames;
+  ReferenceList propList;
 
   if (varDecl) {
     varDecl->evaluate(exec);
@@ -1788,13 +1788,16 @@ Completion ForInNode::execute(ExecState *exec)
 
   KJS_CHECKEXCEPTION
   v = e->toObject(exec);
-  v->getPropertyNames(exec, propertyNames);
+  propList = v->propList(exec);
 
-  IdentifierSequencedSetIterator end = propertyNames.end();
-  for (IdentifierSequencedSetIterator it = propertyNames.begin(); it != end; ++it) {
-    const Identifier &name = *it;
-    if (!v->hasProperty(exec, name))
+  ReferenceListIterator propIt = propList.begin();
+
+  while (propIt != propList.end()) {
+    Identifier name = propIt->getPropertyName(exec);
+    if (!v->hasProperty(exec, name)) {
+      propIt++;
       continue;
+    }
 
     ValueImp *str = jsString(name.ustring());
 
@@ -1856,6 +1859,8 @@ Completion ForInNode::execute(ExecState *exec)
         return c;
       }
     }
+
+    propIt++;
   }
 
   // bail out on error
index 334160941093fccdeec3bc7c9f8d2ef26cd3a130..fd60f8e7a4b312bea78aaae82fb9f2cda39f3834 100644 (file)
@@ -34,6 +34,7 @@ namespace KJS {
   class ProgramNode;
   class PropertyNode;
   class PropertyValueNode;
+  class Reference;
   class RegExp;
   class SourceElementsNode;
   class SourceStream;
index 1b8c52087552bc18122741dc7fa302dc8aa3f1ff..4b23d49798d377c48ccd037c5d7341412ecf8a71 100644 (file)
@@ -28,7 +28,7 @@
 #include "types.h"
 #include "interpreter.h"
 #include "lookup.h"
-#include "IdentifierSequencedSet.h"
+#include "reference_list.h"
 
 #include <assert.h>
 #include <math.h>
@@ -374,9 +374,13 @@ bool ObjectImp::hasInstance(ExecState */*exec*/, ValueImp */*value*/)
   return false;
 }
 
-void ObjectImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet &propertyNames)
+ReferenceList ObjectImp::propList(ExecState *exec, bool recursive)
 {
-  _prop.getEnumerablePropertyNames(propertyNames);
+  ReferenceList list;
+  if (_proto->isObject() && recursive)
+    list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
+
+  _prop.addEnumerablesToReferenceList(list, this);
 
   // Add properties from the static hashtable of properties
   const ClassInfo *info = classInfo();
@@ -385,15 +389,14 @@ void ObjectImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet &proper
       int size = info->propHashTable->size;
       const HashEntry *e = info->propHashTable->entries;
       for (int i = 0; i < size; ++i, ++e) {
-        if (e->s && !(e->attr & DontEnum))
-          propertyNames.insert(e->s);
+        if ( e->s && !(e->attr & DontEnum) )
+          list.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap
       }
     }
     info = info->parentClass;
   }
 
-  if (_proto->isObject())
-    static_cast<ObjectImp*>(_proto)->getPropertyNames(exec, propertyNames);
+  return list;
 }
 
 ValueImp *ObjectImp::toPrimitive(ExecState *exec, Type preferredType) const
index 3028b70dd43ddbbfc78b0c14a8bbf55e5628c527..debfdb18e94cceb880621b13ffa8e3d58fcdf4a3 100644 (file)
@@ -47,7 +47,6 @@ namespace KJS {
   class HashTable;
   class HashEntry;
   class ListImp;
-  class IdentifierSequencedSet;
 
   // ECMA 262-3 8.6.1
   // Property attributes
@@ -423,9 +422,12 @@ namespace KJS {
      * having extra properties other than those set specifically with put().
      *
      * @param exec The current execution state
-     * @param propertyNames A list of property names to be filled in by this call
+     * @param recursive Whether or not properties in the object's prototype
+     * chain should be
+     * included in the list.
+     * @return A List of References to properties of the object.
      **/
-    virtual void getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames);
+    virtual ReferenceList propList(ExecState *exec, bool recursive = true);
 
     /**
      * Returns the internal value of the object. This is used for objects such
index 6634997b92bd2f9843b3103e43f3c9f2bca4c719..bcba9675abbcc90b71f38d5c36c06f95d63da217 100644 (file)
@@ -25,7 +25,7 @@
 #include <kxmlcore/FastMalloc.h>
 #include "object.h"
 #include "protect.h"
-#include "IdentifierSequencedSet.h"
+#include "reference_list.h"
 
 #include <algorithm>
 
@@ -74,7 +74,7 @@ PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger()
 #endif
 
 // lastIndexUsed is an ever-increasing index used to identify the order items
-// were inserted into the property map. It's vital that getEnumerablePropertyNames
+// were inserted into the property map. It's vital that addEnumerablesToReferenceList
 // return the properties in the order they were added for compatibility with other
 // browsers' JavaScript implementations.
 struct PropertyMapHashTable
@@ -566,13 +566,13 @@ static int comparePropertyMapEntryIndices(const void *a, const void *b)
     return 0;
 }
 
-void PropertyMap::getEnumerablePropertyNames(IdentifierSequencedSet& propertyNames) const
+void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, ObjectImp *base) const
 {
     if (!_table) {
 #if USE_SINGLE_ENTRY
         UString::Rep *key = _singleEntry.key;
         if (key && !(_singleEntry.attributes & DontEnum))
-            propertyNames.insert(Identifier(key));
+            list.append(Reference(base, Identifier(key)));
 #endif
         return;
     }
@@ -598,19 +598,17 @@ void PropertyMap::getEnumerablePropertyNames(IdentifierSequencedSet& propertyNam
     // Sort the entries by index.
     qsort(sortedEnumerables, p - sortedEnumerables, sizeof(sortedEnumerables[0]), comparePropertyMapEntryIndices);
 
-    // Put the keys of the sorted entries into the list.
+    // Put the keys of the sorted entries into the reference list.
     Entry **q = sortedEnumerables;
-    while (q != p) {
-        propertyNames.insert(Identifier(q[0]->key));
-        ++q;
-    }
+    while (q != p)
+        list.append(Reference(base, Identifier((*q++)->key)));
 
     // Deallocate the buffer.
     if (sortedEnumerables != fixedSizeBuffer)
         delete [] sortedEnumerables;
 }
 
-void PropertyMap::getSparseArrayPropertyNames(IdentifierSequencedSet& propertyNames) const
+void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, ObjectImp *base) const
 {
     if (!_table) {
 #if USE_SINGLE_ENTRY
@@ -620,7 +618,7 @@ void PropertyMap::getSparseArrayPropertyNames(IdentifierSequencedSet& propertyNa
             bool fitsInUInt32;
             k.toUInt32(&fitsInUInt32);
             if (fitsInUInt32)
-                propertyNames.insert(Identifier(key));
+                list.append(Reference(base, Identifier(key)));
         }
 #endif
         return;
@@ -635,7 +633,7 @@ void PropertyMap::getSparseArrayPropertyNames(IdentifierSequencedSet& propertyNa
             bool fitsInUInt32;
             k.toUInt32(&fitsInUInt32);
             if (fitsInUInt32)
-                propertyNames.insert(Identifier(key));
+                list.append(Reference(base, Identifier(key)));
         }
     }
 }
index 9cbe1685bad32e58b6a9ad310893fb1d10166a12..66f435f66a34c48e5be760b60a2842c23a0761f8 100644 (file)
@@ -27,8 +27,8 @@
 
 namespace KJS {
 
-    class IdentifierSequencedSet;
     class ObjectImp;
+    class ReferenceList;
     class ValueImp;
     
     class SavedProperty;
@@ -81,8 +81,8 @@ namespace KJS {
         ValueImp **getLocation(const Identifier &name);
 
         void mark() const;
-        void getEnumerablePropertyNames(IdentifierSequencedSet&) const;
-        void getSparseArrayPropertyNames(IdentifierSequencedSet&) const;
+        void addEnumerablesToReferenceList(ReferenceList &, ObjectImp *) const;
+       void addSparseArrayPropertiesToReferenceList(ReferenceList &, ObjectImp *) const;
 
         void save(SavedProperties &) const;
         void restore(const SavedProperties &p);
index 92da297d4e62b3b4274e2b4cc24462a985f9ff35..30897d6145763a0543f856b20c882f6fc562f6de 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef _KJS_PROTECT_H_
 #define _KJS_PROTECT_H_
 
+#include "reference.h"
 #include "value.h"
 #include "protected_values.h"
 #include "interpreter.h"
diff --git a/JavaScriptCore/kjs/protected_reference.h b/JavaScriptCore/kjs/protected_reference.h
new file mode 100644 (file)
index 0000000..4e465ce
--- /dev/null
@@ -0,0 +1,67 @@
+// -*- c-basic-offset: 4 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2005 Apple Computer, Inc.
+ *
+ *  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., 59 Temple Place - Suite 330,
+ *  Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef KJS_PROTECTED_REFERENCE_H
+#define KJS_PROTECTED_REFERENCE_H
+
+#include "protect.h"
+#include "reference.h"
+#include "interpreter.h" 
+
+namespace KJS {
+
+    class ProtectedReference : public Reference {
+    public:
+        ProtectedReference(const Reference& r) 
+            : Reference(r) 
+        {
+            InterpreterLock lock;
+            gcProtectNullTolerant(base); 
+        }
+
+        ~ProtectedReference()
+        { 
+            InterpreterLock lock;
+            gcUnprotectNullTolerant(base);
+        }
+
+        ProtectedReference& operator=(const Reference &r)
+       {
+            InterpreterLock lock;
+            ValueImp *old = base;
+            Reference::operator=(r); 
+            gcProtectNullTolerant(base);
+            gcUnprotectNullTolerant(old); 
+            return *this;
+       }
+
+    private:
+        ProtectedReference();
+        ProtectedReference(ObjectImp *b, const Identifier& p);
+        ProtectedReference(ObjectImp *b, unsigned p);
+        ProtectedReference(const Identifier& p);
+        ProtectedReference(unsigned p);
+    };
+
+} // namespace
+
+#endif
diff --git a/JavaScriptCore/kjs/reference.cpp b/JavaScriptCore/kjs/reference.cpp
new file mode 100644 (file)
index 0000000..bc750ba
--- /dev/null
@@ -0,0 +1,83 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2004 Apple Computer, Inc
+ *
+ *  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 Steet, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "reference.h"
+
+#include "internal.h"
+
+namespace KJS {
+
+// ------------------------------ Reference ------------------------------------
+
+Reference::Reference(ObjectImp *b, const Identifier& p)
+  : base(b),
+    propertyNameIsNumber(false),
+    prop(p)
+{
+}
+
+Reference::Reference(ObjectImp *b, unsigned p)
+  : base(b),
+    propertyNameAsNumber(p),
+    propertyNameIsNumber(true)
+{
+}
+
+Identifier Reference::getPropertyName(ExecState *exec) const
+{
+  if (propertyNameIsNumber && prop.isNull())
+    prop = Identifier::from(propertyNameAsNumber);
+  return prop;
+}
+
+ValueImp *Reference::getValue(ExecState *exec) const 
+{
+  ValueImp *o = base;
+  if (!o || !o->isObject()) {
+    if (!o || o->isNull())
+      return throwError(exec, ReferenceError, "Can't find variable: " + getPropertyName(exec).ustring());
+    return throwError(exec, ReferenceError, "Base is not an object");
+  }
+
+  if (propertyNameIsNumber)
+    return static_cast<ObjectImp*>(o)->get(exec, propertyNameAsNumber);
+  return static_cast<ObjectImp*>(o)->get(exec, prop);
+}
+
+bool Reference::deleteValue(ExecState *exec)
+{
+  ValueImp *o = base;
+  Type t = o ? o->type() : NullType;
+
+  // The spec doesn't mention what to do if the base is null... just return true
+  if (t != ObjectType) {
+    assert(t == NullType);
+    return true;
+  }
+
+  if (propertyNameIsNumber)
+    return static_cast<ObjectImp*>(o)->deleteProperty(exec,propertyNameAsNumber);
+  return static_cast<ObjectImp*>(o)->deleteProperty(exec,prop);
+}
+
+}
diff --git a/JavaScriptCore/kjs/reference.h b/JavaScriptCore/kjs/reference.h
new file mode 100644 (file)
index 0000000..73143c6
--- /dev/null
@@ -0,0 +1,71 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2003 Apple Computer, Inc
+ *
+ *  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 Steet, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _KJS_REFERENCE_H_
+#define _KJS_REFERENCE_H_
+
+#include "identifier.h"
+#include "object.h"
+
+namespace KJS {
+
+  class ObjectImp;
+
+  class Reference {
+    friend class ReferenceList;
+    friend class ReferenceListIterator;
+  public:
+    Reference(ObjectImp *b, const Identifier& p);
+    Reference(ObjectImp *b, unsigned p);
+    
+    /**
+     * Performs the GetPropertyName type conversion operation on this value
+     * (ECMA 8.7)
+     */
+    Identifier getPropertyName(ExecState *exec) const;
+
+    /**
+     * Performs the GetValue type conversion operation on this value
+     * (ECMA 8.7.1)
+     */
+    ValueImp *getValue(ExecState *exec) const;
+
+    /**
+     * Performs the PutValue type conversion operation on this value
+     * (ECMA 8.7.1)
+     */
+    bool deleteValue(ExecState *exec);
+
+  protected:
+    ValueImp *base;
+
+  private:
+    Reference() { }
+
+    unsigned propertyNameAsNumber;
+    bool propertyNameIsNumber;
+    mutable Identifier prop;
+  };
+
+}
+
+#endif
diff --git a/JavaScriptCore/kjs/reference_list.cpp b/JavaScriptCore/kjs/reference_list.cpp
new file mode 100644 (file)
index 0000000..5627c40
--- /dev/null
@@ -0,0 +1,157 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2003 Apple Computer, Inc
+ *
+ *  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 Steet, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "reference_list.h"
+
+#include "protected_reference.h"
+
+namespace KJS {
+  class ReferenceListNode {
+    friend class ReferenceList;
+    friend class ReferenceListIterator;
+
+  protected:
+    ReferenceListNode(const Reference &ref) : reference(ref), next(NULL) {}
+
+  private:
+    ProtectedReference reference;
+    ReferenceListNode *next;
+  };
+
+  class ReferenceListHeadNode : ReferenceListNode {
+    friend class ReferenceList;
+    friend class ReferenceListIterator;
+    
+    ReferenceListHeadNode(const Reference &ref) : ReferenceListNode(ref), refcount(1) {}
+    int refcount;
+    int length;
+  };
+
+}
+
+using namespace KJS;
+
+// ReferenceList
+
+ReferenceList::ReferenceList() : 
+  head(NULL),
+  tail(NULL)
+{
+}
+
+ReferenceList::ReferenceList(const ReferenceList &list)
+{
+  head = list.head;
+  tail = list.tail;
+  if (head != NULL) {
+    head->refcount++;
+  }
+}
+
+ReferenceList &ReferenceList::operator=(const ReferenceList &list)
+{
+  ReferenceList tmp(list);
+  tmp.swap(*this);
+
+  return *this;
+}
+
+void ReferenceList::swap(ReferenceList &list)
+{
+  ReferenceListHeadNode *tmpHead = list.head;
+  list.head = head;
+  head = tmpHead;
+
+  ReferenceListNode *tmpTail = list.tail;
+  list.tail = tail;
+  tail = tmpTail;
+}
+
+
+void ReferenceList::append(const Reference& ref)
+{
+  if (tail == NULL) {
+    tail = head = new ReferenceListHeadNode(ref);
+  } else {
+    tail->next = new ReferenceListNode(ref);
+    tail = tail->next;
+  }
+  head->length++;
+}
+
+int ReferenceList::length()
+{
+  return head ? head->length : 0;
+}
+
+ReferenceList::~ReferenceList()
+{
+  if (head != NULL && --(head->refcount) == 0) {
+    ReferenceListNode *next;
+    
+    for (ReferenceListNode *p = head; p != NULL; p = next) {
+      next = p->next;
+      if (p == head) {
+       delete (ReferenceListHeadNode *)p;
+      } else {
+       delete p;
+      }
+    }
+  }
+}
+    
+ReferenceListIterator ReferenceList::begin() const
+{
+  return ReferenceListIterator(head);
+}
+
+ReferenceListIterator ReferenceList::end() const
+{
+  return ReferenceListIterator(NULL);
+}
+
+
+// ReferenceListIterator
+
+
+ReferenceListIterator::ReferenceListIterator(ReferenceListNode *n) :
+  node(n)
+{
+}
+
+bool ReferenceListIterator::operator!=(const ReferenceListIterator &it) const 
+{ 
+  return node != it.node;
+}
+
+const Reference *ReferenceListIterator::operator->() const 
+{ 
+  return &node->reference;
+}
+
+const Reference &ReferenceListIterator::operator++(int i) 
+{
+  const Reference &ref = node->reference;
+  node = node->next;
+  return ref;
+}
diff --git a/JavaScriptCore/kjs/reference_list.h b/JavaScriptCore/kjs/reference_list.h
new file mode 100644 (file)
index 0000000..fcb62ac
--- /dev/null
@@ -0,0 +1,69 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2003 Apple Computer, Inc
+ *
+ *  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 Steet, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _KJS_REFERENCE_LIST_H_
+#define _KJS_REFERENCE_LIST_H_
+
+#include "types.h"
+#include "reference.h"
+
+namespace KJS {
+
+  class ReferenceListNode;
+  class ReferenceListHeadNode;
+
+  class ReferenceListIterator {
+    friend class ReferenceList;
+  
+  public:
+    bool operator!=(const ReferenceListIterator &it) const;
+    const Reference *operator->() const;
+    const Reference &operator++(int i);
+    
+  private:
+    ReferenceListIterator(ReferenceListNode *n);
+    ReferenceListIterator();
+    ReferenceListNode *node;
+  };
+  
+  class ReferenceList {
+  public:
+    ReferenceList();
+    ReferenceList(const ReferenceList &list);
+    ReferenceList &operator=(const ReferenceList &list);
+    ~ReferenceList();
+
+    void append(const Reference& val);
+    int length();
+
+    ReferenceListIterator begin() const;
+    ReferenceListIterator end() const;
+    
+  private:
+    void swap(ReferenceList &list);
+    ReferenceListHeadNode *head;
+    ReferenceListNode *tail;
+  }; 
+  
+}
+
+#endif
index de38dc019a244999f986adddd1787673e91b04e6..0ebd1893a14a3b784dd0d2bef7f678ab1fa9e98d 100644 (file)
@@ -240,8 +240,6 @@ namespace KJS {
     };
 
   public:
-    typedef Rep Impl;
-
     /**
      * Constructs a null string.
      */
@@ -463,8 +461,6 @@ namespace KJS {
      */
     static void globalClear();
 #endif
-
-    Impl *impl() const { return rep; }
   private:
     UString(Rep *r) { attach(r); }
     void attach(Rep *r) { rep = r; r->ref(); }
index ec94009c6ebbba920c9e65b0a870a1f17704ff75..b6d32ad4e588bd01e333603a099f321861c4a026 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "HashTable.h"
 #include "HashTraits.h"
-#include "HashFunctions.h"
+#include "hashfunctions.h"
 
 namespace KXMLCore {