]> git.saurik.com Git - apple/javascriptcore.git/blame - runtime/StructureRareData.cpp
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / runtime / StructureRareData.cpp
CommitLineData
93a37866
A
1/*
2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "StructureRareData.h"
28
ed1e77d3 29#include "JSPropertyNameEnumerator.h"
93a37866 30#include "JSString.h"
81345200 31#include "JSCInlines.h"
93a37866
A
32
33namespace JSC {
34
ed1e77d3 35const ClassInfo StructureRareData::s_info = { "StructureRareData", 0, 0, CREATE_METHOD_TABLE(StructureRareData) };
93a37866
A
36
37Structure* StructureRareData::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
38{
ed1e77d3 39 return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
93a37866
A
40}
41
42StructureRareData* StructureRareData::create(VM& vm, Structure* previous)
43{
44 StructureRareData* rareData = new (NotNull, allocateCell<StructureRareData>(vm.heap)) StructureRareData(vm, previous);
45 rareData->finishCreation(vm);
46 return rareData;
47}
48
ed1e77d3 49void StructureRareData::destroy(JSCell* cell)
93a37866 50{
ed1e77d3 51 static_cast<StructureRareData*>(cell)->StructureRareData::~StructureRareData();
93a37866
A
52}
53
54StructureRareData::StructureRareData(VM& vm, Structure* previous)
55 : JSCell(vm, vm.structureRareDataStructure.get())
56{
57 if (previous)
58 m_previous.set(vm, this, previous);
59}
60
93a37866
A
61void StructureRareData::visitChildren(JSCell* cell, SlotVisitor& visitor)
62{
63 StructureRareData* thisObject = jsCast<StructureRareData*>(cell);
81345200 64 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
93a37866
A
65
66 JSCell::visitChildren(thisObject, visitor);
67 visitor.append(&thisObject->m_previous);
68 visitor.append(&thisObject->m_objectToStringValue);
ed1e77d3
A
69 visitor.append(&thisObject->m_cachedPropertyNameEnumerator);
70 visitor.append(&thisObject->m_cachedGenericPropertyNameEnumerator);
71}
72
73JSPropertyNameEnumerator* StructureRareData::cachedPropertyNameEnumerator() const
74{
75 return m_cachedPropertyNameEnumerator.get();
76}
77
78void StructureRareData::setCachedPropertyNameEnumerator(VM& vm, JSPropertyNameEnumerator* enumerator)
79{
80 m_cachedPropertyNameEnumerator.set(vm, this, enumerator);
93a37866
A
81}
82
83} // namespace JSC