blob: 9ea1e1430bd1350f5a8553752a36519b75841e7f [file] [log] [blame]
oliver@apple.comea771492013-07-25 03:58:38 +00001/*
fpizlo@apple.comda834ae2015-03-26 04:28:43 +00002 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
oliver@apple.comea771492013-07-25 03:58:38 +00003 *
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. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "FTLAbstractHeapRepository.h"
28
29#if ENABLE(FTL_JIT)
30
fpizlo@apple.comda834ae2015-03-26 04:28:43 +000031#include "DirectArguments.h"
benjamin@webkit.org0badc6d2015-11-18 01:53:44 +000032#include "FTLAbbreviations.h"
fpizlo@apple.com4c6b8ad2014-07-22 21:08:50 +000033#include "GetterSetter.h"
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +000034#include "JSArrowFunction.h"
oliver@apple.comab28a202014-09-10 21:52:02 +000035#include "JSEnvironmentRecord.h"
fpizlo@apple.coma398a562014-08-06 21:32:55 +000036#include "JSPropertyNameEnumerator.h"
fpizlo@apple.com0d5b2e82013-09-08 03:24:13 +000037#include "JSScope.h"
fpizlo@apple.comfb7eff22014-02-11 01:45:50 +000038#include "JSCInlines.h"
fpizlo@apple.comda834ae2015-03-26 04:28:43 +000039#include "ScopedArguments.h"
40#include "ScopedArgumentsTable.h"
oliver@apple.comea771492013-07-25 03:58:38 +000041
42namespace JSC { namespace FTL {
43
oliver@apple.comf023bee2013-07-25 04:00:48 +000044AbstractHeapRepository::AbstractHeapRepository(LContext context)
oliver@apple.comea771492013-07-25 03:58:38 +000045 : root(0, "jscRoot")
46
47#define ABSTRACT_HEAP_INITIALIZATION(name) , name(&root, #name)
48 FOR_EACH_ABSTRACT_HEAP(ABSTRACT_HEAP_INITIALIZATION)
49#undef ABSTRACT_HEAP_INITIALIZATION
50
51#define ABSTRACT_FIELD_INITIALIZATION(name, offset) , name(&root, #name, offset)
52 FOR_EACH_ABSTRACT_FIELD(ABSTRACT_FIELD_INITIALIZATION)
53#undef ABSTRACT_FIELD_INITIALIZATION
54
mhahnenberg@apple.comb6f85192014-02-27 01:27:18 +000055 , JSCell_freeListNext(JSCell_structureID)
fpizlo@apple.com1002a1d2013-11-06 04:40:02 +000056
msaboff@apple.com95894332014-01-29 19:18:54 +000057#define INDEXED_ABSTRACT_HEAP_INITIALIZATION(name, offset, size) , name(context, &root, #name, offset, size)
oliver@apple.comea771492013-07-25 03:58:38 +000058 FOR_EACH_INDEXED_ABSTRACT_HEAP(INDEXED_ABSTRACT_HEAP_INITIALIZATION)
59#undef INDEXED_ABSTRACT_HEAP_INITIALIZATION
60
oliver@apple.comf023bee2013-07-25 04:00:48 +000061#define NUMBERED_ABSTRACT_HEAP_INITIALIZATION(name) , name(context, &root, #name)
oliver@apple.comea771492013-07-25 03:58:38 +000062 FOR_EACH_NUMBERED_ABSTRACT_HEAP(NUMBERED_ABSTRACT_HEAP_INITIALIZATION)
63#undef NUMBERED_ABSTRACT_HEAP_INITIALIZATION
64
oliver@apple.comf023bee2013-07-25 04:00:48 +000065 , absolute(context, &root, "absolute")
66 , m_context(context)
benjamin@webkit.org81ec96c2015-11-18 23:14:54 +000067#if !FTL_USES_B3
oliver@apple.comf023bee2013-07-25 04:00:48 +000068 , m_tbaaKind(mdKindID(m_context, "tbaa"))
benjamin@webkit.org81ec96c2015-11-18 23:14:54 +000069#endif
oliver@apple.comea771492013-07-25 03:58:38 +000070{
fpizlo@apple.com6d7963b2014-09-22 15:34:29 +000071 // Make sure that our explicit assumptions about the StructureIDBlob match reality.
72 RELEASE_ASSERT(!(JSCell_indexingType.offset() & (sizeof(int32_t) - 1)));
73 RELEASE_ASSERT(JSCell_indexingType.offset() + 1 == JSCell_typeInfoType.offset());
74 RELEASE_ASSERT(JSCell_indexingType.offset() + 2 == JSCell_typeInfoFlags.offset());
fpizlo@apple.com3cb36ea2015-10-05 19:35:32 +000075 RELEASE_ASSERT(JSCell_indexingType.offset() + 3 == JSCell_cellState.offset());
fpizlo@apple.com6d7963b2014-09-22 15:34:29 +000076
77 JSCell_indexingType.changeParent(&JSCell_usefulBytes);
78 JSCell_typeInfoType.changeParent(&JSCell_usefulBytes);
79 JSCell_typeInfoFlags.changeParent(&JSCell_usefulBytes);
fpizlo@apple.com3cb36ea2015-10-05 19:35:32 +000080 JSCell_cellState.changeParent(&JSCell_usefulBytes);
benjamin@webkit.org81ec96c2015-11-18 23:14:54 +000081
82#if !FTL_USES_B3
oliver@apple.comf023bee2013-07-25 04:00:48 +000083 root.m_tbaaMetadata = mdNode(m_context, mdString(m_context, root.m_heapName));
oliver@apple.comea771492013-07-25 03:58:38 +000084
85 RELEASE_ASSERT(m_tbaaKind);
86 RELEASE_ASSERT(root.m_tbaaMetadata);
benjamin@webkit.org81ec96c2015-11-18 23:14:54 +000087#endif
fpizlo@apple.com1002a1d2013-11-06 04:40:02 +000088
89 RELEASE_ASSERT(!JSCell_freeListNext.offset());
oliver@apple.comea771492013-07-25 03:58:38 +000090}
91
92AbstractHeapRepository::~AbstractHeapRepository()
93{
94}
95
96} } // namespace JSC::FTL
97
98#endif // ENABLE(FTL_JIT)
99