summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp')
-rw-r--r--Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp119
1 files changed, 103 insertions, 16 deletions
diff --git a/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp b/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp
index d7f83c960..0b48c4b19 100644
--- a/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp
+++ b/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,14 +28,29 @@
#if ENABLE(FTL_JIT)
+#include "B3CCallValue.h"
+#include "B3FenceValue.h"
+#include "B3MemoryValue.h"
+#include "B3PatchpointValue.h"
+#include "B3ValueInlines.h"
+#include "DirectArguments.h"
+#include "FTLState.h"
+#include "GetterSetter.h"
+#include "JSPropertyNameEnumerator.h"
#include "JSScope.h"
-#include "JSVariableObject.h"
-#include "Operations.h"
+#include "JSCInlines.h"
+#include "RegExpConstructor.h"
+#include "RegExpObject.h"
+#include "ScopedArguments.h"
+#include "ScopedArgumentsTable.h"
+#include "ShadowChicken.h"
namespace JSC { namespace FTL {
-AbstractHeapRepository::AbstractHeapRepository(LContext context)
- : root(0, "jscRoot")
+using namespace B3;
+
+AbstractHeapRepository::AbstractHeapRepository()
+ : root(nullptr, "jscRoot")
#define ABSTRACT_HEAP_INITIALIZATION(name) , name(&root, #name)
FOR_EACH_ABSTRACT_HEAP(ABSTRACT_HEAP_INITIALIZATION)
@@ -45,25 +60,31 @@ AbstractHeapRepository::AbstractHeapRepository(LContext context)
FOR_EACH_ABSTRACT_FIELD(ABSTRACT_FIELD_INITIALIZATION)
#undef ABSTRACT_FIELD_INITIALIZATION
- , JSCell_freeListNext(JSCell_structure)
+ , JSCell_freeListNext(JSCell_header)
-#define INDEXED_ABSTRACT_HEAP_INITIALIZATION(name, size) , name(context, &root, #name, size)
+#define INDEXED_ABSTRACT_HEAP_INITIALIZATION(name, offset, size) , name(&root, #name, offset, size)
FOR_EACH_INDEXED_ABSTRACT_HEAP(INDEXED_ABSTRACT_HEAP_INITIALIZATION)
#undef INDEXED_ABSTRACT_HEAP_INITIALIZATION
-#define NUMBERED_ABSTRACT_HEAP_INITIALIZATION(name) , name(context, &root, #name)
+#define NUMBERED_ABSTRACT_HEAP_INITIALIZATION(name) , name(&root, #name)
FOR_EACH_NUMBERED_ABSTRACT_HEAP(NUMBERED_ABSTRACT_HEAP_INITIALIZATION)
#undef NUMBERED_ABSTRACT_HEAP_INITIALIZATION
- , absolute(context, &root, "absolute")
- , m_context(context)
- , m_tbaaKind(mdKindID(m_context, "tbaa"))
+ , absolute(&root, "absolute")
{
- root.m_tbaaMetadata = mdNode(m_context, mdString(m_context, root.m_heapName));
-
- RELEASE_ASSERT(m_tbaaKind);
- RELEASE_ASSERT(root.m_tbaaMetadata);
-
+ // Make sure that our explicit assumptions about the StructureIDBlob match reality.
+ RELEASE_ASSERT(!(JSCell_indexingTypeAndMisc.offset() & (sizeof(int32_t) - 1)));
+ RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 1 == JSCell_typeInfoType.offset());
+ RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 2 == JSCell_typeInfoFlags.offset());
+ RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 3 == JSCell_cellState.offset());
+
+ JSCell_structureID.changeParent(&JSCell_header);
+ JSCell_usefulBytes.changeParent(&JSCell_header);
+ JSCell_indexingTypeAndMisc.changeParent(&JSCell_usefulBytes);
+ JSCell_typeInfoType.changeParent(&JSCell_usefulBytes);
+ JSCell_typeInfoFlags.changeParent(&JSCell_usefulBytes);
+ JSCell_cellState.changeParent(&JSCell_usefulBytes);
+
RELEASE_ASSERT(!JSCell_freeListNext.offset());
}
@@ -71,6 +92,72 @@ AbstractHeapRepository::~AbstractHeapRepository()
{
}
+void AbstractHeapRepository::decorateMemory(const AbstractHeap* heap, Value* value)
+{
+ m_heapForMemory.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decorateCCallRead(const AbstractHeap* heap, Value* value)
+{
+ m_heapForCCallRead.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decorateCCallWrite(const AbstractHeap* heap, Value* value)
+{
+ m_heapForCCallWrite.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decoratePatchpointRead(const AbstractHeap* heap, Value* value)
+{
+ m_heapForPatchpointRead.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decoratePatchpointWrite(const AbstractHeap* heap, Value* value)
+{
+ m_heapForPatchpointWrite.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decorateFenceRead(const AbstractHeap* heap, Value* value)
+{
+ m_heapForFenceRead.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::decorateFenceWrite(const AbstractHeap* heap, Value* value)
+{
+ m_heapForFenceWrite.append(HeapForValue(heap, value));
+}
+
+void AbstractHeapRepository::computeRangesAndDecorateInstructions()
+{
+ root.compute();
+
+ if (verboseCompilationEnabled()) {
+ dataLog("Abstract Heap Repository:\n");
+ root.deepDump(WTF::dataFile());
+ }
+
+ auto rangeFor = [&] (const AbstractHeap* heap) -> HeapRange {
+ if (heap)
+ return heap->range();
+ return HeapRange();
+ };
+
+ for (HeapForValue entry : m_heapForMemory)
+ entry.value->as<MemoryValue>()->setRange(rangeFor(entry.heap));
+ for (HeapForValue entry : m_heapForCCallRead)
+ entry.value->as<CCallValue>()->effects.reads = rangeFor(entry.heap);
+ for (HeapForValue entry : m_heapForCCallWrite)
+ entry.value->as<CCallValue>()->effects.writes = rangeFor(entry.heap);
+ for (HeapForValue entry : m_heapForPatchpointRead)
+ entry.value->as<PatchpointValue>()->effects.reads = rangeFor(entry.heap);
+ for (HeapForValue entry : m_heapForPatchpointWrite)
+ entry.value->as<PatchpointValue>()->effects.writes = rangeFor(entry.heap);
+ for (HeapForValue entry : m_heapForFenceRead)
+ entry.value->as<FenceValue>()->read = rangeFor(entry.heap);
+ for (HeapForValue entry : m_heapForFenceWrite)
+ entry.value->as<FenceValue>()->write = rangeFor(entry.heap);
+}
+
} } // namespace JSC::FTL
#endif // ENABLE(FTL_JIT)