oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 1 | /* |
fpizlo@apple.com | da834ae | 2015-03-26 04:28:43 +0000 | [diff] [blame] | 2 | * Copyright (C) 2013-2015 Apple Inc. All rights reserved. |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 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. ``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.com | da834ae | 2015-03-26 04:28:43 +0000 | [diff] [blame] | 31 | #include "DirectArguments.h" |
benjamin@webkit.org | 0badc6d | 2015-11-18 01:53:44 +0000 | [diff] [blame] | 32 | #include "FTLAbbreviations.h" |
fpizlo@apple.com | 4c6b8ad | 2014-07-22 21:08:50 +0000 | [diff] [blame] | 33 | #include "GetterSetter.h" |
commit-queue@webkit.org | a4201b0 | 2015-08-17 22:24:20 +0000 | [diff] [blame] | 34 | #include "JSArrowFunction.h" |
oliver@apple.com | ab28a20 | 2014-09-10 21:52:02 +0000 | [diff] [blame] | 35 | #include "JSEnvironmentRecord.h" |
fpizlo@apple.com | a398a56 | 2014-08-06 21:32:55 +0000 | [diff] [blame] | 36 | #include "JSPropertyNameEnumerator.h" |
fpizlo@apple.com | 0d5b2e8 | 2013-09-08 03:24:13 +0000 | [diff] [blame] | 37 | #include "JSScope.h" |
fpizlo@apple.com | fb7eff2 | 2014-02-11 01:45:50 +0000 | [diff] [blame] | 38 | #include "JSCInlines.h" |
fpizlo@apple.com | da834ae | 2015-03-26 04:28:43 +0000 | [diff] [blame] | 39 | #include "ScopedArguments.h" |
| 40 | #include "ScopedArgumentsTable.h" |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 41 | |
| 42 | namespace JSC { namespace FTL { |
| 43 | |
oliver@apple.com | f023bee | 2013-07-25 04:00:48 +0000 | [diff] [blame] | 44 | AbstractHeapRepository::AbstractHeapRepository(LContext context) |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 45 | : 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.com | b6f8519 | 2014-02-27 01:27:18 +0000 | [diff] [blame] | 55 | , JSCell_freeListNext(JSCell_structureID) |
fpizlo@apple.com | 1002a1d | 2013-11-06 04:40:02 +0000 | [diff] [blame] | 56 | |
msaboff@apple.com | 9589433 | 2014-01-29 19:18:54 +0000 | [diff] [blame] | 57 | #define INDEXED_ABSTRACT_HEAP_INITIALIZATION(name, offset, size) , name(context, &root, #name, offset, size) |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 58 | FOR_EACH_INDEXED_ABSTRACT_HEAP(INDEXED_ABSTRACT_HEAP_INITIALIZATION) |
| 59 | #undef INDEXED_ABSTRACT_HEAP_INITIALIZATION |
| 60 | |
oliver@apple.com | f023bee | 2013-07-25 04:00:48 +0000 | [diff] [blame] | 61 | #define NUMBERED_ABSTRACT_HEAP_INITIALIZATION(name) , name(context, &root, #name) |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 62 | FOR_EACH_NUMBERED_ABSTRACT_HEAP(NUMBERED_ABSTRACT_HEAP_INITIALIZATION) |
| 63 | #undef NUMBERED_ABSTRACT_HEAP_INITIALIZATION |
| 64 | |
oliver@apple.com | f023bee | 2013-07-25 04:00:48 +0000 | [diff] [blame] | 65 | , absolute(context, &root, "absolute") |
| 66 | , m_context(context) |
benjamin@webkit.org | 81ec96c | 2015-11-18 23:14:54 +0000 | [diff] [blame] | 67 | #if !FTL_USES_B3 |
oliver@apple.com | f023bee | 2013-07-25 04:00:48 +0000 | [diff] [blame] | 68 | , m_tbaaKind(mdKindID(m_context, "tbaa")) |
benjamin@webkit.org | 81ec96c | 2015-11-18 23:14:54 +0000 | [diff] [blame] | 69 | #endif |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 70 | { |
fpizlo@apple.com | 6d7963b | 2014-09-22 15:34:29 +0000 | [diff] [blame] | 71 | // 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.com | 3cb36ea | 2015-10-05 19:35:32 +0000 | [diff] [blame] | 75 | RELEASE_ASSERT(JSCell_indexingType.offset() + 3 == JSCell_cellState.offset()); |
fpizlo@apple.com | 6d7963b | 2014-09-22 15:34:29 +0000 | [diff] [blame] | 76 | |
| 77 | JSCell_indexingType.changeParent(&JSCell_usefulBytes); |
| 78 | JSCell_typeInfoType.changeParent(&JSCell_usefulBytes); |
| 79 | JSCell_typeInfoFlags.changeParent(&JSCell_usefulBytes); |
fpizlo@apple.com | 3cb36ea | 2015-10-05 19:35:32 +0000 | [diff] [blame] | 80 | JSCell_cellState.changeParent(&JSCell_usefulBytes); |
benjamin@webkit.org | 81ec96c | 2015-11-18 23:14:54 +0000 | [diff] [blame] | 81 | |
| 82 | #if !FTL_USES_B3 |
oliver@apple.com | f023bee | 2013-07-25 04:00:48 +0000 | [diff] [blame] | 83 | root.m_tbaaMetadata = mdNode(m_context, mdString(m_context, root.m_heapName)); |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 84 | |
| 85 | RELEASE_ASSERT(m_tbaaKind); |
| 86 | RELEASE_ASSERT(root.m_tbaaMetadata); |
benjamin@webkit.org | 81ec96c | 2015-11-18 23:14:54 +0000 | [diff] [blame] | 87 | #endif |
fpizlo@apple.com | 1002a1d | 2013-11-06 04:40:02 +0000 | [diff] [blame] | 88 | |
| 89 | RELEASE_ASSERT(!JSCell_freeListNext.offset()); |
oliver@apple.com | ea77149 | 2013-07-25 03:58:38 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | AbstractHeapRepository::~AbstractHeapRepository() |
| 93 | { |
| 94 | } |
| 95 | |
| 96 | } } // namespace JSC::FTL |
| 97 | |
| 98 | #endif // ENABLE(FTL_JIT) |
| 99 | |