source: webkit/trunk/JavaScriptCore/kjs/PropertyNameArray.cpp@ 37086

Last change on this file since 37086 was 36701, checked in by [email protected], 17 years ago

2008-09-19 Sam Weinig <[email protected]>

Roll r36694 back in. It did not cause the crash.

  • JavaScriptCore.exp:
  • VM/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): (JSC::JSPropertyNameIterator::invalidate):
  • VM/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::JSPropertyNameIterator): (JSC::JSPropertyNameIterator::create):
  • kjs/JSObject.cpp: (JSC::JSObject::getPropertyNames):
  • kjs/PropertyMap.cpp: (JSC::PropertyMap::getEnumerablePropertyNames):
  • kjs/PropertyMap.h:
  • kjs/PropertyNameArray.cpp: (JSC::PropertyNameArray::add):
  • kjs/PropertyNameArray.h: (JSC::PropertyNameArrayData::create): (JSC::PropertyNameArrayData::propertyNameVector): (JSC::PropertyNameArrayData::setCachedPrototypeChain): (JSC::PropertyNameArrayData::cachedPrototypeChain): (JSC::PropertyNameArrayData::begin): (JSC::PropertyNameArrayData::end): (JSC::PropertyNameArrayData::PropertyNameArrayData): (JSC::PropertyNameArray::PropertyNameArray): (JSC::PropertyNameArray::addKnownUnique): (JSC::PropertyNameArray::size): (JSC::PropertyNameArray::operator[]): (JSC::PropertyNameArray::begin): (JSC::PropertyNameArray::end): (JSC::PropertyNameArray::setData): (JSC::PropertyNameArray::data): (JSC::PropertyNameArray::releaseData):
  • kjs/StructureID.cpp: (JSC::structureIDChainsAreEqual): (JSC::StructureID::getEnumerablePropertyNames): (JSC::StructureID::clearEnumerationCache): (JSC::StructureID::createCachedPrototypeChain):
  • kjs/StructureID.h:
  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#include "config.h"
22#include "PropertyNameArray.h"
23
24namespace JSC {
25
26static const size_t setThreshold = 20;
27
28void PropertyNameArray::add(UString::Rep* identifier)
29{
30 ASSERT(identifier == &UString::Rep::null || identifier == &UString::Rep::empty || identifier->identifierTable());
31
32 size_t size = m_data->propertyNameVector().size();
33 if (size < setThreshold) {
34 for (size_t i = 0; i < size; ++i) {
35 if (identifier == m_data->propertyNameVector()[i].ustring().rep())
36 return;
37 }
38 } else {
39 if (m_set.isEmpty()) {
40 for (size_t i = 0; i < size; ++i)
41 m_set.add(m_data->propertyNameVector()[i].ustring().rep());
42 }
43 if (!m_set.add(identifier).second)
44 return;
45 }
46
47 m_data->propertyNameVector().append(Identifier(m_globalData, identifier));
48}
49
50} // namespace JSC
Note: See TracBrowser for help on using the repository browser.