summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Heap
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Heap')
-rw-r--r--Libraries/LibJS/Heap/Heap.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Libraries/LibJS/Heap/Heap.cpp b/Libraries/LibJS/Heap/Heap.cpp
index f1739531e9..ae451897ba 100644
--- a/Libraries/LibJS/Heap/Heap.cpp
+++ b/Libraries/LibJS/Heap/Heap.cpp
@@ -37,7 +37,7 @@
#ifdef __serenity__
# include <serenity.h>
-#elif __linux__
+#elif __linux__ or __MACH__
# include <pthread.h>
#endif
@@ -157,6 +157,14 @@ void Heap::gather_conservative_roots(HashTable<Cell*>& roots)
ASSERT_NOT_REACHED();
}
pthread_attr_destroy(&attr);
+#elif __MACH__
+ stack_base = (FlatPtr)pthread_get_stackaddr_np(pthread_self());
+ pthread_attr_t attr = {};
+ if (int rc = pthread_attr_getstacksize(&attr, &stack_size) != 0) {
+ fprintf(stderr, "pthread_attr_getstacksize: %s\n", strerror(-rc));
+ ASSERT_NOT_REACHED();
+ }
+ pthread_attr_destroy(&attr);
#endif
FlatPtr stack_reference = reinterpret_cast<FlatPtr>(&dummy);