Changeset 32609 in webkit for trunk/JavaScriptCore/kjs/PropertyNameArray.cpp
- Timestamp:
- Apr 27, 2008, 10:59:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/PropertyNameArray.cpp
r29663 r32609 1 1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 * Copyright (C) 2006 Apple Computer, Inc3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 25 25 namespace KJS { 26 26 27 void PropertyNameArray::add(const Identifier& ident) 27 static const size_t setThreshold = 20; 28 29 void PropertyNameArray::add(UString::Rep* identifier) 28 30 { 29 if (!m_set.add(ident.ustring().rep()).second) 30 return; 31 32 m_vector.append(ident); 31 ASSERT(identifier->identifierTable); 32 33 size_t size = m_vector.size(); 34 if (size < setThreshold) { 35 for (size_t i = 0; i < size; ++i) { 36 if (identifier == m_vector[i].ustring().rep()) 37 return; 38 } 39 } else { 40 if (m_set.isEmpty()) { 41 for (size_t i = 0; i < size; ++i) 42 m_set.add(m_vector[i].ustring().rep()); 43 } 44 if (!m_set.add(identifier).second) 45 return; 46 } 47 48 m_vector.append(identifier); 33 49 } 34 50 35 void PropertyNameArray::swap(PropertyNameArray& other)36 {37 m_vector.swap(other.m_vector);38 m_set.swap(other.m_set);39 }40 41 42 51 } // namespace KJS 43
Note:
See TracChangeset
for help on using the changeset viewer.