Title: [150338] branches/dfgFourthTier/Source/_javascript_Core
- Revision
- 150338
- Author
- [email protected]
- Date
- 2013-05-18 09:06:18 -0700 (Sat, 18 May 2013)
Log Message
fourthTier: getCTIStub should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=116126
Reviewed by Dan Bernstein.
It's called from the compilation thread. Give it locks.
* jit/JITThunks.cpp:
(JSC::JITThunks::ctiStub):
(JSC::JITThunks::hostFunctionStub):
* jit/JITThunks.h:
(JITThunks):
Modified Paths
Diff
Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (150337 => 150338)
--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog 2013-05-18 15:02:57 UTC (rev 150337)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog 2013-05-18 16:06:18 UTC (rev 150338)
@@ -1,5 +1,20 @@
2013-05-17 Filip Pizlo <[email protected]>
+ fourthTier: getCTIStub should be thread-safe
+ https://bugs.webkit.org/show_bug.cgi?id=116126
+
+ Reviewed by Dan Bernstein.
+
+ It's called from the compilation thread. Give it locks.
+
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::ctiStub):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITThunks.h:
+ (JITThunks):
+
+2013-05-17 Filip Pizlo <[email protected]>
+
fourthTier: Executable and CodeBlock should be aware of DFG::Plans that complete asynchronously
https://bugs.webkit.org/show_bug.cgi?id=116350
Modified: branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.cpp (150337 => 150338)
--- branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.cpp 2013-05-18 15:02:57 UTC (rev 150337)
+++ branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.cpp 2013-05-18 16:06:18 UTC (rev 150338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,14 +63,20 @@
MacroAssemblerCodeRef JITThunks::ctiStub(VM* vm, ThunkGenerator generator)
{
+ Locker locker(m_lock);
CTIStubMap::AddResult entry = m_ctiStubMap.add(generator, MacroAssemblerCodeRef());
- if (entry.isNewEntry)
+ if (entry.isNewEntry) {
+ // Compilation thread can only retrieve existing entries.
+ ASSERT(!isCompilationThread());
entry.iterator->value = generator(vm);
+ }
return entry.iterator->value;
}
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor)
{
+ ASSERT(!isCompilationThread());
+
if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(function))
return nativeExecutable;
@@ -81,6 +87,8 @@
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, ThunkGenerator generator, Intrinsic intrinsic)
{
+ ASSERT(!isCompilationThread());
+
if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(function))
return nativeExecutable;
Modified: branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.h (150337 => 150338)
--- branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.h 2013-05-18 15:02:57 UTC (rev 150337)
+++ branches/dfgFourthTier/Source/_javascript_Core/jit/JITThunks.h 2013-05-18 16:06:18 UTC (rev 150338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,6 +39,7 @@
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
+#include <wtf/ThreadingPrimitives.h>
namespace JSC {
@@ -61,10 +62,15 @@
void clearHostFunctionStubs();
private:
+ // Main thread can hold this lock for a while, so use an adaptive mutex.
+ typedef Mutex Lock;
+ typedef MutexLocker Locker;
+
typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
CTIStubMap m_ctiStubMap;
typedef HashMap<NativeFunction, Weak<NativeExecutable> > HostFunctionStubMap;
OwnPtr<HostFunctionStubMap> m_hostFunctionStubMap;
+ Lock m_lock;
};
} // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes