blob: 2c2809e972d195e7158c44c6ba70c3cefa17f7c6 [file] [log] [blame]
oliver@apple.comea771492013-07-25 03:58:38 +00001/*
fpizlo@apple.com93398892015-07-10 21:19:51 +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
ryanhaddad@apple.com22104f52016-09-28 17:08:17 +000026#pragma once
oliver@apple.comea771492013-07-25 03:58:38 +000027
oliver@apple.comea771492013-07-25 03:58:38 +000028#if ENABLE(FTL_JIT)
29
fpizlo@apple.come362fbc2015-12-03 20:01:57 +000030#include "B3OpaqueByproducts.h"
oliver@apple.comea771492013-07-25 03:58:38 +000031#include "DFGCommonData.h"
fpizlo@apple.com6e697962015-10-12 17:56:26 +000032#include "FTLLazySlowPath.h"
oliver@apple.comea771492013-07-25 03:58:38 +000033#include "FTLOSRExit.h"
34#include "JITCode.h"
35
fpizlo@apple.com93398892015-07-10 21:19:51 +000036namespace JSC {
37
38class TrackedReferences;
39
40namespace FTL {
oliver@apple.comea771492013-07-25 03:58:38 +000041
42class JITCode : public JSC::JITCode {
43public:
44 JITCode();
45 ~JITCode();
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000046
commit-queue@webkit.org2cb9c252016-12-13 19:38:13 +000047 CodePtr addressForCall(ArityCheckMode) override;
msaboff@apple.com95894332014-01-29 19:18:54 +000048 void* executableAddressAtOffset(size_t offset) override;
49 void* dataAddressAtOffset(size_t offset) override;
50 unsigned offsetOf(void* pointerIntoCode) override;
51 size_t size() override;
52 bool contains(void*) override;
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000053
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000054 void initializeB3Code(CodeRef);
fpizlo@apple.come362fbc2015-12-03 20:01:57 +000055 void initializeB3Byproducts(std::unique_ptr<B3::OpaqueByproducts>);
commit-queue@webkit.org2cb9c252016-12-13 19:38:13 +000056 void initializeAddressForCall(CodePtr);
57 void initializeArityCheckEntrypoint(CodeRef);
58
fpizlo@apple.com93398892015-07-10 21:19:51 +000059 void validateReferences(const TrackedReferences&) override;
sbarati@apple.com9aacac42015-10-08 19:37:28 +000060
61 RegisterSet liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex) override;
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000062
utatane.tea@gmail.com43926962016-11-27 06:08:16 +000063 std::optional<CodeOrigin> findPC(CodeBlock*, void* pc) override;
sbarati@apple.comd3d0c002016-01-30 01:11:05 +000064
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000065 CodeRef b3Code() const { return m_b3Code; }
oliver@apple.comea771492013-07-25 03:58:38 +000066
andersca@apple.come782bf12014-12-06 21:04:31 +000067 JITCode* ftl() override;
68 DFG::CommonData* dfgCommon() override;
sbarati@apple.coma582c182015-12-05 00:04:01 +000069 static ptrdiff_t commonDataOffset() { return OBJECT_OFFSETOF(JITCode, common); }
oliver@apple.comea771492013-07-25 03:58:38 +000070
71 DFG::CommonData common;
72 SegmentedVector<OSRExit, 8> osrExit;
sbarati@apple.comcda241d2015-10-19 20:29:45 +000073 SegmentedVector<OSRExitDescriptor, 8> osrExitDescriptors;
fpizlo@apple.com6e697962015-10-12 17:56:26 +000074 Vector<std::unique_ptr<LazySlowPath>> lazySlowPaths;
oliver@apple.comea771492013-07-25 03:58:38 +000075
76private:
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000077 CodePtr m_addressForCall;
fpizlo@apple.comf74e4ae2015-11-18 23:05:34 +000078 CodeRef m_b3Code;
fpizlo@apple.come362fbc2015-12-03 20:01:57 +000079 std::unique_ptr<B3::OpaqueByproducts> m_b3Byproducts;
commit-queue@webkit.org2cb9c252016-12-13 19:38:13 +000080 CodeRef m_arityCheckEntrypoint;
oliver@apple.comea771492013-07-25 03:58:38 +000081};
82
83} } // namespace JSC::FTL
84
85#endif // ENABLE(FLT_JIT)