Skip to content

Commit

Permalink
[DOMJIT] Support DFG::AbstractHeapKind in DOMJIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Aug 12, 2022
1 parent 517664c commit 3262da8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Source/JavaScriptCore/dfg/DFGClobberize.h
Expand Up @@ -1283,6 +1283,9 @@ void clobberize(Graph& graph, Node* node, const ReadFunctor& read, const WriteFu
read(World);
else
read(AbstractHeap(DOMState, effect.reads.rawRepresentation()));
} else if (effect.readsLen > 0) {
for (auto i = 0; i < effect.readsLen; ++i)
read(effect.readsKind[i]);
}
if (effect.writes) {
if (effect.writes == DOMJIT::HeapRange::top()) {
Expand All @@ -1291,6 +1294,9 @@ void clobberize(Graph& graph, Node* node, const ReadFunctor& read, const WriteFu
write(Heap);
} else
write(AbstractHeap(DOMState, effect.writes.rawRepresentation()));
} else if (effect.writesLen) {
for (auto i = 0; i < effect.writesLen; ++i)
write(effect.writesKind[i]);
}
if (effect.def != DOMJIT::HeapRange::top()) {
DOMJIT::HeapRange range = effect.def;
Expand All @@ -1313,6 +1319,9 @@ void clobberize(Graph& graph, Node* node, const ReadFunctor& read, const WriteFu
read(World);
else
read(AbstractHeap(DOMState, effect.reads.rawRepresentation()));
} else if (effect.readsLen > 0) {
for (auto i = 0; i < effect.readsLen; ++i)
read(effect.readsKind[i]);
}
if (effect.writes) {
if (effect.writes == DOMJIT::HeapRange::top()) {
Expand All @@ -1321,6 +1330,9 @@ void clobberize(Graph& graph, Node* node, const ReadFunctor& read, const WriteFu
write(Heap);
} else
write(AbstractHeap(DOMState, effect.writes.rawRepresentation()));
} else if (effect.writesLen) {
for (auto i = 0; i < effect.writesLen; ++i)
write(effect.writesKind[i]);
}
ASSERT_WITH_MESSAGE(effect.def == DOMJIT::HeapRange::top(), "Currently, we do not accept any def for CallDOM.");
return;
Expand Down
24 changes: 23 additions & 1 deletion Source/JavaScriptCore/domjit/DOMJITEffect.h
Expand Up @@ -25,12 +25,12 @@

#pragma once

#include "DFGAbstractHeap.h"
#include "DOMJITHeapRange.h"

namespace JSC { namespace DOMJIT {

struct Effect {

constexpr static Effect forWrite(HeapRange writeRange)
{
return { HeapRange::none(), writeRange };
Expand All @@ -41,6 +41,24 @@ struct Effect {
return { readRange, HeapRange::none() };
}

template<uint8_t N>
constexpr static Effect forReadDFG(const DFG::AbstractHeapKind* kinds)
{
return { HeapRange::none(), HeapRange::none(), HeapRange::none(), kinds, N };
}

template<uint8_t N>
constexpr static Effect forWriteDFG(const DFG::AbstractHeapKind* kinds)
{
return { HeapRange::none(), HeapRange::none(), HeapRange::none(), nullptr, 0, kinds, N };
}

template<uint8_t N, uint8_t M>
constexpr static Effect forReadWriteDFG(const DFG::AbstractHeapKind* reads, const DFG::AbstractHeapKind* writes)
{
return { HeapRange::none(), HeapRange::none(), HeapRange::none(), reads, N, writes, M };
}

constexpr static Effect forReadWrite(HeapRange readRange, HeapRange writeRange)
{
return { readRange, writeRange };
Expand Down Expand Up @@ -69,6 +87,10 @@ struct Effect {
HeapRange reads { HeapRange::top() };
HeapRange writes { HeapRange::top() };
HeapRange def { HeapRange::top() };
const DFG::AbstractHeapKind* readsKind { nullptr };
uint8_t readsLen { 0 };
const DFG::AbstractHeapKind* writesKind { nullptr };
uint8_t writesLen { 0 };
};

} }

0 comments on commit 3262da8

Please sign in to comment.