+2005-10-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
+
+ Also fixed some bugs with for..in enumeration while I was at it. object
+ properties now come before prototype properties and duplicates
+ between object and prototype are listed only once.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/IdentifierSequencedSet.cpp: Added.
+ (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
+ (KJS::IdentifierSequencedSet::deallocateVector):
+ (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
+ (KJS::IdentifierSequencedSet::insert):
+ * kjs/IdentifierSequencedSet.h: Added.
+ (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
+ (KJS::IdentifierSequencedSetIterator::operator*):
+ (KJS::IdentifierSequencedSetIterator::operator->):
+ (KJS::IdentifierSequencedSetIterator::operator++):
+ (KJS::IdentifierSequencedSetIterator::operator==):
+ (KJS::IdentifierSequencedSetIterator::operator!=):
+ (KJS::IdentifierSequencedSet::begin):
+ (KJS::IdentifierSequencedSet::end):
+ (KJS::IdentifierSequencedSet::size):
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::getPropertyNames):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd):
+ * kjs/nodes.cpp:
+ (ForInNode::execute):
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::getPropertyNames):
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getEnumerablePropertyNames):
+ (KJS::PropertyMap::getSparseArrayPropertyNames):
+ * kjs/property_map.h:
+ * kjs/protect.h:
+ * kjs/protected_reference.h: Removed.
+ * kjs/reference.cpp: Removed.
+ * kjs/reference.h: Removed.
+ * kjs/reference_list.cpp: Removed.
+ * kjs/reference_list.h: Removed.
+ * kjs/ustring.h:
+ (KJS::UString::impl):
+ * kxmlcore/HashSet.h:
+
2005-10-04 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
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 */; };
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, ); }; };
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;
};
--- /dev/null
+// -*- 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
+
--- /dev/null
+// -*- 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
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 ReferenceList propList(ExecState *exec, bool recursive);
+ virtual void getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames);
virtual void mark();
#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"
return ObjectImp::deleteProperty(exec, Identifier::from(index));
}
-ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive)
+void ArrayInstanceImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames)
{
- 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) {
- properties.append(Reference(this, i));
- }
+ if (imp && imp != undefined)
+ propertyNames.insert(Identifier::from(i));
}
- return properties;
+
+ ObjectImp::getPropertyNames(exec, propertyNames);
}
void ArrayInstanceImp::resizeStorage(unsigned newLength)
}
if (newLength < length) {
- ReferenceList sparseProperties;
+ IdentifierSequencedSet sparseProperties;
- _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
+ _prop.getSparseArrayPropertyNames(sparseProperties);
+
+ IdentifierSequencedSetIterator end = sparseProperties.end();
- ReferenceListIterator it = sparseProperties.begin();
- while (it != sparseProperties.end()) {
- Reference ref = it++;
+ for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
+ Identifier name = *it;
bool ok;
- unsigned index = ref.getPropertyName(exec).toArrayIndex(&ok);
- if (ok && index > newLength) {
- ref.deleteValue(exec);
- }
+ unsigned index = name.toArrayIndex(&ok);
+ if (ok && index > newLength)
+ deleteProperty(exec, name);
}
}
}
}
- ReferenceList sparseProperties;
- _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
- unsigned newLength = o + sparseProperties.length();
+ IdentifierSequencedSet sparseProperties;
+ _prop.getSparseArrayPropertyNames(sparseProperties);
+ unsigned newLength = o + sparseProperties.size();
- if (newLength > storageLength) {
+ if (newLength > storageLength)
resizeStorage(newLength);
- }
- ReferenceListIterator it = sparseProperties.begin();
- while (it != sparseProperties.end()) {
- Reference ref = it++;
- storage[o] = ref.getValue(exec);
- ObjectImp::deleteProperty(exec, ref.getPropertyName(exec));
+ IdentifierSequencedSetIterator end = sparseProperties.end();
+ for (IdentifierSequencedSetIterator it = sparseProperties.begin(); it != end; ++it) {
+ Identifier name = *it;
+ storage[o] = get(exec, name);
+ ObjectImp::deleteProperty(exec, name);
o++;
}
#include "lexer.h"
#include "operations.h"
#include "ustring.h"
-#include "reference_list.h"
+#include "IdentifierSequencedSet.h"
using namespace KJS;
ValueImp *retval = 0;
ObjectImp *v;
Completion c;
- ReferenceList propList;
+ IdentifierSequencedSet propertyNames;
if (varDecl) {
varDecl->evaluate(exec);
KJS_CHECKEXCEPTION
v = e->toObject(exec);
- propList = v->propList(exec);
+ v->getPropertyNames(exec, propertyNames);
- ReferenceListIterator propIt = propList.begin();
-
- while (propIt != propList.end()) {
- Identifier name = propIt->getPropertyName(exec);
- if (!v->hasProperty(exec, name)) {
- propIt++;
+ IdentifierSequencedSetIterator end = propertyNames.end();
+ for (IdentifierSequencedSetIterator it = propertyNames.begin(); it != end; ++it) {
+ const Identifier &name = *it;
+ if (!v->hasProperty(exec, name))
continue;
- }
ValueImp *str = jsString(name.ustring());
return c;
}
}
-
- propIt++;
}
// bail out on error
class ProgramNode;
class PropertyNode;
class PropertyValueNode;
- class Reference;
class RegExp;
class SourceElementsNode;
class SourceStream;
#include "types.h"
#include "interpreter.h"
#include "lookup.h"
-#include "reference_list.h"
+#include "IdentifierSequencedSet.h"
#include <assert.h>
#include <math.h>
return false;
}
-ReferenceList ObjectImp::propList(ExecState *exec, bool recursive)
+void ObjectImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet &propertyNames)
{
- ReferenceList list;
- if (_proto->isObject() && recursive)
- list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
-
- _prop.addEnumerablesToReferenceList(list, this);
+ _prop.getEnumerablePropertyNames(propertyNames);
// Add properties from the static hashtable of properties
const ClassInfo *info = classInfo();
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) )
- list.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap
+ if (e->s && !(e->attr & DontEnum))
+ propertyNames.insert(e->s);
}
}
info = info->parentClass;
}
- return list;
+ if (_proto->isObject())
+ static_cast<ObjectImp*>(_proto)->getPropertyNames(exec, propertyNames);
}
ValueImp *ObjectImp::toPrimitive(ExecState *exec, Type preferredType) const
class HashTable;
class HashEntry;
class ListImp;
+ class IdentifierSequencedSet;
// ECMA 262-3 8.6.1
// Property attributes
* having extra properties other than those set specifically with put().
*
* @param exec The current execution state
- * @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.
+ * @param propertyNames A list of property names to be filled in by this call
**/
- virtual ReferenceList propList(ExecState *exec, bool recursive = true);
+ virtual void getPropertyNames(ExecState *exec, IdentifierSequencedSet& propertyNames);
/**
* Returns the internal value of the object. This is used for objects such
#include <kxmlcore/FastMalloc.h>
#include "object.h"
#include "protect.h"
-#include "reference_list.h"
+#include "IdentifierSequencedSet.h"
#include <algorithm>
#endif
// lastIndexUsed is an ever-increasing index used to identify the order items
-// were inserted into the property map. It's vital that addEnumerablesToReferenceList
+// were inserted into the property map. It's vital that getEnumerablePropertyNames
// return the properties in the order they were added for compatibility with other
// browsers' JavaScript implementations.
struct PropertyMapHashTable
return 0;
}
-void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, ObjectImp *base) const
+void PropertyMap::getEnumerablePropertyNames(IdentifierSequencedSet& propertyNames) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key && !(_singleEntry.attributes & DontEnum))
- list.append(Reference(base, Identifier(key)));
+ propertyNames.insert(Identifier(key));
#endif
return;
}
// Sort the entries by index.
qsort(sortedEnumerables, p - sortedEnumerables, sizeof(sortedEnumerables[0]), comparePropertyMapEntryIndices);
- // Put the keys of the sorted entries into the reference list.
+ // Put the keys of the sorted entries into the list.
Entry **q = sortedEnumerables;
- while (q != p)
- list.append(Reference(base, Identifier((*q++)->key)));
+ while (q != p) {
+ propertyNames.insert(Identifier(q[0]->key));
+ ++q;
+ }
// Deallocate the buffer.
if (sortedEnumerables != fixedSizeBuffer)
delete [] sortedEnumerables;
}
-void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, ObjectImp *base) const
+void PropertyMap::getSparseArrayPropertyNames(IdentifierSequencedSet& propertyNames) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
- list.append(Reference(base, Identifier(key)));
+ propertyNames.insert(Identifier(key));
}
#endif
return;
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
- list.append(Reference(base, Identifier(key)));
+ propertyNames.insert(Identifier(key));
}
}
}
namespace KJS {
+ class IdentifierSequencedSet;
class ObjectImp;
- class ReferenceList;
class ValueImp;
class SavedProperty;
ValueImp **getLocation(const Identifier &name);
void mark() const;
- void addEnumerablesToReferenceList(ReferenceList &, ObjectImp *) const;
- void addSparseArrayPropertiesToReferenceList(ReferenceList &, ObjectImp *) const;
+ void getEnumerablePropertyNames(IdentifierSequencedSet&) const;
+ void getSparseArrayPropertyNames(IdentifierSequencedSet&) const;
void save(SavedProperties &) const;
void restore(const SavedProperties &p);
#ifndef _KJS_PROTECT_H_
#define _KJS_PROTECT_H_
-#include "reference.h"
#include "value.h"
#include "protected_values.h"
#include "interpreter.h"
+++ /dev/null
-// -*- 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
+++ /dev/null
-// -*- 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);
-}
-
-}
+++ /dev/null
-// -*- 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
+++ /dev/null
-// -*- 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;
-}
+++ /dev/null
-// -*- 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
};
public:
+ typedef Rep Impl;
+
/**
* Constructs a null string.
*/
*/
static void globalClear();
#endif
+
+ Impl *impl() const { return rep; }
private:
UString(Rep *r) { attach(r); }
void attach(Rep *r) { rep = r; r->ref(); }
#include "HashTable.h"
#include "HashTraits.h"
-#include "hashfunctions.h"
+#include "HashFunctions.h"
namespace KXMLCore {
+2005-10-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - test case for some fixes I made to for..in enumeration. object
+ properties now come before prototype properties and duplicates
+ between object and prototype are listed only once.
+
+ * fast/js/for-in-expected.txt: Added.
+ * fast/js/for-in.html: Added.
+
2005-10-05 Anders Carlsson <andersca@mac.com>
Reviewed by Maciej.
--- /dev/null
+This test checks whether for..in iteration properly skips duplicate entries, and whether it lists the properties of objects before those of their prototypes. It should print the following one per line in this order: "obj", "overloaded", "proto", "protoProto".
+
+
+obj
+overloaded
+proto
+protoProto
+
--- /dev/null
+<body>
+<p>
+This test checks whether for..in iteration properly skips duplicate
+entries, and whether it lists the properties of objects before those
+of their prototypes. It should print the following one per line in
+this order: "obj", "overloaded", "proto", "protoProto".
+<p>
+<hr>
+<pre id="console">
+</pre>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(s)
+{
+ document.getElementById('console').innerHTML += s + '<br>';
+}
+
+var protoProto = {protoProto: "protoProto", overloaded: "overloaded"};
+
+var proto = {proto: "proto", overloaded: "overloaded"};
+proto.__proto__ = protoProto;
+
+var obj = {obj: "obj", overloaded: "overloaded"};
+obj.__proto__ = proto;
+
+for (var prop in obj) {
+ log(prop);
+}
+
+
+</script>
+</body>